:root {
  --bg: #f3efe6;
  --card: #fffaf3;
  --ink: #241c14;
  --muted: #6f6256;
  --line: #e4d9c8;
  --accent: #c4532a;
  --quiet: #f6f0e6;
  --shadow: 0 10px 30px rgba(60, 40, 20, 0.06);
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", "Songti SC", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  padding: 14px 20px;
  background: rgba(243, 239, 230, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--serif);
  font-size: 28px;
  text-decoration: none;
  letter-spacing: 0.04em;
}
.search { flex: 1; max-width: 520px; }
.search input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 10px 16px;
  outline: none;
}
.search input:focus { border-color: var(--accent); }

#app {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 72px;
}
.loading, .empty, .note { color: var(--muted); }
.hero h1 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 52px;
  font-weight: 500;
  letter-spacing: 0.03em;
}
.lede { margin: 0 0 28px; font-size: 18px; }

.lane { margin-top: 28px; }
.lane h2 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
}
.letters { display: flex; flex-wrap: wrap; gap: 8px; }
.letters button {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 12px;
  min-height: 44px;
}
.letters strong { font-size: 15px; font-weight: 600; }
.letters span { margin-left: 6px; color: var(--muted); font-size: 13px; }
.starters, .results, .walk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.starter, .result, .card {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.starter { padding: 18px 18px 16px; }
.starter strong, .result strong, .card strong {
  display: block;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
}
.starter span, .meta { color: var(--muted); font-size: 15px; }
.result, .card { padding: 12px 14px 14px; }
.result { display: flex; flex-direction: column; gap: 4px; }
.card img, .figure img, .ph {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #efe7da;
  border-radius: 12px;
}
.ph {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--serif);
}
.card strong { margin-top: 10px; font-size: 22px; }
.card em, .result em { font-style: normal; color: var(--muted); }

.detail {
  display: grid;
  gap: 22px;
}
.figure { margin: 0; }
.back {
  border: 0;
  background: transparent;
  padding: 0 0 10px;
  color: var(--muted);
}
.word {
  margin: 0;
  font-family: var(--serif);
  font-size: 64px;
  line-height: 1;
  font-weight: 500;
}
.meaning { margin: 8px 0 0; font-size: 22px; }
.speak {
  margin-top: 14px;
  border: 0;
  background: var(--ink);
  color: #fffaf3;
  border-radius: 999px;
  padding: 10px 16px;
  min-height: 44px;
}
.mnemonic {
  font-size: 20px;
  margin: 16px 0 0;
}
.section-title {
  margin: 22px 0 10px;
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.chips, .quiet-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .text-link {
  border: 1px solid var(--line);
  background: var(--ink);
  color: #fffaf3;
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 44px;
}
.chip small { display: block; font-size: 12px; opacity: 0.75; }
.chip.quiet, .tag {
  background: var(--quiet);
  color: var(--ink);
}
.tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 44px;
}
.text-link { background: transparent; color: var(--ink); margin-top: 12px; }
.walk { margin-top: 28px; }
.walk-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}
.walk-head h2 { margin: 0; font-size: 28px; font-family: var(--serif); font-weight: 500; }
.pager { display: flex; gap: 8px; }
.pager button, .senses button {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 12px;
  min-height: 44px;
}
.level-label select, .badge {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
}
.level-label select {
  padding: 8px 12px;
  min-height: 44px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.word-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.badge {
  padding: 2px 10px;
  color: var(--muted);
  font-size: 14px;
}
.graph-wrap {
  position: relative;
  height: 460px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  overflow: hidden;
}
.graph-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.graph-node {
  position: absolute;
  transform: translate(-50%, -50%);
  max-width: 132px;
  border: 1px solid var(--line);
  background: #fffaf3;
  border-radius: 14px;
  padding: 8px 10px;
  min-height: 44px;
  text-align: center;
  box-shadow: var(--shadow);
  z-index: 1;
}
.graph-node strong { font-family: var(--serif); font-size: 18px; font-weight: 500; }
.graph-node small { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; }
.graph-node.center {
  background: var(--ink);
  color: #fffaf3;
  z-index: 2;
}
.graph-node.center small { color: #f0e6da; }
.graph-note { margin: 8px 0 0; }
.round { max-width: 720px; }
.splits { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.hook, .split {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
}
.hook {
  background: #f3d7cb;
  color: var(--accent);
}
.split {
  background: var(--quiet);
  color: var(--ink);
  font-weight: 500;
}
.round-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.next-word {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 10px 16px;
  min-height: 44px;
}
.round-summary h1 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 500;
}

@media (min-width: 900px) {
  .detail { grid-template-columns: minmax(320px, 1.15fr) minmax(340px, 0.85fr); align-items: start; }
  .copy { position: sticky; top: 84px; }
}
@media (max-width: 640px) {
  .hero h1 { font-size: 40px; }
  .word { font-size: 44px; }
  .top { padding-inline: 12px; }
  #app { width: min(1120px, calc(100% - 20px)); }
}
