/* Layout: one-screen phone game on a silicone repair mat — header, tabs, score row, square parts tray, parts chain */
/* Fonts are bundled (www/fonts, SIL Open Font License) instead of loaded from Google, so startup doesn't wait on the network. */
@font-face { font-family: "Chakra Petch"; font-weight: 500; font-display: swap; src: url(../fonts/chakra-petch-500.woff2) format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-weight: 600; font-display: swap; src: url(../fonts/chakra-petch-600.woff2) format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-weight: 700; font-display: swap; src: url(../fonts/chakra-petch-700.woff2) format("woff2"); }
@font-face { font-family: "Figtree"; font-weight: 400 700; font-display: swap; src: url(../fonts/figtree.woff2) format("woff2"); }
:root {
  --mat: #0e3836;
  --mat-deep: #092826;
  --tray: #061d1c;
  --slot: rgba(196, 236, 224, 0.06);
  --line: rgba(196, 236, 224, 0.07);
  --line-strong: rgba(196, 236, 224, 0.13);
  --ink: #e8f4ef;
  --muted: #8db3aa;
  --copper: #e38b4f;
  --copper-ink: #2a1205;
  --good: #7fd6a0;
  --panel: rgba(4, 22, 21, 0.62);
  --font-display: "Chakra Petch", "Rajdhani", "Segoe UI", system-ui, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
img { max-width: 100%; }
html, body { height: 100%; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body {
  margin: 0;
  background-color: var(--mat);
  background-image:
    linear-gradient(var(--line-strong) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-strong) 1px, transparent 1px),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-block: 12px 20px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
header { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.brand h1 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 26px; letter-spacing: 0.01em; line-height: 1; }
.brand h1 span { color: var(--copper); }
.brand small { font-family: var(--font-display); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.chips { display: flex; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line-strong);
  font-family: var(--font-display); font-weight: 600; font-size: 14px;
  font-variant-numeric: tabular-nums; position: relative;
}
.coin { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffd2a8, var(--copper) 55%, #a85a28); box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.18); flex: none; }
.chip .lbl { color: var(--muted); font-weight: 500; font-size: 12px; }
.float { position: absolute; right: 8px; top: -6px; color: var(--copper); font-family: var(--font-display); font-weight: 700; font-size: 14px; pointer-events: none; animation: rise .9s ease-out forwards; }
@keyframes rise { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-22px); } }

.tabs { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 12px; padding: 4px; gap: 4px; }
.tabs button {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.02em;
  padding: 9px 2px; border-radius: 9px; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--mat-deep); }
button:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }

