:root {
  --bg: #f4f1ec;
  --card: #ffffff;
  --ink: #23282e;
  --muted: #6f7783;
  --accent: #8b5c43;
  --accent-deep: #4a352b;
  --soft: #f2e8e0;
  --line: #e8e1d9;
  --shadow: 0 18px 50px rgba(60, 42, 30, 0.10);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 100% -80px, #e7d8cb 0%, transparent 60%),
    radial-gradient(700px 360px at -10% 8%, #e9e2d7 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.8;
}

.page { max-width: 860px; margin: 0 auto; padding: 0 16px 44px; }

.hero {
  margin: 0 -16px 22px;
  padding: 54px 24px 30px;
  color: #fff;
  background: linear-gradient(140deg, #3d2c24 0%, #6b4a38 55%, #8b5c43 100%);
  border-radius: 0 0 30px 30px;
  box-shadow: 0 16px 40px rgba(61, 44, 36, 0.22);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -70px;
  top: -70px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
}

.hero-inner { position: relative; z-index: 1; }

.eyebrow {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 10px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(28px, 8vw, 42px);
  line-height: 1.2;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.hero-line {
  width: 46px;
  height: 3px;
  margin: 16px 0 0;
  border-radius: 99px;
  background: #e8c9ae;
}

.content {
  background: var(--card);
  border: 1px solid rgba(139, 92, 67, 0.08);
  border-radius: 22px;
  padding: 26px 20px 34px;
  box-shadow: var(--shadow);
  min-height: 220px;
}

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 12px;
  color: var(--muted);
  text-align: center;
}

.state p { margin: 0; font-size: 14px; }

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.content h1,
.content h2,
.content h3,
.content h4 {
  color: var(--accent-deep);
  line-height: 1.35;
  margin: 1.6em 0 0.7em;
}

.content h1 { font-size: 26px; }
.content h2 {
  font-size: 21px;
  padding-left: 12px;
  border-left: 4px solid var(--accent);
}
.content h3 { font-size: 18px; }
.content h4 { font-size: 16px; }

.content p { margin: 0 0 1.1em; }

.content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(139, 92, 67, 0.35);
  word-break: break-all;
}

.content ul,
.content ol {
  margin: 0 0 1.2em;
  padding-left: 1.4em;
}

.content li { margin: 0.25em 0; }

.content strong { color: var(--accent-deep); }

.figure { margin: 22px 0; text-align: center; }

.content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 16px auto;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(45, 32, 24, 0.12);
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 18px 0 24px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.content table {
  border-collapse: collapse;
  width: 100%;
  min-width: 420px;
  font-size: 14px;
  background: #fff;
}

.content td,
.content th {
  border: 1px solid var(--line);
  padding: 9px 11px;
  vertical-align: top;
  text-align: left;
}

.content th { background: var(--soft); color: var(--accent-deep); }

.empty { color: var(--muted); text-align: center; }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  padding: 26px 0 0;
}

.back-to-top {
  position: fixed;
  right: calc(18px + env(safe-area-inset-right, 0px));
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  line-height: 44px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(139, 92, 67, 0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top.is-visible:active { transform: translateY(1px) scale(0.98); }

.picker {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(36, 27, 22, 0.45);
  backdrop-filter: blur(4px);
}

.picker[hidden] { display: none; }

.picker-card {
  width: 100%;
  max-width: 340px;
  background: #fff;
  border-radius: 18px;
  padding: 26px 22px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
}

.picker-card p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }

.picker-card button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 11px 22px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(139, 92, 67, 0.3);
}

.picker-card button:active { transform: translateY(1px); }

@media (max-width: 480px) {
  .page { padding: 0 12px 34px; }
  .hero { margin: 0 -12px 18px; padding: 44px 20px 26px; border-radius: 0 0 24px 24px; }
  .content { padding: 22px 16px 28px; border-radius: 18px; }
  .content h1 { font-size: 23px; }
  .content h2 { font-size: 19px; }
  .content table { font-size: 13px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181b;
    --card: #202227;
    --ink: #e8e6e2;
    --muted: #a4a7ad;
    --accent: #d2a183;
    --accent-deep: #f0d9c8;
    --soft: #2c2826;
    --line: #38383d;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  }
  body { background: radial-gradient(800px 400px at 100% -60px, #2b2521 0%, transparent 60%), var(--bg); }
  .content table { background: var(--card); }
  .content th { background: var(--soft); }
  .picker-card { background: var(--card); color: var(--ink); }
}
