:root {
  color-scheme: light dark;
  --bg: #f3f4f0;
  --surface: #fbfcf8;
  --surface-muted: #e8ebe4;
  --text: #20231e;
  --muted: #676d64;
  --line: #d9ddd5;
  --accent: #365d48;
  --accent-contrast: #f8fbf7;
  --warning: #8a5a12;
  --shadow: rgba(48, 67, 54, 0.16);
  --radius: 16px;
  font-family: "PingFang SC", "Microsoft YaHei UI", "Noto Sans CJK SC", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151713;
    --surface: #20231e;
    --surface-muted: #2c302a;
    --text: #f0f2ed;
    --muted: #adb3a9;
    --line: #3a3f37;
    --accent: #8bb79c;
    --accent-contrast: #112017;
    --warning: #e1b468;
    --shadow: rgba(0, 0, 0, 0.34);
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }

button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent), transparent 35%);
  outline-offset: 3px;
}

button:active { transform: scale(0.98); }

.shell {
  width: min(100%, 520px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(30px, env(safe-area-inset-bottom));
}

.merchant-header {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 4px 2px 18px;
}

.merchant-logo {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.merchant-header h1,
.hero-caption p,
.hero-caption small,
.platform-section h2,
.platform-section > p { margin: 0; }

.merchant-header h1 {
  font-size: 21px;
  letter-spacing: -0.02em;
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-muted);
  box-shadow: 0 16px 45px var(--shadow);
}

.hero img {
  display: block;
  width: 100%;
  height: clamp(310px, 58dvh, 470px);
  object-fit: cover;
}

.hero-caption {
  position: absolute;
  inset: auto 0 0;
  padding: 60px 18px 18px;
  color: #f4f7f2;
  background: linear-gradient(transparent, rgba(12, 16, 13, 0.82));
}

.hero-caption p {
  font-size: clamp(21px, 5.8vw, 28px);
  font-weight: 720;
  letter-spacing: -0.035em;
}

.hero-caption small {
  display: block;
  margin-top: 6px;
  color: rgba(244, 247, 242, 0.78);
}

.wifi-section { padding: 18px 2px 0; }

.wifi-button {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 78px;
  padding: 12px 15px 12px 12px;
  border: 1px solid color-mix(in srgb, var(--accent), var(--line) 62%);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent), var(--surface) 91%);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.wifi-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 13px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 12px;
  font-weight: 800;
}

.wifi-copy strong, .wifi-copy small { display: block; }
.wifi-copy strong { font-size: 17px; }
.wifi-copy small { margin-top: 4px; color: var(--muted); }

.platform-section { padding: 26px 2px 4px; }

.platform-section h2 {
  font-size: 26px;
  letter-spacing: -0.035em;
}

.platform-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.platform-button {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 72px;
  padding: 12px 15px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, transform 120ms ease, background 160ms ease;
}

.platform-button:hover { border-color: var(--accent); }

.platform-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  font-weight: 800;
}

.platform-mark-douyin { background: #1f1f23; }
.platform-mark-xiaohongshu { background: #b72f35; }
.platform-mark-meituan { background: #966000; }
.platform-mark-dianping { background: #a65316; }

.platform-copy { min-width: 0; }
.platform-copy strong { display: block; font-size: 17px; }
.platform-copy small { display: block; margin-top: 3px; color: var(--muted); }
.button-arrow { color: var(--muted); font-size: 30px; font-weight: 300; }

footer {
  padding: 26px 8px 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

footer a { color: inherit; text-underline-offset: 3px; }

.prepare-sheet {
  width: min(calc(100% - 20px), 500px);
  max-height: calc(100dvh - 24px);
  margin: auto auto max(10px, env(safe-area-inset-bottom));
  padding: 10px 18px max(18px, env(safe-area-inset-bottom));
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 80px var(--shadow);
}

.prepare-sheet::backdrop { background: rgba(10, 12, 10, 0.58); }

.sheet-grabber {
  width: 42px;
  height: 5px;
  margin: 0 auto 15px;
  border-radius: 9px;
  background: var(--line);
}

.sheet-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sheet-heading h2 { margin: 4px 0 0; font-size: 23px; letter-spacing: -0.03em; }
#prepare-status { margin: 0; color: var(--accent); font-size: 13px; font-weight: 700; }
#prepare-status[data-tone="warning"] { color: var(--warning); }
#wifi-status { margin: 0; color: var(--accent); font-size: 13px; font-weight: 700; }
#wifi-status[data-tone="warning"] { color: var(--warning); }

.close-button {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 13px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 25px;
  cursor: pointer;
}

.prepared-content {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 14px;
  margin-top: 18px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.media-preview-wrap {
  width: 104px;
  height: 130px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface);
}

.media-preview-wrap img,
.media-preview-wrap video {
  display: block;
  width: 104px;
  height: 130px;
  object-fit: cover;
}

.copy-preview {
  display: -webkit-box;
  max-height: 90px;
  margin: 2px 0 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.text-button {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.sheet-note {
  margin: 15px 2px 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.steps {
  margin: 0;
  padding: 0 0 0 25px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 10px;
  margin-top: 18px;
}

.wifi-details {
  display: grid;
  gap: 0;
  margin: 22px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.wifi-details div { display: grid; grid-template-columns: 86px 1fr; gap: 12px; padding: 16px 2px; }
.wifi-details div + div { border-top: 1px solid var(--line); }
.wifi-details dt { color: var(--muted); font-size: 13px; }
.wifi-details dd { margin: 0; overflow-wrap: anywhere; font-weight: 750; }
.wifi-actions { grid-template-columns: 1fr 1.25fr; }

.primary-button,
.secondary-button,
.error-panel button {
  min-height: 50px;
  border-radius: 14px;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
}

.primary-button,
.error-panel button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--text);
  font-size: 13px;
}

.state-panel {
  display: grid;
  gap: 18px;
  min-height: 80dvh;
  align-content: center;
}

.skeleton {
  display: block;
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.skeleton-logo { width: 48px; height: 48px; }
.skeleton-line { width: 55%; height: 28px; }
.skeleton-block { width: 100%; height: 55dvh; max-height: 470px; }

.error-panel { text-align: center; justify-items: center; }
.error-panel h1 { margin: 0; font-size: 24px; }
.error-panel p { margin: -8px 0 0; color: var(--muted); }
.error-panel button { padding: 0 22px; }

body.sheet-open { overflow: hidden; }

@media (min-width: 720px) {
  .shell { padding-top: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
