/* Easy Japanese 14 Days — 和モダン theme
   Paper (生成り) background, sumi ink text, Zen Kaku Gothic headings and body (gothic throughout for readability),
   and the ten tags coloured with traditional Japanese colours. */
:root {
  --bg: #f5efe3;            /* 生成り */
  --bg-deep: #ede5d4;
  --panel: #fbf8f1;         /* 白練 */
  --ink: #26221d;           /* 墨 */
  --muted: #7a7064;         /* 灰汁 */
  --line: #e0d6c3;
  --line-strong: #cbbfa8;
  --accent: #3e5c3b;        /* 松葉 */
  --accent-soft: rgba(62, 92, 59, .10);
  --accent-ink: #fbf8f1;
  --shu: #c0452c;           /* 朱 */
  --ok: #4d7d3f; --ng: #b8432d; --core: #26221d;
  /* tags — 伝統色 */
  --p-は: #d49a1a;  /* 山吹 */
  --p-が: #c9533a;  /* 朱 */
  --p-を: #2f5d8c;  /* 藍 */
  --p-に: #5b8a3c;  /* 若竹 */
  --p-で: #86689f;  /* 藤 */
  --p-と: #d57a36;  /* 柿 */
  --p-へ: #4f9a8a;  /* 青磁 */
  --p-から: #2f8fa6;/* 浅葱 */
  --p-まで: #2d6474;/* 納戸 */
  --p-も: #8a8076;  /* 利休鼠 */
  --p-none: #cdbfa6;
  --radius: 10px;
  --shadow: 0 1px 0 rgba(90, 70, 40, .05), 0 6px 18px -10px rgba(90, 70, 40, .28);
  --shadow-lift: 0 2px 0 rgba(90, 70, 40, .05), 0 12px 26px -12px rgba(90, 70, 40, .38);
  --font-body: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .28 0 0 0 0 .18 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --seigaiha: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='28' viewBox='0 0 56 28'%3E%3Cg fill='none' stroke='%233e5c3b' stroke-opacity='.10' stroke-width='1.2'%3E%3Cpath d='M0 28a28 28 0 0 1 56 0M8 28a20 20 0 0 1 40 0M16 28a12 12 0 0 1 24 0M-28 14a28 28 0 0 1 56 0M28 14a28 28 0 0 1 56 0M-20 14a20 20 0 0 1 40 0M36 14a20 20 0 0 1 40 0M-12 14a12 12 0 0 1 24 0M44 14a12 12 0 0 1 24 0'/%3E%3C/g%3E%3C/svg%3E");
  font-family: var(--font-body);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1a17; --bg-deep: #161411; --panel: #25221e; --ink: #eee6d8; --muted: #a79c8c;
    --line: #3a352e; --line-strong: #4b453c; --core: #eee6d8; --p-none: #4d473e;
    --accent: #8fb383; --accent-soft: rgba(143, 179, 131, .12); --accent-ink: #1c1a17; --shu: #e07a5f;
    --ok: #8fb383; --ng: #e07a5f;
    --shadow: 0 1px 0 rgba(0,0,0,.3), 0 8px 20px -12px rgba(0,0,0,.6);
    --shadow-lift: 0 2px 0 rgba(0,0,0,.3), 0 14px 28px -12px rgba(0,0,0,.7);
  }
}
:root[data-theme="dark"] {
  --bg: #1c1a17; --bg-deep: #161411; --panel: #25221e; --ink: #eee6d8; --muted: #a79c8c;
  --line: #3a352e; --line-strong: #4b453c; --core: #eee6d8; --p-none: #4d473e;
  --accent: #8fb383; --accent-soft: rgba(143, 179, 131, .12); --accent-ink: #1c1a17; --shu: #e07a5f;
  --ok: #8fb383; --ng: #e07a5f;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { overflow-x: clip; }
body {
  background-color: var(--bg); background-image: var(--paper);
  color: var(--ink); line-height: 1.75; letter-spacing: .01em;
  -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(192, 69, 44, .18); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--shu); }
.wrap { max-width: 800px; margin: 0 auto; padding: 20px 16px 8px; }

