/* The look shared by all the games: one card, big chunky buttons. Each game sets --accent. Needs base.css. */
.app { max-width: 540px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom)); }

.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 36px; margin-bottom: 16px; }
.back { color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 600; padding: 6px 0; }
.sound { border: 1px solid var(--line); background: var(--card); border-radius: 99px; width: 40px; height: 34px; font-size: 15px; }

.hero { font-size: 52px; line-height: 1; margin: 4px 0 12px; display: inline-block; }
.bob { animation: bob 2.6s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
h1 { margin: 0 0 2px; font-size: 34px; line-height: 1.1; letter-spacing: -0.02em; }
.subtitle { margin: 0 0 14px; font-size: 20px; font-weight: 800; }
.subtitle > .hy { padding: 0 6px; border-radius: 8px; background: linear-gradient(transparent 45%, color-mix(in srgb, var(--accent) 55%, transparent) 45%); }
.subtitle .tr, .subtitle .muted { font-size: 15px; }
.lede { margin: 0 0 14px; color: var(--muted); font-size: 16px; line-height: 1.55; }
.lede b, .how b { color: var(--text); }
.how { margin: 0 0 8px; padding: 0 0 0 18px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.how li { margin-bottom: 6px; }
.label { margin: 22px 0 10px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.mode-note { margin: 10px 0 0; font-size: 14px; line-height: 1.45; }
.stats { margin: 22px 0 14px; font-size: 14px; line-height: 1.45; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 9px 13px; border: 2px solid var(--line); border-radius: 99px; background: var(--card); color: var(--muted); font-size: 15px; font-weight: 700; transition: transform 0.12s; }
.chip:active { transform: scale(0.95); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: transparent; }

.btn {
  display: block; width: 100%; padding: 15px; margin-bottom: 10px;
  border: 2px solid var(--line); border-radius: 18px; background: var(--card);
  font-size: 17px; font-weight: 700; text-align: center; text-decoration: none; color: inherit;
  box-shadow: var(--shadow); transition: transform 0.1s;
}
.btn:active { transform: translateY(2px) scale(0.99); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 55%, #000); }
.btn.primary:active { box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 55%, #000); transform: translateY(3px); }
.btn.big { padding: 19px 16px; font-size: 19px; }
.btn .hy { opacity: 0.75; font-size: 0.85em; margin-left: 4px; }
.link { display: block; margin: 8px auto 0; padding: 10px; border: 0; background: none; color: var(--muted); font-size: 14px; text-align: center; text-decoration: underline; text-underline-offset: 3px; }

/* play */
.meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; color: var(--muted); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.clock-s { color: var(--text); }
.clock-s.low { color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.lives { letter-spacing: 2px; }
.flame { display: inline-block; margin-left: 6px; color: var(--apricot); }
.progress { height: 8px; margin-bottom: 14px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width 0.25s linear; }

.card {
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  min-height: 210px; padding: 18px 18px 20px; margin-bottom: 14px;
  background: var(--card); border: 3px solid transparent; border-radius: 26px; box-shadow: var(--shadow);
  overflow-wrap: break-word;
}
.card .label { margin: 0 0 auto; padding-bottom: 10px; align-self: stretch; }
.card.q { background: color-mix(in srgb, var(--accent) 14%, var(--card)); transition: border-color 0.2s, background 0.2s; }
.card.q.ok { border-color: var(--good); }
.card.q.ko { border-color: var(--bad); }
.show { margin: 0 0 auto; font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; max-width: 100%; }
.show.glyph { font-size: 132px; line-height: 1.05; font-weight: 700; }
.show.word { font-size: clamp(36px, 12vw, 54px); }
.show.phrase { font-size: clamp(24px, 7.2vw, 32px); line-height: 1.3; font-weight: 700; }
.show.latin { font-size: 72px; font-family: ui-rounded, system-ui, sans-serif; }
.show.emoji { font-size: 84px; line-height: 1.1; }
.sub { margin: 8px 0 0; color: var(--muted); font-size: 17px; line-height: 1.4; }
.sub b { color: var(--text); font-size: 20px; }
.card.short { min-height: 0; }
.card .big { margin: 8px 0 12px; font-size: 24px; font-weight: 800; }
.card .huge { margin: 14px 0; font-size: clamp(28px, 8.5vw, 40px); font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
.card .note { margin: 0; font-size: 15px; line-height: 1.45; }
.card.accent { background: var(--accent); color: var(--on-accent); }
.card.accent .label, .card.accent .note { color: inherit; opacity: 0.85; }

.opts { display: grid; gap: 10px; margin-bottom: 14px; }
.opts.short { grid-template-columns: 1fr 1fr; }
.opt {
  min-height: 62px; padding: 12px 10px; border: 2px solid var(--line); border-radius: 18px; background: var(--card);
  box-shadow: 0 3px 0 var(--line); font-size: 19px; font-weight: 700; text-align: center; overflow-wrap: anywhere;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s, transform 0.1s;
}
.opts.long .opt { font-size: 17px; font-weight: 600; line-height: 1.35; text-align: left; padding: 14px 16px; }
.opt.hy { font-size: 24px; }
.opts.long .opt.hy { font-size: 21px; text-align: center; }
.opt.glyph { font-size: 44px; font-weight: 700; min-height: 84px; line-height: 1; }
.opt:not(:disabled):active { transform: translateY(2px) scale(0.98); box-shadow: 0 1px 0 var(--line); }
.opt.right { background: var(--good); border-color: transparent; color: #fff; animation: boing 0.35s; }
.opt.wrong { background: var(--bad); border-color: transparent; color: #fff; }
.opt.dim { opacity: 0.4; }

.why { position: relative; margin-bottom: 14px; padding: 15px 17px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow); font-size: 16px; line-height: 1.55; }
.why p { margin: 0; }
.why .verdict { margin-bottom: 6px; font-size: 20px; font-weight: 800; }
.why.good { background: var(--good-bg); }
.why.bad { background: var(--bad-bg); }
.why.good .verdict { color: var(--good); }
.why.bad .verdict { color: var(--bad); }
.why .verdict .tr { font-size: 15px; }
.why .hy { font-weight: 700; font-size: 1.1em; }
.why .pair, .recap .pair { font-weight: 800; font-size: 1.35em; margin-right: 2px; }
.note-l { display: block; margin-top: 6px; }
.also { display: block; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 14px; }
.also .hy { font-size: 1em; }
.say { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border: 0; border-radius: 99px; background: var(--card); font-size: 18px; }

/* end */
.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.score { padding: 14px 8px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); text-align: center; }
.score strong { display: block; font-size: 30px; }
.score span { color: var(--muted); font-size: 14px; }
.recap { margin: 0 0 18px; padding: 0; list-style: none; }
.recap li { padding: 12px 14px; margin-bottom: 8px; border-radius: 16px; background: var(--card); }
.recap p { margin: 0; line-height: 1.5; font-size: 15px; }
.recap .hy { font-weight: 700; color: var(--text); }

/* letter hunt */
.hunt-card { min-height: 0; padding-top: 14px; }
.hunt-card .show.latin { font-size: 58px; }
.hint { margin: 10px 0 0; min-height: 30px; font-size: 15px; font-weight: 700; color: var(--muted); }
.hint.on { color: var(--bad); }
.glyph-s { font-size: 26px; vertical-align: -3px; margin-left: 4px; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grid.cleared .cell:not(.hit) { opacity: 0.35; }
.cell {
  aspect-ratio: 1; border: 2px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 3px 0 var(--line);
  font-size: clamp(30px, 10vw, 40px); font-weight: 700; line-height: 1; transition: transform 0.1s, background 0.15s;
}
.cell:active { transform: scale(0.93); }
.cell.hit { background: var(--good); color: #fff; border-color: transparent; animation: boing 0.35s; }
.cell.bad { background: var(--bad); color: #fff; border-color: transparent; animation: shake 0.35s; }

/* word builder */
.build-card { min-height: 0; }
.build-card .show.emoji { font-size: 72px; }
.say-tr { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--card-2); color: var(--text); font-weight: 800; font-size: 20px; }
.slots { display: flex; justify-content: center; gap: 5px; width: 100%; margin-top: 16px; }
.slot {
  display: grid; place-items: center; flex: 1 1 0; min-width: 0; max-width: 46px; height: 52px; border-radius: 12px;
  border: 2px dashed var(--line); font-size: clamp(22px, 7vw, 30px); font-weight: 700;
}
.slot.cur { border-color: var(--accent); border-style: solid; animation: pulse 1.2s infinite; }
.slot.filled { border-style: solid; border-color: transparent; background: var(--card-2); animation: boing 0.3s; }
.slots.done .slot { background: var(--good); color: #fff; }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 4px; }
.tile {
  min-width: 58px; height: 62px; padding: 0 8px; border: 2px solid var(--line); border-radius: 16px; background: var(--card);
  box-shadow: 0 4px 0 var(--line); font-size: 32px; font-weight: 700; line-height: 1; transition: transform 0.1s, opacity 0.2s;
}
.tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.tile.used { opacity: 0; pointer-events: none; transform: scale(0.6); }
.tile.bad { background: var(--bad); color: #fff; animation: shake 0.35s; }
.tile.lit { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent); animation: boing 0.6s infinite alternate; }

/* animations */
.pop { animation: pop 0.25s ease-out; }
@keyframes pop { from { transform: translateY(6px) scale(0.98); opacity: 0.3; } to { transform: none; opacity: 1; } }
.shake { animation: shake 0.35s; }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes boing { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }

/* alphabet page */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.dot { display: inline-block; width: 10px; height: 10px; margin-right: -8px; border-radius: 99px; background: var(--line); }
.dot.known { background: var(--good); }
.dot.review { background: var(--apricot); }
.abc { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; margin-bottom: 8px; }
.ltile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px 2px 7px;
  border: 2px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 3px 0 var(--line); transition: transform 0.1s;
}
.ltile:active { transform: scale(0.94); }
.ltile .t-l { font-size: 24px; font-weight: 700; line-height: 1.1; white-space: nowrap; }
.ltile .t-s { color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.ltile.known { border-color: color-mix(in srgb, var(--good) 60%, transparent); background: color-mix(in srgb, var(--good) 10%, var(--card)); }
.ltile.review { border-color: color-mix(in srgb, var(--apricot) 70%, transparent); background: color-mix(in srgb, var(--apricot) 12%, var(--card)); }

.sheet-bg { position: fixed; inset: 0; z-index: 20; background: rgba(20, 10, 5, 0.45); }
.sheet {
  position: fixed; z-index: 21; left: 50%; bottom: 0; width: min(540px, 100%); transform: translateX(-50%);
  max-height: 88dvh; overflow-y: auto; padding: 20px 20px max(24px, env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0; background: var(--card); box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25); line-height: 1.5;
}
.sheet.pop { animation: up 0.25s ease-out; }
@keyframes up { from { transform: translate(-50%, 30px); opacity: 0.4; } to { transform: translate(-50%, 0); opacity: 1; } }
.sheet p { margin: 0 0 10px; }
.sheet-x { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border: 0; border-radius: 99px; background: var(--card-2); }
.sheet .say { top: 12px; right: 58px; background: var(--card-2); }
.big-pair { margin: 0 !important; font-size: 92px; font-weight: 700; line-height: 1.1; }
.sheet-sound { font-size: 20px; }
.kw { display: flex; align-items: center; gap: 14px; margin: 14px 0; padding: 12px 16px; border-radius: 18px; background: var(--card-2); }
.kw-e { font-size: 48px; }
.kw-w { font-size: 30px; font-weight: 800; }

.memo h2 { margin: 0; font-size: 18px; }
.memo details { margin-bottom: 10px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.memo summary { padding: 15px 18px; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.memo summary::-webkit-details-marker { display: none; }
.memo summary::after { content: "+"; color: var(--muted); font-size: 22px; font-weight: 700; }
.memo details[open] summary::after { content: "−"; }
.memo .body { padding: 0 18px 14px; font-size: 15px; line-height: 1.6; }
.memo .body p { margin: 0 0 10px; }
.memo .hy { font-weight: 700; font-size: 1.1em; }
.memo table { width: 100%; border-collapse: collapse; margin: 4px 0 12px; font-size: 15px; }
.memo th, .memo td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.memo th { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.memo .series .t-l { font-size: 22px; }
.memo .punct td:first-child { width: 48px; font-size: 26px; text-align: center; }

/* write */
.wdots { display: flex; gap: 4px; }
.wdot { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 99px; background: var(--card); font-size: 14px; opacity: 0.45; }
.wdot.cur { opacity: 1; box-shadow: 0 0 0 3px var(--accent); }
.wdot.done { opacity: 1; background: var(--good-bg); }
.wtop { position: relative; display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; padding: 8px 54px 8px 12px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.wtop .say { top: 50%; transform: translateY(-50%); background: var(--card-2); }
.wglyph { flex: none; font-size: 40px; font-weight: 700; line-height: 1; }
.winfo { font-size: 15px; line-height: 1.35; }
.winfo .hy { font-weight: 700; }
.pad {
  position: relative; width: 100%; max-width: 380px; aspect-ratio: 1; margin: 0 auto 10px;
  border-radius: 26px; background: var(--card); box-shadow: var(--shadow); overflow: hidden; touch-action: none;
  border: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.pad.won { border-color: var(--good); }
.pad canvas { position: absolute; inset: 0; touch-action: none; }
.meter { position: absolute; left: 14px; right: 14px; bottom: 10px; height: 5px; border-radius: 99px; background: var(--line); overflow: hidden; pointer-events: none; }
.meter span { display: block; height: 100%; background: var(--good); transition: width 0.3s; }
.wmsg { min-height: 26px; margin: 0 0 10px; text-align: center; font-size: 17px; font-weight: 700; }
.wmsg.good { color: var(--good); font-size: 20px; }
.wmsg.bad { color: var(--bad); }
.wbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wbtns .btn { margin: 0; }
.wbtns .btn:only-child { grid-column: span 2; }
.wbtns.three { grid-template-columns: 0.55fr 1fr 1.25fr; }
.wbtns.three .btn { padding-left: 6px; padding-right: 6px; white-space: nowrap; }
.wresults { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin: 14px 0 18px; }
.wres { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); font-size: 13px; }
.wres .hy { font-size: 34px; font-weight: 700; line-height: 1.2; }
