/* Dominoes: a painted café table. Petrol enamel, bone tiles, brass pins, marigold for "your move". */
:root {
  --table: #12454a;
  --table-hi: #17535a;
  --rail: #0b3236;
  --rail-2: #0e3a3e;
  --bone: #f3ebdd;
  --bone-edge: #d6c6a8;
  --bone-line: #b7a585;
  --ink: #1c1b18;
  --marigold: #f2b134;
  --marigold-deep: #d9951a;
  --alert: #e8604c;
  --text: #eaf2ef;
  --muted: #a9c6c1;
  --line: rgba(234, 242, 239, 0.14);
  --brass: #c9a24a;
  --brass-dark: #8e6e26;
  --p1: #2b67c8; --p2: #1e8a4c; --p3: #c2362b; --p4: #7a3ca0; --p5: #a86400; --p6: #0e7c86;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bar-h: 52px;
  --radius-s: 8px;
  --radius-m: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--table);
  background-image: radial-gradient(120% 80% at 50% 0%, var(--table-hi), var(--table) 60%, #0f3d42);
  background-attachment: fixed;
  font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.15; margin: 0; font-weight: 750; letter-spacing: -0.01em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.06rem; }
p { margin: 0; }
.note { color: var(--muted); font-size: 0.94rem; }
.lede { font-size: 1.06rem; max-width: 34em; }
:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--bone); color: var(--ink); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
.noscript { padding: 24px; }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 4px;
  background: var(--rail);
  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
}
.bar-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; padding-left: 6px; }
.brand { font-weight: 800; font-size: 1.12rem; letter-spacing: -0.01em; }
.bar-sub { color: var(--muted); font-size: 0.94rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: inline-grid; place-items: center;
  background: none; border: 0; border-radius: 10px; cursor: pointer; color: var(--text);
  font-size: 1.4rem; line-height: 1;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.07); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.small { width: 36px; height: 36px; font-size: 1.3rem; color: var(--muted); }

