/* Toy box design system (rewritten 2026-12-04). Own code. Sits on top of hub.css and uses its colour variables.
   Tokens: radius 10/14/20/28, elevation 1-3, motion 150/260/450ms on one easing curve, spacing on a 4px grid.
   Every target is at least 48px; nothing moves for people who ask their device for reduced motion. */
:root{
  --t-r1:10px; --t-r2:14px; --t-r3:20px; --t-r4:28px;
  --t-e1:0 1px 2px rgba(31,42,39,.08),0 1px 1px rgba(31,42,39,.04);
  --t-e2:0 1px 2px rgba(31,42,39,.06),0 6px 16px -6px rgba(31,42,39,.28);
  --t-e3:0 2px 6px rgba(31,42,39,.08),0 22px 44px -18px rgba(31,42,39,.45);
  --t-ease:cubic-bezier(.2,.8,.2,1); --t-fast:150ms; --t-med:260ms; --t-slow:450ms;
  --t-gold:#e9b44c; --t-gold-2:#c98f1c; --t-ok:#1d7a46; --t-no:#b3261e;
  --t-felt:#1b5a43; --t-felt-2:#123f2f; --t-wood:#7a5230; --t-wood-2:#5a3a1f;
}

/* ---------- page parts ---------- */
.panel{padding:16px 18px}
.howto{display:flex;gap:12px;align-items:flex-start;color:var(--ink);font-size:.84em;line-height:1.45;margin:0;
  background:var(--tint);border-radius:var(--t-r2);padding:12px 14px}
.howto::before{content:"";flex:none;width:6px;align-self:stretch;border-radius:3px;background:var(--brand);opacity:.5}
.howto b{font-weight:700}
body.rf-contrast .howto{border:2px solid var(--line)}

