:root {
  --ink: #2B1A3A; --paper: #FBF7F0; --card: #FFFFFF; --accent: #8E2F4A; --accent-ink: #FFFFFF;
  --muted: #6E6378; --line: #E6DDD0; --chip: #F1E8DA; --star: #E0A100;
  --good: #2E7D4F; --good-bg: #E3F3E8; --bad: #B3261E; --bad-bg: #FBE4E1;
  --shadow: 0 6px 24px rgba(43, 26, 58, .12);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #F2EAF5; --paper: #1A1020; --card: #251A2D; --accent: #E8A0B4; --accent-ink: #1A1020;
    --muted: #A89CB0; --line: #3A2C44; --chip: #2E2237; --star: #FFC93C;
    --good: #7FD69E; --good-bg: #1E3326; --bad: #FF9A8F; --bad-bg: #3A1F22;
    --shadow: 0 6px 24px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink);
       font: 400 17px/1.5 Georgia, 'Times New Roman', serif; }
button { font: inherit; color: inherit; cursor: pointer; }
.wrap { overflow-x: clip; max-width: 34rem; margin: 0 auto; padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); min-height: 100vh; display: flex; flex-direction: column; }

/* top bar */
.bar { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 8px; }
.bar .title { font-weight: 700; font-size: 1.15rem; flex: 1; text-align: center; }
.iconbtn { border: 0; background: none; padding: 8px; min-width: 44px; min-height: 44px; border-radius: 12px; font-size: 1rem; color: var(--accent); }
.iconbtn:active { background: var(--chip); }

h1 { font-size: clamp(2.2rem, 11vw, 3.2rem); margin: .2em 0 .1em; letter-spacing: -.02em; text-align: center; }
.sub { color: var(--muted); font-style: italic; text-align: center; margin: 0 0 1.2rem; }
label.lbl { display: block; font-weight: 700; margin: 1rem 0 .4rem; }
input[type=text], input[type=search] { width: 100%; font: inherit; font-size: 18px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--card); color: var(--ink); }
.btn { display: block; width: 100%; border: 0; border-radius: 14px; padding: 14px 16px; font-weight: 700; font-size: 1.05rem;
  background: var(--accent); color: var(--accent-ink); margin-top: 1rem; min-height: 50px; }
.btn.ghost { background: var(--chip); color: var(--ink); }
.btn:disabled { opacity: .45; cursor: default; }
.err { color: var(--bad); margin: .6rem 0 0; min-height: 1.5em; text-align: center; }

/* tabs */
.tabs { display: flex; background: var(--chip); border-radius: 14px; padding: 4px; gap: 4px; }
.tabs button { flex: 1; border: 0; background: none; padding: 10px; border-radius: 10px; font-weight: 700; min-height: 44px; }
.tabs button[aria-selected="true"] { background: var(--card); box-shadow: var(--shadow); }

/* emoji picker */
.picked { display: flex; gap: 10px; justify-content: center; margin: .2rem 0 .6rem; }
.slot { width: 56px; height: 56px; border-radius: 14px; border: 2px dashed var(--line); display: grid; place-items: center; font-size: 32px; background: var(--card); }
.slot.full { border-style: solid; border-color: var(--accent); }
.emojis { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; }
.emojis button { border: 0; background: none; font-size: clamp(20px, 6.4vw, 28px); aspect-ratio: 1; border-radius: 10px; padding: 0; line-height: 1; }
.emojis button[aria-pressed="true"] { background: var(--accent); }

/* home */
.hello { text-align: center; margin: .5rem 0 1.2rem; }
.hello .who { font-size: 1.6rem; font-weight: 700; }
.tile { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 18px;
  padding: 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
.tile h2 { margin: 0 0 .2rem; font-size: 1.4rem; }
.tile p { margin: 0; color: var(--muted); }
.tile.locked { box-shadow: none; opacity: .55; cursor: default; }
.meter { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--chip); margin: 12px 0 6px; }
.meter span { display: block; height: 100%; }
.small { font-size: 14px; color: var(--muted); }

/* stars */
.stars { color: var(--star); letter-spacing: 1px; white-space: nowrap; font-size: 15px; }
.stars .off { color: var(--line); }

