/* ==========================================================================
   Rōpū Mapi — aadized.com
   Google Material 3 baseline: neutral surfaces, Google blue as the primary
   colour, and red / yellow / green kept to icons and status colours.
   Type: Google Sans Flex (Noto Sans TC on the Chinese pages).

   Theme: no data-theme follows the device; data-theme="light" or "dark"
   is the saved choice from the switch in the top bar (see app.js).
   ========================================================================== */

:root {
  color-scheme: light;

  /* Surfaces */
  --md-bg: #FFFFFF;
  --md-surface: #FFFFFF;
  --md-surface-1: #F8FAFD;
  --md-surface-2: #F0F4F9;
  --md-surface-3: #E9EEF6;
  --md-on-surface: #1F1F1F;
  --md-on-surface-variant: #444746;
  --md-outline: #747775;
  --md-outline-variant: #C4C7C5;

  /* Primary: Google blue */
  --md-primary: #0B57D0;
  --md-on-primary: #FFFFFF;
  --md-primary-container: #D3E3FD;
  --md-on-primary-container: #041E49;
  --md-secondary-container: #C2E7FF;
  --md-on-secondary-container: #001D35;

  /* Accent tones: icon tiles and status */
  --g-blue: #0B57D0;      --g-blue-c: #D3E3FD;   --g-on-blue-c: #041E49;
  --g-red: #B3261E;       --g-red-c: #F9DEDC;    --g-on-red-c: #410E0B;
  --g-yellow: #7C5800;    --g-yellow-c: #FFEFC2; --g-on-yellow-c: #3D2E00;
  --g-green: #146C2E;     --g-green-c: #C4EED0;  --g-on-green-c: #072711;

  /* State layers and elevation */
  --md-hover: rgba(31, 31, 31, 0.08);
  --md-press: rgba(31, 31, 31, 0.12);
  --md-elev-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
  --md-elev-2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);

  /* Shape */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 28px;
  --r-full: 9999px;

  --container-max: 1160px;
  --font: "Google Sans Flex", "Google Sans", Roboto, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-zh: "Google Sans Flex", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;

  /* Play button border: white edge on dark surfaces, none needed on light */
  --play-border: #000000;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --md-bg: #131314;
    --md-surface: #131314;
    --md-surface-1: #1B1B1C;
    --md-surface-2: #1E1F20;
    --md-surface-3: #282A2C;
    --md-on-surface: #E3E3E3;
    --md-on-surface-variant: #C4C7C5;
    --md-outline: #8E918F;
    --md-outline-variant: #444746;
    --md-primary: #A8C7FA;
    --md-on-primary: #062E6F;
    --md-primary-container: #0842A0;
    --md-on-primary-container: #D3E3FD;
    --md-secondary-container: #004A77;
    --md-on-secondary-container: #C2E7FF;
    --g-blue: #A8C7FA;   --g-blue-c: #0842A0;   --g-on-blue-c: #D3E3FD;
    --g-red: #F2B8B5;    --g-red-c: #8C1D18;    --g-on-red-c: #F9DEDC;
    --g-yellow: #FDD663; --g-yellow-c: #5C4300; --g-on-yellow-c: #FFEFC2;
    --g-green: #6DD58C;  --g-green-c: #0F5223;  --g-on-green-c: #C4EED0;
    --md-hover: rgba(227, 227, 227, 0.08);
    --md-press: rgba(227, 227, 227, 0.12);
    --md-elev-1: 0 1px 3px 1px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.3);
    --md-elev-2: 0 2px 6px 2px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.3);
    --play-border: rgba(255, 255, 255, 0.32);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --md-bg: #131314;
  --md-surface: #131314;
  --md-surface-1: #1B1B1C;
  --md-surface-2: #1E1F20;
  --md-surface-3: #282A2C;
  --md-on-surface: #E3E3E3;
  --md-on-surface-variant: #C4C7C5;
  --md-outline: #8E918F;
  --md-outline-variant: #444746;
  --md-primary: #A8C7FA;
  --md-on-primary: #062E6F;
  --md-primary-container: #0842A0;
  --md-on-primary-container: #D3E3FD;
  --md-secondary-container: #004A77;
  --md-on-secondary-container: #C2E7FF;
  --g-blue: #A8C7FA;   --g-blue-c: #0842A0;   --g-on-blue-c: #D3E3FD;
  --g-red: #F2B8B5;    --g-red-c: #8C1D18;    --g-on-red-c: #F9DEDC;
  --g-yellow: #FDD663; --g-yellow-c: #5C4300; --g-on-yellow-c: #FFEFC2;
  --g-green: #6DD58C;  --g-green-c: #0F5223;  --g-on-green-c: #C4EED0;
  --md-hover: rgba(227, 227, 227, 0.08);
  --md-press: rgba(227, 227, 227, 0.12);
  --md-elev-1: 0 1px 3px 1px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.3);
  --md-elev-2: 0 2px 6px 2px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.3);
  --play-border: rgba(255, 255, 255, 0.32);
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--md-bg);
  color: var(--md-on-surface);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  max-width: 100%;
}