/* segmented control: the chosen side is raised like a key */
.seg{display:flex;gap:4px;margin:12px 0 0;padding:4px;background:var(--tint);border-radius:18px;border:1px solid var(--line)}
.seg .btn{flex:1 1 0;min-height:52px;border:0;background:transparent;color:var(--muted);border-radius:14px;font-size:.84em;line-height:1.2;padding:8px 10px;box-shadow:none}
.seg .btn[aria-pressed=true]{background:var(--card);color:var(--brand);box-shadow:var(--t-e2)}
body.rf-contrast .seg .btn[aria-pressed=true]{background:var(--accent);color:#000}

/* buttons: one family everywhere, each with an icon in front */
.toolbar{display:grid;grid-template-columns:repeat(auto-fit,minmax(8.4em,1fr));gap:10px;margin:14px 0 6px}
.toolbar .btn{min-height:56px;box-shadow:var(--t-e1);border-color:var(--line)}
.btn{transition:background var(--t-fast),border-color var(--t-fast),box-shadow var(--t-fast),transform var(--t-fast) var(--t-ease)}
.btn:active{transform:scale(.97)}
.btn:disabled{opacity:.45;cursor:default;transform:none}
.btn .bi{width:22px;height:22px;flex:none;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.btn.primary{box-shadow:0 1px 0 rgba(255,255,255,.18) inset,0 8px 18px -10px rgba(22,63,52,.8)}

/* score and player chips */
.chips{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0 0}
.chip{display:inline-flex;align-items:center;gap:8px;background:var(--card);border:1px solid var(--line);border-radius:999px;padding:6px 14px 6px 7px;font-weight:700;font-size:.82em;font-variant-numeric:tabular-nums;box-shadow:var(--t-e1);transition:box-shadow var(--t-med),border-color var(--t-med)}
.chip .pip{width:24px;height:24px;border-radius:50%;flex:none;box-shadow:inset 0 -3px 0 rgba(0,0,0,.25),inset 0 2px 2px rgba(255,255,255,.35)}
.chip.on{border-color:var(--brand);box-shadow:0 0 0 3px color-mix(in srgb,var(--brand) 20%,transparent)}

/* status line under the board */
.status{display:flex;align-items:center;gap:12px;font-weight:650;margin:12px 0;min-height:56px;padding:10px 16px;
  background:var(--card);border:1px solid var(--line);border-radius:var(--t-r2);box-shadow:var(--t-e1);line-height:1.35}
.status::before{content:"";flex:none;width:10px;height:10px;border-radius:50%;background:var(--brand);box-shadow:0 0 0 5px color-mix(in srgb,var(--brand) 16%,transparent)}
.status:empty{visibility:hidden}
.status.win,.win{background:linear-gradient(135deg,#fff7e0,#fdeec4);border:1.5px solid var(--t-gold);color:#4a3507;font-size:1.05em;
  box-shadow:0 12px 30px -14px rgba(201,143,28,.8);animation:t-pop var(--t-slow) var(--t-ease)}
.status.win::before{content:"\2605";width:36px;height:36px;display:grid;place-items:center;background:var(--t-gold);color:#fff;font-size:20px;box-shadow:0 0 0 5px rgba(233,180,76,.25)}
body.rf-contrast .status{border:2px solid var(--line)}
body.rf-contrast .status.win{background:#000;color:#ffd166;border-color:#ffd166}
@keyframes t-pop{0%{transform:scale(.96);opacity:.4}60%{transform:scale(1.02)}100%{transform:none;opacity:1}}

/* the table every board sits on */
.board-wrap{margin:8px auto;max-width:640px;touch-action:manipulation;-webkit-user-select:none;user-select:none}
.toyico svg{width:30px;height:30px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* ---------- celebration ---------- */
.t-confetti{position:fixed;inset:0;pointer-events:none;z-index:60;overflow:hidden}
.t-confetti i{position:absolute;top:-16px;width:10px;height:14px;border-radius:2px;animation:t-fall 2.4s cubic-bezier(.25,.6,.35,1) forwards}
@keyframes t-fall{to{transform:translate(var(--dx),110vh) rotate(var(--rot));opacity:.9}}

/* ---------- Tilly, the helper tortoise ---------- */
.tilly{position:fixed;right:14px;bottom:calc(86px + env(safe-area-inset-bottom));z-index:30;display:flex;flex-direction:column;align-items:flex-end;gap:10px;pointer-events:none;max-width:calc(100vw - 28px)}
.tilly > *{pointer-events:auto}
.tilly-btn{width:72px;height:72px;border-radius:50%;border:0;padding:0;cursor:pointer;background:radial-gradient(circle at 35% 30%,#fffdf9,#f1e6d2);
  box-shadow:0 0 0 3px #fffdf9,0 0 0 4.5px #e2d6c2,var(--t-e3);display:grid;place-items:center;overflow:hidden;transition:transform var(--t-med) var(--t-ease)}
.tilly-btn:active{transform:scale(.94)}
.tilly-btn svg{width:60px;height:60px;margin-top:2px}
.tilly.talking .tilly-btn svg{animation:t-bob 2.4s ease-in-out infinite}
@keyframes t-bob{50%{transform:translateY(-3px) rotate(-3deg)}}
.tilly-say{width:min(340px,calc(100vw - 28px));background:var(--card);color:var(--ink);border:1px solid var(--line);border-radius:22px 22px 8px 22px;
  padding:16px 16px 14px;box-shadow:var(--t-e3);font-size:.9em;line-height:1.45;transform-origin:100% 100%;animation:t-in var(--t-med) var(--t-ease)}
.tilly-say[hidden]{display:none}
.tilly-name{font-size:.7em;font-weight:800;letter-spacing:.1em;text-transform:uppercase;color:var(--brand);margin:0 0 4px}
.tilly-text{margin:0 0 12px;font-weight:500}
.tilly-text b{font-weight:700}
.tilly-row{display:flex;gap:8px}
.tilly-row .btn{min-height:52px;font-size:.84em;flex:1 1 auto;padding:8px 14px}
.tilly-row .btn.quiet{flex:0 1 auto;background:transparent;border-color:transparent;color:var(--muted);box-shadow:none}
.tilly.cheer .tilly-say{border-color:var(--t-gold);background:linear-gradient(160deg,#fffdf6,#fff2cf)}
@keyframes t-in{from{opacity:0;transform:translateY(8px) scale(.94)}to{opacity:1;transform:none}}
body.rf-contrast .tilly-btn{background:#000;box-shadow:0 0 0 3px #ffd166}
body.rf-contrast .tilly-say,body.rf-contrast .tilly.cheer .tilly-say{background:#000;border:2px solid #ffd166}
.tilly-back{margin:14px auto 0;display:flex;width:fit-content}
/* leave room at the bottom so Tilly never sits on the last buttons */
body.has-tilly .wrap{padding-bottom:calc(190px + env(safe-area-inset-bottom))}
@media (min-width:900px){ .tilly{right:24px;bottom:24px} body.has-tilly .wrap{padding-bottom:124px} }
@media print{ .tilly,.t-confetti{display:none} }

@media (max-width:520px){
  .panel{padding:14px}
  .howto{font-size:.8em;padding:10px 12px}
  .toolbar{grid-template-columns:repeat(auto-fit,minmax(96px,1fr));gap:8px}
  .toolbar .btn{font-size:.82em;padding:8px 8px;flex-direction:column;gap:4px;line-height:1.15;min-height:64px}
  .status{font-size:.9em}
  .tilly-btn{width:64px;height:64px}
  .tilly-btn svg{width:54px;height:54px}
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation:none!important}
  .t-confetti{display:none}
}