/* ---------- buttons and fields ---------- */
.btn {
  min-height: 44px; padding: 10px 18px;
  border-radius: 999px; border: 0; cursor: pointer;
  font-weight: 700; letter-spacing: 0.005em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary { background: var(--marigold); color: var(--ink); box-shadow: 0 2px 0 var(--marigold-deep); }
.btn-primary:hover { background: #f6c056; }
.btn-primary:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--marigold-deep); }
.btn-quiet { background: transparent; color: inherit; box-shadow: inset 0 0 0 1.5px currentColor; }
.btn-quiet:hover { background: rgba(255, 255, 255, 0.06); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
input:not([type=radio]):not([type=checkbox]), select {
  min-height: 44px; padding: 8px 12px; border-radius: var(--radius-s);
  border: 1.5px solid var(--line); background: var(--rail-2); color: var(--text); width: 100%;
}
input::placeholder { color: #7fa39e; }
select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.opt { display: grid; gap: 6px; font-weight: 650; border: 0; margin: 0; padding: 0; min-width: 0; }
.opt legend { padding: 0; margin-bottom: 6px; }
.inline { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; }
.inline select { width: auto; }
.hint { color: var(--muted); font-size: 0.9rem; font-weight: 400; }
.error { color: #ffb4a6; font-weight: 650; margin-top: 14px; }

.seg { display: inline-flex; background: var(--rail-2); border-radius: 999px; padding: 4px; gap: 2px; border: 1.5px solid var(--line); width: max-content; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; padding: 7px 18px; border-radius: 999px; font-weight: 700; }
.seg input:checked + span { background: var(--bone); color: var(--ink); }
.seg input:focus-visible + span { outline: 3px solid var(--marigold); outline-offset: 1px; }

.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 650; cursor: pointer; }
.switch input { width: 22px; height: 22px; accent-color: var(--marigold-deep); }

/* ---------- page screens ---------- */
main { outline: none; }
.screen { padding: 24px max(16px, env(safe-area-inset-left)) 48px; }
#home, .panel { max-width: 680px; margin: 0 auto; }
.panel { display: grid; gap: 22px; }
.hero { display: grid; gap: 14px; padding: 8px 0 28px; }
.hero-chain { width: 100%; max-width: 560px; height: auto; aspect-ratio: 10 / 2.6; overflow: visible; }
.hero h1 { font-size: clamp(3rem, 12vw, 5.4rem); font-weight: 800; letter-spacing: -0.035em; line-height: 0.95; }
.resume { display: grid; gap: 8px; justify-items: start; margin-bottom: 26px; }
.modes { display: grid; border-top: 1px solid var(--line); }
.mode {
  display: grid; gap: 4px; text-align: left;
  padding: 20px 8px 20px 0; background: none; border: 0; border-bottom: 1px solid var(--line);
  cursor: pointer; position: relative;
}
.mode::after {
  content: ""; position: absolute; right: 6px; top: 50%; width: 12px; height: 24px; margin-top: -12px;
  border-radius: 3px; background: var(--bone); box-shadow: inset 0 0 0 1.5px var(--bone-edge);
  opacity: 0; transform: translateX(-6px); transition: opacity 0.15s, transform 0.15s;
}
.mode:hover::after, .mode:focus-visible::after { opacity: 1; transform: none; }
.mode-name { font-size: 1.45rem; font-weight: 750; letter-spacing: -0.01em; }
.mode-desc { color: var(--muted); max-width: 34em; padding-right: 30px; }
.mode:disabled { cursor: not-allowed; }
.mode:disabled .mode-name { color: var(--muted); }

.seats-fs { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.seats-fs legend { font-weight: 650; margin-bottom: 8px; padding: 0; }
.seat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.seat { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 0.9fr) 36px; gap: 8px; align-items: center; }
.seat-num { width: 24px; height: 40px; border-radius: 5px; background: var(--bone); color: var(--ink); display: grid; place-items: center; font-weight: 800; font-size: 0.9rem; }
.seat-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); font-size: 0.86rem; font-weight: 650; color: var(--muted); }
.seat-tag.you { background: var(--bone); color: var(--ink); }
.seat-tag.away { background: rgba(232, 96, 76, 0.2); color: #ffc2b7; }
.lobby-seats .seat { grid-template-columns: 28px minmax(0, 1fr) auto minmax(0, 150px) 36px; min-height: 48px; }
.lobby-seats .seat-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-seats .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.seat.empty .seat-num { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--muted); }
.seat.empty .seat-name { color: var(--muted); font-weight: 500; }
.host-only { display: grid; gap: 22px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; align-items: start; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.form-actions .btn-primary { min-width: 160px; }

.online-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.oncard { display: grid; gap: 10px; align-content: start; padding: 18px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 640px) {
  .online-grid { border-top: 0; gap: 28px; }
  .oncard { border-bottom: 0; padding: 0; }
  .oncard + .oncard { border-left: 1px solid var(--line); padding-left: 28px; }
}
.code-input { font-size: 1.5rem !important; letter-spacing: 0.3em; text-transform: uppercase; font-weight: 800; }

.code-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.code-tiles { display: flex; gap: 6px; }
.code-chip {
  width: 40px; height: 54px; display: grid; place-items: center;
  background: var(--bone); color: var(--ink); border-radius: 7px;
  box-shadow: inset 0 0 0 1.5px var(--bone-edge), 0 3px 0 rgba(0, 0, 0, 0.25);
  font-size: 1.6rem; font-weight: 800;
}
.code-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- the table ---------- */
body[data-screen="table"] .screen#table { padding: 0; }
body[data-screen="table"] { overflow: hidden; }
.table-wrap {
  height: calc(100dvh - var(--bar-h) - env(safe-area-inset-top));
  display: grid; grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 1000px) {
  .table-wrap { grid-template-columns: minmax(0, 1fr) 300px; }
}
.play-area {
  min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto;
  padding: 10px max(10px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom));
  gap: 8px;
}
.players { list-style: none; margin: 0; padding: 2px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.players::-webkit-scrollbar { display: none; }
.player {
  flex: 1 0 auto; min-width: 128px; max-width: 260px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name score" "tiles clock" "sub sub";
  column-gap: 10px; row-gap: 2px; padding: 8px 12px;
  border-radius: var(--radius-m); background: rgba(11, 50, 54, 0.7);
  box-shadow: inset 0 0 0 1.5px transparent;
  transition: box-shadow 0.2s;
}
.player.turn { box-shadow: inset 0 0 0 2px var(--marigold); background: rgba(11, 50, 54, 0.95); }
.player.away { opacity: 0.7; }
.p-name { grid-area: name; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-you { margin-left: 6px; font-size: 0.78rem; font-weight: 700; color: var(--ink); background: var(--bone); padding: 1px 7px; border-radius: 999px; vertical-align: 2px; }
.p-score { grid-area: score; font-weight: 800; font-size: 1.2rem; text-align: right; }
.p-tiles { grid-area: tiles; display: flex; align-items: center; gap: 6px; min-height: 22px; }
.backs { display: flex; gap: 2px; }
.backs .tile-svg { width: 9px; height: 18px; }
.p-count { color: var(--muted); font-size: 0.86rem; }
.p-sub { grid-area: sub; color: var(--muted); font-size: 0.8rem; }
.p-clock { grid-area: clock; justify-self: end; font-weight: 750; color: var(--marigold); font-size: 0.92rem; }
.p-clock.low { color: #ffb4a6; }
@media (max-width: 640px) {
  .players { gap: 6px; }
  .player { flex: 1 1 0; min-width: 0; padding: 6px 9px; border-radius: 11px; grid-template-areas: "name score" "tiles clock"; }
  .p-sub { display: none; }
  .p-name { font-size: 0.94rem; }
  .p-score { font-size: 1.05rem; }
  .backs .tile-svg:not(:first-child) { display: none; }
  .p-you { display: none; }
  .player.me .p-name { text-decoration: underline 2px var(--bone); text-underline-offset: 4px; }
}

.board {
  position: relative; min-height: 160px;
  border-radius: 22px;
  background: radial-gradient(90% 90% at 50% 45%, rgba(255, 255, 255, 0.05), transparent 70%), var(--table);
  box-shadow: inset 0 0 0 6px var(--rail-2), inset 0 0 0 7px rgba(0, 0, 0, 0.25), inset 0 10px 30px rgba(0, 0, 0, 0.25);
}
.board svg { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); overflow: visible; }
.board-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); pointer-events: none; font-size: 1rem; }
.bone { position: absolute; left: 18px; bottom: 12px; font-size: 0.82rem; color: var(--muted); pointer-events: none; }

