:root {
  --accent: #f07c1b;
  --accent-dark: #c95f08;
  --bg: #fff8f0;
  --card: #ffffff;
  --text: #2b2b2b;
  --muted: #777;
  --good: #2e9d58;
  --bad: #d64545;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Nirmala UI", "Noto Sans Devanagari", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.hi { font-family: "Nirmala UI", "Noto Sans Devanagari", "Mangal", sans-serif; }
.topbar { background: var(--accent); padding: 12px 20px; }
.brand { color: #fff; text-decoration: none; font-size: 1.4rem; font-weight: 700; }
.brand span { font-size: 0.9rem; font-weight: 400; opacity: 0.9; margin-left: 6px; }
main { max-width: 760px; margin: 0 auto; padding: 20px 16px 60px; }
h1, h2, h3 { margin: 0.4em 0; }
.muted { color: var(--muted); }
.card {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 16px;
}
.btn {
  display: inline-block; border: none; border-radius: 10px; padding: 10px 18px;
  font-size: 1rem; cursor: pointer; background: var(--accent); color: #fff;
  text-decoration: none; font-family: inherit;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: #eee; color: var(--text); }
.btn.secondary:hover { background: #ddd; }
.btn.good { background: var(--good); }
.btn.small { padding: 6px 12px; font-size: 0.9rem; }
.btn:disabled { opacity: 0.5; cursor: default; }
input[type=text] {
  font-size: 1.1rem; padding: 10px; border-radius: 10px; border: 2px solid #ddd; width: 100%; max-width: 320px;
}
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 14px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.stat .num { font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.stat .label { font-size: 0.85rem; color: var(--muted); }
.unit-card { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.unit-card .icon { font-size: 2rem; width: 52px; height: 52px; border-radius: 12px; background: #ffe7d1; display: flex; align-items: center; justify-content: center; }
.unit-card .info { flex: 1; }
.unit-card.locked { opacity: 0.5; }
.bar { height: 10px; background: #eee; border-radius: 5px; overflow: hidden; margin-top: 6px; }
.bar > div { height: 100%; background: var(--good); transition: width 0.4s; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 16px; }
.tab { padding: 8px 14px; border-radius: 20px; background: #eee; text-decoration: none; color: var(--text); font-size: 0.95rem; }
.tab.active { background: var(--accent); color: #fff; }
.tab .done { color: var(--good); }
.tab.active .done { color: #fff; }
.flashcard { text-align: center; padding: 30px 18px; }
.flashcard .word { font-size: 3rem; font-weight: 700; }
.flashcard .roman { color: var(--muted); font-size: 1.1rem; }
.flashcard .meaning { font-size: 1.4rem; margin-top: 14px; }
.flashcard .example { margin-top: 10px; font-size: 1.15rem; }
.gender { display: inline-block; font-size: 0.8rem; padding: 2px 8px; border-radius: 8px; background: #eef; margin-top: 6px; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.dots { display: flex; gap: 6px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #ddd; cursor: pointer; border: none; padding: 0; }
.dot.known { background: var(--good); }
.dot.current { outline: 2px solid var(--accent); outline-offset: 2px; }
table.plural { border-collapse: collapse; width: 100%; margin-top: 8px; }
table.plural td, table.plural th { border-bottom: 1px solid #eee; padding: 8px; text-align: left; font-size: 1.15rem; }
table.plural th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.passage p { font-size: 1.25rem; line-height: 1.9; }
.translation { color: #555; font-style: italic; border-left: 3px solid var(--accent); padding-left: 10px; margin-top: -6px; }
.speak { background: none; border: none; font-size: 1.3rem; cursor: pointer; vertical-align: middle; }
.option {
  display: block; width: 100%; text-align: left; padding: 12px 14px; margin: 8px 0;
  border: 2px solid #e5e5e5; border-radius: 10px; background: #fff; font-size: 1.15rem; cursor: pointer; font-family: inherit;
}
.option:hover:not(:disabled) { border-color: var(--accent); }
.option.correct { border-color: var(--good); background: #e8f7ee; }
.option.wrong { border-color: var(--bad); background: #fdecec; }
.option:disabled { cursor: default; }
.explain { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: #fff4e6; }
.big-score { font-size: 3rem; font-weight: 700; color: var(--accent); text-align: center; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #333; color: #fff;
  padding: 10px 18px; border-radius: 10px; opacity: 0; transition: opacity 0.3s; pointer-events: none; max-width: 90%;
}
.toast.show { opacity: 1; }
.small { font-size: 0.85rem; }
.ok { color: var(--good); font-weight: 600; }
.tab .mins { font-size: 0.75rem; opacity: 0.75; }
.steps { list-style: none; padding: 0; margin: 8px 0; }
.steps li { padding: 5px 0; }
.timer { background: #fff; border-radius: 10px; padding: 10px 14px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.timer .p { color: var(--bad); font-size: 0.85rem; margin-left: 8px; }
.timer .bar > div { background: var(--accent); }
.step-footer { margin-top: 20px; }
.task { font-size: 1.25rem; font-weight: 600; margin-bottom: 2px; }
.tipbox { background: #fff8ef; border: 1px solid #f6dcc0; border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.tipbox summary { cursor: pointer; font-weight: 600; }
.tipbox li { margin: 4px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { border: 1px solid var(--accent); background: #fff; color: var(--accent-dark); border-radius: 16px; padding: 4px 12px; font-size: 1rem; cursor: pointer; }
.chip:hover { background: #ffe7d1; }
textarea { width: 100%; font-size: 1.15rem; line-height: 1.7; padding: 10px; border-radius: 10px; border: 2px solid #ddd; resize: vertical; font-family: "Nirmala UI", "Noto Sans Devanagari", sans-serif; }
textarea:focus { outline: none; border-color: var(--accent); }
textarea.short { margin-top: 6px; }
.wordtask { margin: 12px 0; }
.big { font-size: 1.3rem; }
.sample { margin-top: 6px; padding: 6px 10px; background: #e8f7ee; border-radius: 8px; }
.editor-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; gap: 10px; flex-wrap: wrap; }
.kb { background: #f4f4f4; border-radius: 10px; padding: 8px; margin-top: 8px; }
.kb-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.key { min-width: 36px; height: 38px; border: 1px solid #ccc; background: #fff; border-radius: 6px; font-size: 1.1rem; cursor: pointer; }
.key:active { background: #ffe7d1; }
.key.wide { min-width: 140px; font-size: 0.9rem; }
.review { margin-top: 16px; border-top: 2px dashed #eee; padding-top: 8px; }
.check { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; cursor: pointer; }
.check input { margin-top: 4px; width: 18px; height: 18px; }
.model { white-space: pre-wrap; background: #f3f8ff; border-left: 4px solid #6a9be0; border-radius: 8px; padding: 12px 14px; font-size: 1.15rem; line-height: 1.8; }
.answer-line { min-height: 54px; border: 2px dashed var(--accent); border-radius: 10px; padding: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 12px 0; }
.pool { display: flex; flex-wrap: wrap; gap: 6px; }
.rchip { border: 2px solid #ddd; background: #fff; border-radius: 10px; padding: 8px 12px; font-size: 1.15rem; cursor: pointer; font-family: inherit; }
.rchip.placed { border-color: var(--accent); background: #fff4e6; }
.rchip.ghost { border-style: dashed; color: transparent; }
.task { white-space: pre-line; }
.hero { border-left: 6px solid var(--accent); }
.hero h2 { margin: 6px 0 2px; }
.calendar { padding: 12px; }
.week { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.wl { width: 62px; font-size: 0.8rem; color: var(--muted); flex-shrink: 0; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; flex: 1; }
.day { display: flex; flex-direction: column; align-items: center; padding: 6px 2px; border-radius: 10px; background: #f6f6f6; text-decoration: none; color: var(--text); min-width: 0; }
.day:hover { background: #ffe7d1; }
.day .dn { font-size: 0.75rem; color: var(--muted); }
.day .di { font-size: 1.2rem; }
.day .dl { font-size: 0.65rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day.done { background: #e8f7ee; }
.day.today { outline: 3px solid var(--accent); background: #fff4e6; }
.weak-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eee; }
details > summary { cursor: pointer; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.level-card { display: block; text-decoration: none; color: inherit; border-left: 6px solid var(--accent); }
.level-card div { margin: 3px 0; }
.level-card.locked { opacity: 0.55; border-left-color: #ccc; }
.level-card.current { background: #fff4e6; }
.month summary { font-size: 1.05rem; }
.month.locked { opacity: 0.55; }
.days12 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 12px; }
.emoji-big { font-size: 4rem; line-height: 1.2; margin-top: 10px; }
.big-q { font-size: 4.5rem; text-align: center; line-height: 1.2; }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.option.big-opt { font-size: 2.6rem; text-align: center; padding: 14px; margin: 0; }
.listen-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.listen-btn { font-size: 1.2rem; padding: 12px 22px; }
.trace-label { font-size: 1.6rem; margin: 6px 0; }
canvas.trace { width: 100%; max-width: 600px; aspect-ratio: 600 / 360; background: #fffdf8; border: 2px dashed #f2c79a; border-radius: 14px; touch-action: none; cursor: crosshair; }
.passage p.poem { white-space: pre-line; font-size: 1.35rem; line-height: 2; }
@media (max-width: 500px) {
  .days12 { grid-template-columns: repeat(4, 1fr); }
  .big-q { font-size: 3.5rem; }
  .option.big-opt { font-size: 2.2rem; }
  .wl { display: none; }
  .day .dl { display: none; }
  .flashcard .word { font-size: 2.4rem; }
  .stat .num { font-size: 1.4rem; }
}