a {
  color: var(--md-primary);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--md-primary);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  color: var(--md-on-surface);
  font-weight: 500;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.75rem, 3.2vw, 2.25rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}

h3 {
  font-size: 1.25rem;
  line-height: 1.35;
  margin: 0 0 8px;
}

p {
  margin: 0 0 1em;
}

strong {
  font-weight: 600;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

@media (min-width: 720px) {
  .container {
    padding-left: 24px;
    padding-right: 24px;
  }
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--r-full);
  background: var(--md-primary);
  color: var(--md-on-primary);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

/* Material Symbols Rounded (filled) */
.msr {
  font-family: "Material Symbols Rounded";
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  direction: ltr;
  display: inline-block;
  font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}

/* ---------- Top app bar ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--md-surface);
  border-bottom: 1px solid var(--md-outline-variant);
  padding-top: env(safe-area-inset-top, 0px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 64px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px 0 8px;
  margin-right: 4px;
  border-radius: var(--r-full);
  color: var(--md-on-surface);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  flex: none;
}

.back-link:hover {
  background: var(--md-hover);
  text-decoration: none;
}

.back-link svg {
  width: 24px;
  height: 24px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
  color: var(--md-on-surface);
  text-decoration: none;
  min-width: 0;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.brand-name {
  white-space: nowrap;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.brand-by {
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--md-on-surface-variant);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  order: 1;
}

.nav-links a:not(.btn) {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--r-full);
  color: var(--md-on-surface-variant);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links a:not(.btn):hover {
  background: var(--md-hover);
  color: var(--md-on-surface);
}

.nav-links a[aria-current="page"] {
  background: var(--md-secondary-container);
  color: var(--md-on-secondary-container) !important;
}

.nav-links .btn {
  margin-left: 8px;
}

.theme-toggle {
  order: 2;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--md-on-surface-variant);
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--md-hover);
  color: var(--md-on-surface);
}

.theme-toggle svg {
  width: 22px;
  height: 22px;
}

.nav-toggle {
  order: 3;
  display: none;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--md-outline);
  border-radius: var(--r-full);
  background: transparent;
  color: var(--md-on-surface);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.nav-toggle:hover {
  background: var(--md-hover);
}

@media (max-width: 1120px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px max(16px, env(safe-area-inset-left, 0px)) 16px;
    background: var(--md-surface-2);
    border-bottom: 1px solid var(--md-outline-variant);
    box-shadow: var(--md-elev-2);
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-links a:not(.btn) {
    height: 48px;
    padding: 0 16px;
    font-size: 1rem;
  }

  .nav-links .btn {
    margin: 8px 0 0;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .back-link span {
    display: none;
  }

  .back-link {
    width: 40px;
    padding: 0;
    justify-content: center;
    margin-right: 0;
  }

  .brand-by {
    display: none;
  }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: var(--r-full);
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn-sm {
  min-height: 40px;
  padding: 0 18px;
  font-size: 0.875rem;
}

.btn-primary {
  background: var(--md-primary);
  color: var(--md-on-primary);
}

.btn-primary:hover {
  box-shadow: var(--md-elev-1);
  background: color-mix(in srgb, var(--md-primary) 92%, var(--md-on-primary));
}

.btn-secondary {
  background: transparent;
  color: var(--md-primary);
  border-color: var(--md-outline);
}

.btn-secondary:hover {
  background: color-mix(in srgb, var(--md-primary) 8%, transparent);
}

/* Google Play buttons: black with white text in both themes, like the Play badge */
.btn[href*="play.google.com"] {
  background: #000000;
  color: #FFFFFF;
  border: 1px solid var(--play-border);
  box-shadow: none;
}

.btn[href*="play.google.com"]:hover {
  background: #202124;
  color: #FFFFFF;
  box-shadow: var(--md-elev-2);
}

.btn[href*="play.google.com"]::before {
  content: "";
  width: 11px;
  height: 13px;
  flex: none;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

/* ---------- Hero (home) ---------- */

.hero {
  padding: clamp(40px, 6vw, 80px) 0 clamp(48px, 6vw, 88px);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 14px 0 12px;
  margin-bottom: 20px;
  border-radius: var(--r-sm);
  border: 1px solid var(--md-outline-variant);
  color: var(--md-on-surface-variant);
  font-size: 0.875rem;
  font-weight: 500;
}

.eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--g-green);
}