.status { text-align: center; min-height: 1.5em; font-weight: 600; padding: 0 8px; }
.status.mine { color: var(--marigold); }

.hand-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px; }
.hand { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; min-height: 88px; align-items: flex-end; max-width: 100%; }
.hand-note { color: var(--muted); align-self: center; }
.htile {
  --tw: 46px;
  width: var(--tw); height: calc(var(--tw) * 2); padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 8px; position: relative;
  transition: transform 0.14s ease, opacity 0.14s;
  touch-action: manipulation;
}
.htile .tile-svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.28)); }
.htile.ok { transform: translateY(-6px); }
.htile.ok::after { content: ""; position: absolute; left: 20%; right: 20%; bottom: -10px; height: 3px; border-radius: 3px; background: var(--marigold); }
.htile.ok:hover { transform: translateY(-9px); }
.htile.dim { opacity: 0.5; }
.htile.sel { transform: translateY(-12px); }
.htile.sel .tile-svg { filter: drop-shadow(0 0 0 var(--marigold)) drop-shadow(0 0 4px var(--marigold)); }
.htile.sel::before { content: ""; position: absolute; inset: -4px; border-radius: 10px; box-shadow: 0 0 0 3px var(--marigold); }
.htile.drawn .tile-svg { animation: drawn 0.5s ease-out; }
.htile.nope { animation: nope 0.32s; }
@keyframes drawn { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes nope { 25% { translate: -5px 0; } 50% { translate: 5px 0; } 75% { translate: -3px 0; } }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.actions:empty { display: none; }
@media (min-width: 700px) {
  .htile { --tw: 52px; }
  .hand { min-height: 112px; gap: 8px; }
}
@media (max-height: 640px) and (max-width: 999px) {
  .htile { --tw: 38px; }
  .hand { min-height: 80px; }
}

/* ---------- tiles (SVG) ---------- */
.t-face { fill: var(--bone); stroke: var(--bone-edge); stroke-width: 0.045; }
.tile .t-face { filter: drop-shadow(0 0.06px 0 rgba(0, 0, 0, 0.35)); }
.t-line { stroke: var(--bone-line); stroke-width: 0.035; stroke-linecap: round; }
.pip { fill: var(--ink); }
.pip.p1 { fill: var(--p1); } .pip.p2 { fill: var(--p2); } .pip.p3 { fill: var(--p3); }
.pip.p4 { fill: var(--p4); } .pip.p5 { fill: var(--p5); } .pip.p6 { fill: var(--p6); }
.plain-pips .pip { fill: var(--ink); }
.t-pin { fill: var(--brass); stroke: var(--brass-dark); stroke-width: 0.02; }
.t-back { fill: #e3d6bd; stroke: var(--bone-line); stroke-width: 0.05; }
.t-back-pin { fill: var(--brass); }
.tile.last .t-face { stroke: var(--marigold); stroke-width: 0.07; }
.tile.fresh { animation: settle 0.38s cubic-bezier(0.2, 0.9, 0.3, 1.2); transform-box: fill-box; transform-origin: center; }
@keyframes settle { from { transform: scale(1.18); opacity: 0; } to { transform: none; opacity: 1; } }
.ghost { cursor: pointer; outline: none; }
.ghost .t-face { fill: rgba(243, 235, 221, 0.55); stroke: none; }
.ghost .pip { opacity: 0.75; }
.ghost-ring { fill: rgba(242, 177, 52, 0.12); stroke: var(--marigold); stroke-width: 0.07; stroke-dasharray: 0.22 0.14; }
.ghost:hover .ghost-ring, .ghost:focus-visible .ghost-ring { fill: rgba(242, 177, 52, 0.3); stroke-width: 0.12; stroke-dasharray: none; }
.hero-tile { animation: lay 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.15) both; transform-box: fill-box; transform-origin: center; }
@keyframes lay { from { opacity: 0; transform: translateY(-0.6px) scale(1.15); } to { opacity: 1; transform: none; } }

/* ---------- side panel ---------- */
.side {
  min-height: 0; overflow-y: auto; padding: 16px 16px 24px;
  background: rgba(11, 50, 54, 0.85); border-left: 1px solid rgba(0, 0, 0, 0.25);
  display: grid; align-content: start; gap: 12px;
}
.side h2 { font-size: 1.1rem; }
.side-head { display: flex; justify-content: space-between; align-items: center; }
.side-close { display: none; }
.scores { width: 100%; border-collapse: collapse; }
.scores th { text-align: left; font-size: 0.86rem; color: var(--muted); font-weight: 600; padding: 4px 0; }
.scores td { padding: 7px 0; border-top: 1px solid var(--line); font-weight: 650; }
.scores .num { text-align: right; font-weight: 800; }
.scores tr.turn td:first-child { color: var(--marigold); }
.meter { display: block; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); margin-top: 5px; max-width: 180px; overflow: hidden; }
.meter-fill { display: block; height: 100%; background: var(--bone); border-radius: 4px; }
.hist { margin: 4px 0 0; padding-left: 0; list-style: none; color: var(--muted); font-size: 0.88rem; display: grid; gap: 2px; }
.log { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 0.92rem; color: var(--muted); }
.log li:first-child { color: var(--text); }
.log .log-domino, .log .log-blocked, .log .log-match { color: var(--marigold); font-weight: 650; }
@media (max-width: 999px) {
  .side {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; max-height: 75dvh;
    border-radius: 20px 20px 0 0; border: 0; background: var(--rail);
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    transform: translateY(105%); transition: transform 0.22s ease; visibility: hidden;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
  }
  .side.open { transform: none; visibility: visible; }
  .side-close { display: inline-flex; }
}
@media (min-width: 1000px) {
  #btnPanel { display: none; }
}