/* ---------- header ---------- */
header.top {
  display: flex; align-items: center; gap: 14px; padding: 10px 18px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
header.top .brand { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-head); font-weight: 700; text-decoration: none; color: var(--ink); font-size: 17px; line-height: 1.1; letter-spacing: .04em; }
header.top .brand::before {
  content: 'に'; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 5px;
  background: var(--shu); color: #fbf3ea; font-size: 14px; font-weight: 700; box-shadow: inset 0 0 0 2px rgba(255,255,255,.18);
  transform: rotate(-3deg);
}
header.top nav { display: flex; gap: 4px; flex-wrap: nowrap; overflow-x: auto; font-size: 13.5px; -ms-overflow-style: none; scrollbar-width: none; margin-left: auto; }
header.top nav::-webkit-scrollbar { display: none; }
header.top nav a { flex: 0 0 auto; text-decoration: none; color: var(--muted); white-space: nowrap; padding: 4px 9px; border-radius: 999px; transition: background .15s, color .15s; }
header.top nav a:hover { color: var(--ink); background: var(--accent-soft); }
header.top nav a.on { color: var(--accent); font-weight: 700; background: var(--accent-soft); }
header.top nav a.install { color: var(--accent); font-weight: 700; border: 1px solid var(--accent); margin-right: 4px; }
header.top nav a[hidden] { display: none; }
header.top nav a.lang { border: 1px solid var(--line-strong); font-weight: 700; color: var(--shu); margin-left: 4px; letter-spacing: .06em; }
@media (max-width: 520px) { header.top { padding: 8px 12px; gap: 10px; } header.top .brand { font-size: 15px; } header.top .brand::before { width: 21px; height: 21px; font-size: 12px; } header.top nav { font-size: 12.5px; gap: 2px; } header.top nav a { padding: 3px 7px; } }