.hero h1 {
  margin: 0 0 20px;
  font-size: clamp(2.4rem, 5.2vw, 3.75rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 500;
}

.hero h1 .accent {
  display: block;
  color: var(--md-primary);
}

.hero-lead {
  margin: 0 0 28px;
  max-width: 58ch;
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  line-height: 1.6;
  color: var(--md-on-surface-variant);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

/* Trust chips: M3 assist chips, one Google colour each */
.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.trust-strip li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 14px 0 10px;
  border-radius: var(--r-xs);
  border: 1px solid var(--md-outline-variant);
  color: var(--md-on-surface);
  font-size: 0.875rem;
  font-weight: 500;
}

.trust-strip .msr {
  font-size: 18px;
}

.trust-strip li:nth-child(4n + 1) .msr { color: var(--g-blue); }
.trust-strip li:nth-child(4n + 2) .msr { color: var(--g-red); }
.trust-strip li:nth-child(4n + 3) .msr { color: var(--g-yellow); }
.trust-strip li:nth-child(4n + 4) .msr { color: var(--g-green); }

/* ---------- Sections ---------- */

.section {
  padding: clamp(56px, 7vw, 96px) 0;
}

.section-alt {
  background: var(--md-surface-1);
  border-top: 1px solid var(--md-outline-variant);
  border-bottom: 1px solid var(--md-outline-variant);
}

.section-head {
  max-width: 720px;
  margin-bottom: 40px;
}

.section-head p {
  color: var(--md-on-surface-variant);
  font-size: 1.0625rem;
  margin: 0;
}

.section-kicker {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--md-primary);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Steps */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 860px) {
  .steps-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.step-card,
.feature-card,
.info-panel {
  padding: 24px;
  border-radius: var(--r-lg);
  background: var(--md-surface-2);
}

.section-alt .step-card,
.section-alt .info-panel {
  background: var(--md-surface);
  border: 1px solid var(--md-outline-variant);
}

.step-card p,
.feature-card p {
  margin: 0;
  color: var(--md-on-surface-variant);
}

.step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.step-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  font-size: 26px;
}

.step-card:nth-child(3n + 1) .step-icon { background: var(--g-blue-c); color: var(--g-on-blue-c); }
.step-card:nth-child(3n + 2) .step-icon { background: var(--g-green-c); color: var(--g-on-green-c); }
.step-card:nth-child(3n + 3) .step-icon { background: var(--g-yellow-c); color: var(--g-on-yellow-c); }