/* ---------- dialogs ---------- */
.shade { position: fixed; inset: 0; z-index: 30; background: rgba(4, 22, 24, 0.6); }
.sheet {
  position: fixed; z-index: 45; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(600px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); overflow-y: auto;
  background: var(--bone); color: var(--ink); border-radius: 18px;
  box-shadow: inset 0 0 0 2px var(--bone-edge), 0 24px 60px rgba(0, 0, 0, 0.45);
  padding: 24px;
  color-scheme: light;
}
.sheet .note { color: #5f5847; }
.sheet .btn-quiet { color: var(--ink); }
.sheet select, .sheet input:not([type=checkbox]) { background: #fffaf1; color: var(--ink); border-color: var(--bone-edge); }
.sheet-body { display: grid; gap: 16px; }
.sheet h2.big { font-size: clamp(1.8rem, 6vw, 2.4rem); letter-spacing: -0.02em; }
.sheet-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; align-items: center; }
.sheet-actions .note { flex: 1 1 200px; }
.sheet[data-kind="cover"] { text-align: center; }
.sheet[data-kind="cover"] .sheet-actions { justify-content: center; }
.sheet[data-kind="cover"] .lede { margin: 0 auto; }
.prose { display: grid; gap: 10px; max-width: 62ch; }
.prose h3 { margin-top: 6px; }
.settings { display: grid; gap: 8px; }
.link-box { font-size: 0.95rem; }
@media (max-width: 640px) {
  .sheet { left: 0; right: 0; top: auto; bottom: 0; transform: none; width: auto; border-radius: 20px 20px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom)); max-height: 88dvh; }
}

