@font-face {
  font-family: "Noto Sans Thai";
  src: url("fonts/NotoSansThai.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --bg: #f4f1ea; --card: #ffffff; --ink: #1d2327; --muted: #6b7378;
  --accent: #1f7a6d; --again: #c8483c; --good: #2f7fc1; --easy: #3c9a5f;
  --radius: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-user-select: none; user-select: none;
}
.bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: var(--accent); color: #fff; position: sticky; top: 0; z-index: 2; }
.bar h1 { flex: 1; margin: 0; font-size: 19px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: none; border: 0; color: #fff; font-size: 34px; line-height: 1; padding: 0 8px 4px 0; }
.counter { font-size: 14px; opacity: .9; }
.view { max-width: 560px; margin: 0 auto; padding: 16px; }
button { font: inherit; cursor: pointer; }
.primary, .secondary { border: 0; border-radius: 14px; padding: 14px 18px; font-size: 18px; font-weight: 600; width: 100%; }
.primary { background: var(--accent); color: #fff; }
.secondary { background: #e4e0d6; color: var(--ink); margin-bottom: 10px; }
.big { padding: 18px; font-size: 20px; }
.pill { display: inline-block; min-width: 28px; padding: 2px 10px; border-radius: 999px; background: rgba(255,255,255,.25); margin-left: 6px; font-size: 16px; }
.section { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 4px 8px; }
.decks { list-style: none; padding: 0; margin: 0; }
.decks li { background: var(--card); border-radius: 14px; margin-bottom: 10px; padding: 16px; display: flex; align-items: center; gap: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.decks .name { flex: 1; font-size: 18px; font-weight: 600; }
.decks .meta { font-size: 13px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.decks .due { font-weight: 700; color: var(--accent); font-size: 18px; }
.decks .due.zero { color: #b5b9bb; }
.foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 24px; line-height: 2; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 13px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 4px 18px rgba(0,0,0,.08); min-height: 48vh; padding: 28px 20px; display: flex; flex-direction: column; justify-content: center; text-align: center; }
.thai { font-family: "Noto Sans Thai", sans-serif; font-size: clamp(44px, 13vw, 72px); font-weight: 500; line-height: 1.5; word-break: break-word; }
.thai.long { font-size: clamp(30px, 8.5vw, 46px); }
.hint { color: #b5b9bb; font-size: 14px; margin-top: 8px; }
.back { border-top: 1px solid #ece8df; margin-top: 16px; padding-top: 16px; }
.paiboon { font-size: 26px; color: var(--accent); font-weight: 600; }
.english { font-size: 20px; margin-top: 6px; }
.example { margin-top: 18px; background: #f8f6f1; border-radius: 12px; padding: 12px; }
.ex-thai { font-family: "Noto Sans Thai", sans-serif; font-size: 24px; line-height: 1.6; }
.ex-pb { color: var(--accent); font-size: 17px; margin-top: 2px; }
.ex-en { color: var(--muted); font-size: 16px; margin-top: 2px; }
.mini-play { border: 0; background: #e4e0d6; border-radius: 50%; width: 34px; height: 34px; font-size: 14px; vertical-align: middle; }
.play { display: block; margin: 14px auto; border: 0; background: #e4e0d6; border-radius: 999px; padding: 12px 26px; font-size: 18px; }
.grades { display: flex; gap: 10px; }
.g { flex: 1; border: 0; border-radius: 14px; padding: 16px 4px 10px; color: #fff; font-size: 19px; font-weight: 600; }
.g small { display: block; font-size: 12px; font-weight: 400; opacity: .9; margin-top: 2px; }
.again { background: var(--again); } .good { background: var(--good); } .easy { background: var(--easy); }
.show { margin-top: 4px; }
.done-box { text-align: center; padding-top: 10vh; }
.done-thai { font-family: "Noto Sans Thai", sans-serif; font-size: 56px; color: var(--accent); }
.done-pb { color: var(--muted); font-size: 18px; margin-bottom: 16px; }
.done-box p { font-size: 18px; margin-bottom: 24px; }
[hidden] { display: none !important; }