.step-num {
  color: var(--md-on-surface-variant);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Features */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 960px) {
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .feature-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.feature-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background-color 0.15s ease;
}

.feature-card:hover {
  background: var(--md-surface-3);
}

.feature-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 14px;
  border-radius: var(--r-md);
  font-size: 26px;
}

.feature-badge {
  align-self: flex-start;
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Icon tiles: Google colours, as tonal containers */
.feature-icon.badge-violet,
.feature-icon.badge-emerald { background: var(--g-blue-c); color: var(--g-on-blue-c); }
.feature-icon.badge-amber { background: var(--g-yellow-c); color: var(--g-on-yellow-c); }
.feature-icon.badge-blue,
.feature-icon.badge-teal { background: var(--g-green-c); color: var(--g-on-green-c); }
.feature-icon.badge-red { background: var(--g-red-c); color: var(--g-on-red-c); }

.feature-badge.badge-violet,
.feature-badge.badge-emerald { color: var(--g-blue); }
.feature-badge.badge-amber { color: var(--g-yellow); }
.feature-badge.badge-blue,
.feature-badge.badge-teal { color: var(--g-green); }
.feature-badge.badge-red { color: var(--g-red); }

/* Privacy and limits */
.split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 860px) {
  .split-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.info-panel {
  padding: 28px;
}

.check-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}

.check-list li {
  position: relative;
  padding-left: 32px;
  color: var(--md-on-surface-variant);
}

.check-list li strong {
  color: var(--md-on-surface);
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--g-green-c);
}

.check-list li::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 7px;
  width: 8px;
  height: 5px;
  border-left: 2px solid var(--g-on-green-c);
  border-bottom: 2px solid var(--g-on-green-c);
  transform: rotate(-45deg);
}

.split-grid .info-panel:nth-child(2) .check-list li::before { background: var(--g-yellow-c); }
.split-grid .info-panel:nth-child(2) .check-list li::after {
  left: 9px;
  top: 7px;
  width: 2px;
  height: 7px;
  border: 0;
  background: var(--g-on-yellow-c);
  transform: none;
}

/* FAQ */
.faq-list {
  display: grid;
  gap: 8px;
  max-width: 860px;
}

.faq-item {
  border-radius: var(--r-md);
  background: var(--md-surface-2);
  overflow: hidden;
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 14px 20px;
  font-size: 1.0625rem;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border-right: 2px solid var(--md-on-surface-variant);
  border-bottom: 2px solid var(--md-on-surface-variant);
  transform: rotate(45deg) translateY(-3px);
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  transform: rotate(-135deg) translateY(-3px);
}

.faq-item summary:hover {
  background: var(--md-hover);
}

.faq-answer {
  padding: 0 20px 18px;
  color: var(--md-on-surface-variant);
}

.faq-answer p:last-child {
  margin-bottom: 0;
}

/* Download banner */
.cta-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(28px, 4vw, 48px);
  border-radius: var(--r-xl);
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
}

.cta-copy {
  max-width: 640px;
}

.cta-copy h2 {
  color: var(--md-on-primary-container);
}

.cta-copy p {
  margin: 0 0 8px;
}

.cta-meta {
  font-size: 0.875rem;
  opacity: 0.85;
}

/* ---------- Document pages (guides, privacy, terms) ---------- */

.doc-main {
  padding: clamp(32px, 5vw, 64px) 0 clamp(56px, 7vw, 96px);
}

.doc-wrap {
  max-width: 760px;
  margin: 0 auto;
  font-size: 1.0625rem;
}

.doc-header {
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--md-outline-variant);
}

.doc-header h1 {
  margin: 0 0 14px;
  font-size: clamp(2.1rem, 4.6vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.doc-meta {
  margin: 0;
  color: var(--md-on-surface-variant);
  font-size: 1.0625rem;
}

.doc-section {
  margin-top: 40px;
}

.doc-section h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.75rem);
  margin-bottom: 12px;
}

.doc-section h3 {
  margin-top: 24px;
}