.summary { list-style: none; margin: 0; padding: 0; display: grid; }
.sum-row { display: grid; grid-template-columns: minmax(70px, 1fr) minmax(0, 2.2fr) 64px 48px; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--bone-edge); }
.sum-row.head { font-size: 0.8rem; color: #5f5847; border-top: 0; padding-bottom: 2px; }
.sum-row.head span:nth-child(n + 3) { text-align: right; }
.sum-row.won .sum-name { font-weight: 800; }
.sum-row.won { background: linear-gradient(90deg, rgba(242, 177, 52, 0.28), transparent); }
.sum-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 6px; }
.sum-tiles { display: flex; flex-wrap: wrap; gap: 3px; }
.sum-tiles .mini { width: 15px; height: 30px; }
.sum-tiles .mini .t-face { stroke-width: 0.06; }
.sum-tiles .out { font-weight: 700; color: var(--p2); }
.sum-pips { text-align: right; color: #5f5847; font-size: 0.92rem; }
.sum-score { text-align: right; font-weight: 800; font-size: 1.1rem; padding-right: 6px; }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; z-index: 44; /* under dialogs */ left: 50%; transform: translateX(-50%);
  bottom: calc(150px + env(safe-area-inset-bottom)); display: grid; gap: 6px; justify-items: center;
  pointer-events: none; width: min(520px, calc(100vw - 24px));
}
body:not([data-screen="table"]) .toasts { bottom: auto; top: calc(var(--bar-h) + env(safe-area-inset-top) + 12px); }
.toast {
  background: var(--ink); color: var(--bone); padding: 9px 16px; border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); font-weight: 600; font-size: 0.95rem; text-align: center;
  animation: toast-in 0.18s ease-out; transition: opacity 0.4s;
}
.toast.err { background: #5a1e16; color: #ffe1da; }
.toast.out { opacity: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