.modeline { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); min-height: 18px; flex-wrap: wrap; }
.modeline b { color: var(--ink); font-weight: 600; }
.needs { flex-basis: 100%; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.needs .mk { font-family: var(--font-display); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.need { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line-strong); color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 13px; }
.need i { width: 24px; height: 24px; border-radius: 6px; background: var(--tb); color: var(--tf); display: grid; place-items: center; }
.need i svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.need b { font-variant-numeric: tabular-nums; }
.need.done { border-color: var(--good); }
.need.done b { color: var(--good); }
.clock { font-family: var(--font-display); font-weight: 700; font-size: 24px; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1; }
.clock.low { color: var(--copper); }
#playView[data-mode="jobs"] .board { width: min(100%, 480px, max(250px, calc(100dvh - 372px))); }

.scores { display: flex; gap: 6px; align-items: stretch; }
.scorebox { flex: 1; min-width: 0; display: flex; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 10px; }
.score { flex: 1; min-width: 0; padding: 4px 10px; display: flex; flex-direction: column; justify-content: center; }
.score + .score { border-left: 1px solid var(--line-strong); }
.score .k { font-family: var(--font-display); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score .v { font-family: var(--font-display); font-weight: 700; font-size: 25px; font-variant-numeric: tabular-nums; line-height: 1.05; }
.btn {
  appearance: none; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink);
  font-family: var(--font-display); font-weight: 600; font-size: 14px; letter-spacing: 0.03em;
  border-radius: 10px; padding: 8px 12px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:disabled { opacity: .4; cursor: default; }
/* Pressed buttons shrink a touch, so a tap always shows it landed. */
.btn { transition: transform .08s ease-out; }
.btn:active:not(:disabled) { transform: scale(.95); }
.btn.primary { background: var(--copper); color: var(--copper-ink); border-color: transparent; }
.btn .tag { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; padding: 2px 5px; border-radius: 4px; background: rgba(227,139,79,.18); color: var(--copper); }
.btn.primary .tag { background: rgba(0,0,0,.15); color: var(--copper-ink); }
.side-btns { display: flex; gap: 6px; }
.side-btns .btn { padding: 4px 10px; font-size: 13px; }

.board {
  position: relative;
  width: min(100%, 480px);
  width: min(100%, 480px, max(250px, calc(100dvh - 330px)));
  aspect-ratio: 1; max-width: 100%;
  margin: 0 auto;
  background: var(--tray);
  border-radius: 16px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,.55), 0 1px 0 rgba(255,255,255,.05);
  container-type: size;
  touch-action: none;
  user-select: none;
  --g: 2.6cqw;
  --cs: calc((100cqw - 5 * var(--g)) / 4);
}
/* Swipe surface: the full-width strip the tray sits in, so the empty sides beside it slide parts too
   (easier to reach on wide screens and foldables). It reaches past the page padding to the screen edges. */
.board-zone {
  margin-inline: calc(50% - 50vw);
  padding-inline: calc(50vw - 50%);
  touch-action: none;
  user-select: none;
}
html { overflow-x: clip; }
.slot, .tile { position: absolute; width: var(--cs); height: var(--cs); left: var(--g); top: var(--g); border-radius: 2.6cqw; }
/* Moved with transform rather than left/top: the slide runs on the GPU without re-laying out the page every frame. */
.slot, .tile { transform: translate(calc(var(--c) * (var(--cs) + var(--g))), calc(var(--r) * (var(--cs) + var(--g)))); }
.slot { background: var(--slot); box-shadow: inset 0 1px 3px rgba(0,0,0,.4); }
.tile { transition: transform .11s ease-out; z-index: 2; }
.tile.dead { z-index: 1; }
.face {
  width: 100%; height: 100%; border-radius: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6cqw;
  background: var(--tb); color: var(--tf);
  box-shadow: inset 0 -0.9cqw 0 rgba(0,0,0,.16), inset 0 0.5cqw 0 rgba(255,255,255,.28), 0 0.8cqw 1.6cqw rgba(0,0,0,.35);
}
.face svg { width: 42%; height: 42%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.face .nm { font-family: var(--font-display); font-weight: 700; font-size: 3.7cqw; line-height: 1; letter-spacing: 0.02em; white-space: nowrap; }
.face .vl { font-family: var(--font-display); font-weight: 600; font-size: 2.6cqw; line-height: 1; opacity: .62; font-variant-numeric: tabular-nums; }
.tile.new .face { animation: appear .16s ease-out .08s both; }
.tile.pop .face { animation: pop .18s ease-out .09s; }
@keyframes appear { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.13); } 100% { transform: scale(1); } }
.t11 .face, .t12 .face { box-shadow: inset 0 -0.9cqw 0 rgba(0,0,0,.16), inset 0 0.5cqw 0 rgba(255,255,255,.4), 0 0 4cqw rgba(242,193,78,.55); }

