:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang HK", "Noto Sans TC", sans-serif;
  color: #172033;
  background: #e8edf3;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: linear-gradient(180deg, #eff5fb 0%, #e8edf3 100%);
}

button,
a,
select,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: 4px solid #ffbf47;
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: .58;
}

.app-shell {
  width: min(100%, 520px);
  height: 100vh;
  height: 100svh;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 12px max(10px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 16%, #d8d5f8 0, transparent 32%),
    radial-gradient(circle at 18% 62%, #cbe7f5 0, transparent 42%),
    linear-gradient(160deg, #eff3f9 0%, #e8f0f5 52%, #f6e7ed 100%);
  box-shadow: 0 0 28px rgb(23 32 51 / 12%);
}

.topbar {
  min-height: 46px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px 44px;
  align-items: center;
  gap: 7px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.3rem, 5.6vw, 1.8rem);
  line-height: 1.08;
  letter-spacing: .02em;
}

.round-button {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 68%);
  border-radius: 50%;
  background: rgb(255 255 255 / 58%);
  box-shadow: 0 2px 9px rgb(35 49 73 / 8%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-weight: 800;
}

.button-row button,
.panel > button,
.profile-actions button {
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid #1f4f78;
  border-radius: 10px;
  background: #fff;
  font-weight: 750;
}

.feature-widget {
  min-height: 108px;
  max-height: 145px;
  aspect-ratio: 160 / 63;
  display: grid;
  grid-template-columns: 3fr 7fr;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 70%);
  border-radius: 24px;
  box-shadow: 0 8px 22px rgb(43 53 86 / 18%);
}

.feature-widget button {
  min-width: 0;
  padding: 0;
  border: 0;
}

.widget-plan {
  display: grid;
  place-items: center;
  color: #583957;
  background: linear-gradient(145deg, #fff4e7, #e9c6ce);
}

.widget-plan span {
  font-family: "Kaiti TC", "STKaiti", "DFKai-SB", "BiauKai", serif;
  font-size: clamp(1.4rem, 6vw, 1.75rem);
  font-style: italic;
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1.12;
  text-shadow: 0 2px 1px rgb(255 255 255 / 70%);
}

.feature-widget .widget-video {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-left: 3px solid #fff;
  color: #fff;
  background: radial-gradient(circle at 72% 25%, #8266b3 0, #38446f 36%, #121e39 82%);
}

.widget-video::before {
  position: absolute;
  inset: -40% -10%;
  content: "";
  transform: rotate(-22deg);
  background: linear-gradient(90deg, transparent 23%, rgb(255 255 255 / 12%) 30%, transparent 41%, rgb(236 171 222 / 19%) 65%, transparent 72%);
}

.widget-video::after {
  position: absolute;
  inset: 45% 0 0;
  content: "";
  background: linear-gradient(transparent, rgb(9 15 33 / 66%));
}

.preview-play {
  z-index: 1;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  padding-left: 3px;
  border: 2px solid rgb(255 255 255 / 85%);
  border-radius: 50%;
  background: rgb(255 255 255 / 18%);
  font-size: 1.25rem;
  backdrop-filter: blur(8px);
}

.preview-caption,
.widget-video small {
  position: absolute;
  z-index: 1;
  bottom: 11px;
  font-weight: 750;
}

.preview-caption { left: 14px; }
.widget-video small { right: 12px; font-size: .7rem; }

.tile-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 4px 2px;
}

.home-tile {
  min-width: 0;
  min-height: 76px;
  padding: 3px 1px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  background: transparent;
  text-align: center;
  line-height: 1.12;
}

.home-tile:active {
  transform: scale(.95);
}

.app-icon {
  width: clamp(56px, min(17vw, 9svh), 68px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 22%;
  color: #fff;
  box-shadow: 0 6px 13px rgb(39 54 80 / 19%), inset 0 1px rgb(255 255 255 / 22%);
}

.app-icon svg {
  width: 62%;
  height: 62%;
}

.app-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.app-name {
  max-width: 100%;
  color: #1b2d43;
  font-size: clamp(.78rem, 2.9vw, .9rem);
  font-weight: 720;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgb(255 255 255 / 65%);
}

.icon-whatsapp { background: #25d366; }
.icon-whatsapp img { width: 63%; height: 63%; }
.icon-instagram { background: radial-gradient(circle at 30% 105%, #ffd600 0 22%, #ff7a00 38%, #ff0169 61%, #d300c5 78%, #7638fa 100%); }
.icon-instagram img { width: 62%; height: 62%; }
.icon-facebook { background: #0866ff; }
.icon-facebook img { width: 88%; height: 88%; }
.icon-scameter { background: #fff; }
.icon-scameter img { object-fit: cover; }
.icon-settings { background: linear-gradient(145deg, #8a9bad, #627c94); }
.icon-telecom { background: linear-gradient(145deg, #61a7a3, #27737b); }
.icon-official { background: linear-gradient(145deg, #7d95c4, #465e9a); }
.icon-support { background: linear-gradient(145deg, #e5aa69, #c57a42); }
.icon-checklist { background: linear-gradient(145deg, #75aa8b, #41826a); }
.icon-more { background: linear-gradient(145deg, #a8a3b8, #79758e); }

.hotline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  padding: 7px;
  border: 1px solid rgb(255 255 255 / 72%);
  border-radius: 24px;
  background: rgb(255 255 255 / 54%);
  box-shadow: 0 10px 28px rgb(44 61 84 / 15%);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.hotline-grid button {
  min-width: 0;
  min-height: 61px;
  padding: 5px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  border-radius: 17px;
  background: transparent;
  color: #184063;
  text-align: center;
}

.hotline-grid button:active {
  background: rgb(255 255 255 / 55%);
}

.hotline-grid button strong {
  font-size: clamp(.75rem, 2.9vw, .88rem);
  line-height: 1.15;
}

.hotline-number {
  font-size: clamp(.8rem, 3.2vw, 1rem);
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.hotline-grid .emergency {
  color: #a52d3b;
}

.drawer,
.confirm-dialog {
  width: min(100%, 520px);
  max-width: none;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 22px 22px 0 0;
  color: #172033;
  background: #fffdf8;
  box-shadow: 0 -10px 35px rgb(0 0 0 / 22%);
}

.drawer {
  height: min(88svh, 760px);
  max-height: 88svh;
}

.drawer::backdrop,
.confirm-dialog::backdrop {
  background: rgb(15 24 35 / 55%);
}

.drawer-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.drawer-header {
  min-height: 54px;
  padding: 7px 10px;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 74px;
  align-items: center;
  border-bottom: 1px solid #d9dde2;
  background: #f7f4ec;
}

.drawer-header h2 {
  grid-column: 2;
  margin: 0;
  font-size: 1.16rem;
  text-align: center;
}

.drawer-header button {
  min-height: 44px;
  padding: 4px;
  border: 0;
  border-radius: 9px;
  color: #154f7a;
  background: transparent;
  font-weight: 800;
}

#drawer-back {
  grid-column: 1;
}

#drawer-close {
  grid-column: 3;
}

.drawer-header button:last-child {
  justify-self: end;
}

.drawer-body {
  min-height: 0;
  padding: 16px 16px max(24px, env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.panel[hidden] {
  display: none;
}

.panel h3 {
  margin: 20px 0 7px;
  color: #173e5e;
  font-size: 1.05rem;
}

.panel h3:first-child {
  margin-top: 0;
}

.panel p {
  line-height: 1.55;
}

.muted {
  color: #596270;
}

.notice {
  padding: 11px;
  border-left: 5px solid #e0a31a;
  border-radius: 7px;
  background: #fff6d9;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.button-row > * {
  flex: 1 1 140px;
}

.action-link {
  min-height: 44px;
  padding: 9px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: #fff;
  background: #155d8f;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.steps {
  padding-left: 1.5rem;
  line-height: 1.55;
}

.steps li + li {
  margin-top: 9px;
}

.resource-list {
  padding: 0;
  list-style: none;
}

.resource-list li + li {
  margin-top: 9px;
}

.resource-list a {
  min-height: 58px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid #b9c6d1;
  border-radius: 12px;
  color: #153d5d;
  background: #f3f8fc;
  text-decoration: none;
}

.resource-list span {
  margin-top: 3px;
  color: #4f5f6c;
}

.video-placeholder {
  aspect-ratio: 16 / 9;
  display: grid;
  place-content: center;
  gap: 12px;
  border: 3px dashed #9d789f;
  border-radius: 16px;
  color: #64336b;
  background: #f8eef9;
  text-align: center;
}

.video-placeholder span {
  font-size: 2.2rem;
}

.more-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.more-list button {
  min-height: 110px;
  padding: 12px;
  display: grid;
  place-items: center;
  gap: 7px;
  border: 1px solid #c5cdd5;
  border-radius: 15px;
  background: #f7fafc;
  font-size: 1rem;
}

.more-list button span {
  font-size: 1.8rem;
}

.checklist {
  display: grid;
  gap: 9px;
  margin: 12px 0 16px;
}

.checklist label {
  min-height: 54px;
  padding: 9px 11px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid #c8d0d8;
  border-radius: 12px;
  background: #fff;
}

.checklist input {
  width: 24px;
  height: 24px;
}

details {
  margin: 18px 0 10px;
  padding: 11px;
  border: 1px solid #c8d0d8;
  border-radius: 11px;
}

summary {
  min-height: 32px;
  font-weight: 800;
  cursor: pointer;
}

.text-button {
  border: 0 !important;
  color: #63333a;
  background: transparent !important;
  text-decoration: underline;
}

.confirm-dialog {
  width: min(calc(100% - 24px), 440px);
  max-height: calc(100svh - 24px);
  margin: auto;
  padding: 20px;
  overflow-y: auto;
  border-radius: 18px;
}

.confirm-dialog form {
  display: grid;
  gap: 12px;
}

.confirm-dialog h2,
.confirm-dialog p {
  margin: 0;
}

.call-note {
  color: #436477;
  text-align: center;
}

.call-number {
  color: #153d5d;
  font-size: 1.8rem;
  font-weight: 850;
  text-align: center;
}

.primary-button {
  color: #fff !important;
  background: #155d8f !important;
}

.profile-dialog label {
  font-weight: 800;
}

.profile-dialog select {
  width: 100%;
  min-height: 48px;
  padding: 8px;
  border: 2px solid #66717d;
  border-radius: 9px;
  background: #fff;
}

.profile-actions {
  display: grid;
  gap: 8px;
}

.large-text {
  font-size: 18px;
}

.large-text .app-name {
  font-size: clamp(.9rem, 3.4vw, 1rem);
  white-space: normal;
}

.large-text .hotline-grid button strong {
  font-size: .85rem;
}

.visually-hidden {
  position: fixed;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 700px) {
  .app-shell {
    width: min(100%, 960px);
    padding: 20px 28px;
  }

  .feature-widget {
    width: min(100%, clamp(430px, 55vw, 600px));
    max-height: 236px;
    justify-self: center;
  }

  .tile-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  .hotline-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-height: 650px) {
  .app-shell { padding-top: 5px; padding-bottom: 5px; gap: 4px; }
  .feature-widget { max-height: 115px; }
  .app-icon { width: clamp(50px, 8.8svh, 56px); }
  .home-tile { gap: 4px; }
  .hotline-grid { padding: 5px; }
  .hotline-grid button { min-height: 55px; }
}

@media (max-width: 350px) {
  .app-name { font-size: .78rem; }
  .hotline-grid button strong { font-size: .75rem; }
}

@media print {
  html,
  body {
    height: auto;
    overflow: visible;
    background: #fff;
  }

  body > * {
    display: none !important;
  }

  #drawer {
    position: static;
    width: 100%;
    height: auto;
    max-height: none;
    display: block !important;
    box-shadow: none;
  }

  .drawer-header,
  .panel {
    display: none !important;
  }

  .drawer-body,
  .panel[data-panel-content="checklist"] {
    display: block !important;
    overflow: visible;
  }

  .panel[data-panel-content="checklist"] > button {
    display: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .drawer[open] {
    animation: rise .18s ease-out;
  }

  @keyframes rise {
    from { transform: translateY(18px); opacity: .7; }
    to { transform: translateY(0); opacity: 1; }
  }
}

.age-fit-card {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(132px + env(safe-area-inset-bottom));
  width: min(calc(100vw - 24px), 520px);
  transform: translateX(-50%);
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid rgb(255 255 255 / 88%);
  border-radius: 16px;
  color: #173e59;
  background: rgb(255 255 255 / 88%);
  box-shadow: 0 5px 16px rgb(35 49 73 / 13%);
}

.age-fit-card[hidden] {
  display: none;
}

.age-fit-card h2,
.age-fit-card p {
  margin: 0;
}

.age-fit-card h2 {
  font-size: .95rem;
  line-height: 1.25;
}

.age-fit-card p {
  color: #355269;
  font-size: .85rem;
  line-height: 1.3;
}

.age-fit-options {
  display: grid;
  grid-template-columns: .8fr 1.7fr;
  gap: 5px;
}

.age-fit-option {
  min-width: 0;
  min-height: 42px;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #9bb2c3;
  border-radius: 10px;
  background: rgb(255 255 255 / 76%);
  color: #173e59;
  font-size: .88rem;
  font-weight: 750;
  line-height: 1.15;
}

.age-fit-option svg {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.age-fit-option small {
  color: #4b6272;
  font-size: .78rem;
  font-weight: 600;
}

.age-fit-option:active {
  background: #e5f1f8;
}

.age-fit-skip {
  grid-column: 1 / -1;
  min-height: 34px;
  border-color: transparent;
  background: transparent;
  color: #4b6272;
  font-weight: 650;
}
