:root{font-family:system-ui,-apple-system,sans-serif;color:#182d36;background:#f6f1e8;font-synthesis:none}*{box-sizing:border-box}body{margin:0}button,select{font:inherit}button,.import-button{border:1px solid #49616a;border-radius:.7rem;background:#fff;color:#182d36;padding:.85rem 1rem;min-height:3rem;cursor:pointer}button:focus-visible,select:focus-visible,.import-button:focus-within{outline:3px solid #a76c3b;outline-offset:2px}.site-head{background:#182d36;color:#fff;padding:1rem max(1rem,env(safe-area-inset-right))}.head-inner{max-width:42rem;margin:auto;display:flex;align-items:center;gap:.8rem}.logo{background:#b98962;border-radius:.7rem;font:2rem serif;width:3.3rem;height:3.3rem;display:grid;place-items:center}.eyebrow{margin:0;text-transform:uppercase;letter-spacing:.15em;font-size:.7rem;color:#d9c3ac}h1{font-size:1.35rem;margin:.1rem 0}main{max-width:42rem;margin:auto;padding:1.25rem 1rem 3rem}.toolbar,.study{background:#fffdf9;border:1px solid #ded5c7;border-radius:1rem;padding:1.1rem;box-shadow:0 8px 32px #1b2d3210}.deck-label{font-weight:700;display:block;margin-bottom:.45rem}select{width:100%;min-height:3rem;border:1px solid #8a9a9f;border-radius:.6rem;padding:.5rem;background:white}.deck-description{color:#53646a;font-size:.9rem;margin:.6rem 0 1rem}.tools{display:flex;gap:.5rem;flex-wrap:wrap}.tools button,.import-button{font-size:.84rem}.import-button{position:relative;overflow:hidden}.import-button input{position:absolute;inset:0;opacity:0;width:100%;height:100%;cursor:pointer}.study{margin-top:1rem}.study-meta{display:flex;justify-content:space-between;color:#607078;font-size:.85rem}.step-label{color:#836341;text-transform:uppercase;letter-spacing:.1em;font-size:.72rem;margin:1.4rem 0 .4rem}.card-face,.answer-face{border-radius:.9rem;padding:1.4rem;display:flex;min-height:13rem;flex-direction:column;align-items:center;justify-content:center;text-align:center}.card-face{background:#edf3f1;border:1px solid #cfdfdb}.answer-face{background:#f8efe2;border:1px solid #ecdcc4;margin-top:.85rem;min-height:9rem}.field{margin:.3rem 0;line-height:1.35}.field.hanzi,.field.bopomofo{font-family:'Noto Serif CJK TC','PingFang TC','Hiragino Sans GB',serif;font-size:clamp(4rem,18vw,6.5rem)}.answer-face .field.hanzi{font-size:5rem}.field.pinyin{font-size:1.5rem}.field.de{font-size:1.2rem;max-width:35ch}.answer-face .field.de{font-size:1.05rem}.extra{font-size:.9rem;color:#685e51;margin:.3rem 0}.primary{background:#1e5660;color:white;border-color:#1e5660}.reveal{display:block;width:100%;margin-top:1rem;font-weight:700}.grade-help{text-align:center;color:#53646a;font-size:.9rem}.grades{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.6rem}.grades button{min-height:3.5rem}.grades button:last-child{background:#e3f0e9}.empty{text-align:center;padding:2rem 1rem}.message{padding:.8rem 1rem;background:#e3f0e9;border-radius:.6rem}.error{background:#f8d8d2;color:#7f2518}footer{color:#617078;font-size:.82rem;line-height:1.5;margin-top:1rem}@media(max-width:370px){.tools{display:grid}.grades{grid-template-columns:1fr}}

button, select, input { font: inherit; }
input:focus-visible { outline: 3px solid #a76c3b; outline-offset: 2px; }
#new-limit { width: 6rem; min-height: 2.8rem; padding: .4rem; border: 1px solid #8a9a9f; border-radius: .6rem; margin-bottom: 1rem; }
@font-face { font-family: 'MOE Kai'; src: url('/fonts/MOE-Kai.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'MOE Song'; src: url('/fonts/MOE-Song.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: Iansui; src: url('/fonts/Iansui-Regular.woff2') format('woff2'); font-display: swap; }
.logo { font-family: Iansui, 'Noto CJK Drill', serif; }
@font-face { font-family: 'Noto CJK Drill'; src: url('/fonts/NotoSerifCJKtc-Regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Noto Sans Siddham'; src: url('/fonts/NotoSansSiddham-Regular.woff2') format('woff2'); font-display: swap; }
.study[data-font='moe-kai'] .field.hanzi, .study[data-font='moe-kai'] .field.bopomofo { font-family: 'MOE Kai', 'Noto CJK Drill', serif; }
.study[data-font='moe-song'] .field.hanzi, .study[data-font='moe-song'] .field.bopomofo { font-family: 'MOE Song', 'Noto CJK Drill', serif; }
.study[data-font='iansui'] .field.hanzi, .study[data-font='iansui'] .field.bopomofo { font-family: Iansui, 'Noto CJK Drill', serif; }
.study[data-font='moe-kai'] .example-ruby { font-family: 'MOE Kai', 'Noto CJK Drill', serif; }
.study[data-font='moe-song'] .example-ruby { font-family: 'MOE Song', 'Noto CJK Drill', serif; }
.study[data-font='iansui'] .example-ruby { font-family: Iansui, 'Noto CJK Drill', serif; }
.examples { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem 1.4rem; max-width: 100%; margin: .8rem 0 .4rem; }
.example { display: flex; flex-direction: column; align-items: center; gap: .15rem; min-width: 0; }
.example-ruby { font-size: clamp(3rem, 11vw, 3.6rem); line-height: 1.3; ruby-position: over; }
.example-ruby rt { color: #356f91; font: 600 .45em system-ui, sans-serif; white-space: nowrap; }
.example-meaning { color: #685e51; font-size: .9rem; max-width: 28ch; }
.audio-sample { display: flex; flex-direction: column; align-items: center; gap: .15rem; color: #685e51; font-size: .75rem; }
.field.siddham { font-family: 'Noto Sans Siddham', sans-serif; font-size: clamp(4rem, 18vw, 6.5rem); line-height: 1.3; }
.field.iast { font-size: 1.5rem; }
#font-choice { margin-bottom: 1rem; }
.build-version { margin-left: auto; align-self: flex-start; color: #d9c3ac; font-size: .75rem; white-space: nowrap; }
.home-view, .drill-view { min-height: 0; }
.deck-overview, .settings, .deck-tile { background: #fffdf9; border: 1px solid #ded5c7; border-radius: 1rem; padding: 1.1rem; box-shadow: 0 8px 32px #1b2d3210; }
.home-tabs { display: flex; gap: .5rem; margin-bottom: .8rem; }
.home-tabs button { min-height: 2.6rem; padding: .5rem .8rem; }
.home-tabs .selected { background: #1e5660; border-color: #1e5660; color: white; }
.home-tabs .reload-button { margin-left: auto; }
.home-tabs { flex-wrap: wrap; }
.review-launch { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; margin-bottom: 1rem; border-radius: .8rem; background: #edf3f1; }
.review-launch strong { font-size: 1.1rem; }
.review-launch p { margin: .25rem 0 0; color: #53646a; font-size: .9rem; }
.review-launch button { flex: none; }
.streak-page { background: #fffdf9; border: 1px solid #ded5c7; border-radius: 1rem; padding: 1.1rem; box-shadow: 0 8px 32px #1b2d3210; }
.streak-page h2 { margin: 0 0 .6rem; font-size: 1.2rem; }
.streak-calendar { width: 100%; border-collapse: separate; border-spacing: .2rem; margin-top: .8rem; text-align: center; table-layout: fixed; }
.streak-calendar th { font-size: .75rem; color: #53646a; }
.streak-calendar td { border-radius: .4rem; background: #edf3f1; padding: .45rem .1rem; color: #8a9a9f; font-weight: 700; }
.streak-calendar td.checked { background: #32776d; color: white; }
.streak-calendar .streak-week-label th { text-align: left; padding: .7rem 0 .2rem; }
@media (max-width: 500px) {
  .home-tabs { gap: .3rem; }
  .home-tabs button { min-height: 2.5rem; padding: .35rem .55rem; }
  .home-tabs .icon-button { width: 2.5rem; padding: .25rem; }
  .review-launch { align-items: stretch; flex-direction: column; }
  .streak-calendar { border-spacing: .1rem; }
  .streak-calendar td { padding: .4rem 0; }
  .streak-page { padding: .75rem; }
}
.stats-page { background: #fffdf9; border: 1px solid #ded5c7; border-radius: 1rem; padding: 1.1rem; box-shadow: 0 8px 32px #1b2d3210; }
.stats-page h2 { margin: 0 0 1rem; font-size: 1.2rem; }
.stats-page h3 { font-size: 1rem; margin: 1.2rem 0 .6rem; }
.stats-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.stats-summary > div { background: #edf3f1; border-radius: .6rem; padding: .7rem; }
.stats-summary strong { display: block; font-size: 1.5rem; }
.stats-summary span, .stats-note { color: #53646a; font-size: .85rem; }
.stats-history { display: grid; gap: .3rem; }
.stats-day { display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) 2rem; align-items: center; gap: .5rem; font-size: .8rem; }
.stats-day-track { background: #edf3f1; border-radius: .3rem; height: .65rem; overflow: hidden; }
.stats-day-track > div { background: #1e5660; height: 100%; border-radius: inherit; }
.stats-day strong { text-align: right; }
.stats-legend { display: flex; flex-wrap: wrap; gap: .3rem .8rem; font-size: .75rem; color: #53646a; }
.stats-legend span::before { content: ''; display: inline-block; width: .7rem; height: .7rem; margin-right: .3rem; border-radius: .15rem; background: #ded5c7; }
.stats-legend span:nth-child(2)::before { background: #d9a57f; }
.stats-legend span:nth-child(3)::before { background: #e6c967; }
.stats-legend span:nth-child(4)::before { background: #32776d; }
.stats-decks { display: grid; gap: .8rem; margin-top: .8rem; }
.stats-deck-label { display: flex; justify-content: space-between; gap: .5rem; font-size: .85rem; }
.stats-deck-label span { color: #53646a; text-align: right; }
.stats-track { display: flex; overflow: hidden; height: .9rem; border-radius: .3rem; margin-top: .3rem; background: #eee; }
.stats-track .unseen { background: #ded5c7; }
.stats-track .learning { background: #d9a57f; }
.stats-track .building { background: #e6c967; }
.stats-track .spaced { background: #32776d; }
.deck-overview h2, .settings h2 { margin: 0 0 1rem; font-size: 1.2rem; }
.deck-grid { display: grid; gap: .8rem; }
.deck-tile { box-shadow: none; }
.deck-tile h3 { margin: 0; font-size: 1.15rem; }
.deck-title-row { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.deck-title-row button { flex: none; min-height: 2.5rem; }
.deck-tile p { color: #53646a; font-size: .9rem; }
.deck-tile .deck-paused { font-weight: 700; color: #7a5139; }
.deck-tile .deck-count { font-weight: 700; color: #1e5660; }
.deck-tile .deck-next { margin: -.3rem 0 .8rem; font-variant-numeric: tabular-nums; }
.deck-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.deck-actions button { flex: 1; }
.deck-actions .icon-button { flex: 0 0 3rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-head h2 { margin: 0; }
.daily-new-budget { color: #1e5660; font-size: .9rem; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.icon-button { width: 3rem; padding: .4rem; font-size: 1.5rem; line-height: 1; }
.transfer-button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.transfer-icon { font-size: 1.4rem; line-height: 1; }
.settings-page { width: min(100%, 42rem); justify-self: center; margin: 0; }
.settings { margin-top: 1rem; }
.settings label:not(.import-button) { display: block; margin: .8rem 0 .4rem; font-weight: 600; }
.settings .tools { margin-top: .3rem; }
.drill-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .6rem; }
.drill-head h2 { font-size: 1rem; margin: 0; text-align: right; }
.drill-view .study { margin-top: 0; }
.drill-view > .message:not(.error) { margin: .6rem 0 0; padding: .6rem .8rem; }
.key-hint { display: none; }
.answer-face audio { display: block; width: min(100%, 15rem); height: 2.5rem; margin-top: .5rem; }
.settings audio { display: block; width: min(100%, 15rem); height: 2.5rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
.field.hanzi.long, .field.bopomofo.long { font-size: clamp(2.5rem, 12vw, 4.5rem); overflow-wrap: anywhere; }
@media (max-width: 899px) {
  body:has(.drill-view) { height: 100dvh; overflow: hidden; display: grid; grid-template-rows: auto minmax(0, 1fr); }
  .site-head { padding: max(.45rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) .45rem max(1rem, env(safe-area-inset-left)); }
  .head-inner { gap: .55rem; }
  .logo { width: 2.5rem; height: 2.5rem; font-size: 1.6rem; }
  .eyebrow { display: none; }
  h1 { font-size: 1.1rem; }
  .build-version { align-self: center; font-size: .7rem; }
  main { padding: .75rem 1rem max(.75rem, env(safe-area-inset-bottom)); }
  main:has(.drill-view) { width: 100%; height: 100%; min-height: 0; margin: 0 auto; padding-top: .5rem; padding-bottom: max(.5rem, env(safe-area-inset-bottom)); }
  .drill-view { height: 100%; min-height: 0; display: flex; flex-direction: column; }
  .drill-view .study { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; padding: .75rem; }
  .drill-view .drill-head { flex: none; margin-top: .5rem; }
  .drill-view .step-label { margin: .7rem 0 .35rem; }
  .drill-view .card-face { flex: 1; min-height: 7rem; padding: .7rem; }
  .drill-view .answer-face { flex: 1; min-height: 7rem; padding: .7rem; overflow: auto; justify-content: flex-start; }
  .drill-view .grades button { min-height: 2.75rem; padding: .4rem; }
  .drill-view .grade-help { margin: .5rem 0; }
  .drill-head button { min-height: 2.5rem; padding: .55rem .7rem; }
  .study:has(.answer-face) .card-face { flex: none; min-height: 7rem; }
  .study:has(.answer-face) .field.hanzi, .study:has(.answer-face) .field.bopomofo { font-size: clamp(3.5rem, 16vw, 5rem); }
  .study:has(.answer-face) .field.hanzi.long, .study:has(.answer-face) .field.bopomofo.long { font-size: clamp(2.3rem, 11vw, 4rem); }
  .study:has(.answer-face) .answer-face .field.bopomofo.long { font-size: clamp(1.8rem, 7vw, 2.5rem); line-height: 1.25; }
  .study:has(.answer-face) .answer-face .field.de { font-size: .96rem; }
  .study:has(.answer-face) .grade-help { margin: .6rem 0; }
}
@media (min-width: 900px) {
  body { height: 100dvh; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) 10rem; }
  .site-head { grid-column: 2; grid-row: 1; display: flex; align-items: center; padding: 1rem; }
  .head-inner { flex-direction: column; text-align: center; }
  .logo { width: 4rem; height: 4rem; font-size: 2.6rem; }
  .build-version { margin-left: 0; align-self: center; }
  main { grid-column: 1; grid-row: 1; width: 100%; max-width: 80rem; height: 100dvh; padding: 1rem; }
  .key-hint { display: inline; margin-left: .35rem; opacity: .7; font-size: .8em; }
  .home-view { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; gap: .6rem; }
  .home-view:has(.settings-page) { grid-template-rows: minmax(0, 1fr) auto; }
  .settings-page { padding: .8rem 1rem; }
  .settings-page label:not(.import-button) { margin: .45rem 0 .25rem; }
  .settings-page #new-limit, .settings-page #font-choice { margin-bottom: .25rem; }
  .settings-page .deck-description { margin: .35rem 0; }
  .settings-page h3 { margin: .6rem 0 .3rem; }
  .deck-overview, .settings, .stats-page, .streak-page { margin: 0; min-height: 0; overflow: auto; }
  .stats-decks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deck-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-view footer { grid-column: 1 / -1; margin: 0; }
  .home-view footer p { margin: 0; }
  .drill-view { height: 100%; display: flex; flex-direction: column; }
  .drill-view .study { min-height: 0; overflow: auto; flex: 1; display: flex; flex-direction: column; }
  .study .field.bopomofo.long { font-size: clamp(2rem, 3vw, 3rem); }
  .card-face { flex: 1; }
  .study:has(.answer-face) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto auto minmax(0, 1fr) auto auto; gap: .5rem 1rem; }
  .study:has(.answer-face) .study-meta, .study:has(.answer-face) .step-label, .study:has(.answer-face) .grade-help, .study:has(.answer-face) .grades { grid-column: 1 / -1; }
  .study:has(.answer-face) .step-label, .study:has(.answer-face) .grade-help { margin: 0; }
  .study:has(.answer-face) .card-face, .study:has(.answer-face) .answer-face { min-height: 0; margin: 0; overflow: auto; }
  .study:has(.answer-face) .grades { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .deck-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