.doc-wrap ul,
.doc-wrap ol {
  padding-left: 1.4em;
  margin: 0 0 1em;
}

.doc-wrap li {
  margin-bottom: 8px;
}

.doc-wrap li::marker {
  color: var(--md-primary);
  font-weight: 600;
}

.doc-callout {
  margin: 20px 0;
  padding: 18px 20px;
  border-radius: var(--r-md);
  background: var(--g-blue-c);
  color: var(--g-on-blue-c);
}

.doc-callout a {
  color: inherit;
}

.doc-callout p:last-child {
  margin-bottom: 0;
}

.doc-callout-danger {
  background: var(--g-red-c);
  color: var(--g-on-red-c);
}

.table-scroll {
  overflow-x: auto;
  margin: 16px 0;
  border-radius: var(--r-md);
  border: 1px solid var(--md-outline-variant);
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.doc-table th,
.doc-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--md-outline-variant);
}

.doc-table th {
  background: var(--md-surface-2);
  font-weight: 600;
}

.doc-table tr:last-child td {
  border-bottom: 0;
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 40px 0 calc(40px + env(safe-area-inset-bottom, 0px));
  background: var(--md-surface-2);
  color: var(--md-on-surface-variant);
  font-size: 0.9rem;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px;
}

.footer-brand strong {
  color: var(--md-on-surface);
  font-weight: 600;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  max-width: 640px;
}

.footer-links a {
  color: var(--md-on-surface-variant);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--md-on-surface);
  text-decoration: underline;
}

.footer-note {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--md-outline-variant);
  font-size: 0.8125rem;
}

/* ---------- Simple pages (404) ---------- */

.center-page {
  min-height: 60vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 64px 0;
}

/* ---------- Traditional Chinese pages ---------- */

html[lang^="zh"] body {
  font-family: var(--font-zh);
  line-height: 1.8;
}

html[lang^="zh"] h1,
html[lang^="zh"] h2,
html[lang^="zh"] h3 {
  letter-spacing: 0.01em;
  line-height: 1.3;
}

html[lang^="zh"] .section-kicker {
  letter-spacing: 0.12em;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ==========================================================================
   Home page phone preview. The phone keeps the app's own dark driving
   screen in both themes; only the tabs and controls around it follow M3.
   ========================================================================== */

.hud-showcase {
  --bg-surface: #0F172A;
  --bg-surface-elevated: #111C33;
  --bg-surface-subtle: #1E293B;
  --border-hud: rgba(51, 65, 85, 0.75);
  --border-strong: rgba(71, 85, 105, 0.9);
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --brand-yellow: #FACC15;
  --brand-yellow-bright: #FDE047;
  --route-blue: #3B82F6;
  --route-blue-deep: #2563EB;
  --route-sky: #38BDF8;
  --eta-emerald: #34D399;
  --alert-red: #EF4444;
  --alert-red-deep: #B91C1C;
  --radius-pill: 9999px;
  --shadow-hud: 0 24px 48px -12px rgba(0, 0, 0, 0.45);
}

/* ==========================================================================
   Interactive Phone HUD Showcase (Modeled on Play Store Screenshots)
   ========================================================================== */

.hud-showcase {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.hud-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.hud-tab {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-hud);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hud-tab:hover {
  color: var(--text-primary);
  border-color: var(--route-blue);
}

.hud-tab[aria-selected="true"] {
  background: var(--route-blue-deep);
  border-color: var(--route-blue);
  color: #ffffff;
}

.phone-frame {
  width: min(100%, 348px);
  border-radius: 34px;
  padding: 12px;
  background: #0B1120;
  border: 2px solid #334155;
  box-shadow: var(--shadow-hud), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.phone-screen {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  min-height: 540px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 12px 12px;
  background: #132033;
}

/* Animated scrolling road & terrain map canvas behind HUD cards */
.phone-screen::before {
  content: "";
  position: absolute;
  inset: -64px 0 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    /* Cross streets scrolling downward */
    repeating-linear-gradient(
      180deg,
      transparent 0 74px,
      rgba(148, 163, 184, 0.14) 74px 77px,
      transparent 77px 156px
    ),
    /* Side roads */
    repeating-linear-gradient(
      90deg,
      transparent 0 68px,
      rgba(148, 163, 184, 0.08) 68px 70px,
      transparent 70px 140px
    ),
    /* Subtle green park patches */
    radial-gradient(circle at 18% 28%, rgba(16, 185, 129, 0.16) 0 42px, transparent 43px),
    radial-gradient(circle at 84% 72%, rgba(16, 185, 129, 0.14) 0 48px, transparent 49px);
  background-size: 100% 156px, 140px 100%, 100% 312px, 100% 312px;
  animation: mapScrollDown 3.2s linear infinite;
  will-change: transform;
}

@keyframes mapScrollDown {
  from { transform: translateY(0); }
  to   { transform: translateY(156px); }
}

/* Scene reel progress bar along top edge of phone screen */
.reel-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(15, 23, 42, 0.75);
  z-index: 10;
  overflow: hidden;
}

.reel-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand-yellow), var(--route-sky));
  transition: width 0.1s linear;
}