/* word list */
.filters { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button { flex: none; border: 1px solid var(--line); background: var(--chip); border-radius: 999px; padding: 6px 12px; font-size: 15px; min-height: 36px; }
.filters button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.sticky { position: sticky; top: 0; background: var(--paper); z-index: 2; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.words { list-style: none; padding: 0; margin: 0; }
.words li { position: relative; overflow: hidden; }
.words li button { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 0 12px; text-align: left; border: 0; background: var(--paper);
  padding: 12px 2px; border-bottom: 1px solid var(--line); position: relative; touch-action: pan-y; transition: transform .18s ease; }
.words li.dragging button { transition: none; }
/* the labels under a row pulled sideways: green on the left for known, red on the right for not known */
.words .swipe { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 16px; font-weight: 800; color: #fff; font-size: 15px; opacity: 0; transition: opacity .15s; }
.words .swipe.known { background: #2e8b57; justify-content: flex-start; }
.words .swipe.unknown { background: #c0392b; justify-content: flex-end; }
.words li.dragging:not(.left) .swipe.known, .words li.dragging.left .swipe.unknown { opacity: .55; }
.words li.dragging.past:not(.left) .swipe.known, .words li.dragging.past.left .swipe.unknown { opacity: 1; }
.words li.flash-known button { background: #e3f4e8; } .words li.flash-unknown button { background: #fbe3e0; }
.words .lat { font-weight: 700; overflow-wrap: anywhere; }
.words .en { color: var(--muted); grid-column: 1; overflow-wrap: anywhere; }
.words .stars { grid-column: 2; grid-row: 1 / span 2; align-self: center; text-align: right; }
.words .rest { font-size: 12px; color: var(--muted); display: block; }
.count { font-size: 14px; color: var(--muted); }

/* play */
.play { flex: 1; display: flex; flex-direction: column; }
.score { display: flex; justify-content: space-between; align-items: center; font-size: 15px; color: var(--muted); margin: 4px 2px 10px; }
.deck { position: relative; flex: 1; min-height: 340px; max-height: 460px; touch-action: none; user-select: none; -webkit-user-select: none; }
.card { position: absolute; inset: 0; background: url('art/ui/paper.jpg') center / 200px, #EFE1C2; background-blend-mode: multiply; border-radius: 18px; box-shadow: var(--shadow), inset 0 0 0 1px rgba(120,90,50,.2), inset 0 0 60px rgba(130,95,45,.22); border: 1px solid #CBB893; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 20px; text-align: center;
  will-change: transform; cursor: grab; }
.card.dragging { cursor: grabbing; }
.card::before { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(ellipse at 30% 20%, rgba(255,250,235,.45), rgba(255,250,235,0) 55%), linear-gradient(160deg, rgba(255,255,255,.1), rgba(120,80,30,.07) 70%, rgba(120,80,30,.18)); mix-blend-mode: multiply; }
.card::after { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; box-shadow: inset 0 0 0 6px rgba(255,255,255,.35), inset 0 0 0 7px rgba(140,110,70,.12); }
.card > * { position: relative; }
.card.anim { transition: transform .28s ease, opacity .28s ease; }
.card .lat { font-size: clamp(2.2rem, 12vw, 3.2rem); font-weight: 700; line-height: 1.1; overflow-wrap: anywhere; }
.card .means { color: var(--muted); font-style: italic; margin: 1.2rem 0 .3rem; }
.card .en { font-size: clamp(1.3rem, 6.5vw, 1.7rem); line-height: 1.25; overflow-wrap: anywhere; }
.card .cstars { position: absolute; top: 14px; left: 0; right: 0; }
.card .stamp { position: absolute; top: 22px; padding: 4px 12px; border: 3px solid; border-radius: 10px; font-weight: 700; font-size: 1.3rem; opacity: 0;
  font-family: system-ui, sans-serif; letter-spacing: .05em; }
.card .stamp.yes { right: 18px; color: var(--good); transform: rotate(12deg); }
.card .stamp.no { left: 18px; color: var(--bad); transform: rotate(-12deg); }
.card.under { transform: scale(.95) translateY(10px); opacity: .85; }
.answer { display: flex; gap: 14px; margin-top: 16px; }
.answer button { flex: 1; border: 0; border-radius: 16px; padding: 14px 8px; font-weight: 700; font-size: 1.1rem; min-height: 56px; }
.answer .no { background: var(--bad-bg); color: var(--bad); }
.answer .yes { background: var(--good-bg); color: var(--good); }
.hint { text-align: center; font-size: 14px; color: var(--muted); margin-top: 10px; }
.toast { position: fixed; left: 50%; top: 27%; transform: translate(-50%, 0); background: var(--good); color: #fff; padding: 8px 18px; border-radius: 999px;
  font-weight: 700; pointer-events: none; opacity: 0; transition: opacity .2s, transform .5s; z-index: 30; font-family: system-ui, sans-serif; }
.toast.show { opacity: 1; transform: translate(-50%, -16px); }
.ctoast { width: max-content; max-width: 90vw; text-align: center; transform: translate(-50%, 16px); }
.ctoast.show { transform: translate(-50%, 0); }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

/* memory sheet */
.sheet { position: fixed; inset: 0; background: rgba(20, 10, 28, .55); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet[hidden] { display: none; }
.panel { background: var(--paper); width: 100%; max-width: 34rem; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 600px) { .sheet { align-items: center; } .panel { border-radius: 22px; } }
.verdict { border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-weight: 700; }
.verdict.bad { background: var(--bad-bg); color: var(--bad); }
.memo { text-align: center; }
.memo .pic { font-size: 64px; line-height: 1.2; margin: 6px 0; }
.memo .lat { font-size: 2.2rem; font-weight: 700; overflow-wrap: anywhere; }
.memo .en { font-size: 1.3rem; margin-bottom: .8rem; }
.memo .how { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.memo .how h3 { margin: 0 0 .3rem; font-size: 1rem; color: var(--accent); }
.memo .how p { margin: 0; }
.memo .meta { margin-top: 10px; }

/* word-type borders */
.card { --frame: #2B5BA8; color: var(--ink); padding: 44px 36px; }
.card[data-kind="noun"]          { --frame: #2B5BA8; }
.card[data-kind="verb"]          { --frame: #C62E2E; }
.card[data-kind="adjective"]     { --frame: #7B3FB5; }
.card[data-kind="adverb"]        { --frame: #0F8A8A; }
.card[data-kind="preposition"]   { --frame: #2E8B3E; }
.card[data-kind="joining word"]  { --frame: #D2691E; }
.card[data-kind="pronoun"]       { --frame: #C2367A; }
.card[data-kind="question word"] { --frame: #3F3FB0; }
.card[data-kind="number"]        { --frame: #B8860B; }
@media (prefers-color-scheme: dark) {
  .card[data-kind="noun"]          { --frame: #7FA8F0; }
  .card[data-kind="verb"]          { --frame: #FF8A80; }
  .card[data-kind="adjective"]     { --frame: #C79BF2; }
  .card[data-kind="adverb"]        { --frame: #5FD3D3; }
  .card[data-kind="preposition"]   { --frame: #7FD68F; }
  .card[data-kind="joining word"]  { --frame: #FFB070; }
  .card[data-kind="pronoun"]       { --frame: #F28BBF; }
  .card[data-kind="question word"] { --frame: #A3A3FF; }
  .card[data-kind="number"]        { --frame: #F2C94C; }
}
.card[data-kind] { background: var(--card); }
.card .frame { position: absolute; inset: 0; color: var(--frame); pointer-events: none; overflow: visible; }
.card .kind { position: absolute; bottom: 30px; left: 0; right: 0; font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--frame); font-family: system-ui, sans-serif; font-weight: 700; }
.card .cstars { top: 32px; }
.card .stamp { top: 40px; z-index: 1; }
.card .stamp.yes { right: 36px; } .card .stamp.no { left: 36px; }

/* streak */
.streakbar { display: flex; align-items: center; justify-content: center; position: relative; margin: 12px 0 2px; }
.streak { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 18px; border-radius: 999px; background: var(--chip);
  font-family: system-ui, sans-serif; font-weight: 800; transition: background .3s; }
.streak .fire { font-size: 1.3rem; filter: grayscale(1); opacity: .5; transition: filter .3s, opacity .3s; }
.streak .n { font-size: 1.6rem; line-height: 1; min-width: 1ch; text-align: center; }
.streak .lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.streak:not(.zero) .fire { filter: none; opacity: 1; }
.streak.hot { background: linear-gradient(90deg, #FFB347, #FF5D8F); color: #fff; }
.streak.hot .lbl { color: #fff; }
.streak.pop { animation: pop .45s ease; }
.streak.zero { animation: shake .4s ease; }
.best { position: absolute; right: 2px; font-size: 13px; color: var(--muted); font-family: system-ui, sans-serif; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* fireworks layer */
/* fireworks draw on a layer behind the page, so they never cover the card */
canvas.fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 0; }
html { background: var(--paper); }
body { background: transparent; }
#app { position: relative; z-index: 1; }

/* vocabulary setting */
.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0 0 10px; }
.levels button { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 7px 2px; min-height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; }
.levels button b { font-size: 15px; }
.levels button span { font-size: 12px; color: var(--muted); font-family: system-ui, sans-serif; }
.levels button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.levels button[aria-checked="true"] span { color: var(--accent-ink); opacity: .85; }

/* add-to-home-screen tip */
.tip { position: relative; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px;
  padding: 10px 40px 10px 14px; margin: 0 0 14px; font-size: 15px; line-height: 1.45; box-shadow: var(--shadow); }
.tip .x { position: absolute; top: 2px; right: 2px; border: 0; background: none; font-size: 22px; width: 40px; height: 40px; color: var(--muted); }
.tip svg { color: var(--accent); }
.card { -webkit-touch-callout: none; }
html, body { overscroll-behavior: none; }
.wrap { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
@media (display-mode: standalone) { .wrap { padding-top: max(calc(16px + env(safe-area-inset-top, 0px)), 62px); } .hstage .ptop { padding-top: max(2px, env(safe-area-inset-top, 0px)); height: auto; min-height: 38px; } }

/* example phrase */
.card .phrase { position: absolute; top: 58px; left: 40px; right: 40px; font-style: italic; font-size: 1.05rem; line-height: 1.35;
  color: var(--muted); overflow-wrap: anywhere; }
.card .phrase mark, .memo .said mark { background: none; color: var(--frame, var(--accent)); font-weight: 700; font-style: normal; }
.memo .said { margin-top: 10px; }
.memo .said .la { font-style: italic; font-size: 1.1rem; }
.memo .said .tr { color: var(--muted); margin-top: 2px; }
/* phrase sits at the top in its own space; the word and meaning share what is left */
.card .phrase { position: static; margin: 22px 0 8px; align-self: stretch; text-align: center; }
.card .lat { margin-top: auto; font-size: clamp(1.9rem, min(12vw, 6.4vh), 3.2rem); }
.card .en { margin-bottom: auto; }
.card { padding-bottom: 56px; }
/* word type sits on the bottom border, like a nameplate */
.card .kind { left: 50%; right: auto; bottom: 8px; transform: translateX(-50%); white-space: nowrap;
  background: #EFE1C2; padding: 1px 10px; line-height: 20px; z-index: 1; }
.card { padding-bottom: 40px; }

/* Organise panel on the home screen */
.levels.top { margin: 4px 0 2px; }
.meterline { text-align: center; margin: 0 0 14px; }
.orgbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.orgbtns .btn { margin-top: 14px; }
.bar .lvtag { min-width: 72px; text-align: right; font-size: 13px; color: var(--muted); font-family: system-ui, sans-serif; }

/* ---------- Practice: garden defence (always landscape) ---------- */
body.noscroll { overflow: hidden; }
.linkbtn { border: 0; background: none; color: var(--accent); text-decoration: underline; font: inherit; font-size: 14px; }
.pstage { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--paper); display: flex; flex-direction: column; overflow: hidden; box-sizing: border-box;
  font-family: system-ui, sans-serif; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
/* a portrait phone: the whole stage turns 90°, so the player turns the phone sideways */
.pstage.rot { right: auto; bottom: auto; transform: rotate(90deg) translateY(-100%); transform-origin: top left; padding: 0 env(safe-area-inset-bottom) 0 env(safe-area-inset-top); }
.ptop { display: flex; align-items: center; gap: 8px; height: 38px; padding: 2px 8px 0; }
.ptop .iconbtn { min-height: 32px; padding: 4px 6px; font-size: 15px; }
.plev { font-weight: 800; font-size: 15px; white-space: nowrap; }
.pbar { flex: 1; max-width: 260px; position: relative; height: 10px; background: var(--chip); border-radius: 5px; }
.pbar div { height: 100%; width: 0; background: linear-gradient(90deg, #9BE564, #2E8B3E); border-radius: 5px; transition: width .4s; }
.pbar .flag { position: absolute; right: 24%; top: -9px; font-size: 14px; }
.ptag { font-size: 12px; color: var(--muted); white-space: nowrap; }
.pcash { margin-left: auto; position: relative; display: flex; align-items: center; gap: 6px; padding: 2px 14px 2px 6px; border-radius: 999px;
  background: linear-gradient(#FFE36B, #E8B20A); color: #4A3000; box-shadow: 0 2px 0 #A87400, 0 3px 8px rgba(0,0,0,.2); }
.pcash .lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
.pcash b { font-size: 26px; font-weight: 900; line-height: 1; min-width: 2.2ch; text-align: right; font-variant-numeric: tabular-nums; }
.coin { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: -2px; margin-right: 3px;
  background: radial-gradient(circle at 35% 35%, #FFF3B0, #E0A100 60%, #A66D00); border: 1.5px solid #8A5A00; box-sizing: border-box; }
.coin.big { width: 26px; height: 26px; border-width: 2px; margin: 0; }
.coinpop { position: absolute; right: 10px; top: -4px; color: #2E7D4F; font-weight: 900; font-size: 18px; opacity: 0; pointer-events: none; }
.coinpop.go { animation: coin .9s ease forwards; }
@keyframes coin { 0% { opacity: 0; transform: translateY(8px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-22px); } }
.pmain { flex: 1; display: flex; gap: 8px; padding: 2px 8px; min-height: 0; }
.pgarden { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; }
.pcanvas { position: relative; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); border: 3px solid #5a3b22; background: #7DBE50; touch-action: none; box-sizing: content-box; }
.pcanvas canvas { display: block; }
.overlay { position: absolute; inset: 0; background: rgba(30, 15, 25, .55); display: flex; align-items: center; justify-content: center; padding: 12px; }
.overlay[hidden] { display: none; }
.ovbox { background: var(--paper); border-radius: 16px; padding: 12px 16px; max-width: 26rem; text-align: center; box-shadow: var(--shadow); font-family: Georgia, serif; }
.ovbox h3 { margin: 0 0 4px; font-size: 1.3rem; }
.ovbox p { margin: 0; font-size: 14px; line-height: 1.35; }
.ovbox .btn { margin-top: 10px; padding: 10px 16px; min-height: 42px; }
.ovbox .linkbtn { margin-top: 6px; }
.pshop { width: 84px; display: flex; flex-direction: column; gap: 5px; justify-content: flex-start; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.pshop .gun { position: relative; overflow: hidden; border: 2px solid var(--line); background: var(--card); border-radius: 10px; padding: 2px 2px 3px; flex: none; height: 66px; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; line-height: 1.05; }
.pshop .gun .ico { height: 36px; font-size: 26px; display: grid; place-items: center; }
.pshop .gun b { font-size: 11px; }
.pshop .gun .cost { font-size: 11px; color: var(--muted); display: flex; align-items: center; }
.pshop .gun .cool { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(60, 40, 70, .35); pointer-events: none; }
.pshop .gun.sel { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.pshop .gun.poor { opacity: .5; }
.pshop .gun.nope { animation: shake .4s ease; }
.pquiz { position: relative; flex-shrink: 0; height: 56px; margin: 4px 8px 6px; display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px 8px; overflow: hidden; }
.pquiz .qword { font: 700 1.35rem/1 Georgia, serif; min-width: 7.5rem; text-align: center; overflow-wrap: anywhere; }
.pquiz .qopts { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pquiz .qopts button { border: 1px solid var(--line); background: var(--chip); border-radius: 10px; padding: 4px 6px; min-height: 44px; font-size: 15px; line-height: 1.15; overflow-wrap: anywhere; }
.qopts button.good { background: var(--good-bg); color: var(--good); border-color: var(--good); font-weight: 700; }
.qopts button.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.ice { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.3rem; color: #1C4E8A;
  background: linear-gradient(160deg, rgba(220, 240, 255, .9), rgba(170, 215, 250, .94)); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.ice[hidden] { display: none; }
.ice::before { content: '❄️ ❄️ ❄️'; position: absolute; top: 4px; left: 10px; font-size: 16px; opacity: .7; }
.ice::after { content: '❄️ ❄️'; position: absolute; bottom: 4px; right: 12px; font-size: 18px; opacity: .7; }
.ice b { font-size: 1.8rem; margin-left: 8px; }
@media (min-height: 700px) and (min-width: 900px) { .ptop { height: 48px; } .pshop { width: 110px; } .pshop .gun { height: 96px; } .pshop .gun .ico { height: 48px; } .pshop .gun b, .pshop .gun .cost { font-size: 13px; }
  .pquiz { height: 70px; } .pquiz .qword { font-size: 1.7rem; } .pquiz .qopts button { font-size: 18px; min-height: 52px; } .pcash b { font-size: 32px; } }

/* cloud sync */
.syncline { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 1px dashed var(--line); background: none; border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; font-size: 14px; color: var(--muted); text-align: left; }
.syncline b { color: var(--ink); letter-spacing: .04em; font-family: system-ui, sans-serif; }
.memo .code { font: 800 1.6rem/1.2 system-ui, sans-serif; letter-spacing: .06em; background: var(--chip); border-radius: 12px; padding: 10px; margin: 6px 0 12px; user-select: all; -webkit-user-select: all; overflow-wrap: anywhere; }

/* Practice: art from the Squishygeddon set */
.pshop .gun .ico img { height: 34px; width: auto; max-width: 70px; }
.pshop .gun b { display: block; line-height: 1.05; }
.buddy { position: relative; height: 36px; width: 46px; margin-left: 4px; }
.buddy img { position: absolute; bottom: -2px; left: 0; height: 36px; width: auto; }
.buddy img.emo { height: 16px; left: 24px; top: -4px; bottom: auto; filter: drop-shadow(0 0 2px #fff); }
.buddy img.emo.pop { animation: pop .4s ease; }
.ovbox.won, .ovbox.lost { background: linear-gradient(180deg, #3a2a66, #262050); color: #fff; border: 3px solid #58f2ff; box-shadow: 0 0 0 3px #2a6a7a, 0 10px 30px rgba(0,0,0,.4); padding-top: 8px; }
.ovbox.won p, .ovbox.lost p { color: #cfe9ff; }
.ovart { display: flex; align-items: center; justify-content: center; gap: 6px; }
.ovart img { height: 44px; width: auto; }
.ovart img.ttl { height: 40px; }
.ovart.lost img.ttl { height: 34px; }
.ovart img.sad { height: 64px; }
.ovstats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0 2px; }
.ovstats div { background: linear-gradient(180deg, #6ff7ff, #26bcc9); color: #103a40; border-radius: 8px; padding: 4px 8px; font-family: system-ui, sans-serif; display: flex; flex-direction: column; align-items: center; }
.ovstats span { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; opacity: .8; }
.ovstats b { font-size: 18px; }
.ovbox.won .ovbtn, .ovbox.lost .ovbtn { background: linear-gradient(180deg, #7ff9ff, #2aa9b8); color: #0c3338; font-family: system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; }
.ice { background-image: url('art/ui/ice.png'), linear-gradient(160deg, rgba(220, 240, 255, .9), rgba(170, 215, 250, .94)); background-repeat: no-repeat; background-position: center; background-size: 55% auto, auto; }
.tile.prac { position: relative; padding-left: 92px; min-height: 120px; }
.tile.prac .pracico { position: absolute; left: 16px; top: 16px; width: 64px; height: 64px; border-radius: 14px; }
@media (min-height: 700px) and (min-width: 900px) { .buddy { height: 44px; width: 56px; } .buddy img { height: 44px; } .buddy img.emo { height: 20px; left: 30px; } .ovart img { height: 60px; } .ovart img.ttl { height: 54px; } .ovart img.sad { height: 90px; } }

/* trophy cabinet */
.cabinet { background: linear-gradient(180deg, #3a2a66, #262050); border: 3px solid #58f2ff; border-radius: 18px; padding: 12px 10px 14px; box-shadow: 0 0 0 3px #2a6a7a, var(--shadow); }
.cabsign { text-align: center; font: 900 1.6rem/1.2 system-ui, sans-serif; letter-spacing: .12em; color: #0c3338; background: linear-gradient(180deg, #7ff9ff, #2aa9b8); border-radius: 10px; padding: 4px 10px; margin: 0 auto 12px; max-width: 16rem; box-shadow: 0 0 12px rgba(127,249,255,.6); }
.shelves { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px 4px; }
.trophy { display: flex; flex-direction: column; align-items: center; gap: 2px; background: linear-gradient(180deg, rgba(111,247,255,.25), rgba(38,188,201,.25)); border-radius: 10px; padding: 6px 2px 4px; border-bottom: 4px solid rgba(255,255,255,.25); }
.trophy img { width: 100%; max-width: 64px; height: auto; filter: brightness(0) opacity(.45); transition: filter .3s; }
.trophy.got img { filter: none; }
.trophy span { font: 600 10px/1.15 system-ui, sans-serif; color: #cfe9ff; text-align: center; }
.trophy.got span { color: #fff; }
.ovstars { display: flex; justify-content: center; gap: 6px; margin: 2px 0 4px; }
.ovstars img { height: 34px; width: auto; }
.pshop .gun.power { border-color: #58f2ff; background: linear-gradient(180deg, #e9fdff, #bff3ff); animation: glow 1.2s ease-in-out infinite; }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(88,242,255,.0); } 50% { box-shadow: 0 0 0 5px rgba(88,242,255,.55); } }
.pshop .gun.power .ico img { height: 32px; }
.pshop .gun[data-g=upgrade] .ico img { height: 30px; }
.pshop .gun.tool { background: linear-gradient(180deg, #fff6d6, #f3e2b0); border-color: #d9b45a; }
.pshop .gun.tool.sel { border-color: #e8902b; box-shadow: 0 0 0 3px rgba(232,144,43,.45); }
@media (min-width: 600px) { .shelves { gap: 12px 8px; } .trophy img { max-width: 110px; } .trophy span { font-size: 13px; } }

.pshop .gun[hidden] { display: none; }

/* Jacques Hammer */
.htitle { position: absolute; inset: 0; background: #58BAF6 url('art/jh/title_wide.jpg') center / auto 100% no-repeat; cursor: pointer; display: flex; align-items: flex-end; justify-content: center; }
.htsub { margin: 0 0 8%; background: rgba(40,20,30,.75); color: #fff; border-radius: 12px; padding: 8px 14px; text-align: center; font: 800 15px system-ui, sans-serif; }
.htsub span { font-weight: 500; opacity: .85; font-size: 13px; }
@media (orientation: portrait) { .htitle { background-image: url('art/jh/title_tall.jpg'); background-size: cover; background-position: center; } }
@media (orientation: landscape) { .htitle { align-items: flex-start; justify-content: flex-start; } .htsub { margin: 10px 0 0 10px; text-align: left; } }
.hbox { flex: 1; min-height: 0; position: relative; margin: 2px 8px; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); border: 3px solid #5a3b22; background: #8FD3FF; touch-action: none; }
.hbox canvas { display: block; }
.hlev { font-size: 12px; color: var(--muted); white-space: nowrap; font-weight: 700; }
.hlives { font-size: 14px; font-weight: 800; color: #b43b2e; margin-left: 6px; white-space: nowrap; }
.hlives.warn { animation: hwarn .6s ease-in-out infinite alternate; }
@keyframes hwarn { from { opacity: 1; } to { opacity: .35; } }
@media (max-width: 520px) { .hstage .ptop { gap: 4px; padding: 2px 6px 0; } .hstage .ptop .iconbtn { padding: 4px 2px; font-size: 14px; } .hstage .plev { font-size: 14px; } .hstage .ptag { display: none; } .hstage .hlives { font-size: 13px; letter-spacing: 0; margin-left: 2px; } .hstage .pcash { padding: 2px 10px 2px 8px; } .hstage .pcash .lbl { font-size: 15px; margin-right: 1px; } .hstage .pcash b { font-size: 22px; } .hbar { padding: 4px 8px 6px; } }
.hbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 10px 6px; }
.hwhy { position: absolute; left: 50%; top: 10px; transform: translate(-50%, -20px); opacity: 0; background: rgba(60,20,40,.85); color: #FFD23F; padding: 6px 12px; border-radius: 10px; font: 700 14px system-ui, sans-serif; max-width: 90%; text-align: center; pointer-events: none; transition: opacity .3s, transform .3s; }
.hwhy.show { opacity: 1; transform: translate(-50%, 0); animation: whyout 3.2s forwards; }
@keyframes whyout { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }

/* Jacques Hammer items screen, built from the artist's ShopUI pieces (art/jh/ui_*).
   Plain stretched backgrounds and a canvas-painted frame: iOS Safari drops CSS border-image on these. */
.hitems { position: absolute; inset: 0; background: #6d8f6f url('art/jh/title_tall.jpg') center / cover; display: flex; flex-direction: column; padding: 6px 6px 4px; gap: 0; font-family: system-ui, sans-serif; image-rendering: pixelated; }
.hitems::before { content: ''; position: absolute; inset: 0; background: rgba(60,40,30,.5); }
.hitems > * { position: relative; }
.hitems button { -webkit-appearance: none; appearance: none; font-family: system-ui, sans-serif; }
.hihead { display: flex; align-items: flex-end; gap: 6px; margin: 0 10px -2px; z-index: 2; }
.hititle { width: 150px; height: 33px; background: url('art/jh/ui_title.png') no-repeat center; background-size: 100% 100%; color: #fff; text-shadow: 0 2px 0 #7a4a1e; font-weight: 900; letter-spacing: .12em; font-size: 17px; display: flex; align-items: center; justify-content: center; padding-bottom: 4px; }
.hicoins { height: 30px; background: url('art/jh/ui_panel.png') no-repeat center; background-size: 100% 100%; padding: 0 14px 2px; display: flex; align-items: center; font-weight: 900; color: #7a4a1e; font-size: 15px; min-width: 70px; }
.hiclose { margin-left: auto; width: 38px; height: 36px; border: 0; background: url('art/jh/ui_close.png') no-repeat center; background-size: 100% 100%; color: transparent; font-size: 0; }
.hiframe { flex: 1; min-height: 0; position: relative; padding: 50px 24px 26px; display: flex; flex-direction: column; gap: 6px; }
.hiframe canvas.hiframebg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.hiframe > :not(.hiframebg):not(.hitabs) { position: relative; z-index: 1; }
.hitabs { position: absolute; top: 8px; left: 10px; right: 10px; display: flex; gap: 3px; height: 36px; z-index: 1; }
.hitabs button { flex: 1; border: 0; background: url('art/jh/ui_tab.png') no-repeat center; background-size: 100% 100%; padding: 0 0 2px; font-weight: 900; letter-spacing: .02em; color: #4b3fa8; font-size: 12px; }
.hitabs button.on { background-image: url('art/jh/ui_tab_on.png'); color: #e8902b; }
.hibody { flex: 1; min-height: 0; display: flex; gap: 6px; padding: 0 0 6px; }
.hiwho { width: 33%; background: url('art/jh/ui_panel.png') no-repeat center; background-size: 100% 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; padding: 14px 8px 12px; position: relative; }
.hilv { position: absolute; top: 10px; left: 12px; font-weight: 900; color: #5a3a1a; font-size: 14px; }
.hiwho canvas { width: 100%; max-width: 150px; height: auto; image-rendering: pixelated; }
.higrid { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; align-content: start; padding: 2px; }
.hislot { border: 0; background: url('art/jh/ui_slot.png') no-repeat center; background-size: 100% 100%; padding: 8px 4px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 104px; cursor: pointer; color: #5a3a1a; }
.hislot canvas { width: 60px; height: 60px; image-rendering: pixelated; }
.hislot.worn { background-image: url('art/jh/ui_slot_on.png'); }
.hislot.poor { opacity: .55; }
.hiname { font-size: 11px; font-weight: 800; text-align: center; line-height: 1.1; }
.hiprice { font-size: 11px; font-weight: 900; color: #e8902b; }
.hibar { height: 18px; margin: 0 2px; background: url('art/jh/ui_track.png') no-repeat center; background-size: 100% 100%; position: relative; }
.hibar i { position: absolute; left: 0; top: 0; bottom: 0; min-width: 16px; background: url('art/jh/ui_fill.png') no-repeat center; background-size: 100% 100%; }
.hinote { text-align: center; color: #fff; font-weight: 700; font-size: 12px; text-shadow: 0 1px 2px rgba(0,0,0,.7); min-height: 1.2em; padding-top: 4px; }
.hiopen { position: absolute; top: 10px; right: 10px; width: auto; font-size: 14px; padding: 8px 12px; min-height: 36px; }
.hcoin { color: #e8902b; font-weight: 900; }
@media (max-width: 520px) { .hiwho { width: 30%; } .higrid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; } .hislot { min-height: 100px; } .hislot canvas { width: 56px; height: 56px; } }

/* profiles and avatars */
.profiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 18px; margin: 10px 0 18px; }
.profile { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; font-size: 15px; color: var(--ink); padding: 4px; min-width: 84px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--c, var(--chip)); position: relative; box-shadow: var(--shadow); vertical-align: middle; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar b { font-size: 18px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.avatar i { position: absolute; right: -2px; bottom: -2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); color: #fff; font: 700 13px/16px system-ui, sans-serif; font-style: normal; text-align: center; }
.avatar.big { width: 76px; height: 76px; }
.avatar.big b { font-size: 34px; }
.avatar.big i { width: 24px; height: 24px; font-size: 18px; line-height: 24px; right: 0; bottom: 0; }
.avatar.add { background: var(--card); border: 3px dashed var(--line); color: var(--muted); font-size: 40px; font-weight: 300; box-shadow: none; }
.userbox { display: flex; align-items: center; gap: 10px; }
.avatarbtn { border: 0; background: none; padding: 0; }
.avatarbtn .avatar { width: 44px; height: 44px; }
.avatarbtn .avatar b { font-size: 20px; }
.pickhello { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 6px 0 10px; }
.pickhello .avatar i { display: none; }
.profile .avatar i { display: none; }

/* the Practice section: one banner per game */
.tile.prac2 { display: flex; flex-direction: column; gap: 12px; }
.tile.prac2 h2 { margin-bottom: 2px; }
.gamebanner { position: relative; display: block; width: 100%; aspect-ratio: 3 / 1; border: 0; border-radius: 16px; overflow: hidden; background: #333 center / cover no-repeat; box-shadow: var(--shadow); padding: 0; cursor: pointer; image-rendering: auto; }
.gamebanner:active { transform: scale(.985); }
.gname { position: absolute; left: 0; right: 0; top: 9%; text-align: center; font-weight: 900; font-size: clamp(22px, 7.4vw, 40px); letter-spacing: .04em; line-height: 1; color: #fff;
  text-shadow: 0 2px 0 #2a1a3a, 0 -2px 0 #2a1a3a, 2px 0 0 #2a1a3a, -2px 0 0 #2a1a3a, 2px 2px 0 #2a1a3a, -2px 2px 0 #2a1a3a, 2px -2px 0 #2a1a3a, -2px -2px 0 #2a1a3a, 0 6px 14px rgba(0,0,0,.6); font-family: system-ui, -apple-system, sans-serif; text-transform: uppercase; }
.gname.squishy { color: #9BE564; font-style: italic; transform: rotate(-2deg); }
.gname.hammer { color: #8FEBD6; }
.gname.cards { color: #FFE9B0; }
.gname.list { color: #FFD6E0; }

/* read: sentences */
.rsent { position: relative; inset: auto; background-color: #F8F0DC; min-height: 150px; padding: 26px 18px; margin: 6px 0 14px; display: flex; flex-direction: column; justify-content: center; gap: 12px; cursor: default; }
.rla { font-size: clamp(1.5rem, 7vw, 2rem); line-height: 1.6; font-weight: 700; text-align: center; }
.rw { padding: 2px 6px; border-radius: 8px; transition: background .2s; }
.rw.cur { background: #FFE066; box-shadow: 0 0 0 3px #FFD23F; }
.rw.done { color: var(--good); }
.rp { color: var(--muted); }
.ren { text-align: center; color: var(--muted); font-style: italic; min-height: 1.4em; opacity: 0; transition: opacity .3s; }
.ren.show { opacity: 1; }
.ropts { display: flex; flex-direction: column; gap: 10px; }
.ropts .btn { width: 100%; font-size: 1.15rem; }
.ropts .btn.good { background: var(--good); color: #fff; border-color: var(--good); }
.ropts .btn.bad { background: var(--bad); color: #fff; border-color: var(--bad); }
.rmsg { text-align: center; min-height: 1.5em; margin: 12px 0 0; color: var(--muted); }
.gname.read { color: #FFF3B0; }

/* leaderboard */
.lb { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.lb th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; text-align: right; padding: 4px 6px; font-family: system-ui, sans-serif; }
.lb td { padding: 8px 6px; text-align: right; border-top: 1px solid var(--line); font-size: 1.05rem; }
.lb td.who { text-align: left; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.lb tr.me td { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.avatar.tiny { width: 28px; height: 28px; box-shadow: none; }
.avatar.tiny b { font-size: 13px; }
.avatar.tiny i { display: none; }

/* the card turned over */
.card.flipped { animation: flipin .45s ease; cursor: default; padding: 14px 14px 12px; }
@keyframes flipin { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }
.card.flipped > :not(.back) { display: none; }
.card .back { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; height: 100%; overflow-y: auto; text-align: center; animation: backin .45s ease; }
@keyframes backin { 0%, 50% { opacity: 0; } 100% { opacity: 1; } }
.card .back .pic { font-size: 34px; line-height: 1.1; }
.card .back .blat { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.card .back .ben { font-size: 1.1rem; margin-bottom: 2px; }
.card .back .how { text-align: left; width: 100%; background: rgba(255,255,255,.55); border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; font-size: .88rem; line-height: 1.3; }
.card .back .how h3 { margin: 0 0 4px; font-size: .95rem; color: var(--accent); }
.card .back .how p { margin: 0; }
.card .back .btn { width: 100%; margin-top: auto; position: sticky; bottom: 0; flex: none; }
.card .back .small { font-size: .8rem; }
.verline { display: block; margin: 18px auto 0; color: var(--muted); font-size: 12px; text-decoration: none; }

/* ---------- the artist's card game: scene, card frame, beasts ---------- */
.play { position: relative; }
.play[class*="scene-"]::before, .play.chome::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--scene, #c99a66); }
.play.scene-earth { --scene: radial-gradient(ellipse 60% 40% at 20% 20%, rgba(120,70,40,.55), transparent 70%), radial-gradient(ellipse 50% 35% at 80% 70%, rgba(90,50,30,.5), transparent 70%), radial-gradient(ellipse 70% 30% at 50% 100%, rgba(70,40,25,.6), transparent 70%), linear-gradient(170deg, #d8a86f, #b67b48 55%, #8a5634); }
.play.scene-grass { --scene: radial-gradient(ellipse 60% 40% at 15% 25%, rgba(255,255,200,.3), transparent 70%), radial-gradient(ellipse 50% 35% at 85% 65%, rgba(40,110,40,.45), transparent 70%), radial-gradient(circle at 70% 15%, rgba(255,255,255,.35) 0 6px, transparent 7px), linear-gradient(170deg, #b6e07a, #6fb84a 55%, #3f8a37); }
.play.scene-water { --scene: radial-gradient(circle at 20% 30%, rgba(255,255,255,.5) 0 5px, transparent 6px), radial-gradient(circle at 75% 20%, rgba(255,255,255,.4) 0 8px, transparent 9px), radial-gradient(circle at 60% 80%, rgba(255,255,255,.4) 0 6px, transparent 7px), radial-gradient(circle at 30% 70%, rgba(255,255,255,.35) 0 9px, transparent 10px), radial-gradient(ellipse 60% 40% at 80% 60%, rgba(20,110,120,.45), transparent 70%), linear-gradient(170deg, #9ff0e4, #35b7c0 55%, #1f7f95); }
.play.scene-snow { --scene: radial-gradient(ellipse 60% 40% at 25% 20%, rgba(255,255,255,.9), transparent 70%), radial-gradient(ellipse 50% 40% at 80% 75%, rgba(255,255,255,.8), transparent 70%), radial-gradient(ellipse 70% 30% at 50% 100%, rgba(170,190,220,.7), transparent 70%), linear-gradient(170deg, #f7fbff, #d9e4f4 55%, #b9c9e2); }
.play.scene-fire { --scene: radial-gradient(ellipse 60% 40% at 20% 25%, rgba(255,220,120,.55), transparent 70%), radial-gradient(ellipse 50% 35% at 80% 70%, rgba(140,30,20,.55), transparent 70%), radial-gradient(ellipse 70% 30% at 50% 100%, rgba(90,10,10,.6), transparent 70%), linear-gradient(170deg, #ffb24a, #f0702e 55%, #b5321f); }
.play.scene-crystal { --scene: radial-gradient(ellipse 60% 40% at 20% 20%, rgba(255,255,255,.55), transparent 70%), radial-gradient(ellipse 50% 35% at 85% 65%, rgba(110,50,170,.5), transparent 70%), radial-gradient(ellipse 70% 30% at 50% 100%, rgba(80,30,130,.6), transparent 70%), linear-gradient(170deg, #f3d4ff, #c58ff0 55%, #8650c9); }
.wrap:has(.play[class*="scene-"]) .bar, .wrap:has(.chome) .bar, .wrap:has(.pedia) .bar { background: rgba(255,250,240,.82); border-radius: 14px; padding: 0 6px; margin-bottom: 10px; color: #2B1A3A; }
.wrap:has(.play[class*="scene-"]) .bar .iconbtn, .wrap:has(.chome) .bar .iconbtn, .wrap:has(.pedia) .bar .iconbtn { color: #8E2F4A; }
.wrap:has(.play[class*="scene-"]) .lvtag, .wrap:has(.chome) .lvtag, .wrap:has(.pedia) .lvtag { color: #6E6378; }
.play[class*="scene-"] .streak { background: rgba(255,250,240,.85); color: #2B1A3A; }
.play[class*="scene-"] .streak .lbl { color: #6E6378; }
.play[class*="scene-"] .best, .play[class*="scene-"] .score, .play[class*="scene-"] .hint { color: rgba(255,255,255,.92); text-shadow: 0 1px 3px rgba(0,0,0,.45); }
.play[class*="scene-"] .hint b { color: #fff; }
.play[class*="scene-"] .answer .no { background: rgba(255,240,238,.92); }
.play[class*="scene-"] .answer .yes { background: rgba(235,250,240,.92); }

.card { background: linear-gradient(180deg, #f6f1e2 0%, #ece3cb 45%, #e3d7b8 100%); border: 0; border-radius: 20px; padding: 48px 28px 44px;
  box-shadow: 0 0 0 7px #a7adb6, 0 0 0 9px #e6e9ee, 0 0 0 10px #8e959f, 0 12px 28px rgba(0,0,0,.35); color: #2B1A3A; }
.card::before { background: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,0) 30%, rgba(120,90,40,.08)); mix-blend-mode: normal; }
.card::after { box-shadow: inset 0 0 0 2px rgba(255,255,255,.55), inset 0 0 0 3px rgba(140,120,80,.15); }
.card.under { transform: scale(.94) translateY(12px); opacity: 1; filter: brightness(.96); }
.card .orn { position: absolute; left: 0; right: 0; height: 64px; pointer-events: none; background: center / 240px 64px no-repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 64'%3E%3Cg fill='%23b9ad8c' fill-opacity='.38'%3E%3Cpath d='M163 38 L149 28 L146 36Z'/%3E%3Cpath d='M153 55 L144 40 L138 46Z'/%3E%3Cpath d='M138 73 L134 48 L126 51Z'/%3E%3Cpath d='M120 76 L124 52 L116 52Z'/%3E%3Cpath d='M102 73 L114 51 L106 48Z'/%3E%3Cpath d='M87 55 L102 46 L96 40Z'/%3E%3Cpath d='M77 38 L94 36 L91 28Z'/%3E%3C/g%3E%3Ccircle cx='120' cy='22' r='22' fill='%23b9ad8c' fill-opacity='.3'/%3E%3C/svg%3E"); }
.card .orn.top { top: 0; }
.card .orn.bottom { bottom: 0; transform: scaleY(-1); }
.card .orn .num { position: absolute; left: 50%; top: 22px; transform: translate(-50%, -50%); font: 700 22px/1 system-ui, sans-serif; color: #b9ad8c; }
.card .cstars { top: 72px; }
.card .lat { font-size: clamp(2rem, 11vw, 3rem); margin-top: 10px; white-space: nowrap; overflow-wrap: normal; align-self: stretch; text-align: center; }
.card .rule { width: 72%; height: 2px; background: #2B1A3A; opacity: .8; margin: 14px 0; border-radius: 2px; }
.card .means { display: none; }
.card .en { font-size: clamp(1.25rem, 6vw, 1.6rem); }
.card .kind { bottom: 52px; left: 50%; right: auto; transform: translateX(-50%); color: var(--frame); background: none; padding: 0; }
.card .phrase { position: static; margin: 0 0 auto; padding: 18px 0 70px; font-size: 1.45rem; line-height: 1.3; color: #6E6378; }
/* the example sentence sits under the meaning: the space below it, not above it, takes up the slack */
.card:has(.phrase) .en { margin-bottom: 0; }
.card:has(.phrase) .lat { margin-top: auto; }
.card .frame { display: none; }
.card .stamp { top: 10px; width: 54px; height: 54px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center; font: 900 30px/1 system-ui, sans-serif; color: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.3), inset 0 -3px 0 rgba(0,0,0,.15); }
.card .stamp.yes { right: 10px; background: #43b14b; transform: none; }
.card .stamp.no { left: 10px; background: #d7312b; transform: none; }
.card .badge { position: absolute; top: 10px; width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; font: 900 34px/1 system-ui, sans-serif; color: #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,.35), inset 0 -3px 0 rgba(0,0,0,.15); animation: badgein .28s cubic-bezier(.2,1.6,.4,1); }
.card .badge.ok { right: 10px; background: #43b14b; }
.card .badge.bad { left: 10px; background: #d7312b; }
.card.judged .stamp { display: none; }
.card.judged.ok { box-shadow: 0 0 0 7px #43b14b, 0 0 0 9px #e6e9ee, 0 0 0 10px #2d7a33, 0 12px 28px rgba(0,0,0,.35); }
.card.judged.bad { box-shadow: 0 0 0 7px #d7312b, 0 0 0 9px #e6e9ee, 0 0 0 10px #8a1d19, 0 12px 28px rgba(0,0,0,.35); }
.card.judged .lat, .card.judged .en, .card.judged .rule, .card.judged .kind, .card.judged .phrase, .card.judged .cstars { opacity: .35; }
@keyframes badgein { from { transform: scale(0); } to { transform: scale(1); } }
.card.flipped { background: linear-gradient(180deg, #f6f1e2, #ece3cb); }

.combo { position: absolute; left: 0; right: 0; top: 42%; text-align: center; pointer-events: none; z-index: 5; font: 900 clamp(34px, 11vw, 52px)/1 system-ui, sans-serif; letter-spacing: .02em;
  color: #c04df0; -webkit-text-stroke: 2px #4a1470; paint-order: stroke fill; text-shadow: 0 3px 0 #4a1470, 0 6px 14px rgba(0,0,0,.4); opacity: 0; transform: scale(.4) rotate(-6deg); }
.combo.show { animation: comboin 1.1s ease forwards; }
@keyframes comboin { 0% { opacity: 0; transform: scale(.4) rotate(-6deg); } 18% { opacity: 1; transform: scale(1.15) rotate(3deg); } 30% { transform: scale(1) rotate(-2deg); } 75% { opacity: 1; transform: scale(1) translateY(0); } 100% { opacity: 0; transform: scale(.9) translateY(-30px); } }

.pal { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; text-align: left; background: rgba(255,250,240,.85); color: #2B1A3A; border-radius: 16px; padding: 6px 12px 6px 6px; margin: 8px 0 2px; min-height: 52px; }
.pal:empty { display: none; }
.pal .bpic { width: 44px; height: 44px; border-radius: 50%; background: #fff; object-fit: contain; flex: none; display: grid; place-items: center; font-size: 26px; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.pal .btxt { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.2; }
.pal .btxt b { font-size: .98rem; }
.pal .small { font-size: 12px; color: #6E6378; }
.pal .xp { display: block; height: 7px; border-radius: 4px; background: #e6ddd0; margin: 4px 0 2px; overflow: hidden; }
.pal .xp i { display: block; height: 100%; background: linear-gradient(90deg, #c04df0, #ff7ad0); border-radius: 4px; transition: width .4s; }
.pal.big { padding: 10px 14px 10px 10px; margin-bottom: 14px; }
.pal.big .bpic { width: 64px; height: 64px; }

.card.beast { justify-content: flex-start; padding: 24px 22px 20px; cursor: pointer; }
.card.beast .btitle { font: 900 clamp(28px, 9vw, 40px)/1 system-ui, sans-serif; color: #8a2bd6; -webkit-text-stroke: 1.5px #3b0d6b; paint-order: stroke fill; letter-spacing: .04em; margin: 24px 0 6px; animation: badgein .5s cubic-bezier(.2,1.6,.4,1); }
.card.beast .bstage { position: relative; width: min(62%, 220px); aspect-ratio: 1; margin: 4px auto 10px; display: grid; place-items: center; }
.card.beast .bstage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 8px 10px rgba(0,0,0,.25)); }
.card.beast .glow { position: absolute; inset: -20%; border-radius: 50%; background: radial-gradient(circle, #fff 30%, rgba(255,255,255,.7) 50%, rgba(255,255,255,0) 72%); opacity: 0; pointer-events: none; }
.card.beast.egg .bnew { animation: eggin .7s cubic-bezier(.2,1.5,.4,1); }
.card.beast.grow .bold { animation: oldout 1.6s ease forwards; }
.card.beast.grow .bnew { animation: newin 1.6s ease forwards; }
.card.beast.grow .glow { animation: glow 1.6s ease forwards; }
@keyframes eggin { from { transform: scale(0) rotate(-20deg); } to { transform: scale(1) rotate(0); } }
@keyframes oldout { 0% { opacity: 1; } 45% { opacity: 1; transform: scale(1.05); } 60% { opacity: 0; } 100% { opacity: 0; } }
@keyframes newin { 0% { opacity: 0; transform: scale(.6); } 55% { opacity: 0; transform: scale(.6); } 75% { opacity: 1; transform: scale(1.1); } 100% { opacity: 1; transform: scale(1); } }
@keyframes glow { 0% { opacity: 0; transform: scale(.3); } 45% { opacity: 1; transform: scale(1.1); } 70% { opacity: 1; } 100% { opacity: 0; transform: scale(1.4); } }
.card.beast .ribbon { position: relative; background: linear-gradient(180deg, #e07ad6, #b547b0); color: #fff; font: 700 1.15rem/1 system-ui, sans-serif; padding: 10px 26px; border-radius: 6px; box-shadow: 0 3px 0 #7a2a78, 0 6px 12px rgba(0,0,0,.25); margin-top: 4px; text-shadow: 0 1px 0 #7a2a78; }
.card.beast .ribbon::before, .card.beast .ribbon::after { content: ''; position: absolute; top: 6px; width: 22px; height: 100%; background: #9c3a9a; z-index: -1; }
.card.beast .ribbon::before { left: -14px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 40% 50%); }
.card.beast .ribbon::after { right: -14px; clip-path: polygon(0 0, 100% 0, 60% 50%, 100% 100%, 0 100%); }
.card.beast .belem { font-size: 34px; margin-top: 12px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.25)); }
.card.beast .btap { margin-top: auto; color: #6E6378; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
.trumpets { position: absolute; top: 6%; height: 72%; width: auto; pointer-events: none; z-index: 3; animation: fanfare .7s cubic-bezier(.2,1.4,.4,1); filter: drop-shadow(0 6px 10px rgba(0,0,0,.35)); }
.trumpets.l { left: -8%; transform-origin: left center; }
.trumpets.r { right: -8%; transform-origin: right center; }
@keyframes fanfare { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.pedia { flex: 1; }
.pedia::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse 60% 40% at 20% 20%, rgba(255,255,255,.4), transparent 70%), linear-gradient(170deg, #b8d9d0, #7fb8b0 55%, #4f8f8c); }
/* the Beastpedia: one pill per monster holding its stages (2–4 discs: not every monster has every stage drawn) */
.bgrid { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 20px; justify-content: center; }
.bmon { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 5px 4px; border-radius: 16px; background: rgba(255,255,255,.28); box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.bmon.dim { background: rgba(0,0,0,.06); box-shadow: none; }
.bdiscs { display: flex; gap: 5px; justify-content: center; }
.bdiscs .bc { width: 50px; }
.bmname { font: 700 11px/1 system-ui, sans-serif; color: #2b1a3a; letter-spacing: .02em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bmon.dim .bmname { color: rgba(43,26,58,.45); }
@media (max-width: 360px) { .bdiscs .bc { width: 52px; } }
.bc { aspect-ratio: 1; border-radius: 50%; border: 0; padding: 6px; background: radial-gradient(circle, #fbf6ea, #e6d9c0); box-shadow: 0 2px 6px rgba(0,0,0,.25), inset 0 0 0 3px #c9b7ff; display: grid; place-items: center; }
.bc img { width: 100%; height: 100%; object-fit: contain; }
.bc.unknown { background: radial-gradient(circle, #c9bba6, #a6957b); box-shadow: 0 2px 6px rgba(0,0,0,.2), inset 0 0 0 3px rgba(255,255,255,.3); }
.bc.unknown img { filter: brightness(0) opacity(.3); }
.bc.nudge { animation: shake .4s ease; }
.bsheet { text-align: center; }
.bsheet .bbig { width: min(60vw, 260px); aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 8px 12px rgba(0,0,0,.25)); }
.bsheet .bname { font-size: 1.7rem; font-weight: 700; }
.bsheet .becol { background: var(--chip); border-radius: 14px; padding: 12px 14px; text-align: left; }
.gname.beasts { color: #FFC9F7; }
@media (min-width: 480px) { .bgrid { grid-template-columns: repeat(6, 1fr); } }

/* Sentences: stories read line by line */
.rtitle { text-align: center; margin: 2px 0 8px; }
.rstory { background: var(--chip); border-radius: 14px; padding: 8px 12px; margin-bottom: 8px; font-size: .95rem; line-height: 1.35; }
.rline { display: flex; flex-direction: column; padding: 3px 0; border-bottom: 1px solid var(--line); }
.rline:last-child { border-bottom: 0; }
.rline .rl { font-weight: 700; }
.rline .re { color: var(--muted); font-style: italic; font-size: .88rem; }

/* Passages: speak the English */
.pbox { position: relative; inset: auto; background-color: #F8F0DC; padding: 16px 14px; margin: 6px 0 12px; display: block; text-align: center; min-height: 0; }
.pline { font-size: .95rem; line-height: 1.5; color: var(--muted); padding: 2px 0; }
.pline.past { color: var(--good); }
.pline.ahead { opacity: .55; }
.pline.cur { font-size: clamp(1.35rem, 6.2vw, 1.8rem); font-weight: 700; color: var(--ink); line-height: 1.7; padding: 6px 0; }
.pw { position: relative; display: inline-grid; border: 0; background: none; padding: 0 2px; font: inherit; color: inherit; perspective: 400px; vertical-align: baseline; }
.pw .f, .pw .b { grid-area: 1 / 1; display: inline-block; transition: transform .45s; backface-visibility: hidden; border-radius: 8px; padding: 0 6px; text-align: center; white-space: nowrap; }
.pw .b { transform: rotateX(180deg); background: #FFE066; color: #2B1A3A; }
.pw.flip .f { transform: rotateX(180deg); }
.pw.flip .b { transform: rotateX(0); }
.pen { display: flex; flex-wrap: wrap; gap: 6px 8px; justify-content: center; min-height: 48px; font-size: 1.15rem; margin-bottom: 10px; }
.ew { display: inline-block; min-width: calc(var(--n) * .62em + 14px); height: 1.7em; line-height: 1.7em; padding: 0 7px; border-radius: 9px; background: var(--chip); border-bottom: 3px solid var(--line); text-align: center; transition: background .25s; }
.ew.on { background: var(--good-bg); color: var(--good); border-bottom-color: var(--good); font-weight: 700; animation: pop .35s ease; }
.microw { display: flex; align-items: center; gap: 12px; margin: 6px 0; }
.mic { width: 64px; height: 64px; border-radius: 50%; border: 0; font-size: 30px; background: var(--accent); color: #fff; box-shadow: var(--shadow); flex: none; }
.mic.on { background: #d7312b; animation: micpulse 1.2s ease-in-out infinite; }
.mic:disabled { opacity: .4; }
@keyframes micpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(215,49,43,.5); } 50% { box-shadow: 0 0 0 14px rgba(215,49,43,0); } }
.micside { flex: 1; min-width: 0; }
.heard { font-style: italic; color: var(--muted); min-height: 1.4em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.typerow { display: flex; gap: 8px; margin-top: 6px; }
.typerow input { flex: 1; }
.typerow .btn { width: auto; margin: 0; padding: 10px 16px; }
.gname.pass { color: #C9F0FF; }
.miclog { color: var(--muted); font-size: 11px; line-height: 1.3; word-break: break-word; }

/* Cards & Beasts home: a face-down deck, laid out exactly like the play screen */
.cardback { position: absolute; inset: 0; border-radius: 20px; background: linear-gradient(160deg, #5f6a78, #3c4654 60%, #2d3540); box-shadow: 0 0 0 7px #a7adb6, 0 0 0 9px #e6e9ee, 0 0 0 10px #8e959f, 0 12px 28px rgba(0,0,0,.35); overflow: hidden; cursor: grab; will-change: transform; touch-action: none; user-select: none; -webkit-user-select: none; }
.cardback.b2 { transform: scale(.97) translate(5px, 7px) rotate(2deg); filter: brightness(.9); }
.cardback.b3 { transform: scale(.94) translate(-5px, 14px) rotate(-3deg); filter: brightness(.8); }
.cardback.top { z-index: 2; }
.cardback.anim { transition: transform .25s ease, opacity .25s ease; }
.cardback .orn { position: absolute; left: 0; right: 0; height: 64px; background: center / 240px 64px no-repeat; opacity: .9;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 64'%3E%3Cg fill='%23e6e9ee' fill-opacity='.85'%3E%3Cpath d='M164 29 L148 25 L150 34Z'/%3E%3Cpath d='M152 48 L142 36 L136 41Z'/%3E%3Cpath d='M128 76 L123 52 L116 52Z'/%3E%3Cpath d='M92 76 L104 53 L97 52Z'/%3E%3Cpath d='M89 48 L104 41 L98 36Z'/%3E%3Cpath d='M76 29 L90 34 L92 25Z'/%3E%3C/g%3E%3Ccircle cx='120' cy='22' r='22' fill='%23e6e9ee' fill-opacity='.9'/%3E%3C/svg%3E"); }
.cardback .orn.top { top: 0; } .cardback .orn.bottom { bottom: 0; transform: scaleY(-1); }
.cardback .emblem { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); width: 42%; aspect-ratio: 1; border-radius: 50%; border: 4px solid #e6e9ee; display: grid; place-items: center; font-size: clamp(40px, 12vw, 64px); color: #FFE066; background: rgba(255,255,255,.08); }
.cardback .deckhint { position: absolute; left: 0; right: 0; top: 74%; text-align: center; color: #e6e9ee; font-weight: 700; }
.pediarow .gamebanner { flex: 1; }
.deckcount { text-align: center; color: rgba(255,255,255,.92); text-shadow: 0 1px 3px rgba(0,0,0,.45); margin: 10px 0 0; }
.pal[hidden], .score[hidden] { display: none; }
.play .deck { margin-top: 14px; }

/* gifts */
.bc { position: relative; }
/* duplicates (spares) show as a pile: one or two more discs peeping out behind */
.bc.stack::before, .bc.stack2::after { content: ''; position: absolute; inset: 0; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, #efe6d2, #d6c6a6); box-shadow: 0 2px 5px rgba(0,0,0,.35), inset 0 0 0 3px #b39cf5; transform: translate(7px, -7px); }
.bc.stack2::after { transform: translate(14px, -14px); z-index: -2; background: radial-gradient(circle, #e2d6bd, #c8b693); }
.bc .spare { position: absolute; right: -2px; top: -2px; background: #c04df0; color: #fff; font: 700 12px/1 system-ui, sans-serif; padding: 4px 6px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.giftbox { display: flex; gap: 12px; align-items: center; background: linear-gradient(135deg, #fff3c4, #ffe0f0); border: 2px solid #ffc93c; border-radius: 18px; padding: 12px 14px; margin: 0 0 14px; box-shadow: var(--shadow); color: #2B1A3A; animation: pop .5s ease; }
.giftbox img, .giftbox .gpic { width: 64px; height: 64px; object-fit: contain; flex: none; font-size: 44px; display: grid; place-items: center; }
.giftbox .gtxt { flex: 1; min-width: 0; line-height: 1.3; }
.giftbox .gbtns { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.giftbox .gbtns .btn { width: auto; margin: 0; padding: 8px 18px; min-height: 40px; }
.giftbox .linkbtn { font-size: 13px; color: #8E2F4A; }
.giftcard { position: relative; inset: auto; width: min(70vw, 260px); aspect-ratio: 3 / 4; margin: 0 auto; padding: 16px 14px 10px; cursor: default; }
.giftcard .btitle { margin: 10px 0 4px; font-size: 26px; }
.giftcard .belem { font-size: 26px; margin-top: 6px; }
#pname { text-transform: uppercase; text-align: center; font-weight: 700; letter-spacing: .06em; }

/* Read a book */
.gamebanner.locked { filter: grayscale(.85) brightness(.8); }
.gamebanner .corner { position: absolute; right: 10px; bottom: 10px; background: #2B1A3A; color: #fff; font: 700 13px/1 system-ui, sans-serif; padding: 6px 10px; border-radius: 999px; letter-spacing: .04em; }
.gname.book { color: #FFE7B8; }
.gname.snap { color: #D7FFD0; }
.gname.lib { color: #FFE9C2; }
.snapbtns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.filebtn { display: inline-flex; align-items: center; cursor: pointer; }
#pasted { width: 100%; box-sizing: border-box; font: inherit; font-size: 1rem; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); resize: vertical; margin-top: 10px; }
.snapprog { margin: 14px 0; text-align: center; }
.snapbar { height: 12px; border-radius: 6px; background: var(--chip); overflow: hidden; margin-bottom: 6px; }
.snapbar span { display: block; height: 100%; width: 0; background: var(--good); transition: width .3s; }
.snapbox { text-align: left; font-size: 1.15rem; line-height: 1.9; color: var(--ink); }
.snapbox .pw { font-weight: 700; }
.snapbox .pw .f { background: #FFF1C4; }
.snapbox .pw .b { background: #FFE066; }
.snaps { display: inline; }
.snapbr { display: block; height: 0; }
.snapbr.para { height: .8em; }
.snapbox { font-size: 1.25rem; }
/* Snap a page: the start screen, like a translator app */
.snapstart { max-width: 42rem; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: #fff; padding: calc(4px + env(safe-area-inset-top, 0px)) 0 calc(16px + env(safe-area-inset-bottom)); box-sizing: border-box; }
#pasted { flex: 1; width: 100%; box-sizing: border-box; border: 0; outline: 0; resize: none; background: #fff; color: #111; font: inherit; font-size: 1.6rem; line-height: 1.4; padding: 10px 20px; min-height: 40vh; }
#pasted::placeholder { color: #8a8a8a; }
.snapnote { margin: 0; padding: 0 20px 8px; color: #B23A48; font-size: .95rem; }
.sfoot { display: flex; justify-content: center; align-items: flex-end; gap: 26px; padding: 8px 16px 0; }
.sround { display: flex; flex-direction: column; align-items: center; gap: 8px; border: 0; background: none; color: #333; font: inherit; font-size: .9rem; cursor: pointer; padding: 0; }
.scirc { display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: #E3EEFF; color: #1B4E9B; font-size: 1.6rem; }
.sround.go .scirc { background: #1B4E9B; color: #fff; }
.sround.go[hidden] { display: none; }
.snapprog2 { padding: 10px 20px; } .snapprog2 .small { text-align: center; margin-top: 6px; }
/* the camera screen */
.camscreen { position: fixed; inset: 0; background: #000; z-index: 20; }
.camscreen video, .camscreen .camstill { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camtop { position: absolute; top: env(safe-area-inset-top, 0px); left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; color: #fff; font-weight: 600; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.camback { border: 0; background: none; color: #fff; font-size: 2rem; line-height: 1; width: 44px; height: 44px; }
.camhint { position: absolute; left: 0; right: 0; top: calc(60px + env(safe-area-inset-top, 0px)); text-align: center; color: #fff; font-size: .9rem; text-shadow: 0 1px 4px rgba(0, 0, 0, .7); }
.cambot { position: absolute; left: 0; right: 0; bottom: calc(28px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: center; gap: 48px; }
.camgal { display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 50%; background: rgba(40, 40, 40, .85); color: #fff; cursor: pointer; }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .35); padding: 0; display: flex; align-items: center; justify-content: center; }
.shutter span { display: block; width: 62px; height: 62px; border-radius: 50%; background: #fff; }
.shutter:disabled { opacity: .6; }
.camprog { position: absolute; left: 24px; right: 24px; bottom: calc(130px + env(safe-area-inset-bottom)); color: #fff; text-align: center; font-size: .95rem; text-shadow: 0 1px 4px rgba(0, 0, 0, .7); }
.camprog[hidden] { display: none; }
.camprog .snapbar { background: rgba(255, 255, 255, .3); margin-bottom: 8px; }
/* the reader: white edge to edge, text at book size, every control behind Aa */
html.readermode { background: #fff; }
.reader { max-width: 42rem; margin: 0 auto; padding: calc(4px + env(safe-area-inset-top, 0px)) 0 calc(40px + env(safe-area-inset-bottom)); background: #fff; min-height: 100vh; }
.rhead { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; height: 44px; }
.rhead .iconbtn { color: #777; font-size: .95rem; }
.rpos { font-size: .8rem; color: #999; font-family: system-ui, sans-serif; letter-spacing: .02em; }
.rtool.aa { border: 0; background: none; color: #555; font-size: 1.05rem; min-width: 44px; height: 44px; font-family: Georgia, serif; }
.rtools { display: flex; align-items: center; justify-content: center; gap: 8px; }
.rtool { border: 1.5px solid #ddd; background: #fff; color: #222; border-radius: 10px; min-width: 44px; height: 40px; padding: 0 14px; font-weight: 600; cursor: pointer; }
.rtool.on { background: #222; color: #fff; border-color: #222; }
.rtool.sz1 { font-size: .8rem; } .rtool.sz2 { font-size: 1rem; } .rtool.sz3 { font-size: 1.25rem; }
.rsep { width: 1px; height: 26px; background: #e2e2e2; margin: 0 6px; }
.paper { position: relative; background: #fff; color: #111; padding: 8px 20px 10px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
.paper.serif { font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif; } .paper.sans { font-family: -apple-system, system-ui, 'Helvetica Neue', Arial, sans-serif; }
.paper.size1 { font-size: 1rem; } .paper.size2 { font-size: 1.125rem; } .paper.size3 { font-size: 1.3rem; line-height: 1.6; }
.paper p { margin: 0 0 .9em; } .paper p:last-of-type { margin-bottom: 0; }
.lw { font-weight: 700; border-radius: 3px; cursor: pointer; }
.lw.focus { background: #FFE066; box-shadow: 0 0 0 2px #FFE066; }
.lw.ok { color: #1F7A3A; font-weight: 500; font-style: italic; } .lw.bad { color: #B23A48; font-weight: 500; font-style: italic; text-decoration: underline wavy #B23A48; }
/* the Library: a clean list of books on white */
.libpage { max-width: 42rem; margin: 0 auto; min-height: 100vh; background: #fff; padding: calc(4px + env(safe-area-inset-top, 0px)) 0 calc(30px + env(safe-area-inset-bottom)); }
.libtitle { font-family: 'Iowan Old Style', Palatino, Georgia, serif; font-size: 2rem; font-weight: 700; margin: 6px 20px 12px; color: #111; }
.lbook { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 13px 20px; border-bottom: 1px solid #eee; cursor: pointer; font: inherit; color: #111; }
.lbook:active { background: #f6f6f6; }
.lbook .lt { display: block; font-family: 'Iowan Old Style', Palatino, Georgia, serif; font-size: 1.15rem; font-weight: 600; line-height: 1.25; }
.lbook .la { display: block; font-family: -apple-system, system-ui, sans-serif; font-size: .85rem; color: #777; margin-top: 3px; }
.lbar { display: block; height: 3px; background: #eee; border-radius: 2px; margin-top: 8px; overflow: hidden; } .lbar span { display: block; height: 100%; background: #1B4E9B; }
.lcarry { background: #F3F7FF; border: 0; border-radius: 14px; margin: 0 16px 14px; width: calc(100% - 32px); padding: 14px 16px; }
.lcarry .lk { display: block; font-family: -apple-system, system-ui, sans-serif; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #1B4E9B; margin-bottom: 4px; }
.lshelf { border-top: 1px solid #eee; }
.lopen { display: flex; gap: 8px; padding: 16px 20px 6px; }
.lopen input { flex: 1; min-width: 0; font: inherit; font-family: -apple-system, system-ui, sans-serif; font-size: 1rem; padding: 10px 12px; border: 1.5px solid #ddd; border-radius: 11px; background: #fff; color: #111; }
.lopen .rchoice { flex: none; padding: 6px 18px; }
.lnote { font-family: -apple-system, system-ui, sans-serif; font-size: .85rem; color: #888; padding: 6px 20px; margin: 0; }
.lload { padding: 40px 20px; text-align: center; color: #777; font-family: -apple-system, system-ui, sans-serif; }
.rpic { margin: 1.2em 0; text-align: center; }
.rpic img { display: block; max-width: 100%; max-height: 62vh; width: auto; height: auto; margin: 0 auto; }
.rpic figcaption { font-size: .82em; font-style: italic; color: #666; margin-top: .45em; line-height: 1.35; }
.rdrop { float: left; width: 3.1em; height: auto; margin: .2em .45em 0 0; }
html.rdark .rpic img, html.rdark .rdrop { filter: brightness(.85); } html.rdark .rpic figcaption { color: #999; }
.paper p.rh { text-align: center; font-weight: 700; letter-spacing: .02em; margin: 1.2em 0 .9em; }
html.rdark .libpage, html.rdark .lbook { background: #000; color: #eee; } html.rdark .libtitle { color: #f2f2f2; } html.rdark .lbook { border-bottom-color: #222; } html.rdark .lshelf { border-top-color: #222; }
html.rdark .lcarry { background: #10203A; } html.rdark .lbar { background: #2a2a2a; } html.rdark .lopen input { background: #1C1C1E; color: #eee; border-color: #3a3a3c; }
/* the answer panel: the bottom fifth of the screen; pulled up it shows the text settings */
.rsheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: #fff; border-top: 1px solid #e6e6e6; box-shadow: 0 -6px 20px rgba(0, 0, 0, .07); border-radius: 16px 16px 0 0; padding: 0 14px calc(10px + env(safe-area-inset-bottom)); max-width: 42rem; margin: 0 auto; touch-action: none; }
.rgrip { position: relative; display: flex; align-items: center; justify-content: space-between; height: 34px; cursor: pointer; user-select: none; -webkit-user-select: none; }
.rbar { position: absolute; left: 50%; top: 7px; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: #d0d0d0; }
.rword { font-weight: 700; font-size: 1rem; color: #111; font-family: 'Iowan Old Style', Palatino, Georgia, serif; padding-top: 6px; }
.rhint { font-family: Georgia, serif; font-weight: 700; color: #888; padding-top: 6px; }
.rans { display: grid; grid-template-columns: 1fr; gap: 6px; }
.rchoice { border: 0; background: #F2F2F2; color: #111; border-radius: 11px; min-height: 40px; padding: 6px 14px; font: inherit; font-family: -apple-system, system-ui, sans-serif; font-size: 1rem; font-weight: 500; text-align: left; cursor: pointer; }
.rchoice:active { background: #FFE680; } .rchoice.wrong { background: #FBE3E6; color: #B23A48; } .rchoice.isright { background: #DFF5E6; color: #1F7A3A; }
.rchoice.main { background: #1B4E9B; color: #fff; text-align: center; font-weight: 600; }
.rset { display: none; padding: 14px 0 4px; border-top: 1px solid #eee; margin-top: 10px; }
.rsheet.open .rset { display: block; }
.rrow { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; font-family: -apple-system, system-ui, sans-serif; font-size: .95rem; color: #555; }
.rseg { display: flex; gap: 6px; }
.reader { padding-bottom: calc(190px + env(safe-area-inset-bottom)); }
/* white on black */
html.readermode.rdark, html.rdark .reader, html.rdark .snapstart, html.rdark #pasted { background: #000; }
html.rdark .paper { background: #000; color: #E6E6E6; }
html.rdark #pasted { color: #eee; } html.rdark #pasted::placeholder { color: #777; }
html.rdark .lw.focus { background: #8A6D00; box-shadow: 0 0 0 2px #8A6D00; color: #fff; }
html.rdark .lw.ok { color: #6FD08C; } html.rdark .lw.bad { color: #FF8A98; text-decoration-color: #FF8A98; }
html.rdark .rsheet { background: #1C1C1E; border-top-color: #2c2c2e; }
html.rdark .rword { color: #f2f2f2; } html.rdark .rbar { background: #48484a; }
html.rdark .rchoice { background: #2C2C2E; color: #f2f2f2; } html.rdark .rchoice.wrong { background: #5A1F28; color: #FFB3BD; } html.rdark .rchoice.isright { background: #1E4D2E; color: #B9F0C8; }
html.rdark .rset { border-top-color: #2c2c2e; } html.rdark .rrow { color: #aaa; }
html.rdark .rtool { background: #2C2C2E; color: #eee; border-color: #3a3a3c; } html.rdark .rtool.on { background: #f2f2f2; color: #000; border-color: #f2f2f2; }
html.rdark .rhead .iconbtn, html.rdark .rpos { color: #999; } html.rdark .sround { color: #ddd; } html.rdark .scirc { background: #1C2A40; color: #9CC3FF; }
.reader .rmsg { padding: 0 20px; } .reader .snapbtns { padding: 0 16px; }
.snapzoom { overflow-x: auto; border-radius: 14px; box-shadow: var(--shadow); background: #fff; margin: 6px 0 4px; -webkit-overflow-scrolling: touch; }
.snapphoto { position: relative; width: 100%; }
.snapphoto img { display: block; width: 100%; height: 100%; }
.pw.ph { position: absolute; display: flex; align-items: center; justify-content: center; box-sizing: border-box; padding: 0 .25em; border-radius: .25em; background: rgba(255, 224, 102, .96); color: #2B1A3A; font-weight: 700; font-family: Georgia, 'Times New Roman', serif; line-height: 1; white-space: nowrap; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); z-index: 1; perspective: none; }
.pw.ph.flip { background: transparent; color: transparent; box-shadow: none; outline: 3px solid var(--good); outline-offset: 1px; }
.btn.small { font-size: .95rem; padding: 8px 14px; }
.booktitle { text-align: center; margin: 0 0 6px; line-height: 1.2; }
.booktitle b { display: block; font-size: 1.2rem; }
.pline .ptr { font-size: .8rem; font-style: italic; color: var(--muted); font-weight: 400; }

/* RARE beasts: a metallic holographic card — near-black foil with vivid rainbow patches that drift, a glitter of
   dots in three sizes, a moving sheen and a silver frame; the Beastpedia disc gets a rainbow ring */
.card.beast.rare { background: #07071a; color: #fff;
  box-shadow: 0 0 0 7px #cfd4de, 0 0 0 9px #f4f6fa, 0 0 0 10px #8e959f, 0 12px 28px rgba(0,0,0,.45); overflow: hidden; }
.card.beast.rare::before { background: linear-gradient(115deg, rgba(255,255,255,0) 35%, rgba(255,255,255,.35) 47%, rgba(255,255,255,0) 58%); background-size: 300% 300%; background-repeat: no-repeat; animation: foilsheen 2.8s ease-in-out infinite; mix-blend-mode: screen; z-index: 1; }
.card.beast.rare::after { box-shadow: inset 0 0 0 2px rgba(255,255,255,.5), inset 0 0 0 3px rgba(120,160,255,.25); }
.card.beast.rare .foil, .bsheet.rare .foil { position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background:
    radial-gradient(circle, rgba(255,255,255,.55) 0 1px, transparent 1.8px) 3px 5px / 29px 31px,
    radial-gradient(circle, rgba(255,255,255,.6) 0 1px, transparent 1.8px) 17px 21px / 37px 23px,
    radial-gradient(circle, rgba(255,255,255,.75) 0 1.6px, transparent 2.6px) 9px 14px / 53px 47px,
    radial-gradient(circle, rgba(255,255,255,.9) 0 3.5px, transparent 4.6px) 21px 9px / 97px 83px,
    radial-gradient(circle, rgba(255,255,255,.8) 0 5px, transparent 6.5px) 58px 51px / 173px 151px,
    radial-gradient(ellipse 45% 35% at 22% 18%, #ff5aa5, transparent 70%), radial-gradient(ellipse 40% 40% at 80% 24%, #4ad7ff, transparent 70%),
    radial-gradient(ellipse 45% 38% at 72% 72%, #8f6bff, transparent 70%), radial-gradient(ellipse 38% 34% at 18% 78%, #5bff9a, transparent 70%),
    radial-gradient(ellipse 36% 30% at 50% 48%, #ffb347, transparent 70%), radial-gradient(ellipse 30% 30% at 48% 96%, #f9f871, transparent 70%);
  opacity: .8; mix-blend-mode: screen; animation: foildrift 9s linear infinite; }
/* the sheen is one band on an oversized, non-repeating gradient: a repeating one showed its tile edge as a line
   crossing the card on iPhone */
@keyframes foilsheen { 0% { background-position: 130% 130%; } 100% { background-position: -30% -30%; } }
@keyframes foildrift { 0% { filter: hue-rotate(0deg); } 100% { filter: hue-rotate(360deg); } }
.card.beast.rare > :not(.foil) { z-index: 2; }
.card.beast.rare .btitle { color: #fff; -webkit-text-stroke: 1.5px #2a2550; text-shadow: 0 0 14px rgba(140,200,255,.9); }
.card.beast.rare .rarebadge { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); font: 800 13px/1 system-ui, sans-serif; letter-spacing: .18em; color: #1a1536;
  background: linear-gradient(90deg, #ffe08a, #fff6d0, #ffd56a); padding: 6px 12px; border-radius: 999px; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.card.beast.rare .bstage img { filter: drop-shadow(0 0 18px rgba(170,210,255,.8)) drop-shadow(0 8px 10px rgba(0,0,0,.5)); }
.card.beast.rare .ribbon { background: linear-gradient(180deg, #f4f6fa, #b9c2d0); color: #1a1536; box-shadow: 0 3px 0 #6f7786, 0 6px 12px rgba(0,0,0,.35); }
.card.beast.rare .ribbon::before, .card.beast.rare .ribbon::after { background: #8e959f; }
.card.beast.rare .btap { color: #e4e8f0; text-shadow: 0 1px 3px #000; }
.card.beast.rare .glow { mix-blend-mode: screen; }
.bc.rare { background: radial-gradient(circle, #fbf6ea, #e6d9c0) padding-box, conic-gradient(from 0deg, #ff5aa5, #ffb347, #f9f871, #5bff9a, #4ad7ff, #8f6bff, #ff5aa5) border-box;
  border: 3px solid transparent; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.bc.rare::after { content: '✦'; position: absolute; left: -2px; top: -4px; font-size: 14px; color: #ffd56a; text-shadow: 0 0 4px #000; }
.raretag { color: #b547b0; }

.otherline { display: block; text-align: center; margin: 2px auto 10px; font-size: 14px; color: var(--muted); text-decoration: none; }

/* the Jacques Hammer coin counter ticks up as each coin lands */
.hstage .pcash b.bump { animation: coinbump .35s ease; }
@keyframes coinbump { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* read aloud */
.speakbtn { border: 0; background: var(--chip); color: var(--ink); width: 34px; height: 34px; border-radius: 50%; font-size: 17px; line-height: 34px; padding: 0; cursor: pointer; flex: none; }
.speakbtn.pop { animation: speakpop .3s ease; }
@keyframes speakpop { 50% { transform: scale(1.3); } }
.streakbar .speakbtn { margin-left: 6px; }
.rgrip .speakbtn { position: absolute; right: 38px; top: 2px; width: 30px; height: 30px; line-height: 30px; font-size: 15px; }   /* beside Aa, so the middle of the bar is always the grip itself */
.speakline { display: block; margin: 0 auto 6px; font-size: 14px; color: var(--muted); }
.otherline { display: block; text-align: center; margin: 2px auto 10px; font-size: 14px; color: var(--muted); text-decoration: none; }
.speakbtn.small { display: inline-grid; place-items: center; width: 26px; height: 26px; line-height: 26px; font-size: 13px; vertical-align: middle; margin-left: 8px; }
.memo .lat .speakbtn.small { width: 32px; height: 32px; font-size: 16px; vertical-align: 6px; }

/* the word in its own script (Arabic for Tounsi): smaller, under the Latin-letter word */
.arab { font-family: "Noto Naskh Arabic", "Geeza Pro", "Arabic Typesetting", "Traditional Arabic", system-ui, sans-serif; font-weight: 400; color: var(--muted, #6b5f58); }
.card .arab { font-size: clamp(2.4rem, 12vw, 3.2rem); line-height: 1.25; margin-top: 2px; text-align: center; }
.card:has(.phrase) .arab { margin-top: 0; }
.card .back .arab.small { font-size: 1.1rem; }
.memo .arab { font-size: 1.5rem; line-height: 1.3; margin: -2px 0 2px; }
.words .lat .arab { display: inline-block; margin-left: 8px; font-size: 1.05rem; font-weight: 400; vertical-align: 1px; }
.memo .how.mine { margin-top: 10px; }
.memo .how.mine .linkbtn.small { padding: 0; font-size: .95rem; text-align: left; }
.memo .how.mine textarea { width: 100%; box-sizing: border-box; margin-top: 6px; font: inherit; font-size: 1rem; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); resize: vertical; }
/* the English answer as big as the word, shrunk to one line like the word (both games); a card with an Arabic line keeps room above the word */
.card:has(.arab) .lat { padding-top: 44px; }
.card:has(.arab) .arab { line-height: 1.15; }
.card .en { font-size: clamp(2rem, 11vw, 3rem); font-weight: 700; line-height: 1.1; white-space: nowrap; overflow-wrap: normal; align-self: stretch; text-align: center; }
.lb td.who .emo { font-size: 1.1rem; letter-spacing: 2px; }

/* the Beastpedia sheet of a rare beast: the same holographic foil as its card */
.bsheet.rare { position: relative; background: #07071a; color: #fff; box-shadow: inset 0 0 0 3px #cfd4de, inset 0 0 0 5px #8e959f; }
.bsheet.rare::before { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; background: linear-gradient(115deg, rgba(255,255,255,0) 35%, rgba(255,255,255,.35) 47%, rgba(255,255,255,0) 58%); background-size: 300% 300%; background-repeat: no-repeat; animation: foilsheen 2.8s ease-in-out infinite; mix-blend-mode: screen; z-index: 1; }
.bsheet.rare > :not(.foil) { position: relative; z-index: 2; }
.bsheet.rare .rarebadge { display: table; margin: 2px auto 8px; font: 800 13px/1 system-ui, sans-serif; letter-spacing: .18em; color: #1a1536; background: linear-gradient(90deg, #ffe08a, #fff6d0, #ffd56a); padding: 6px 12px; border-radius: 999px; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.bsheet.rare .bbig { filter: drop-shadow(0 0 18px rgba(170,210,255,.8)) drop-shadow(0 8px 10px rgba(0,0,0,.5)); }
.bsheet.rare .bname { text-shadow: 0 0 14px rgba(140,200,255,.9); }
.bsheet.rare .small { color: #d8dcea; }
.bsheet.rare .raretag { color: #ffe08a; }
.bsheet.rare .becol { background: rgba(255,255,255,.14); color: #fff; }
.bsheet.rare .btn.ghost { color: #fff; border-color: rgba(255,255,255,.55); background: rgba(255,255,255,.08); }


/* a word that is a picture (Learn the notes: a note on a stave) — a pale card, sized for each place */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wpic { display: block; background: #fffdf6; border-radius: 10px; height: auto; }
.card .lat .wpic { width: min(82%, 280px); margin: 0 auto; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.memo .lat .wpic { width: min(70%, 240px); margin: 0 auto 4px; }
.blat .wpic { width: 150px; margin: 0 auto; }
#list .lat .wpic, .lat .wpic { width: 104px; }
.pquiz .qword .wpic { height: 58px; width: auto; margin: 0 auto; }
@media (min-width: 700px) { .pquiz .qword .wpic { height: 66px; } }
