:root {
  --ink: #1f2240;
  --muted: #6b6f8e;
  --bg: #fbf7f2;
  --line: #eee3d6;
  --honey: #ffc83d;
  --good: #1fa96b;
  --bad: #e2445c;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2 { font-family: Fredoka, Inter, sans-serif; line-height: 1.1; margin: 0; }

main {
  max-width: 440px; min-height: 100svh; margin: 0 auto;
  padding: 16px 16px max(20px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px;
}

.btn {
  font: 700 18px Fredoka, Inter, sans-serif; letter-spacing: .3px;
  border: 0; border-radius: 16px; padding: 16px; width: 100%;
  background: var(--ink); color: #fff; cursor: pointer;
}
.btn.alt { background: #fff; color: var(--ink); border: 2px solid var(--ink); }
.btn:active { transform: translateY(1px); }

/* ---------- Home ---------- */
.home { justify-content: center; text-align: center; }
.brand { font: 700 16px Fredoka, sans-serif; color: var(--muted); text-decoration: none; }
.brand span { color: var(--honey); }
.home h1 { font-size: 48px; }
.home h1 span { color: var(--honey); }
.home .lead { color: var(--muted); margin: 0 0 12px; line-height: 1.5; }
.chips { display: flex; justify-content: center; gap: 6px; margin: 4px 0 8px; }
.chips i { width: 44px; height: 64px; border-radius: 10px; }
.mode small { display: block; font: 400 13px Inter, sans-serif; opacity: .7; margin-top: 2px; }

/* ---------- Play ---------- */
.hud { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 14px; color: var(--muted); min-height: 24px; }
.hud b { color: var(--ink); font-size: 18px; }
.dots { display: flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #c9c3d8; }
.dots i.now { border-color: var(--ink); }
.dots i.done { background: var(--ink); border-color: var(--ink); }
.ask { font-size: 24px; text-align: center; }
.ask small { display: block; font: 400 14px Inter, sans-serif; color: var(--muted); margin-top: 4px; }
.swatch { flex: 1; min-height: 240px; border-radius: 24px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }

.clock { display: flex; align-items: center; gap: 10px; }
.clock span { font: 700 20px Fredoka, sans-serif; min-width: 24px; text-align: right; }
.timer { flex: 1; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--ink); transform-origin: left; }
.timer.low i { background: var(--bad); }


/* ---------- Reveal / results ---------- */
.score { text-align: center; font: 700 64px Fredoka, sans-serif; line-height: 1; }
.score small { font-size: 24px; color: var(--muted); }
.verdict { text-align: center; font-weight: 600; color: var(--muted); }
.verdict.pass { color: var(--good); }
.verdict.fail { color: var(--bad); }
.pair { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-height: 200px; }
.pair div { border-radius: 20px; padding: 14px; display: flex; flex-direction: column; justify-content: space-between; font-size: 14px; }
.pair code { font-size: 13px; opacity: .85; }
.list { display: grid; gap: 8px; }
.list .row { display: grid; grid-template-columns: 1fr 1fr 56px; gap: 6px; align-items: center; }
.list .row i { height: 40px; border-radius: 10px; }
.list .row.head { font-size: 13px; color: var(--muted); font-weight: 600; }
.list .row b { text-align: right; font-family: Fredoka, sans-serif; font-size: 20px; }
.big { text-align: center; }
.big .lvl { font: 700 96px Fredoka, sans-serif; line-height: 1; }
.big p { margin: 6px 0 0; color: var(--muted); }
.stack { display: grid; gap: 10px; margin-top: auto; }
.toast { text-align: center; color: var(--good); font-size: 14px; min-height: 18px; }

/* ---------- Absolute Color additions ---------- */
.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: -4px; }
.top .name { font: 700 16px Fredoka, sans-serif; color: var(--muted); }
.top .name b { color: var(--honey); }
.top .dbl { margin-left: auto; margin-right: 10px; font: 700 14px Fredoka, sans-serif; color: var(--ink); text-decoration: none; }
.top .dbl b { color: var(--honey); }
.lang { position: relative; border: 1.5px solid var(--ink); border-radius: 999px; padding: 4px 12px; font: 600 13px Inter, sans-serif; cursor: pointer; }
.lang select { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 16px; }
.lang:has(select:disabled) { opacity: .35; }
.home { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; text-align: center; }
.btn.ghost { background: transparent; color: var(--ink); font-size: 16px; padding: 10px; }

.list .row { grid-template-columns: 64px 1fr auto 44px; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.list .row.head { display: block; border-bottom: 2px solid var(--ink); padding: 0 0 6px; }
.sw2 { display: flex; }
.sw2 i { flex: 1; height: 40px; border: 2px solid var(--ink); }
.sw2 i:first-child { border-radius: 10px 0 0 10px; }
.sw2 i:last-child { border-radius: 0 10px 10px 0; border-left: 0; }
.codes { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.off { font-size: 12px; color: var(--muted); text-align: right; }
.list .row b.hi { color: var(--good); }
.list .row b.mid { color: #d98b00; }
.list .row b.lo { color: var(--bad); }
.card { width: 100%; border-radius: 16px; border: 1px solid var(--line); background: #fff; }
.card:not([src]) { display: none; }
.share { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.x { background: #000; }
.btn.ig { background: linear-gradient(45deg, #f9a03f, #e1306c 50%, #833ab4); }
.lbbox { text-align: center; border: 2px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 8px; justify-items: center; }
.lbbox:empty { display: none; }
.lbbox h3 { font-family: Fredoka, sans-serif; margin: 0; }
.lbbox p { margin: 0; color: var(--muted); font-size: 14px; }
.lbbox .rank { font: 700 22px Fredoka, sans-serif; color: var(--ink); }
.lbbox .err { color: var(--bad); }
.gbtn { min-height: 44px; width: 100%; display: flex; justify-content: center; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; border: 2px solid var(--ink); border-radius: 14px; overflow: hidden; }
.tabs button { font: 700 16px Fredoka, sans-serif; border: 0; padding: 10px; background: #fff; color: var(--ink); cursor: pointer; }
.tabs button.on { background: var(--ink); color: #fff; }
.mine { text-align: center; font-weight: 600; margin: 0; }
.board10 p { text-align: center; color: var(--muted); }
:lang(zh-Hant) body { font-family: Inter, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif; }
:lang(ja) body { font-family: Inter, "Hiragino Sans", "Noto Sans JP", "Yu Gothic", system-ui, sans-serif; }
:lang(ko) body { font-family: Inter, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif; }
.home .privacy { font-size: 12px; color: var(--muted); }
.lbrow { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.lbrow i { font: 700 15px Fredoka, sans-serif; color: var(--muted); font-style: normal; }
.lbrow:nth-child(1) i { color: #d4a017; } .lbrow:nth-child(2) i { color: #8e9aa6; } .lbrow:nth-child(3) i { color: #b5703c; }
.lbrow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbrow b { font-family: Fredoka, sans-serif; }
.lbrow.you { background: #fff3cf; border-radius: 10px; }
.lbrow em { font-style: normal; font-size: 11px; background: var(--honey); color: var(--ink); border-radius: 99px; padding: 1px 7px; margin-left: 4px; }
.lbgap { text-align: center; color: var(--muted); padding: 2px 0; }
.lbbox .board10 { width: 100%; }
.mebox { width: 100%; display: grid; gap: 8px; justify-items: center; }
.mebox:empty { display: none; }
.promo { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 18px; text-decoration: none; color: var(--ink); background: linear-gradient(135deg, #fff3e4, #ffe2bd); border: 2px solid #ffcf8f; margin-top: 6px; }
.promo img { width: 64px; height: 64px; border-radius: 16px; flex: none; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.promo b { display: block; font: 700 17px/1.25 Fredoka, Inter, sans-serif; }
.promo small { display: block; margin-top: 4px; font-weight: 600; color: #d9771f; }
.more { text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); }

/* ---------- Cut a Steak ---------- */
:root { --steak: #c0392b; }
.top .name b, .home h1 span { color: var(--steak); }
.home h1 { font-size: 46px; }
canvas.mini { width: 100%; max-width: 340px; height: 170px; margin: 0 auto; display: block; }
.emoji { font-size: 64px; }
.ticket { align-self: center; background: #fff; border: 2px dashed #c9bba6; border-radius: 12px; padding: 10px 22px; text-align: center; box-shadow: 0 3px 10px rgba(0,0,0,.06); transform: rotate(-1.5deg); }
.ticket span { display: block; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .5px; }
.ticket b { display: block; font: 700 34px Fredoka, Inter, sans-serif; color: var(--steak); }
.ticket small { display: block; font-size: 13px; color: var(--muted); }
.ticket.small { padding: 4px 16px; transform: none; }
.ticket.small b { font-size: 24px; }
.boardwrap { position: relative; display: flex; }
canvas.board { width: 100%; height: 250px; touch-action: none; cursor: crosshair; }
.tag { position: absolute; left: 14px; top: 12px; background: #fffdf8; border: 1.5px solid #8a5a2b; border-radius: 6px 12px 12px 6px; padding: 3px 10px 3px 14px; font-size: 13px; font-weight: 600; color: #5a3a1a; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.tag::before { content: ''; position: absolute; left: 4px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: #8a5a2b; }
.scale { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 8px; text-align: center; }
.scale div { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px 4px; }
.scale div.got { background: #1f2240; color: #fff; border-color: #1f2240; }
.scale span { display: block; font-size: 12px; color: var(--muted); }
.scale div.got span { color: #c9c3d8; }
.scale b { font: 700 24px Fredoka, Inter, sans-serif; }
.scale .okc { color: var(--good); } .scale .offc { color: var(--steak); }
.list .row.cs { grid-template-columns: 70px 1fr auto 44px; }
.list .row.cs .ord { font: 700 18px Fredoka, Inter, sans-serif; text-align: left; color: var(--ink); }
.hint { text-align: center; font-weight: 600; color: var(--muted); margin: 0; }