.hud-panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-height: 512px;
  animation: hudFadeIn 0.28s ease;
}

@keyframes hudFadeIn {
  from { opacity: 0.35; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hud-panel[hidden] {
  display: none;
}

/* Animated dashed centre line inside active blue route */
.mock-route-line::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.85) 0 8px,
    transparent 8px 22px
  );
  background-size: 100% 22px;
  animation: routeDashMove 0.65s linear infinite;
}

@keyframes routeDashMove {
  from { background-position: 0 0; }
  to   { background-position: 0 22px; }
}

/* Gentle live vehicle motion on map */
.mock-marker-you {
  animation: puckPulse 1.8s ease-in-out infinite;
}

.mock-marker-peer {
  animation: peerFloat 2.8s ease-in-out infinite;
}

.mock-marker-straggler {
  animation: stragglerDrift 3.6s ease-in-out infinite;
}

.mock-marker-fuel {
  animation: fuelGlide 4s ease-in-out infinite;
}

.mock-alert-banner {
  animation: alertPulse 1.4s ease-in-out infinite alternate;
}

@keyframes puckPulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 0 0 rgba(59, 130, 246, 0.6); }
  50%      { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), 0 0 0 9px rgba(59, 130, 246, 0); }
}

@keyframes peerFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(5px); }
}

@keyframes stragglerDrift {
  0%   { transform: translateY(-6px); }
  75%  { transform: translateY(14px); }
  100% { transform: translateY(14px); }
}

@keyframes fuelGlide {
  0%   { transform: translateY(-5px); }
  100% { transform: translateY(10px); }
}

@keyframes alertPulse {
  from { box-shadow: 0 6px 18px rgba(185, 28, 28, 0.45); }
  to   { box-shadow: 0 8px 26px rgba(239, 68, 68, 0.8); }
}

/* Pause state freezes all motion cleanly */
.phone-screen.is-paused::before,
.phone-screen.is-paused .mock-route-line::after,
.phone-screen.is-paused .mock-marker,
.phone-screen.is-paused .mock-alert-banner {
  animation-play-state: paused !important;
}

.hud-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.hud-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.hud-play-btn:hover {
  border-color: var(--brand-yellow);
  color: var(--brand-yellow-bright);
}

/* Turn card (mirrors .turn-card from apps/server/public/index.html) */
.mock-turn-card {
  background: rgba(15, 23, 42, 0.96);
  border: 1.5px solid rgba(59, 130, 246, 0.55);
  border-radius: 16px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.mock-turn-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.18);
  border: 1.5px solid rgba(52, 211, 153, 0.5);
  color: var(--eta-emerald);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 1.25rem;
  flex: none;
}

.mock-turn-dist {
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1.05;
  color: #ffffff;
}

.mock-turn-action {
  font-size: 0.78rem;
  font-weight: 700;
  color: #93C5FD;
}

