/* Rolli's table: a green felt under warm wooden light, ivory dice with dark pips for Farkle and
   earthy dig dice for Dig, cream type and gold accents — Skami's and Settli's sibling at the dice
   table. One size variable, --u (the width of a die on the felt), is set from the window by
   main.js. The shared pieces (the top bar, the 🔊 panel and the ☰ menu, portraits, the log, toasts
   and banners, the chat, dialogs, the screens before the board, the home tabs) are Settli's, on felt. */

:root {
  --felt: #1f5240;
  --felt-hi: #2f6e55;
  --felt-lo: #0e2a20;
  --panel: #0c2a1fd9;
  --panel-solid: #10332a;
  --line: #ffffff22;
  --ink: #fdf6e3;
  --corgi: #f08a24;
  --cream: #fff6e6;
  --gold: #ffd166;
  --go: #7cf29a;
  --doom: #e05a4f;
  --ivory: #fbf6ea;
  --pip: #2b1d14;
  --u: 64px;
  --round: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", "Arial Rounded MT Bold", system-ui, sans-serif;
  --coat-0: #d9482b;
  --coat-1: #3d8fd6;
  --coat-2: #8a96a8;
  --coat-3: #ef8a1e;
  --coat-4: #5f9e4a;
  --coat-5: #8a5a3c;
  --d-shallow: #e3c992;
  --d-shallow-lo: #b99a5e;
  --d-deep: #9b6537;
  --d-deep-lo: #6e4423;
  --d-deepest: #474b5f;
  --d-deepest-lo: #2a2d3b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* Height is 100% down from html, never 100vh: on an iPhone's home screen 100vh is not the screen. */
html, body { margin: 0; height: 100%; overscroll-behavior: none; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  background: var(--felt-lo);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
#app { height: 100%; }
kbd { font: 600 10px system-ui; margin-left: 6px; opacity: .6; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ——— the felt, under the board and the screens before it ——— */
.game, .screen {
  background:
    radial-gradient(circle at 50% 120%, #00000055, transparent 60%),
    repeating-linear-gradient(45deg, #ffffff04 0 2px, transparent 2px 5px),
    radial-gradient(ellipse 90% 80% at 50% 35%, var(--felt-hi), var(--felt) 55%, var(--felt-lo));
}

/* ——— the board ———
   The safe area is padded ONCE, here and on .screen. On a home screen iOS draws its own opaque
   status bar above the page (index.html), so the top inset is 0 there. */
.game {
  --side: clamp(240px, 22vw, 320px);
  position: relative;
  height: 100%;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--side);
  grid-template-rows: auto auto minmax(0, 1fr);
  grid-template-areas: "top top" "corgis corgis" "stage log";
  overflow: hidden;
  overflow: clip;
}
.topbar { grid-area: top; display: flex; align-items: center; gap: 8px; padding: 12px 16px 6px; z-index: 6; }
.brand { font: 900 21px var(--round); color: var(--corgi); text-shadow: 0 2px 0 #0006; margin-right: 4px; text-decoration: none; }
a.brand:hover { color: var(--gold); }
.code, .icon {
  height: 30px; padding: 0 12px;
  border: 1px solid #ffffff30; border-radius: 999px;
  background: #00000040;
  font-size: 13px;
}
.code:hover, .icon:hover { background: #00000066; }
.with-badge { position: relative; }
.with-badge .badge { position: absolute; top: -6px; right: -6px; min-width: 18px; padding: 1px 5px; border-radius: 999px; background: var(--doom); color: #fff; font: 800 11px/16px var(--round); text-align: center; box-shadow: 0 2px 6px #0007; }
.badge:empty { display: none; }
.spacer { flex: 1; }
/* what wins at this table: the points to play to, beside the table's code */
.goal { flex: none; display: inline-flex; align-items: center; gap: 3px; padding: 0 2px; font: 800 13px var(--round); color: var(--cream); white-space: nowrap; opacity: .9; }
.goal b { color: var(--gold); font-weight: 900; font-size: 15px; }
.goal-sub { display: none; font-size: 9.5px; font-weight: 700; opacity: .75; }
.clock { padding: 4px 11px; border-radius: 999px; background: #00000048; font: 900 14px var(--round); color: var(--cream); white-space: nowrap; }
.clock:empty { display: none; }
.clock.low { background: #7a1f14; color: #ffe1dc; animation: ready 1s ease-in-out infinite; }
.log-btn { display: none; }

/* the sound panel the 🔊 opens and the ☰ menu; the veil behind them takes the tap that closes them */
.sound-veil { position: fixed; inset: 0; z-index: 49; display: none; }
.sound-veil.on { display: block; }
.sound-pop {
  position: absolute; top: calc(52px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px)); z-index: 50;
  display: none; flex-direction: column;
  width: min(260px, calc(100vw - 24px));
  padding: 8px 16px 12px;
  border: 2px solid #ffd16655; border-radius: 16px;
  background: linear-gradient(#143a2d, #0c2a1f);
  box-shadow: 0 20px 50px #000c;
  transform-origin: top right;
  animation: pop .18s ease-out;
}
.sound-pop.on { display: flex; }
.sound-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; font: 800 15px var(--round); color: var(--cream); cursor: pointer; }
.sound-pop input[type="range"] { width: 100%; height: 28px; margin: 0 0 4px; accent-color: var(--corgi); transition: opacity .15s; }
.sound-row.off + input[type="range"] { opacity: .45; }
.switch {
  appearance: none; -webkit-appearance: none;
  flex: none; width: 46px; height: 26px; margin: 0;
  border: 1px solid #ffffff30; border-radius: 999px;
  background: radial-gradient(circle, var(--cream) 0 9px, #0000 10px) 1px 50% / 22px 22px no-repeat #00000060;
  cursor: pointer;
  transition: background-color .15s, background-position .15s, border-color .15s;
}
.switch:checked { border-color: #7a4a14; background-color: var(--corgi); background-position: calc(100% - 1px) 50%; }
.sound-hint { margin: 6px 0 0; font-size: 12px; opacity: .65; }
.sound-hint kbd { margin: 0 2px 0 0; }
.menu-pop { width: min(300px, calc(100vw - 24px)); padding: 8px; gap: 2px; }
.menu-item { display: block; width: 100%; padding: 11px 12px; border: 0; border-radius: 10px; background: none; font: 700 14.5px var(--round); text-align: left; }
.menu-item:hover, .menu-item:focus-visible { background: #ffffff14; }
.menu-item.warn { color: #ffb4ab; }

/* ——— a corgi's portrait ——— */
.avatar {
  position: relative;
  display: grid; place-items: center; flex: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--face, none) 50% 30% / cover no-repeat, radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--coat, var(--corgi)) 55%, #fff), var(--coat, var(--corgi)));
  box-shadow: 0 0 0 3px var(--coat, var(--corgi)), 0 0 0 4px #0005, 0 2px 8px #0008;
  color: #fff;
  font: 900 18px var(--round);
  text-shadow: 0 1px 2px #0008;
}
.avatar span { opacity: 0; }

/* ——— the log ——— */
.log-panel { grid-area: log; display: flex; flex-direction: column; min-height: 0; margin: 8px 14px 12px 4px; padding: 8px 10px 8px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); z-index: 3; }
.log-panel .drawer-head { margin-bottom: 4px; }
.log-panel .drawer-x { display: none; }
.lines { flex: 1; min-height: 0; margin: 0; padding: 0 2px 0 0; overflow: auto; list-style: none; font-size: 12.5px; line-height: 1.45; user-select: text; -webkit-user-select: text; overscroll-behavior: contain; }
.lines li { padding: 2px 0; }
.lines li.turn { margin-top: 8px; padding-top: 6px; border-top: 1px solid #ffffff14; font: 800 11px var(--round); letter-spacing: .08em; text-transform: uppercase; opacity: .75; }
.lines li.good { color: var(--go); }
.lines li.bad { color: #ffb4ab; }

/* ——— banners, toasts ——— */
.banner { position: fixed; left: 50%; top: 42%; z-index: 58; display: flex; flex-direction: column; align-items: center; pointer-events: none; animation: banner 1.7s ease-out forwards; }
.banner strong { font: 900 clamp(30px, 6vw, 62px) var(--round); color: var(--gold); text-shadow: 0 4px 0 #6b3f10, 0 0 30px #0009; white-space: nowrap; }
.banner span { font-weight: 800; text-shadow: 0 2px 4px #000; }
.toasts { position: fixed; top: calc(56px + env(safe-area-inset-top, 0px)); left: 50%; z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(calc(100vw - 32px), 380px); transform: translateX(-50%); pointer-events: none; }
.toast { padding: 8px 14px; border: 1px solid #ffffff2a; border-radius: 12px; background: #0c2a1ff4; box-shadow: 0 6px 20px #0009; font-size: 13.5px; text-align: center; transition: opacity .4s, transform .4s; }
.toast.error { border-color: var(--doom); }
.toast.good { border-color: var(--go); }
.toast.gone { opacity: 0; transform: translateY(-6px); }
body.offline::after { content: "Reconnecting to the table…"; position: fixed; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); left: 50%; z-index: 80; transform: translateX(-50%); padding: 6px 14px; border-radius: 999px; background: #4a1310f0; font-size: 13px; }

/* ——— the chat drawer, and the end of a game ——— */
.drawer {
  position: absolute; top: calc(52px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 31;
  display: flex; flex-direction: column;
  width: min(340px, 88vw);
  padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 14px;
  background: #08201af4;
  box-shadow: 0 20px 50px #000a;
  transform: translateX(calc(100% + 28px));
  visibility: hidden;
  transition: transform .25s, visibility 0s .25s;
}
.game.show-chat .chat-drawer { transform: none; visibility: visible; transition: transform .25s; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.drawer-head h3 { margin: 0; font: 800 14px var(--round); color: var(--gold); }
.drawer-x { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: #ffffff14; font-size: 18px; line-height: 1; }

/* the table's chat: in the lobby, and in the board's drawer */
.chat { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; }
.chat-lines { flex: 1; min-height: 0; margin: 0; padding: 2px 2px 4px; overflow: auto; list-style: none; display: flex; flex-direction: column; gap: 8px; user-select: text; -webkit-user-select: text; overscroll-behavior: contain; }
.chat-lines li { display: flex; align-items: flex-end; gap: 7px; max-width: 92%; }
.chat-lines li.mine { align-self: flex-end; flex-direction: row-reverse; }
.chat-lines .avatar { width: 26px; height: 26px; box-shadow: 0 0 0 2px var(--coat, var(--corgi)), 0 1px 4px #0008; }
.chat-bubble { display: flex; flex-direction: column; gap: 1px; padding: 6px 10px 7px; border-radius: 14px 14px 14px 4px; background: #ffffff16; font-size: 13.5px; line-height: 1.35; text-align: left; overflow-wrap: anywhere; }
.chat-bubble b { font-size: 11px; color: var(--gold); opacity: .9; }
.mine .chat-bubble { border-radius: 14px 14px 4px 14px; background: color-mix(in srgb, var(--corgi) 34%, #0c2a1f); }
.mine .chat-bubble b { display: none; }
.chat-empty { align-self: center; max-width: none !important; margin: auto; font-size: 13px; opacity: .6; }
.chat-quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: none; padding-bottom: 2px; }
.chat-quick::-webkit-scrollbar { display: none; }
.chat-quick button { flex: none; padding: 4px 10px; border: 1px solid #ffffff2a; border-radius: 999px; background: #ffffff10; font-size: 12.5px; white-space: nowrap; }
.chat-quick button:hover { background: #ffffff22; }
.chat-say { display: flex; gap: 6px; flex: none; }
.chat-say input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid #ffffff38; border-radius: 12px; background: #00000055; color: var(--ink); font-size: 16px; user-select: text; -webkit-user-select: text; }
.chat-say input:focus { outline: 2px solid #f08a2490; outline-offset: 0; }
.chat-send { padding: 0 14px; border: 0; border-radius: 12px; background: linear-gradient(#ffd166, #e8963c); color: #3a2208; font: 900 14px var(--round); }
.chat-send:disabled { opacity: .6; }
/* a line said aloud, beside the corgi who said it */
.say-bubble {
  position: absolute; right: calc(100% + 10px); top: 50%; z-index: 20;
  width: max-content; max-width: min(220px, 60vw);
  padding: 6px 11px; border-radius: 14px;
  background: var(--cream); color: #34241a; box-shadow: 0 6px 18px #000a;
  font: 700 13px/1.3 var(--round); text-align: left; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
  transform: translateY(-50%); pointer-events: none;
  animation: say .22s cubic-bezier(.2, 1.5, .4, 1); transition: opacity .5s;
}
.say-bubble.gone { opacity: 0; }
.game[data-phase="over"] .topbar { z-index: 30; }
.ghost-btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 14px; border: 1px solid #ffffff2e; border-radius: 12px; background: #ffffff10; color: var(--ink); font: 700 13.5px var(--round); text-decoration: none; white-space: nowrap; }
.ghost-btn:hover { background: #ffffff20; }
.ghost-btn.warn { border-color: #e05a4f80; color: #ffb4ab; }

/* ——— dialogs ——— */
dialog.panel {
  max-width: min(92vw, 660px); max-height: 88vh;
  padding: 18px 20px 20px;
  overflow: auto;
  border: 2px solid #ffd16660; border-radius: 18px;
  background: linear-gradient(#143a2d, #0c2a1f);
  color: var(--ink);
  box-shadow: 0 30px 80px #000c;
  user-select: none;
}
dialog.panel::backdrop { background: #0009; backdrop-filter: blur(2px); }
dialog.panel h2 { margin: 0 30px 12px 0; font: 900 20px var(--round); color: var(--gold); }
dialog.panel h3 { margin: 16px 0 8px; font: 800 15px var(--round); color: var(--corgi); }
dialog.panel p, dialog.panel li { font-size: 14px; line-height: 1.5; }
dialog .close { position: absolute; top: 8px; right: 12px; padding: 4px; border: 0; background: none; font-size: 26px; line-height: 1; opacity: .7; }
dialog.panel.ask { width: min(92vw, 400px); }
.ask-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.ask-row button:not(.primary) { padding: 10px 16px; border: 1px solid #ffffff2a; border-radius: 12px; background: #ffffff12; }
.small { margin: 0; font-size: 12px; opacity: .65; }
.hint { font-size: 12.5px; opacity: .8; }
.primary {
  display: inline-block;
  padding: 10px 20px;
  border: 0; border-radius: 12px;
  background: linear-gradient(#ffd166, #e8963c);
  box-shadow: 0 4px 0 #7a4a14, 0 8px 20px #0006;
  color: #3a2208;
  font: 900 15px var(--round);
  text-decoration: none;
}
.primary:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #7a4a14; }
.primary:disabled { filter: grayscale(.7); opacity: .65; }
.primary.danger { background: linear-gradient(#ff8a7a, #e05a4f); box-shadow: 0 4px 0 #7a1f14, 0 8px 20px #0006; color: #2b0703; }

/* the rules */
dialog.panel.rules-dialog { width: min(94vw, 680px); }
.rules .tabs { margin-bottom: 4px; }
.rules ol, .rules ul { padding-left: 20px; }
.rules .lead { font: 800 15px var(--round); color: var(--cream); }
.score-table { width: 100%; border-collapse: collapse; }
.score-table td { padding: 6px 6px; border-bottom: 1px solid #ffffff12; vertical-align: middle; font-size: 13.5px; }
.score-table .pts { font: 900 14px var(--round); color: var(--gold); white-space: nowrap; }
.score-table .note { font-size: 12px; opacity: .75; }
.mini-dice { display: inline-flex; gap: 3px; flex-wrap: wrap; }
.mini-dice .die { --size: 22px; }
.house li { margin-bottom: 4px; }
.depths { list-style: none; padding: 0 !important; display: flex; flex-direction: column; gap: 10px; }
.depth-line { display: grid; grid-template-columns: 74px auto; align-items: center; gap: 4px 10px; }
.depth-line .depth-words { grid-column: 1 / -1; font-size: 12.5px; opacity: .8; }
.depth-faces { display: inline-flex; gap: 3px; }
/* ——— the screens before the board ———
   Taller than the window, a screen scrolls from its top: the margin centres it only while there is room. */
.screen { height: 100%; overflow: auto; display: flex; flex-direction: column; padding: calc(28px + env(safe-area-inset-top, 0px)) calc(16px + env(safe-area-inset-right, 0px)) calc(28px + env(safe-area-inset-bottom, 0px)) calc(16px + env(safe-area-inset-left, 0px)); overscroll-behavior: contain; }
.screen-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(100%, 480px); margin: auto; text-align: center; }
h1 { margin: 0; font: 900 clamp(52px, 13vw, 88px)/1 var(--round); color: var(--corgi); text-shadow: 0 5px 0 #6b3f10, 0 0 40px #0006; }
.tag { margin: 0; font-size: 15px; opacity: .9; }

.welcome { display: flex; gap: 8px; width: 100%; }
.welcome input, .linkrow input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid #ffffff38; border-radius: 12px; background: #00000055; color: var(--ink); font-size: 16px; user-select: text; -webkit-user-select: text; }
.link { padding: 0; border: 0; background: none; color: var(--gold); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.join-code { display: flex; align-items: center; gap: 8px; }
.join-code label { font-size: 13px; opacity: .8; }
.join-code input { width: 8ch; padding: 8px 10px; border: 1px solid #ffffff38; border-radius: 10px; background: #00000055; color: var(--ink); font: 800 16px var(--round); letter-spacing: .2em; text-align: center; text-transform: uppercase; user-select: text; -webkit-user-select: text; }
.join-code button { padding: 8px 14px; border: 1px solid #ffffff38; border-radius: 10px; background: #ffffff18; }
.table-code { display: flex; align-items: baseline; justify-content: space-between; }
.table-code span { font-size: 13px; opacity: .8; }
.table-code b { font: 900 28px var(--round); letter-spacing: .18em; color: var(--gold); }
.whoami { display: flex; align-items: center; gap: 10px; padding: 4px 14px 4px 4px; border-radius: 999px; background: #00000038; font-size: 14px; }
.whoami .avatar { width: 34px; height: 34px; }
.invite { display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #00000038; text-align: left; }
.invite label { font-size: 13px; opacity: .85; }
.invite .link { align-self: flex-start; font-size: 13px; }
.linkrow { display: flex; gap: 6px; }
.linkrow input { font-size: 13px; }
.linkrow button { padding: 0 14px; border: 1px solid #ffffff38; border-radius: 12px; background: #ffffff18; }
.seats { display: flex; flex-direction: column; gap: 6px; width: 100%; margin: 0; padding: 0; list-style: none; }
.seats li { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 999px; background: #00000038; text-align: left; }
.seats .avatar { width: 32px; height: 32px; font-size: 15px; }
.seats em, .chair em { padding: 1px 8px; border-radius: 999px; background: #ffffff1c; font-size: 11px; font-style: normal; white-space: nowrap; }
.seats em:first-of-type { margin-left: auto; }
.bot-tag { background: #6fb1e830 !important; }
em.away { background: #e05a4f40 !important; }

/* the lobby: the chairs, the table's options, the deal */
.screen.lobby .screen-inner { width: min(100%, 520px); }
.chairs-box, .options { display: flex; flex-direction: column; gap: 10px; width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #00000038; text-align: left; }
.chairs-box h3, .options h3 { margin: 0; font: 800 14px var(--round); color: var(--gold); }
.chairs { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chair { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 8px 4px 4px; border-radius: 999px; background: #00000040; }
.chair .avatar { width: 34px; height: 34px; font-size: 15px; }
.chair.vacant { background: transparent; box-shadow: inset 0 0 0 2px #ffffff22; }
.empty-seat { display: grid; place-items: center; width: 34px; height: 34px; font-size: 18px; opacity: .55; }
.chair-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.chair.vacant .chair-name { font-weight: 500; opacity: .6; }
.chair-x { flex: none; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: #ffffff18; font-size: 17px; line-height: 1; }
.chair-x:hover { background: #e05a4f80; }
.add-bot, .fill-btn { flex: none; padding: 6px 12px; border: 1px solid #ffd16699; border-radius: 999px; background: #ffd16622; color: var(--gold); font: 800 12.5px var(--round); white-space: nowrap; }
.add-bot:hover, .fill-btn:hover:not(:disabled) { background: #ffd16640; }
.fill-btn { align-self: flex-end; padding: 8px 14px; }
.fill-btn:disabled { opacity: .4; }
.opt { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; }
.opt-label { display: flex; flex-direction: column; font-size: 13.5px; font-weight: 700; }
.opt-label small { font-size: 11.5px; font-weight: 400; opacity: .7; }
.opt.toggle { cursor: pointer; }
.opt.bots { flex-direction: column; align-items: stretch; gap: 8px; padding-top: 8px; border-top: 1px solid #ffffff14; }
.seg { display: inline-flex; flex-wrap: wrap; padding: 3px; border-radius: 999px; background: #00000048; }
.seg button { min-height: 30px; padding: 5px 12px; border: 0; border-radius: 999px; background: none; font: 800 12.5px var(--round); opacity: .78; }
.seg button[aria-pressed="true"] { background: var(--corgi); color: #3a2208; opacity: 1; }
.seg button:disabled { opacity: .3; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 32px; height: 32px; padding: 0; border: 1px solid #ffffff38; border-radius: 50%; background: #ffffff14; font: 900 17px/1 var(--round); }
.stepper button:disabled { opacity: .3; }
.stepper output { min-width: 70px; font: 900 15px var(--round); text-align: center; }
.opt-read { display: flex; flex-direction: column; gap: 5px; margin: 0; padding: 0; list-style: none; }
.opt-read li { display: flex; justify-content: space-between; font-size: 13.5px; }
.opt-read span { opacity: .75; }
.primary.deal { padding: 12px 28px; font-size: 17px; }
.lobby-chat { display: flex; flex-direction: column; width: 100%; height: 280px; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 14px; background: #00000038; text-align: left; }
.lobby-chat h3 { margin: 0 0 6px; font: 800 14px var(--round); color: var(--gold); }
.lobby-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* the home screen: the buttons, then your tables, your stats and the leaderboard (home.js) */
.home 
.home h1 { font-size: clamp(46px, 11vw, 72px); }
.home-go { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 14px; }
.home-tabs { width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 16px; background: #00000038; text-align: left; overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid #ffffff1a; }
.tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 6px 10px; border: 0; border-bottom: 3px solid transparent; background: none; font: 800 14px var(--round); opacity: .7; white-space: nowrap; }
.tab[aria-selected="true"] { border-bottom-color: var(--corgi); color: var(--gold); opacity: 1; }
.tab-count { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--corgi); color: #3a2208; font-size: 11px; line-height: 17px; text-align: center; }
.tab-count:empty { display: none; }
.tab-panel { display: flex; flex-direction: column; gap: 10px; padding: 12px; min-height: 120px; }
.tab-panel h3 { margin: 6px 0 0; font: 800 14px var(--round); color: var(--corgi); }
.empty { margin: auto; padding: 18px 8px; font-size: 13.5px; text-align: center; opacity: .7; }
.faces { display: inline-flex; flex: none; }
.faces .avatar { width: 24px; height: 24px; font-size: 11px; box-shadow: 0 0 0 2px var(--coat, var(--corgi)), 0 0 0 3px #0006; }
.faces .avatar + .avatar { margin-left: -6px; }
.my-tables { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.my-table { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border: 1px solid #ffffff1c; border-radius: 12px; background: #ffffff0a; }
.my-table.hot { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 16px #ffd16640; }
.my-table-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; color: inherit; text-decoration: none; }
.my-table-top { display: flex; align-items: center; gap: 8px; }
.my-code { font: 900 17px var(--round); letter-spacing: .14em; color: var(--gold); }
.my-table-top em { padding: 0 7px; border-radius: 999px; background: #ffffff1c; font-size: 10.5px; font-style: normal; }
.state { margin-left: auto; font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hot .state { color: var(--gold); font-weight: 800; opacity: 1; }
.my-table-corgis { display: flex; align-items: center; gap: 8px; min-width: 0; }
.names { font-size: 12.5px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.my-table-acts { display: flex; flex-direction: column; gap: 5px; }
.my-table-acts .ghost-btn { justify-content: center; padding: 5px 10px; font-size: 12px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px 8px; border-radius: 12px; background: #ffffff0d; }
.tile b { font: 900 24px var(--round); color: var(--gold); }
.tile span { font-size: 11.5px; opacity: .75; }
.moments { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.moments span { padding: 3px 9px; border-radius: 999px; background: #ffffff10; font-size: 12px; }
.history { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.past { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 12px; background: #ffffff09; }
.past.won { background: color-mix(in srgb, var(--gold) 12%, transparent); }
.place { flex: none; width: 36px; font: 900 15px var(--round); text-align: center; opacity: .85; }
.past.won .place { font-size: 20px; opacity: 1; }
.past-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.past-line { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.past-meta { font-size: 11.5px; opacity: .65; }
.ranks { display: flex; flex-direction: column; gap: 5px; margin: 0; padding: 0; list-style: none; }
.ranks li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 12px; background: #ffffff09; }
.ranks li.you { background: color-mix(in srgb, var(--corgi) 26%, transparent); box-shadow: inset 0 0 0 1px #f08a2490; }
.ranks .avatar { width: 30px; height: 30px; font-size: 13px; }
.ranks-note { margin: 10px 4px 0; font-size: 12px; text-align: center; opacity: .6; }
.rank { flex: none; width: 28px; font: 900 15px var(--round); text-align: center; opacity: .85; }
.rank-name { flex: 1; min-width: 0; font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-name em { margin-left: 6px; padding: 0 7px; border-radius: 999px; background: #ffffff22; font-size: 10.5px; font-style: normal; font-weight: 700; }
.rank-stats { flex: none; font-size: 12px; opacity: .85; text-align: right; }
.rank-stats b { color: var(--gold); }

/* ——— the corgis along the top: a chip each, its score, and a bar toward the target ——— */
.corgis { grid-area: corgis; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 2px 14px 6px; z-index: 4; }
.chip {
  --coat: var(--corgi);
  position: relative;
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 10px;
  min-width: 170px; max-width: 260px; flex: 1 1 170px;
  padding: 7px 12px 9px 8px;
  border: 1px solid var(--line); border-left: 4px solid var(--coat); border-radius: 14px;
  background: var(--panel);
  transition: box-shadow .25s, border-color .25s;
}
.chip.turn { border-color: var(--gold); border-left-color: var(--coat); box-shadow: 0 0 0 1px var(--gold), 0 0 20px #ffd16648; }
.chip.me { background: color-mix(in srgb, var(--panel-solid) 82%, var(--coat) 18%); }
.chip.away .avatar { filter: grayscale(.8); opacity: .7; }
.chip-text { min-width: 0; display: flex; flex-direction: column; }
.chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 800 14px var(--round); }
.chip-name em { font-style: normal; font-weight: 600; font-size: 11px; opacity: .7; }
.chip-score { font: 900 22px/1.1 var(--round); color: var(--gold); font-variant-numeric: tabular-nums; }
.chip-marks { display: flex; flex-wrap: wrap; gap: 4px; min-height: 0; }
.chip-marks:empty { display: none; }
.mark { padding: 0 7px; border-radius: 999px; background: #ffffff1a; font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.mark.streak { color: #ffb4ab; letter-spacing: 1px; }
.mark.reached { background: #ffd16633; color: var(--gold); }
.mark.won { background: #7cf29a33; }
.chip-bar { grid-column: 1 / -1; height: 5px; border-radius: 999px; background: #00000055; overflow: hidden; }
.chip-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--coat), var(--gold)); transition: width .6s ease-out; }
.chip .say-bubble { right: auto; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); }
.float { position: absolute; right: 10px; top: 4px; z-index: 5; font: 900 18px var(--round); color: var(--go); text-shadow: 0 2px 4px #000a; pointer-events: none; animation: floatUp 1.2s ease-out forwards; }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(10px) scale(.7); } 15% { opacity: 1; transform: translateY(0) scale(1.1); } 100% { opacity: 0; transform: translateY(-26px) scale(1); } }

/* ——— the stage: the felt with the dice, the tally, the choices and the buttons ——— */
.stage { grid-area: stage; position: relative; min-height: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 4px 16px 18px; overscroll-behavior: contain; }
.last-round { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 16px; border: 1px solid #ffd16688; border-radius: 999px; background: #3a2a08cc; font: 900 14px var(--round); color: var(--gold); text-align: center; }
.last-round:empty { display: none; }
.last-round .small { color: var(--cream); font-weight: 600; opacity: .9; }
.prompt { min-height: 22px; font: 800 15px var(--round); text-align: center; color: var(--cream); }
.game.my-turn .prompt { color: var(--gold); }
.felt {
  position: relative;
  width: min(100%, calc(var(--u) * 8.4));
  min-height: calc(var(--u) * 2.6);
  padding: calc(var(--u) * .35) calc(var(--u) * .3);
  border-radius: 24px;
  background: radial-gradient(ellipse at 50% 40%, #2e7559, #1c4c3a 70%);
  box-shadow: inset 0 0 0 6px #6b4220, inset 0 0 0 9px #8a5a30, inset 0 6px 30px #0008, 0 12px 30px #0007;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--u) * .25);
}
.tray { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: calc(var(--u) * .28); min-height: calc(var(--u) * 1.15); transition: opacity .3s, filter .3s; }
.tray.stale { opacity: .55; filter: saturate(.7); }
.tray.dusty { animation: dust .7s ease-out; }
@keyframes dust { 0% { filter: sepia(0) brightness(1); } 30% { filter: sepia(.8) brightness(1.25) blur(1px); } 100% { filter: sepia(0) brightness(1); } }
.tray-empty { margin: 0; font: 800 15px var(--round); opacity: .7; }
.held { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; padding: 6px 10px; border-radius: 12px; background: #00000030; }
.held[hidden] { display: none; }
.held .die { --size: calc(var(--u) * .5); }
.held-label { font: 800 11px var(--round); letter-spacing: .06em; text-transform: uppercase; opacity: .7; margin-right: 4px; }
.fx-layer { position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center; overflow: hidden; border-radius: inherit; }
.flash { width: min(70%, 280px); border-radius: 18px; box-shadow: 0 16px 40px #000b; animation: flashIn .35s cubic-bezier(.2, 1.5, .4, 1); transition: opacity .4s, transform .4s; }
.flash.gone { opacity: 0; transform: scale(.9); }
@keyframes flashIn { from { opacity: 0; transform: scale(.6) rotate(-4deg); } }
.runner { position: fixed; left: 0; top: 0; z-index: 60; width: 80px; height: 80px; object-fit: contain; pointer-events: none; filter: drop-shadow(0 6px 6px #0008); }

/* a die: ivory with pips (Farkle), or a depth's earth with its face (Dig) */
.die {
  --size: var(--u);
  position: relative; flex: none;
  width: var(--size); height: var(--size);
  border-radius: calc(var(--size) * .2);
  transform: translateY(var(--lift, 0)) rotate(var(--tilt, 0deg));
  transition: transform .15s ease-out, box-shadow .15s;
}
.die.farkle {
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: calc(var(--size) * .14);
  background: radial-gradient(circle at 30% 25%, #fff, var(--ivory) 55%, #e6dcc5);
  box-shadow: inset 0 calc(var(--size) * -.06) 0 #d4c7a8, 0 calc(var(--size) * .08) calc(var(--size) * .16) #0007;
}
.die.farkle i { place-self: center; width: 62%; height: 62%; border-radius: 50%; background: transparent; }
.die.farkle i.on { background: radial-gradient(circle at 35% 30%, #5a4232, var(--pip)); box-shadow: inset 0 1px 1px #0008; }
.die.farkle[data-face="1"] i.on { background: radial-gradient(circle at 35% 30%, #e0553a, #a82a14); width: 78%; height: 78%; }
.die.dig { display: grid; place-items: center; padding: calc(var(--size) * .1); background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--dc) 70%, #fff), var(--dc) 60%, var(--dc-lo)); box-shadow: inset 0 calc(var(--size) * -.06) 0 var(--dc-lo), 0 calc(var(--size) * .08) calc(var(--size) * .16) #0007; }
[data-depth="shallow"] { --dc: var(--d-shallow); --dc-lo: var(--d-shallow-lo); }
[data-depth="deep"] { --dc: var(--d-deep); --dc-lo: var(--d-deep-lo); }
[data-depth="deepest"] { --dc: var(--d-deepest); --dc-lo: var(--d-deepest-lo); }
.face-svg { width: 100%; height: 100%; }
.face-bone { fill: #fffaf0; stroke: #8a7a5c; stroke-width: 1.2; }
.face-rock { fill: #8d8f96; stroke: #3c3e44; stroke-width: 1.6; }
.face-rock .rock-shine { stroke: #d9dbe0; stroke-width: 1.6; stroke-linecap: round; }
.face-dirt { fill: #5a3a1e; }
[data-depth="shallow"] .face-dirt { fill: #8a6236; }
.face-art { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.face-art.squirrel { transform: scale(1.15); }
.die.pickable { cursor: pointer; }
.die.pickable:hover { --lift: -4px; }
.die.picked { --lift: calc(var(--size) * -.16); box-shadow: 0 0 0 3px var(--gold), 0 0 18px #ffd166aa, 0 calc(var(--size) * .2) calc(var(--size) * .22) #0007; }
.tray .die.gone { pointer-events: none; opacity: 0; }
.mini-face { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 2px; border-radius: 5px; background: var(--dc, #ffffff22); }
.mini-face.gold { background: #6b5212; }

/* the tally under the felt */
.tally { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 14px; min-height: 30px; font: 700 15px var(--round); }
.tally[hidden] { display: none; }
.tally b { color: var(--gold); font-weight: 900; font-size: 18px; font-variant-numeric: tabular-nums; }
.sel.bad { color: #ffb4ab; }
.sel.hint { opacity: .75; }
.haul, .strikes { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; background: #00000038; }
.haul-label { font: 800 11px var(--round); letter-spacing: .06em; text-transform: uppercase; opacity: .7; }
.haul-count { display: inline-flex; align-items: center; gap: 4px; }
.strike { display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 2px; border-radius: 6px; background: #ffffff10; opacity: .35; }
.strike.on { background: #7a1f14; opacity: 1; }

/* Dig: the scoop of dice to roll, and the three depths to fill it from */
.dig-box { display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(100%, 560px); }
.dig-box[hidden] { display: none; }
.scoop { display: flex; gap: 8px; }
.scoop-die { --size: calc(var(--u) * .7); display: grid; place-items: center; width: var(--size); height: var(--size); padding: 0; border: 0; border-radius: calc(var(--size) * .2); background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--dc) 70%, #fff), var(--dc) 60%, var(--dc-lo)); box-shadow: 0 4px 8px #0007; font: 900 15px var(--round); color: #fff; text-shadow: 0 1px 2px #000a; }
.scoop-die span { font-size: calc(var(--size) * .26); letter-spacing: -1px; white-space: nowrap; }
.scoop-die.empty { background: none; box-shadow: inset 0 0 0 2px #ffffff30; }
.scoop-die:not(.empty):hover:not(:disabled) { filter: brightness(1.15); }
.depths { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.depth { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 6px 9px; border: 2px solid color-mix(in srgb, var(--dc) 70%, transparent); border-radius: 14px; background: color-mix(in srgb, var(--dc-lo) 45%, #0008); }
.depth:hover:not(:disabled) { background: color-mix(in srgb, var(--dc) 40%, #0006); }
.depth:disabled { opacity: .72; }
.depth-name { font: 900 14px var(--round); }
.depth .depth-faces { flex-wrap: wrap; justify-content: center; }
.depth .mini-face { width: 24px; height: 24px; }
.depth-count { position: absolute; top: -8px; right: -6px; min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--gold); color: #3a2208; font: 900 13px/22px var(--round); }
.depth-count:empty { display: none; }

/* the buttons */
.acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.roll-btn, .bank-btn { min-width: 150px; min-height: 48px; font-size: 17px; }
.bank-btn { padding: 10px 20px; border: 2px solid #7cf29a99; border-radius: 12px; background: linear-gradient(#2c8a5a, #1d6a43); box-shadow: 0 4px 0 #0e3b24, 0 8px 20px #0006; color: #f2fff6; font: 900 17px var(--round); }
.bank-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #0e3b24; }
.bank-btn:disabled { filter: grayscale(.8); opacity: .5; }
.bank-btn.short { border-color: #e05a4f99; }
.roll-btn[hidden], .bank-btn[hidden] { display: none; }
.game.my-turn .roll-btn:not(:disabled) { animation: ready 1.4s ease-in-out infinite; }
.keys-hint { margin: 0; font-size: 11.5px; opacity: .5; text-align: center; }

/* the end of a game */
.over { position: absolute; inset: 0; z-index: 29; display: none; place-items: center; padding: calc(58px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px)); background: #000a; backdrop-filter: blur(2px); }
.over.on { display: grid; }
.over-card { display: flex; flex-direction: column; align-items: center; gap: 10px; width: min(500px, 100%); max-height: 100%; overflow: auto; padding: 18px 20px 18px; border: 2px solid #ffd16688; border-radius: 22px; background: linear-gradient(#143a2d, #0c2a1f); box-shadow: 0 20px 60px #000c; text-align: center; animation: pop .45s cubic-bezier(.2, 1.5, .4, 1); }
.over-art { width: min(240px, 60%); border-radius: 16px; box-shadow: 0 10px 24px #0009; }
.over-card h2 { margin: 0; font: 900 28px var(--round); color: var(--gold); }
.over-list { display: flex; flex-direction: column; gap: 6px; width: 100%; margin: 0; padding: 0; list-style: none; text-align: left; }
.over-list li { display: grid; grid-template-columns: 34px auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 14px; background: #ffffff0c; }
.over-list li.won { background: color-mix(in srgb, var(--gold) 16%, transparent); box-shadow: inset 0 0 0 1px #ffd16688; }
.over-list .avatar { width: 34px; height: 34px; }
.over-name { display: flex; flex-direction: column; min-width: 0; font: 800 14.5px var(--round); }
.over-name small { font: 600 11.5px system-ui; opacity: .75; }
.over-list b { font: 900 20px var(--round); color: var(--gold); }
.over-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }
.over-acts button:not(.primary), .over-acts a.button { padding: 10px 16px; border: 1px solid #ffffff2e; border-radius: 12px; background: #ffffff12; color: var(--ink); font: 700 14px var(--round); text-decoration: none; }
.over-acts .warn { color: #ffb4ab; border-color: #e05a4f80 !important; }

/* the front door */
.hero { position: relative; display: flex; align-items: center; justify-content: center; gap: 14px; width: 100%; }
.hero-emblem { width: 96px; height: 96px; border-radius: 26px; box-shadow: 0 0 0 4px #8a5a30, 0 10px 24px #0009; }
.hero-dice { display: flex; gap: 6px; }
.hero-dice .die { --size: 34px; animation: bob 2.2s ease-in-out infinite; }
.hero-dice .die:nth-child(2n) { animation-delay: .4s; }
.hero-dice .die:nth-child(3n) { animation-delay: .8s; }
.name-row { display: flex; align-items: center; gap: 10px; width: 100%; }
.name-row span { font-size: 13px; opacity: .8; }
.name-row input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid #ffffff38; border-radius: 12px; background: #00000055; color: var(--ink); font-size: 16px; user-select: text; -webkit-user-select: text; }
.modes { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.level-row { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 13px; }
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #00000040; text-align: left; }
.mode-art { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.mode-text { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 4px; }
.mode-text h2 { margin: 0; font: 900 22px var(--round); color: var(--gold); }
.mode-text p { margin: 0; font-size: 13px; line-height: 1.4; opacity: .9; }
.mode-text .link { align-self: flex-start; font-size: 12.5px; }
.mode-acts { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; margin-top: auto; }
.vs-btn { width: 100%; }
.friends-btn { width: 100%; padding: 9px 12px; border: 1px solid #ffffff38; border-radius: 12px; background: #ffffff14; font: 800 14px var(--round); }
.friends-btn:hover { background: #ffffff24; }
.mode-tag { padding: 0 7px; border-radius: 999px; background: #ffd16633; font-size: 10.5px; font-weight: 800; color: var(--gold); }
.board-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.mode-seg { align-self: flex-start; }
.tiles { grid-template-columns: repeat(5, 1fr); }
.home .screen-inner { width: min(100%, 560px); }

/* ——— motion ——— */
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(var(--tilt, 0deg)); } 50% { transform: translateY(-6px) rotate(var(--tilt, 0deg)); } }
@keyframes ready { 0%, 100% { box-shadow: 0 4px 0 #7a4a14, 0 0 0 #ffd16600; } 50% { box-shadow: 0 4px 0 #7a4a14, 0 0 22px #ffd166bb; } }
@keyframes banner { 0% { transform: translate(-50%, -50%) scale(.6); opacity: 0; } 15% { transform: translate(-50%, -50%) scale(1.06); opacity: 1; } 75% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -60%) scale(1); opacity: 0; } }
@keyframes say { from { scale: .7; opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .05s !important; }
}

/* ——— a phone, or any narrow window: the log goes into a drawer, the corgis tighten ——— */
@media (max-width: 860px) {
  .game { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "corgis" "stage"; }
  .log-btn { display: inline-block; }
  .log-panel { position: absolute; top: calc(52px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 31; width: min(340px, 88vw); margin: 0; background: #08201af4; box-shadow: 0 20px 50px #000a; transform: translateX(calc(100% + 28px)); visibility: hidden; transition: transform .25s, visibility 0s .25s; }
  .game.show-log .log-panel { transform: none; visibility: visible; transition: transform .25s; }
  .log-panel .drawer-x { display: block; }
  .goal { display: none; }
}
@media (max-width: 560px) {
  .topbar { gap: 6px; padding: 8px 10px 4px; }
  .code, .icon { height: 32px; padding: 0 10px; }
  .corgis { gap: 6px; padding: 2px 8px 4px; }
  .chip { min-width: 0; flex-basis: 140px; padding: 5px 8px 7px 6px; gap: 3px 8px; }
  .chip .avatar { width: 34px; height: 34px; }
  .chip-score { font-size: 19px; }
  .stage { padding: 2px 10px 14px; gap: 8px; }
  .felt { border-radius: 18px; }
  .roll-btn, .bank-btn { min-width: 0; flex: 1; }
  .acts { width: 100%; }
  .mode-cards { grid-template-columns: 1fr; }
  .mode-card { display: grid; grid-template-columns: 112px 1fr; }
  .mode-art { grid-row: span 2; height: 100%; aspect-ratio: auto; }
  .mode-acts { padding-top: 4px; }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .hero-emblem { width: 72px; height: 72px; border-radius: 20px; }
  .hero-dice { gap: 4px; }
  .hero-dice .die { --size: 28px; }
  .depth { padding: 7px 4px 8px; }
  .depth .mini-face { width: 19px; height: 19px; }
  .depth .depth-faces { gap: 2px; }
}
@media (pointer: coarse) {
  .keys-hint { display: none; }
  kbd { display: none; }
}
