/* ── Reset & Base ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #fdfaf6;
  --panel: #ffffff;
  --card: #ffffff;
  --text: #2f241b;
  --text-secondary: #5a4e42;
  --muted: #8a7d72;
  --line: #e8ddd0;
  --line-light: #f0e8de;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --shadow-sm: 0 2px 10px rgba(33, 22, 12, 0.05);
  --shadow: 0 8px 24px rgba(33, 22, 12, 0.08);
  --shadow-lg: 0 16px 38px rgba(33, 22, 12, 0.12);
  --font: "Avenir Next", "PingFang SC", "Noto Sans CJK SC", "Inter", system-ui, sans-serif;
  --font-mono: "SF Mono", "Fira Code", monospace;
  --transition: 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --max-width: 1080px;
  --page-gutter: 20px;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 80% -220px, rgba(224, 196, 158, 0.14), transparent 72%),
    radial-gradient(900px 480px at -160px 20%, rgba(142, 164, 184, 0.12), transparent 70%),
    var(--bg);
  color: var(--text);
  line-height: 1.65;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  width: 100%;
  overflow-x: hidden;
}

/* ── Typography ───────────────────────────────────── */
h1 { font-size: 1.9rem; font-weight: 700; line-height: 1.22; letter-spacing: -0.012em; }
h2 { font-size: 1.45rem; font-weight: 650; line-height: 1.28; letter-spacing: -0.008em; }
h3 { font-size: 1.15rem; font-weight: 620; line-height: 1.35; }
h4 { font-size: 0.93rem; font-weight: 620; line-height: 1.38; color: var(--text-secondary); }

p { line-height: 1.72; color: var(--text-secondary); }

a { color: inherit; text-decoration: none; }

ul, ol { padding-left: 1.25em; }
li { margin: 0.3em 0; color: var(--text-secondary); line-height: 1.6; }

/* ── Layout Utilities ─────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-left: max(var(--page-gutter), env(safe-area-inset-left));
  padding-right: max(var(--page-gutter), env(safe-area-inset-right));
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }

/* ── Common ───────────────────────────────────────── */
.hidden { display: none !important; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Buttons ──────────────────────────────────────── */
button {
  font-family: var(--font);
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all var(--transition);
}

.btn-ghost {
  border: 1px solid var(--line);
  color: var(--text-secondary);
  background: rgba(255,255,255,0.72);
}
.btn-ghost:hover {
  border-color: var(--text-secondary);
  color: var(--text);
  background: rgba(255,255,255,0.95);
}

.btn-back {
  color: var(--muted);
  font-size: 0.875rem;
  padding: 6px 0;
}
.btn-back:hover { color: var(--text); }
.btn-back::before { content: "\2190\00a0"; }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 640px) {
  :root { --max-width: 100%; }
  :root { --page-gutter: 24px; }
  h1 { font-size: 1.55rem; }
  h2 { font-size: 1.22rem; }
  .grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .container {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }
}