.mock-turn-street {
  font-size: 0.98rem;
  font-weight: 800;
  color: #F1F5F9;
  margin-top: 2px;
}

.mock-pills-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.mock-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--border-hud);
  font-size: 0.76rem;
  font-weight: 700;
  color: #E2E8F0;
}

.mock-pill-live {
  color: var(--eta-emerald);
  border-color: rgba(52, 211, 153, 0.4);
}

/* Map middle region inside phone mockup */
.mock-map-stage {
  position: relative;
  flex: 1;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.mock-route-line {
  position: absolute;
  width: 6px;
  top: 8px;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 6px;
  background: linear-gradient(180deg, var(--route-sky), var(--route-blue-deep));
  box-shadow: 0 0 18px rgba(59, 130, 246, 0.55);
}

.mock-marker {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 800;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.mock-marker-you {
  background: var(--route-blue-deep);
  border: 2px solid #ffffff;
}

.mock-marker-peer {
  background: #059669;
  border: 1.5px solid #A7F3D0;
}

.mock-marker-straggler {
  background: var(--alert-red-deep);
  border: 1.5px solid #FCA5A5;
}

.mock-marker-fuel {
  background: #0F766E;
  border: 1.5px solid #99F6E4;
}

/* Speedometer + Limit badge (mirrors .speedo-main-circle & .speedo-limit-circle-behind) */
.mock-speed-cluster {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  align-self: flex-start;
  z-index: 3;
}

.mock-speedo {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.95);
  border: 2px solid rgba(59, 130, 246, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.mock-speedo strong {
  font-size: 1.35rem;
  font-weight: 900;
  color: #ffffff;
}

.mock-speedo span {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.mock-limit {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ffffff;
  border: 4px solid var(--alert-red);
  color: #0F172A;
  font-weight: 900;
  font-size: 1.05rem;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
}

/* Bottom HUD card */
.mock-bottom-card {
  background: rgba(15, 23, 42, 0.97);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
}

.mock-eta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mock-eta-time {
  color: var(--eta-emerald);
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1.1;
}

.mock-eta-sub {
  color: #E2E8F0;
  font-size: 0.88rem;
  font-weight: 700;
}

.mock-code-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(139, 92, 246, 0.16);
  border: 1px solid rgba(139, 92, 246, 0.55);
  color: #DDD6FE;
  border-radius: 12px;
  padding: 7px 11px;
  margin: 8px 0;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.mock-roster {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.82rem;
}

.mock-roster-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.75);
}

.mock-alert-banner {
  background: var(--alert-red-deep);
  border: 1.5px solid #FCA5A5;
  color: #ffffff;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 0.86rem;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(185, 28, 28, 0.45);
}

.mock-alert-banner small {
  display: block;
  font-weight: 600;
  color: #FEE2E2;
  margin-top: 2px;
}

.hud-caption {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 340px;
}


/* Tabs and controls around the phone: M3 filter chips on the page surface */
.hud-tab {
  min-height: 32px;
  padding: 0 14px;
  border-radius: var(--r-xs);
  border: 1px solid var(--md-outline-variant);
  background: transparent;
  color: var(--md-on-surface-variant);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
}

.hud-tab:hover {
  background: var(--md-hover);
  color: var(--md-on-surface);
  border-color: var(--md-outline-variant);
}

.hud-tab[aria-selected="true"] {
  background: var(--md-secondary-container);
  border-color: transparent;
  color: var(--md-on-secondary-container);
}

.hud-controls {
  flex-wrap: wrap;
  color: var(--md-on-surface-variant);
  font-size: 0.875rem;
  text-align: center;
}

.hud-play-btn {
  min-height: 32px;
  padding: 0 14px;
  border-radius: var(--r-xs);
  border: 1px solid var(--md-outline);
  background: transparent;
  color: var(--md-on-surface);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
}

.hud-play-btn:hover {
  background: var(--md-hover);
  border-color: var(--md-outline);
  color: var(--md-on-surface);
}

.phone-frame {
  color: #F8FAFC;
}