.overlay {
  position: absolute; inset: 0; z-index: 5; border-radius: 16px;
  background: rgba(6, 29, 28, .82); backdrop-filter: blur(3px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; text-align: center;
}
.overlay h2 { margin: 0; font-family: var(--font-display); font-size: 26px; text-wrap: balance; }
.overlay p { margin: 0; color: var(--muted); max-width: 30ch; }
.overlay .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.chain-wrap { overflow-x: auto; scrollbar-width: none; margin-inline: -4px; }
.chain-wrap::-webkit-scrollbar { display: none; }
.chain { display: flex; gap: 6px; padding: 2px 4px; width: max-content; }
.link { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 46px; opacity: .35; }
.link.got { opacity: 1; }
.link i { width: 34px; height: 34px; border-radius: 8px; background: var(--tb); color: var(--tf); display: grid; place-items: center; }
.link i svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.link span { font-size: 10px; color: var(--muted); white-space: nowrap; font-family: var(--font-display); letter-spacing: 0.02em; }
.hint { font-size: 13px; color: var(--muted); text-align: center; margin: 0; }

/* Earn view */
.earn { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line-strong); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.card h3 { margin: 0; font-family: var(--font-display); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.bal { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.bal .num { font-family: var(--font-display); font-weight: 700; font-size: 38px; font-variant-numeric: tabular-nums; line-height: 1; }
.bal .unit { color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.bar > div { height: 100%; background: var(--copper); border-radius: inherit; transition: width .3s; }
.small { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.45; }
.ways { display: flex; flex-direction: column; }
.way { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; border-top: 1px solid var(--line-strong); }
.way:first-child { border-top: 0; padding-top: 2px; }
.way .txt { min-width: 0; }
.way .t { font-weight: 600; }
.way .d { font-size: 13px; color: var(--muted); }
.way .amt { font-family: var(--font-display); font-weight: 700; color: var(--copper); white-space: nowrap; font-variant-numeric: tabular-nums; }
.example { font-size: 10px; font-family: var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); border: 1px dashed var(--muted); border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: 2px; }
.note { border-left: 3px solid var(--copper); padding: 2px 0 2px 12px; }

/* Ad modal */
.modal {
  position: fixed; inset: 0; z-index: 20; background: rgba(2, 12, 12, .88);
  display: flex; align-items: center; justify-content: center;
  padding-block: max(20px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.adbox { width: min(100%, 380px); background: #f3efe6; color: #1d1a14; border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; }
.adtop { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font-size: 12px; font-family: var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; background: #1d1a14; color: #f3efe6; }
.adart { aspect-ratio: 16 / 10; max-width: 100%; display: grid; place-items: center; background: repeating-linear-gradient(135deg, #e5dfd1 0 14px, #ece7db 14px 28px); text-align: center; padding: 16px; }
.adart b { font-family: var(--font-display); font-size: 22px; display: block; }
.adart span { font-size: 13px; color: #5d5647; }
.adfoot { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.adfoot .btn { background: #1d1a14; color: #f3efe6; border-color: transparent; }
.adfoot .btn.primary { background: var(--copper); color: var(--copper-ink); }
.helpbody { padding: 22px 18px 4px; display: flex; flex-direction: column; gap: 6px; text-align: center; }
.helpbody b { font-family: var(--font-display); font-size: 20px; }
.helpbody span { font-size: 13px; color: #5d5647; }
.adfoot .btn:disabled { opacity: 0.45; }
.way .btn { white-space: nowrap; }
.linkbtn { appearance: none; background: none; border: 0; color: #5d5647; font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; padding: 4px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  width: max-content; max-width: calc(100% - 32px);
  background: var(--ink); color: var(--mat-deep); padding: 10px 14px; border-radius: 10px;
  font-weight: 600; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.4); text-align: center;
}
/* Shown from the tap until the ad appears, so a slow ad never looks like the game froze. */
.ad-loading {
  position: fixed; inset: 0; z-index: 25; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(6, 29, 28, .72); color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: 0.03em;
}
.spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--copper); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spin { animation-duration: 2.4s; }
  .btn { transition: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
  .tile.new .face, .tile.pop .face, .float { animation: none; }
}

/* App additions: sign-in, account, status */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-family: var(--font-display); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.field input {
  appearance: none; width: 100%; border: 1px solid var(--line-strong); background: var(--tray); color: var(--ink);
  border-radius: 10px; padding: 11px 12px; font: inherit; font-size: 16px;
}
.field input:focus-visible { outline: 2px solid var(--copper); outline-offset: 1px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form .btn { padding: 11px 12px; font-size: 15px; }
.form-err { color: var(--copper); font-size: 14px; margin: 0; min-height: 0; }
.form-ok { color: var(--good); font-size: 14px; margin: 0; }
.switch { appearance: none; background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; padding: 2px; align-self: center; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 8px; border-radius: 99px; border: 1px solid currentColor; }
.status-pill.pending { color: var(--copper); }
.status-pill.sent { color: var(--good); }
.status-pill.rejected { color: var(--muted); }
.acct { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.acct .em { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.danger { color: #f19a7a; border-color: rgba(241,154,122,.4); }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.guest-chip { color: var(--muted); }
.legal { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.legal a { color: var(--muted); }
.version { color: var(--muted); margin: 0; }

/* Help button */
.help-chip { width: 34px; justify-content: center; padding: 6px 0; font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--ink); cursor: pointer; }

/* First-run guide (same pattern as Void: dots, one idea per step, one big button) */
.intro {
  position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column;
  background-color: var(--mat-deep);
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 24px 24px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 12px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
  animation: ifade .18s ease-out;
}
.intro.leaving { animation: ifadeout .18s ease-in forwards; }
@keyframes ifade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ifadeout { to { opacity: 0; } }
.intro > * { width: 100%; max-width: 480px; margin-inline: auto; }
.itop { display: flex; align-items: center; justify-content: space-between; min-height: 36px; }
.idots { display: flex; gap: 6px; }
.idots span { height: 6px; width: 6px; border-radius: 99px; background: var(--line-strong); transition: width .25s, background .25s; }
.idots span.done { background: var(--muted); }
.idots span.on { width: 24px; background: var(--ink); }
.iskip { appearance: none; background: none; border: 0; color: var(--muted); font: inherit; font-size: 15px; padding: 8px 4px; cursor: pointer; }
.ibody { flex: 1; overflow-y: auto; padding-block: 18px; display: flex; flex-direction: column; gap: 14px; }
.ibody.from-right { animation: islideR .22s ease-out; }
.ibody.from-left { animation: islideL .22s ease-out; }
@keyframes islideR { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes islideL { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
.ibody h2 { margin: 6px 0 0; font-family: var(--font-display); font-size: 32px; line-height: 1.1; text-wrap: balance; }
.ilead { margin: 0; font-size: 17px; line-height: 1.45; color: #c9e3db; }
.inote { margin: 4px 0 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.irow { display: flex; gap: 14px; align-items: flex-start; padding-block: 4px; }
.irow b { display: block; font-size: 16px; }
.irow p { margin: 2px 0 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.ib { flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--tb); color: var(--tf); display: grid; place-items: center;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.16), inset 0 2px 0 rgba(255,255,255,.3); }
.ib svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ichain { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ichain .ib { width: 30px; height: 30px; border-radius: 8px; }
.ichain .ib svg { width: 19px; height: 19px; }
.ichain i { color: var(--muted); font-style: normal; font-size: 14px; }
.imark { position: relative; width: 120px; height: 100px; margin-top: 16px; }
.imark > div { position: absolute; display: grid; place-items: center; border-radius: 22%;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.16), inset 0 3px 0 rgba(255,255,255,.4), 0 5px 12px rgba(0,0,0,.35); }
.imark svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; width: 62%; height: 62%; }
.imark-a { left: 0; top: 14px; width: 58px; height: 58px; background: #b7d5c8; color: #163028; transform: rotate(-10deg); }
.imark-b { left: 40px; top: 32px; width: 66px; height: 66px; background: #f2c14e; color: #2b2000; transform: rotate(6deg); }
.imark .imark-s { position: absolute; left: 82px; top: 0; width: 28px; height: 28px; fill: var(--copper); stroke: none; }

/* Swipe demo: two Screws slide together and become a Chip */
.idemo { position: relative; height: 92px; width: 268px; max-width: 100%; display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; padding: 8px; background: var(--tray); border-radius: 14px; box-shadow: inset 0 2px 8px rgba(0,0,0,.5); align-self: center; margin-block: 6px; }
.islot { border-radius: 14px; background: var(--slot); }
.ip { position: absolute; top: 8px; left: 8px; width: 76px; height: 76px; border-radius: 16px; background: var(--tb); color: var(--tf);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.16), inset 0 2px 0 rgba(255,255,255,.3), 0 3px 8px rgba(0,0,0,.35); }
.ip svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ip span { font-family: var(--font-display); font-weight: 700; font-size: 13px; }
.ip.d-right { animation: dSlide 2.6s ease-in-out infinite; }
.ip.d-left { animation: dHide 2.6s linear infinite; }
.ip.d-made { animation: dMade 2.6s ease-out infinite; }
@keyframes dSlide { 0%, 20% { transform: translateX(176px); opacity: 1; } 45% { transform: translateX(0); opacity: 1; } 46%, 100% { opacity: 0; transform: translateX(0); } }
@keyframes dHide { 0%, 45% { opacity: 1; } 46%, 100% { opacity: 0; } }
@keyframes dMade { 0%, 45% { opacity: 0; transform: scale(.6); } 55% { opacity: 1; transform: scale(1.12); } 62%, 88% { opacity: 1; transform: scale(1); } 100% { opacity: 0; } }
.iswipe { position: absolute; right: 16px; top: -22px; color: var(--copper); font-family: var(--font-display); font-weight: 700; font-size: 22px; animation: dHand 2.6s ease-in-out infinite; }
@keyframes dHand { 0%, 15% { transform: translateX(0); opacity: 0; } 20% { opacity: 1; } 45% { transform: translateX(-160px); opacity: 1; } 55%, 100% { opacity: 0; transform: translateX(-160px); } }

.icoins { background: var(--panel); border: 1px solid var(--line-strong); border-radius: 14px; padding: 14px 16px; }
.icoin-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-family: var(--font-display); font-size: 20px; }
.icoin-row .coin { width: 20px; height: 20px; }
.icoin-row span:not(.coin) { color: var(--muted); }
.icoins p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.ibtns { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; }
.ibig { width: 100%; padding: 15px 16px; font-size: 17px; border-radius: 14px; }
.ilink { appearance: none; background: none; border: 0; color: var(--muted); font: inherit; font-size: 15px; padding: 10px; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .intro, .ibody.from-right, .ibody.from-left { animation: none; }
  .ip.d-right, .ip.d-left, .iswipe { animation: none; opacity: 0; }
  .ip.d-made { animation: none; opacity: 1; }
}

/* ---------------------------------------------------------------- v2: layout helpers */
.play { display: flex; flex-direction: column; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.pane { display: flex; flex-direction: column; gap: 12px; }

/* Earn sub-tabs */
.subtabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; border-bottom: 1px solid var(--line-strong); }
.subtabs button {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  color: var(--muted); font-family: var(--font-display); font-weight: 600; font-size: 14px; letter-spacing: 0.04em;
  padding: 8px 2px 9px; cursor: pointer;
}
.subtabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--copper); }

.notice-card { border-color: rgba(227,139,79,.5); }
.notice-card h3 { color: var(--copper); }
#streakChip.save-me { cursor: pointer; border-color: var(--copper); animation: save-me 1.6s ease-in-out infinite; }
@keyframes save-me { 50% { box-shadow: 0 0 0 3px rgba(227,139,79,.35); } }
@media (prefers-reduced-motion: reduce) { #streakChip.save-me { animation: none; } }

/* Settings toggles */
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 4px; font-weight: 600; cursor: pointer; }
.toggle input { appearance: none; width: 46px; height: 28px; border-radius: 99px; background: rgba(255,255,255,.12); position: relative; cursor: pointer; flex: none; transition: background .15s; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); transition: transform .15s; }
.toggle input:checked { background: var(--copper); }
.toggle input:checked::after { transform: translateX(18px); }
.toggle input:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }
a.btn { text-decoration: none; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: rgba(255,255,255,.03); border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.stat .k { font-family: var(--font-display); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v { font-family: var(--font-display); font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .v.sm { font-size: 14px; line-height: 27px; }

/* Awards */
.awards { display: flex; flex-direction: column; }
.award { display: flex; align-items: center; gap: 12px; padding-block: 10px; border-top: 1px solid var(--line-strong); }
.award:first-child { border-top: 0; padding-top: 2px; }
.aw-ic { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: rgba(255,255,255,.05); color: var(--muted); }
.award.got .aw-ic { background: rgba(227,139,79,.18); color: var(--copper); }
.aw-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.aw-txt span { font-size: 13px; color: var(--muted); }
.award:not(.got) .aw-txt b { color: #b9d3cc; }
.aw-state { font-family: var(--font-display); font-weight: 600; font-size: 12.5px; color: var(--muted); text-align: right; white-space: nowrap; }
.aw-state.ok { color: var(--good); }
.mbar { height: 5px; margin-top: 6px; }

/* Leaderboard */
.ranks-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.seg { display: inline-flex; background: rgba(255,255,255,.05); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { appearance: none; border: 0; background: none; color: var(--muted); font-family: var(--font-display); font-weight: 600; font-size: 13px; padding: 5px 12px; border-radius: 7px; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--ink); color: var(--mat-deep); }
.board-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.board-list li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 6px; border-top: 1px solid var(--line-strong); }
.board-list li:first-child { border-top: 0; }
.board-list li.me { background: rgba(227,139,79,.12); border-radius: 8px; }
.board-list .rk { font-family: var(--font-display); font-weight: 700; color: var(--muted); text-align: center; }
.board-list li:nth-child(-n+3) .rk { color: var(--copper); }
.board-list .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list .sc { font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; }
.board-list li.empty { display: block; color: var(--muted); font-size: 14px; text-align: center; padding: 14px 6px; }
.nick { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.nick-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field select {
  appearance: none; width: 100%; font: inherit; font-size: 15px; color: var(--ink);
  background: var(--tray) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238db3aa' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 28px 10px 10px;
}
.field select:focus-visible { outline: 2px solid var(--copper); outline-offset: 1px; }

/* Merge effects */
.burst { position: absolute; inset: 0; border-radius: inherit; border: 3px solid var(--tb); box-shadow: 0 0 16px var(--tb); pointer-events: none; animation: burst .55s ease-out .08s both; }
.burst.big { border-width: 4px; box-shadow: 0 0 26px var(--tb), 0 0 6px #fff; animation-duration: .75s; }
@keyframes burst { from { transform: scale(.85); opacity: .95; } to { transform: scale(1.55); opacity: 0; } }
.combo {
  position: absolute; left: 50%; top: 46%; z-index: 6; pointer-events: none; white-space: nowrap;
  font-family: var(--font-display); font-weight: 700; font-size: 7.5cqw; color: var(--copper);
  text-shadow: 0 2px 0 rgba(0,0,0,.45), 0 0 18px rgba(0,0,0,.6);
  animation: comboUp .9s ease-out forwards;
}
@keyframes comboUp { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -90%) scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .burst, .combo { animation: none; display: none; }
}

/* Very narrow screens (folded phone front screen) */
@media (max-width: 359px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .subtabs button { font-size: 13px; }
  .nick-pick { grid-template-columns: 1fr; }
}

/* Unfolded foldables and tablets (700px+): tray on the left, info on the right */
@media (min-width: 700px) {
  .app { max-width: 980px; }
  .play {
    display: grid; gap: 14px 18px; align-content: start;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
    grid-template-areas: "board modeline" "board scores" "board chain" "board hint" "board .";
    grid-template-rows: auto auto auto auto 1fr;
  }
  .play .modeline { grid-area: modeline; align-items: flex-start; }
  .play .scores { grid-area: scores; }
  /* Reach from the screen's left edge to the info column. */
  .play .board-zone { --edge: calc(max(0px, (100vw - 980px) / 2) + max(16px, env(safe-area-inset-left, 0px))); grid-area: board; margin-inline: calc(-1 * var(--edge)) 0; padding-inline: var(--edge) 0; }
  .play .board { width: min(100%, 620px, calc(100dvh - 150px)); margin: 0 auto; }
  #playView[data-mode="jobs"] .board { width: min(100%, 620px, calc(100dvh - 150px)); }
  .play .chain-wrap { grid-area: chain; margin: 0; overflow: visible; }
  .play .chain { flex-wrap: wrap; width: auto; }
  .play .hint { grid-area: hint; text-align: left; }
  .earn { max-width: 820px; width: 100%; margin-inline: auto; }
  .earn .stack { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .earn .stack > #confirmCard { grid-column: 1 / -1; }
  #authCard { max-width: 460px; width: 100%; margin-inline: auto; }
}

/* Browser demo: no Ranks tab */
.demo .subtabs { grid-template-columns: repeat(3, 1fr); }

/* Invite friends */
.invite-row { display: flex; align-items: center; gap: 10px; }
.invite-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 0.2em; font-family: var(--font-display); font-weight: 700; }
.invite-code { flex: 1; font-family: var(--font-display); font-weight: 700; font-size: 26px; letter-spacing: 0.22em; color: var(--copper); }

/* Christmas: gently falling snow behind everything, and a festive brand */
#snow { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
#snow i { position: absolute; top: -10px; left: var(--x); width: var(--s); height: var(--s); border-radius: 50%; background: rgba(255,255,255,.55); animation: snowfall var(--d) linear var(--w) infinite; }
@keyframes snowfall { to { transform: translate3d(14px, 105vh, 0); } }
.season-christmas .app { position: relative; z-index: 1; }
.season-christmas .brand h1 span { color: #e8545f; }
.season-christmas .brand h1::after { content: " 🎄"; font-size: 0.8em; }
@media (prefers-reduced-motion: reduce) { #snow { display: none; } }
