/* The learning app; brand tokens and base come from /style.css. */

.app { min-height: 70vh; }
.app section { padding: 24px 0 48px; }
.eyebrow a { color: var(--muted); text-decoration: none; }
.eyebrow a:hover { color: var(--red); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.center { justify-content: center; }
.title-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.title-row h1 { margin: 0; }
.narrow { max-width: 560px; }
.loading { padding: 24px 0; }
.notice { margin: 16px 0; }
.who { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: 0; text-transform: none; }
nav a.active { color: var(--red); }

/* ---- home ---- */
.scripts { margin-top: 24px; }
.script-card { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; }
.script-card .sample { width: 96px; height: 96px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-size: 56px; border: 3px solid var(--ink); }
.bar { height: 8px; background: var(--cream-deep); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar span { display: block; height: 100%; background: var(--green); transition: width 0.3s; }

/* ---- chart (like the printed table) ---- */
.chart { border-collapse: separate; border-spacing: 8px; margin: 0 auto; }
.chart th { font-weight: 500; color: var(--green); font-size: 13px; }
.chart .rowlabel { padding-right: 4px; }
.chart td { padding: 0; }
.cell {
  position: relative; display: grid; place-items: center; width: clamp(52px, 14vw, 76px); aspect-ratio: 1;
  background: var(--paper); border: 1.5px solid #a8a59c; border-radius: 10px; text-decoration: none; color: var(--ink);
  transition: transform 0.08s, border-color 0.15s;
}
.cell:hover { transform: translateY(-2px); border-color: var(--red); }
.cell .n { position: absolute; top: 3px; right: 6px; font-size: 10px; font-weight: 700; color: var(--mark); }
.cell .k { font-size: clamp(26px, 7vw, 36px); line-height: 1; }
.cell .r { position: absolute; bottom: 2px; font-size: 10px; color: var(--muted); }
.cell.locked { opacity: 0.55; background: #f6f4ee; }
.cell .lock { position: absolute; top: 2px; left: 4px; font-size: 10px; }
.cell .done { position: absolute; bottom: 2px; right: 5px; font-size: 12px; color: var(--green); font-weight: 700; }

/* ---- lesson ---- */
.lesson-title { display: flex; align-items: baseline; gap: 12px; }
.lesson-title .big { font-size: 1.6em; color: var(--purple); }
.lesson-title .rom { color: var(--green); text-transform: lowercase; letter-spacing: 0.05em; }
.lesson-title .pair { font-size: 0.7em; color: var(--muted); }
.lesson-grid { display: grid; gap: 16px; grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.3fr) 92px; align-items: start; }
.model-card { display: grid; gap: 10px; justify-items: center; text-align: center; }
.model-box { width: min(100%, 320px); aspect-ratio: 1; }
.model-box svg { width: 100%; height: 100%; display: block; }
svg.model .ghost path { fill: #f1edf6; }
svg.model .ink {
  fill: none; stroke: var(--model); stroke-width: 128; stroke-linecap: round;
  stroke-dasharray: 3337; stroke-dashoffset: 3339; animation: draw 0.8s linear forwards;
}
svg.model .num { font: 700 44px var(--head); fill: var(--mark); }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { svg.model .ink { stroke-dashoffset: 0; } }
.practice { display: grid; gap: 10px; justify-items: center; text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chip {
  border: 1.5px solid var(--line); background: var(--paper); border-radius: 999px; padding: 6px 12px;
  font: 600 12px var(--head); letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer; color: var(--muted);
}
.chip.active { border-color: var(--red); color: var(--red); }
.watch { display: grid; gap: 12px; justify-items: center; padding: 24px 0; }
.pad { display: grid; gap: 8px; justify-items: center; width: 100%; }
.pad-canvas {
  width: min(100%, 340px); aspect-ratio: 1; background: var(--paper); border: 1.5px solid #a8a59c; border-radius: 12px;
  touch-action: none; cursor: crosshair; display: block;
}
.pad-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; min-height: 34px; }
.fb { font-size: 14px; font-weight: 600; }
.fb.good { color: var(--green); }
.fb.bad { color: var(--red); }
.done-box { display: grid; gap: 8px; justify-items: center; padding: 20px 0; text-align: center; }
.stars { font-size: 40px; color: #d9a521; letter-spacing: 0.1em; }
.buildup { display: grid; gap: 6px; padding: 8px; }
.buildup .b svg { width: 100%; display: block; }
.words-title { margin-top: 32px; }
.words { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.word { display: grid; grid-template-columns: 1fr 120px; gap: 12px; align-items: center; }
.word .meaning { font-size: 13px; color: var(--muted); }
.word .w { font-size: 34px; color: var(--purple); line-height: 1.3; }
.word .w .hit { color: var(--mark); }
.word .r { color: var(--green); font-size: 14px; margin-bottom: 8px; }
.word .pic img { width: 120px; height: 120px; object-fit: contain; border: 1.5px dashed var(--line); border-radius: 10px; background: #fff; }
.locked-page { text-align: center; padding: 48px 0; }

/* ---- quiz ---- */
.quiz { display: grid; gap: 14px; justify-items: center; text-align: center; max-width: 560px; margin: 0 auto; }
.q-kana { font-size: 110px; line-height: 1.1; color: var(--purple); }
.q-rom { font-size: 64px; font-weight: 700; color: var(--green); }
.q-pic { width: 180px; height: 180px; object-fit: contain; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.opt {
  padding: 16px 8px; border: 2px solid var(--line); border-radius: 12px; background: var(--paper);
  font: 600 22px var(--head); cursor: pointer; color: var(--ink);
}
.opt.kana { font-family: var(--kana); font-size: 30px; font-weight: 400; }
.opt:hover { border-color: var(--ink); }
.opt.right { border-color: var(--green); background: #eef6ea; color: var(--green); }
.opt.wrong { border-color: var(--red); background: #fdecef; color: var(--red); }

/* ---- unlock ---- */
.unlock .price { font-size: 40px; font-weight: 700; }
.unlock ul { padding-left: 1.1em; }

/* ---- admin ---- */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.tile .v { font-size: 26px; font-weight: 700; }
.series svg { width: 100%; height: 120px; display: block; }
.toplist ul { list-style: none; padding: 0; margin: 0; }
.toplist li { position: relative; display: flex; justify-content: space-between; gap: 8px; padding: 4px 6px; font-size: 14px; }
.toplist .bar-bg { position: absolute; inset: 0 auto 0 0; background: var(--mauve); border-radius: 6px; z-index: 0; }
.toplist .l, .toplist b { position: relative; z-index: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list { width: 100%; border-collapse: collapse; font-size: 14px; }
.list th, .list td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.msg { border-bottom: 1px solid var(--line); padding: 8px 0; }
.msg p { white-space: pre-wrap; margin: 4px 0; }
.app .card + .card, .app .grid + .card, .app .card + .grid { margin-top: 16px; }

@media (max-width: 860px) {
  .lesson-grid { grid-template-columns: 1fr; }
  .buildup { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
}
@media (max-width: 480px) {
  .word { grid-template-columns: 1fr 96px; }
  .word .pic img { width: 96px; height: 96px; }
  .script-card { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .chart { border-spacing: 4px; }
}
