/* 墨池 mokechi.com — ink-wash look, phone first */
@font-face {
  font-family: "MoBrush";
  src: url("/fonts/mashanzheng-subset.woff2") format("woff2");
  font-display: swap;
}

:root {
  --paper: #F3EEE3;
  --paper-2: #FBF8F2;
  --wash: #E6DFD0;
  --line: #CFC7B6;
  --ink: #1E1C1A;
  --ink-2: #3A3632;
  --muted: #5C574F;
  --seal: #A8321F;
  --seal-dark: #7E2416;
  --ok: #2F5D50;
  --t-plankton: #D9D3C6;
  --t-too_clever: #B7AF9F;
  --t-schooler: #7D766A;
  --t-rare: #4A453E;
  --t-deep_cut: #1E1C1A;
  --t-krillion: #A8321F;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "Noto Serif SC", "SimSun", serif;
  --sans: -apple-system, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --brush: "MoBrush", "STKaiti", "KaiTi", var(--serif);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font-family: var(--sans); font-size: 16px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
a { color: var(--seal); }
a:hover { color: var(--seal-dark); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.app { max-width: 480px; min-height: 100dvh; margin: 0 auto; padding: 16px 24px 28px; display: flex; flex-direction: column; }
.view { display: flex; flex-direction: column; flex: 1; }

/* top bar */
.bar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.seal { width: 34px; height: 34px; border-radius: 4px; background: var(--seal); color: var(--paper);
  display: inline-flex; align-items: center; justify-content: center; font-family: var(--brush); font-size: 22px; line-height: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.link { color: var(--muted); text-decoration: none; padding: 12px 0 12px 12px; font-size: 14px; background: none; border: 0; cursor: pointer; }
.link:hover { color: var(--ink); }
.iconbtn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: flex-start; background: none; border: 0; cursor: pointer; color: var(--ink); padding: 0; }

/* buttons */
.btn { display: flex; align-items: center; justify-content: center; min-height: 54px; width: 100%; border-radius: 6px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper); font-family: var(--serif); font-size: 18px; font-weight: 600; letter-spacing: 3px;
  text-decoration: none; cursor: pointer; padding: 0 16px; }
.btn:hover { background: #000; color: var(--paper); }
.btn.ghost { background: transparent; color: var(--ink); font-family: var(--sans); font-size: 15px; font-weight: 400; letter-spacing: 0; min-height: 48px; }
.btn.ghost:hover { background: var(--wash); color: var(--ink); }
.btn:focus-visible, .link:focus-visible, .iconbtn:focus-visible, input:focus-visible { outline: 3px solid var(--seal); outline-offset: 2px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; }

/* home */
.hero { position: relative; height: 290px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.hero svg { position: absolute; top: 40px; }
.hero h1 { position: relative; margin: 0; font-family: var(--brush); font-weight: 400; font-size: 112px; line-height: 1; letter-spacing: 6px; }
.hero p { position: relative; margin: 18px 0 0; font-family: var(--serif); font-size: 16px; color: var(--ink-2); }
.issue { display: flex; align-items: baseline; justify-content: space-between; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 14px 2px; }
.issue strong { font-family: var(--serif); font-size: 18px; }
.rules { list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.rules li { display: flex; gap: 14px; font-size: 15px; }
.rules b { font-family: var(--serif); font-weight: 900; color: var(--seal); width: 18px; flex-shrink: 0; }
.home-actions { margin-top: 24px; }
.foot { text-align: center; margin-top: 16px; }

/* play */
.steps { display: flex; gap: 6px; margin-top: 12px; }
.steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps span.done { background: var(--ink); }
.steps span.now { background: var(--seal); }
.clock { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--ink); display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 600; }
.clock.low { border-color: var(--seal); color: var(--seal); }
.question { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 44px; text-align: center; }
.question .ask { font-family: var(--serif); font-size: 22px; line-height: 1.5; margin: 0; }
.bigseal { width: 140px; height: 140px; border-radius: 8px; background: var(--seal); color: var(--paper);
  display: flex; align-items: center; justify-content: center; font-family: var(--brush); font-size: 112px; line-height: 1; }
.answer-form { margin-top: 28px; }
.answer-form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.answer-row { display: flex; gap: 10px; }
.answer-row input { flex: 1; min-width: 0; height: 56px; border: 2px solid var(--ink); border-radius: 6px; background: var(--paper-2);
  padding: 0 14px; font-family: var(--serif); font-size: 22px; letter-spacing: 3px; color: var(--ink); }
.answer-row .btn { width: 84px; flex: none; letter-spacing: 2px; }
.msg { min-height: 24px; margin-top: 10px; font-size: 14px; }
.msg.bad { color: var(--seal); }
.shake { animation: shake .35s; }
@keyframes shake { 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }
.inkbar { margin-top: 14px; height: 6px; background: #E2DBCB; border-radius: 3px; overflow: hidden; }
.inkbar div { height: 6px; background: var(--ink); width: 100%; transition: width 1s linear; }

/* reveal */
.card-ink { margin-top: 14px; background: var(--ink); color: var(--paper); border-radius: 8px; padding: 20px 22px; display: flex; flex-direction: column; gap: 8px; }
.card-ink .label { font-size: 13px; color: var(--line); }
.card-ink .word { font-family: var(--serif); font-weight: 900; font-size: 34px; letter-spacing: 5px; }
.card-ink .pts { font-family: var(--serif); font-weight: 900; font-size: 28px; color: #F2B9AC; }
.stamp { min-width: 64px; height: 64px; padding: 4px; border: 2px solid #E0573F; color: #E0573F; border-radius: 6px; display: inline-flex;
  align-items: center; justify-content: center; text-align: center; font-family: var(--brush); font-size: 20px; line-height: 1.05; transform: rotate(-8deg); }
.card-ink.miss .word { color: var(--line); }
.meaning { margin-top: 14px; font-family: var(--serif); font-size: 15px; line-height: 1.7; }
h2 { font-family: var(--serif); font-size: 16px; font-weight: 600; margin: 22px 0 10px; }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bars .b { display: flex; align-items: center; gap: 10px; }
.bars .w { width: 92px; font-family: var(--serif); font-size: 15px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .track { flex: 1; height: 22px; background: var(--wash); border-radius: 3px; overflow: hidden; }
.bars .fill { height: 22px; }
.bars .t { width: 70px; font-size: 12px; text-align: right; color: var(--ink-2); flex-shrink: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-family: var(--serif); font-size: 15px; padding: 6px 10px; border-radius: 4px; background: var(--wash); }
.gem { margin-top: 18px; border: 2px solid var(--seal); border-radius: 8px; padding: 14px 16px; }
.gem .word { font-family: var(--serif); font-weight: 900; font-size: 24px; letter-spacing: 3px; }
.video { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; text-decoration: none; color: var(--ink); background: var(--paper-2); margin-top: 16px; }

/* result */
.pond { position: relative; height: 210px; display: flex; align-items: center; justify-content: center; }
.pond svg { position: absolute; }
.pond .score { position: relative; text-align: center; color: var(--paper); }
.pond .score b { display: block; font-family: var(--serif); font-weight: 900; font-size: 64px; line-height: 1; }
.tiles { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.tile { height: 46px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-family: var(--brush); font-size: 22px; color: #fff; }
.tile.plankton, .tile.too_clever { color: var(--ink); }
.list { margin-top: 16px; border-top: 1px solid var(--line); }
.list .r { display: flex; align-items: center; justify-content: space-between; min-height: 40px; border-bottom: 1px solid #E2DBCB; font-size: 15px; gap: 10px; }
.list .r span:first-child { font-family: var(--serif); }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 6px; font-size: 14px; }

/* archive */
.days { list-style: none; margin: 12px 0 0; padding: 0; border-top: 1px solid var(--line); }
.days a { display: flex; justify-content: space-between; align-items: center; min-height: 52px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); padding: 0 4px; }
.days a:hover { background: var(--wash); }

@media (prefers-reduced-motion: reduce) { .shake { animation: none; } .inkbar div { transition: none; } }

/* levels */
.lvchip { display: inline-block; font-size: 12px; line-height: 1; padding: 4px 9px; border-radius: 11px; color: #fff; font-family: var(--sans); font-weight: 500; vertical-align: 2px; }
.lvhead { display: flex; align-items: baseline; gap: 14px; margin-top: 16px; }
.lvhead h1 { margin: 0; font-family: var(--brush); font-weight: 400; font-size: 64px; line-height: 1; }
.lvhead p { margin: 0; font-family: var(--serif); color: var(--ink-2); }
.lvcard { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: 10px; background: var(--paper-2); color: var(--ink); text-decoration: none; border: 1px solid var(--line); }
.lvcard:hover { border-color: var(--ink); }
.lvcard.dark { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.lvseal { width: 64px; height: 64px; flex-shrink: 0; border-radius: 8px; color: var(--paper); display: flex; align-items: center; justify-content: center; font-family: var(--brush); font-size: 44px; }
.lvtext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lvname { font-family: var(--serif); font-size: 21px; font-weight: 900; }
.lvage, .lvrule { font-family: var(--sans); font-size: 13px; font-weight: 400; color: var(--muted); }
.lvcard.dark .lvage, .lvcard.dark .lvrule { color: var(--line); }
.lvstatus { font-size: 13px; font-weight: 700; color: var(--seal); flex-shrink: 0; }
.lvcard.dark .lvstatus { color: #F2B9AC; }
.note { border-top: 1px solid var(--line); padding-top: 14px; font-size: 13px; color: var(--ink-2); }
.askpy { font-size: 15px; color: var(--muted); letter-spacing: 1px; }
.view.kid .ask { font-size: 26px; font-weight: 600; }
.view.kid .bigseal { width: 160px; height: 160px; font-size: 128px; border-radius: 16px; background: #C0613A; }
.view.kid .answer-row input { height: 64px; font-size: 28px; border-radius: 10px; }
.view.kid .answer-row .btn { height: 64px; width: 96px; border-radius: 10px; }
.picker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; min-height: 0; }
.pick { min-width: 52px; height: 52px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper-2); font-family: var(--serif); font-size: 24px; cursor: pointer; }
.pick:hover, .pick:focus-visible { border-color: var(--ink); outline: none; }
.pyw { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.15; }
.pyw small { font-family: var(--sans); font-size: 12px; letter-spacing: 0; opacity: .8; }
.pyw.big small { font-size: 15px; }
.dayrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 56px; border-bottom: 1px solid var(--line); padding: 8px 4px; }
.dlinks { display: flex; gap: 6px; flex-wrap: wrap; }
.dlv { font-size: 13px; text-decoration: none; color: var(--ink); border: 1px solid; border-radius: 14px; padding: 6px 10px; }
.dlv:hover { background: var(--wash); }
[tabindex="-1"]:focus { outline: none; }
.days a.dlv { display: inline-block; min-height: 0; border-bottom: 1px solid; padding: 6px 10px; }
#app[data-level="teen"] .bigseal { background: #2F5D50; }
#app[data-level="kid"] .bigseal { background: #C0613A; }