/* ---------- type ---------- */
h1, h2, h3, h4, .chapter-card .t, .big { font-family: var(--font-head); font-feature-settings: "palt"; }
h1 { font-size: 30px; margin: 10px 0 8px; line-height: 1.35; font-weight: 700; letter-spacing: .03em; }
h2 { font-size: 21px; margin: 34px 0 12px; line-height: 1.45; font-weight: 700; display: flex; align-items: center; gap: 10px; }
h2::before { content: ''; flex: 0 0 auto; width: 4px; height: 1.05em; border-radius: 2px; background: var(--shu); }
h3 { font-size: 17px; margin: 18px 0 6px; font-weight: 700; }
h4 { font-weight: 700; }
p { margin: 8px 0; }
.lead { color: var(--muted); font-size: 16px; line-height: 1.85; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.big { font-size: 38px; font-weight: 700; }

/* ---------- surfaces ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); margin: 14px 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.grid > .panel { margin: 0; }
.grid > .panel b { font-family: var(--font-head); font-size: 16px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border-radius: 999px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 15px; font-weight: 700; letter-spacing: .03em; cursor: pointer; text-decoration: none; box-shadow: 0 1px 0 rgba(0,0,0,.08), 0 6px 14px -8px rgba(62, 92, 59, .7); transition: transform .12s, box-shadow .15s, background .15s; }
.btn:hover { color: var(--accent-ink); transform: translateY(-1px); box-shadow: 0 2px 0 rgba(0,0,0,.08), 0 10px 18px -8px rgba(62, 92, 59, .75); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--line-strong); box-shadow: none; }
.btn.ghost:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.btn.small { padding: 6px 13px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.tag-pill { display: inline-block; padding: 1px 9px; border-radius: 6px; color: #fff; font-weight: 700; font-size: 13px; }

/* ---------- chunk cards (荷札) ---------- */
.sentence { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 12px 0; min-height: 64px; }
.sentence.answer { min-height: 96px; padding-bottom: 10px; border-bottom: 2px solid var(--line-strong); }
.chunk {
  position: relative; display: inline-flex; flex-direction: column; align-items: stretch;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel);
  padding: 7px 10px 6px 12px; min-width: 66px; cursor: pointer; user-select: none; touch-action: manipulation;
  box-shadow: 0 1px 0 rgba(90,70,40,.06), 0 4px 10px -6px rgba(90,70,40,.35);
  transition: transform .14s ease, box-shadow .14s, opacity .15s, border-color .15s;
}
.chunk::before { /* 荷札の紐穴 */
  content: ''; position: absolute; left: 5px; top: 50%; width: 4px; height: 4px; margin-top: -2px; border-radius: 50%;
  background: var(--bg-deep); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.chunk:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.chunk .role { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.chunk .word { display: flex; align-items: baseline; gap: 5px; font-size: 23px; line-height: 1.25; }
.chunk .word .p { font-weight: 700; color: #fff; padding: 0 7px; border-radius: 5px; font-size: 18px; line-height: 1.5; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
.chunk .roma { font-size: 12px; color: var(--muted); }
.chunk.core { border: 1.5px solid var(--core); box-shadow: 3px 3px 0 var(--line-strong); background: var(--panel); }
.chunk.core::before { display: none; }
.chunk.core .word { font-weight: 700; font-family: var(--font-head); }
.chunk.none { border-style: dashed; }
.chunk.selected { transform: translateY(-5px); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-lift); }
.chunk.dropped { opacity: .3; text-decoration: line-through; }
.chunk.locked { cursor: default; }
.chunk.locked:hover { transform: none; }
.chunk .x { position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%; background: var(--line); color: var(--ink); font-size: 12px; line-height: 20px; text-align: center; border: none; cursor: pointer; }
.chunk.kanji .word .w::after { content: attr(data-kanji); display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.punct { font-size: 26px; align-self: center; font-family: var(--font-head); }
.q-mark { color: var(--shu); font-weight: 700; }
.en { font-size: 15px; margin-top: 4px; }

/* ---------- drill ---------- */
.status { min-height: 24px; font-size: 15px; }
.status.ok { color: var(--ok); font-weight: 700; }
.status.ng { color: var(--ng); font-weight: 700; }
.bank { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; border: 1.5px dashed var(--line-strong); border-radius: 10px; min-height: 62px; background: color-mix(in srgb, var(--bg-deep) 60%, transparent); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.choice { padding: 9px 15px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); font: inherit; font-size: 18px; cursor: pointer; box-shadow: 0 1px 0 rgba(90,70,40,.06); transition: transform .12s, border-color .12s; }
.choice:hover { transform: translateY(-1px); border-color: var(--accent); }
.choice.p { color: #fff; font-weight: 700; border-color: transparent; }
.choice.ok { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok); }
.choice.ng { border-color: var(--ng); opacity: .6; }
.blank { display: inline-block; min-width: 40px; border-bottom: 2px solid var(--ink); text-align: center; }
.blank.filled { border-bottom-color: transparent; }
.progress-bar { height: 8px; background: var(--bg-deep); border-radius: 999px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.08); }
.progress-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--p-は))); border-radius: 999px; transition: width .4s ease; }
#qbox { padding: 20px; }
#qbox .lead { color: var(--ink); font-family: var(--font-head); font-size: 17px; }

/* ---------- progress / chapters ---------- */
.day-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.day { text-align: center; padding: 9px 2px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); text-decoration: none; color: var(--ink); font-size: 13px; line-height: 1.5; transition: transform .12s, border-color .12s; }
.day:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--ink); }
.day.done { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.day.today { outline: 2px solid var(--shu); outline-offset: 1px; }
.chapter-card {
  position: relative; display: block; text-decoration: none; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 14px 18px; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s; overflow: hidden;
}
.chapter-card::after { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--line-strong); transition: background .15s; }
.chapter-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: var(--line-strong); color: var(--ink); }
.chapter-card:hover::after { background: var(--shu); }
.chapter-card .n { color: var(--muted); font-size: 12.5px; letter-spacing: .04em; }
.chapter-card .t { font-weight: 700; font-size: 18px; margin: 2px 0 4px; }
.list-ex { border-top: 1px solid var(--line); padding: 12px 0; }
.list-ex .ja { font-size: 20px; }
.list-ex .ja b { font-weight: 700; }
.list-ex .roma { color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.tabs button { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel); cursor: pointer; color: var(--ink); font: inherit; font-size: 14px; transition: background .12s, border-color .12s; }
.tabs button:hover { border-color: var(--accent); }
.tabs button.on { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.toggle { font-size: 13px; color: var(--muted); }
.toggle input { accent-color: var(--accent); }
.kbd { font-family: ui-monospace, monospace; background: var(--line); padding: 1px 6px; border-radius: 5px; font-size: 13px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl th { font-family: var(--font-head); color: var(--muted); font-weight: 700; }

/* ---------- footer ---------- */
footer { color: var(--muted); font-size: 12.5px; padding: 40px 16px 36px; text-align: center; margin-top: 30px; background: var(--seigaiha); background-size: 56px 28px; border-top: 1px solid var(--line); }
html[lang="tr"] footer::before { content: '14 Günde Kolay Japonca' !important; }
footer::before { content: 'Easy Japanese 14 Days'; display: block; font-family: var(--font-head); font-size: 15px; color: var(--ink); margin-bottom: 6px; letter-spacing: .06em; }

/* ---------- home hero ---------- */
.hero { position: relative; margin: -20px calc(50% - 50vw) 8px; padding: 44px 20px 30px; text-align: center; background: var(--seigaiha); background-size: 56px 28px; border-bottom: 1px solid var(--line); overflow: hidden; }
.hero::after { content: ''; position: absolute; inset: auto 0 0 0; height: 60px; background: linear-gradient(to bottom, transparent, var(--bg)); pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow { display: inline-block; font-size: 12.5px; letter-spacing: .18em; color: var(--shu); border: 1px solid color-mix(in srgb, var(--shu) 45%, transparent); padding: 2px 12px; border-radius: 999px; background: var(--panel); }
.hero h1 { font-size: 44px; margin: 14px 0 6px; letter-spacing: .03em; line-height: 1.2; }
.hero h1 .accent { color: var(--shu); }
.hero .lead { max-width: 560px; margin: 8px auto 0; }
.hero .demo { display: flex; justify-content: center; margin: 22px auto 6px; }
.hero .demo .sentence { justify-content: center; }
.hero .demo-note { font-size: 13px; color: var(--muted); }
.hero .demo-en { font-size: 14px; margin-top: 2px; }
.hero .cta { display: flex; justify-content: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.sentence.shuffling .chunk:not(.core) { animation: hop .45s ease; }
@keyframes hop { 0% { transform: translateY(0); } 40% { transform: translateY(-8px) rotate(-1.5deg); } 100% { transform: translateY(0); } }
@media (max-width: 520px) { .hero { padding: 32px 14px 24px; } .hero h1 { font-size: 31px; } .hero .demo .chunk .word { font-size: 19px; } }
.steps { counter-reset: step; }
.steps .panel { position: relative; padding-top: 22px; }
.steps .panel .num { position: absolute; top: -12px; left: 16px; font-family: var(--font-head); font-size: 13px; background: var(--ink); color: var(--panel); border-radius: 999px; padding: 1px 10px; letter-spacing: .06em; }

@media (max-width: 480px) { .chunk .word { font-size: 20px; } h1 { font-size: 25px; } h2 { font-size: 19px; } .panel { padding: 14px; } }

/* ---------- content pages: lessons, grammar, words ---------- */
.exb { position: relative; padding: 8px 0 8px 14px; border-left: 2px solid var(--line-strong); margin: 10px 0; }
.exb.wrong { border-left-color: var(--ng); }
.exb.wrong .exb-ja { text-decoration: line-through; text-decoration-color: rgba(184,67,45,.55); color: var(--muted); }
.exb.right { border-left-color: var(--ok); }
.exb .mark { font-weight: 800; margin-right: 6px; }
.exb.wrong .mark { color: var(--ng); } .exb.right .mark { color: var(--ok); }
.exb-ja { font-size: 21px; line-height: 1.55; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .45em; }
.exb-ja .tg { font-weight: 700; }
.exb-ja .core { font-weight: 700; text-decoration: underline; text-decoration-color: var(--line-strong); text-decoration-thickness: 2px; text-underline-offset: 5px; }
.exb-ro { color: var(--muted); font-size: 13px; letter-spacing: .02em; }
.exb-en { font-size: 14.5px; }
.exb .say { border: none; background: transparent; cursor: pointer; font-size: 15px; padding: 0 4px; opacity: .55; transition: opacity .12s, transform .12s; }
.exb .say:hover { opacity: 1; transform: scale(1.12); }
.prose p { margin: 10px 0; }
.tip { background: var(--accent-soft); border-radius: 8px; padding: 10px 14px; font-size: 14px; margin: 12px 0; border-left: 3px solid var(--accent); }
.tip::before { content: '一言 '; font-family: var(--font-head); font-weight: 700; color: var(--accent); margin-right: 4px; }
:root[lang="tr"] .tip::before, html[lang="tr"] .tip::before { content: 'İpucu '; }
html[lang="en"] .tip::before { content: 'Tip '; }
.note { background: color-mix(in srgb, var(--p-は) 12%, transparent); border-radius: 8px; padding: 10px 14px; font-size: 14px; margin: 12px 0; border-left: 3px solid var(--p-は); }
.why { font-size: 14px; color: var(--muted); margin: -2px 0 12px 16px; }
.lesson-nav { display: flex; justify-content: space-between; gap: 8px; margin: 22px 0; flex-wrap: wrap; }
.goal { font-size: 15.5px; font-weight: 700; border-left: 4px solid var(--shu); }
.tryit details { border-top: 1px solid var(--line); padding: 10px 0; }
.tryit details:first-child { border-top: none; }
.tryit summary { cursor: pointer; font-size: 15px; }
.tryit summary::marker { color: var(--shu); }
.wordgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.wordgrid .w { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--panel); box-shadow: 0 1px 0 rgba(90,70,40,.05); transition: transform .12s, border-color .12s; }
.wordgrid .w:hover { transform: translateY(-2px); border-color: var(--accent); }
.wordgrid .w b { font-size: 18px; display: block; }
.wordgrid .w span { font-size: 12px; color: var(--muted); }
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.toc a { font-size: 13px; padding: 4px 12px; border: 1px solid var(--line-strong); border-radius: 999px; text-decoration: none; color: var(--ink); background: var(--panel); transition: border-color .12s, background .12s; }
.toc a:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.tagsec { scroll-margin-top: 70px; }
.tagsec .head { display: flex; align-items: center; gap: 12px; }
.tagsec .big-tag { font-family: var(--font-head); font-size: 30px; font-weight: 700; color: #fff; border-radius: 8px; padding: 2px 14px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.14); }
.tagsec .picture { font-style: italic; color: var(--muted); font-size: 14px; }
.use { margin-top: 14px; }
.use h4 { margin: 0 0 2px; font-size: 15.5px; }
.vrow { display: grid; grid-template-columns: minmax(110px, 1.1fr) 1.6fr; gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--line); align-items: baseline; }
.vrow .k { font-size: 20px; }
.vrow .r { font-size: 12px; color: var(--muted); }
.vrow .ex { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.search { width: 100%; padding: 11px 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); font: inherit; font-size: 15px; box-shadow: inset 0 1px 2px rgba(0,0,0,.04); }
.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.lesson-list a { display: flex; gap: 14px; align-items: baseline; padding: 12px 6px; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: background .12s; border-radius: 6px; }
.lesson-list a:first-child { border-top: none; }
.lesson-list a:hover { background: var(--accent-soft); color: var(--ink); }
.lesson-list .d { font-family: var(--font-head); font-weight: 700; color: var(--shu); min-width: 58px; }
.lesson-list b { font-family: var(--font-head); }
.lesson-list .done-mark { margin-left: auto; color: var(--ok); font-weight: 700; }
details.verb { border-top: 1px solid var(--line); padding: 8px 0; }
details.verb summary { display: flex; gap: 10px; align-items: baseline; cursor: pointer; list-style: none; }
details.verb summary::-webkit-details-marker { display: none; }
details.verb .vr { color: var(--muted); font-size: 12px; min-width: 28px; text-align: right; font-family: var(--font-head); }
details.verb .vk { font-size: 19px; font-weight: 700; min-width: 120px; }
details.verb .ve { flex: 1; font-size: 14px; }
details.verb[open] summary .vk { color: var(--accent); }
.vforms { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 4px 38px; }
.vforms > div { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: var(--panel); }
.vforms b { font-size: 16px; }
details.verb > .small, details.verb > .exb { margin-left: 38px; }
@media (max-width: 480px) { .vforms { grid-template-columns: repeat(2, 1fr); margin-left: 0; } details.verb > .small, details.verb > .exb { margin-left: 0; } details.verb .vk { min-width: 96px; font-size: 17px; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* language selector in the hero */
.langswitch { display: inline-flex; gap: 2px; padding: 3px; margin: 0 auto 16px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel); box-shadow: var(--shadow); }
.langswitch a { display: inline-flex; align-items: center; gap: 7px; padding: 6px 16px 6px 8px; border-radius: 999px; text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 500; transition: background .15s, color .15s; }
.langswitch a .code { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 5px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .06em; background: var(--bg-deep); color: var(--muted); }
.langswitch a:hover { color: var(--ink); background: var(--accent-soft); }
.langswitch a.on { background: var(--ink); color: var(--panel); }
.langswitch a.on .code { background: var(--shu); color: #fbf3ea; }
.hero .langswitch + .eyebrow { display: block; width: fit-content; max-width: 100%; margin: 0 auto; }
@media (max-width: 520px) { .hero .eyebrow { letter-spacing: .06em; font-size: 11.5px; } .langswitch a { padding: 5px 13px 5px 6px; font-size: 13px; } }

/* instant speaking (瞬間作文) */
.flash-prompt { font-family: var(--font-head); font-size: 24px; line-height: 1.45; margin: 6px 0 4px; }
.flash-timer { height: 6px; border-radius: 999px; background: var(--bg-deep); overflow: hidden; margin: 12px 0 14px; }
.flash-timer > i { display: block; height: 100%; width: 100%; background: var(--accent); border-radius: 999px; transition: background .3s; }
.flash-timer.late > i { background: var(--shu); }
.flash-timer.off { opacity: .35; }
.flash-answer { border-top: 1px dashed var(--line-strong); margin-top: 12px; padding-top: 8px; }
.flash-grade { margin-top: 8px; }
.flash-grade .btn.suggest { box-shadow: 0 0 0 3px var(--accent-soft); }
.flash-grade .btn.picked { outline: 2px solid var(--ink); outline-offset: 2px; }
.flash-heard.ok { color: var(--ok); } .flash-heard.ng { color: var(--ng); }
.flash-speed { margin-top: 12px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.chipbtn { font: inherit; font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--muted); cursor: pointer; }
.chipbtn.on { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.flash-intro { border-left: 4px solid var(--shu); }

/* ---------- game layer (Duolingo-style): streak, XP, path, lesson mode ---------- */
header.top .gchips { display: inline-flex; gap: 8px; text-decoration: none; font-weight: 700; font-size: 13.5px; color: var(--ink); flex: 0 0 auto; }
header.top .gchips span:first-child { color: #e8741c; }
header.top .gchips .cold { filter: grayscale(1); opacity: .6; }

.gamebar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.gstat { display: flex; align-items: center; gap: 6px; }
.gstat .gi { font-size: 26px; line-height: 1; }
.gstat b { font-size: 24px; font-family: var(--font-head); }
.gstat.streak b { color: #e8741c; }
.gstat.streak.cold .gi { filter: grayscale(1); opacity: .55; }
.gstat.xp b { color: #d49a1a; }
.gstat.dgoal { flex: 1 1 180px; display: block; }
.gstat.dgoal b { font-size: 15px; font-family: inherit; }
.gstat.dgoal .progress-bar { margin-top: 6px; height: 12px; }
.gstat.dgoal .progress-bar > i { background: linear-gradient(90deg, #e8a317, #f2c94c); }

/* learning path */
.path { display: flex; flex-direction: column; align-items: center; padding: 6px 0 20px; }
.punit { width: 100%; margin: 26px 0 16px; padding: 14px 18px; border-radius: 16px; background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 70%, #000); }
.punit:first-child { margin-top: 4px; }
.punit .n { font-size: 12px; opacity: .8; letter-spacing: .06em; }
.punit .t { font-family: var(--font-head); font-weight: 700; font-size: 19px; }
.punit .ja { font-size: 14px; opacity: .75; margin-left: 6px; }
.punit .small { opacity: .85; }
.pnode-wrap.open { z-index: 10; }
.pnode-wrap { position: relative; display: flex; flex-direction: column; align-items: center; margin: 10px 0; transform: translateX(calc(var(--off) * 46px)); }
.pnode { width: 70px; height: 64px; border-radius: 50%; border: 0; cursor: pointer; font: inherit; font-size: 26px; font-weight: 700; color: #fff;
  background: var(--accent); box-shadow: 0 7px 0 color-mix(in srgb, var(--accent) 65%, #000); transition: transform .1s, box-shadow .1s; }
.pnode:active { transform: translateY(5px); box-shadow: 0 2px 0 color-mix(in srgb, var(--accent) 65%, #000); }
.pnode.done { background: #e8a317; box-shadow: 0 7px 0 #b07a0c; }
.pnode.locked { background: var(--bg-deep); color: var(--muted); box-shadow: 0 7px 0 var(--line-strong); font-size: 20px; }
.pnode.chest { border-radius: 18px; width: 64px; }
.pnode.chest.open { background: #8a4f9e; box-shadow: 0 7px 0 #5e3370; }
.pnode.current { animation: pnode-pulse 1.6s ease-in-out infinite; outline: 5px solid color-mix(in srgb, var(--accent) 25%, transparent); outline-offset: 5px; }
@keyframes pnode-pulse { 50% { transform: translateY(-4px); } }
.plabel { font-size: 12px; color: var(--muted); margin-top: 10px; }
.pstart { position: absolute; top: -34px; background: var(--panel); border: 2px solid var(--line-strong); color: var(--accent); font-weight: 700; font-size: 13px; padding: 3px 12px; border-radius: 10px; animation: pnode-pulse 1.6s ease-in-out infinite; white-space: nowrap; letter-spacing: .06em; text-transform: uppercase; }
.pstart::after { content: ''; position: absolute; left: 50%; bottom: -8px; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--line-strong); border-bottom: 0; }
.ppop { position: absolute; top: 96px; z-index: 5; width: min(300px, 86vw); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow), 0 10px 30px -10px rgba(0,0,0,.35); text-align: center; }
.ppop .row { justify-content: center; margin-top: 8px; gap: 6px; }
@media (prefers-reduced-motion: reduce) { .pnode.current, .pstart { animation: none; } }

/* lesson mode (drill): top bar with hearts, bottom feedback sheet */
body.lesson-mode { padding-bottom: 120px; }
.lesson-top { display: flex; align-items: center; gap: 14px; margin: 4px 0 10px; }
.lesson-x { font-size: 22px; color: var(--muted); text-decoration: none; line-height: 1; }
.lesson-top .progress-bar { flex: 1; }
.progress-bar.big { height: 16px; }
.progress-bar.big > i { background: linear-gradient(90deg, #58a700, #7dcf1a); }
.hearts { font-weight: 700; color: var(--ng); font-size: 17px; white-space: nowrap; }
.hearts.lost { animation: heart-shake .5s; }
@keyframes heart-shake { 20%, 60% { transform: translateX(-4px) scale(1.2); } 40%, 80% { transform: translateX(4px) scale(1.2); } }
.lesson-title { font-size: 20px; margin: 6px 0 2px; }
.qpanel { min-height: 220px; }
.again { display: inline-block; font-size: 12px; font-weight: 700; color: #b07a0c; background: #fbefd2; border-radius: 999px; padding: 2px 10px; margin-bottom: 6px; }
.combo { text-align: center; font-weight: 700; font-size: 20px; color: #e8741c; }
.combo.pop { animation: combo-pop .6s ease-out; }
@keyframes combo-pop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
.lesson-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--panel); border-top: 2px solid var(--line); padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); transition: background .2s; }
.lesson-foot-in { max-width: 800px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lesson-foot .status { flex: 1 1 240px; font-size: 16px; }
.lesson-foot.ok { background: #d7ffb8; border-top-color: #b8f28b; }
.lesson-foot.ok .status { color: #58a700; }
.lesson-foot.ng { background: #ffdfe0; border-top-color: #ffc1c1; }
.lesson-foot.ng .status { color: #ea2b2b; }
.lesson-foot .status b { font-size: 19px; display: block; }
.lesson-foot.ng .status b { display: inline; }
.lesson-foot .btn { padding: 12px 26px; font-size: 16px; text-transform: uppercase; letter-spacing: .06em; border-radius: 14px; box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 65%, #000); }
.lesson-foot .btn:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 65%, #000); }
.lesson-foot .btn.ghost { box-shadow: 0 4px 0 var(--line-strong); }
.lesson-foot.ok .btn { background: #58a700; border-color: #58a700; box-shadow: 0 4px 0 #3d7a00; color: #fff; }
.lesson-foot.ng .btn { background: #ea2b2b; border-color: #ea2b2b; box-shadow: 0 4px 0 #b31d1d; color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lesson-foot.ok { background: #1f3514; border-top-color: #2d4d1d; } :root:not([data-theme="light"]) .lesson-foot.ng { background: #3d1a1a; border-top-color: #5a2525; } :root:not([data-theme="light"]) .again { background: #3a2f16; } }
:root[data-theme="dark"] .lesson-foot.ok { background: #1f3514; border-top-color: #2d4d1d; }
:root[data-theme="dark"] .lesson-foot.ng { background: #3d1a1a; border-top-color: #5a2525; }
body.lesson-mode footer { display: none; }

/* results screen */
.result { text-align: center; padding: 26px 18px; }
.result-mascot { font-size: 64px; line-height: 1; animation: combo-pop .7s ease-out; }
.result h2 { margin: 10px 0 16px; font-size: 26px; color: #e8a317; justify-content: center; }
.result h2::before { display: none; }
.result-stats { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.result-stats .stat { flex: 1 1 90px; max-width: 150px; border: 2px solid; border-radius: 14px; overflow: hidden; }
.result-stats .stat span { display: block; font-size: 11px; font-weight: 700; color: #fff; padding: 4px 0; text-transform: uppercase; letter-spacing: .06em; }
.result-stats .stat b { display: block; font-size: 22px; padding: 10px 0; }
.result-stats .xp { border-color: #e8a317; } .result-stats .xp span { background: #e8a317; } .result-stats .xp b { color: #e8a317; }
.result-stats .acc { border-color: #58a700; } .result-stats .acc span { background: #58a700; } .result-stats .acc b { color: #58a700; }
.result-stats .time { border-color: #1cb0f6; } .result-stats .time span { background: #1cb0f6; } .result-stats .time b { color: #1cb0f6; }
.streak-banner { margin: 18px auto 0; font-weight: 700; font-size: 18px; color: #e8741c; }
.streak-banner .flame { display: inline-block; font-size: 30px; animation: combo-pop .8s ease-out; }
.goal-line { max-width: 360px; margin: 16px auto 6px; }
.goal-line .progress-bar { height: 12px; margin-top: 4px; }
.goal-line .progress-bar > i { background: linear-gradient(90deg, #e8a317, #f2c94c); }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }

/* progress: weekly XP bars */
.week { display: flex; align-items: flex-end; gap: 8px; height: 150px; }
.wk { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 12px; color: var(--muted); }
.wk i { display: block; width: 100%; max-width: 34px; min-height: 3px; border-radius: 6px 6px 2px 2px; background: var(--line-strong); }
.wk.hit i { background: linear-gradient(180deg, #f2c94c, #e8a317); }
.wk small { font-weight: 700; color: var(--ink); }
.wk span { margin-top: 4px; }
