/* Layout: one column — who is up, the players and their lives, the felt with the cup, the action in thumb reach */
:root {
  --bg: #17110e;
  --surface: #241a15;
  --surface-2: #2f231c;
  --line: #4a3a30;
  --accent: #ff6b2c;
  --accent-deep: #b8461c;
  --on-accent: #17110e;
  --focus: #ffbd4a;
  --text: #f7ede1;
  --muted: #b5a191;
  --bust: #b8332b;
  --on-bust: #ffffff;
  --danger-text: #ff9a8f;
  --gold: #ffd54f;
  --on-gold: #2b1d14;
  --glow: rgba(255, 107, 44, .16);
  --paper: #f3e7cf;
  --ink: #2b1d14;
  --life: #f3e7cf;
  --life-off: #4a3a30;
  --felt: #1d5a3f;
  --felt-deep: #113a28;
  --felt-rim: #5a3a22;
  --die: #fbf7ef;
  --die-shade: #d9cfbe;
  --pip: #241813;
  --cup: #8a4824;
  --cup-dark: #3e1d0c;
  --cup-rim: #6a3416;
  --cup-stitch: #e7b980;
  --cup-shine: #d08a58;
  --cup-ear: #e7b980;
  --cup-face: #3e1d0c;
  --cup-shadow: rgba(0, 0, 0, .35);
  --scrim: rgba(8, 5, 4, .6);
  --shadow: rgba(0, 0, 0, .45);
  --display: 'Bagel Fat One', 'Arial Black', system-ui, sans-serif;
  --body: 'Rethink Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh;
  background: radial-gradient(130% 55% at 50% 105%, var(--glow), transparent 62%), var(--bg);
  color: var(--text); font-family: var(--body); font-size: 16px; line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, h4, p { margin: 0; }
#app {
  max-width: 560px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 112px;
  display: grid; gap: 12px;
}
.eyebrow, .label { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }

/* ---------- buttons and controls ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; width: 100%; min-height: 52px; padding: 0 18px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; font-size: 17px;
}
.btn:active { transform: translateY(2px); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 3px 0 var(--accent-deep); }
.btn.ghost { background: var(--surface); color: var(--text); border: 1.5px solid var(--line); }
.btn.bust { background: var(--bust); color: var(--on-bust); }
.btn.text { background: transparent; color: var(--muted); min-height: 44px; }
.btn.big { min-height: 58px; font-family: var(--display); font-weight: 400; font-size: 21px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.two .btn.big { font-size: 18px; padding: 0 10px; }
.icon-btn { appearance: none; flex: none; width: 46px; height: 46px; border-radius: 14px; cursor: pointer; border: 1.5px solid var(--line); background: var(--surface); display: grid; place-items: center; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.segmented { display: inline-flex; flex: none; gap: 2px; padding: 3px; border-radius: 12px; background: var(--bg); }
.segmented button { appearance: none; border: 0; cursor: pointer; min-height: 40px; padding: 0 12px; border-radius: 9px; background: none; color: var(--muted); font-weight: 700; font-size: 15px; }
.segmented button[aria-checked="true"] { background: var(--accent); color: var(--on-accent); }
.stepper { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg); }
.stepper button { appearance: none; width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--surface-2); font-size: 24px; font-weight: 700; cursor: pointer; }
.stepper button:disabled { opacity: .3; cursor: default; }
.stepper output { width: 36px; text-align: center; font-family: var(--display); font-size: 24px; }

/* ---------- avatars ---------- */
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--pc); color: var(--on-accent); font-weight: 800; }
.avatar.pic { padding: 0; overflow: hidden; }
.avatar.pic svg { display: block; width: 100%; height: 100%; }
.avatar.avatar-btn { appearance: none; border: 0; padding: 0; cursor: pointer; position: relative; overflow: visible; width: 44px; height: 44px; }
.avatar-btn svg { border-radius: 50%; }
.avatar-btn::after {
  content: ""; position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4L19 9l-4-4L4 16z'/%3E%3C/svg%3E") center / 11px no-repeat;
  box-shadow: 0 0 0 2px var(--surface);
}
.avatar.big-avatar { width: 112px; height: 112px; font-size: 44px; box-shadow: 0 0 0 4px var(--pc); }
.picker-head { margin: 4px 0 0; font-family: var(--display); font-weight: 400; font-size: 18px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 12px 6px; }
.picker-item { appearance: none; border: 0; background: none; cursor: pointer; display: grid; justify-items: center; gap: 4px; padding: 4px 0; border-radius: 12px; }
.picker-item .avatar { width: 52px; height: 52px; }
.picker-item.on .avatar { box-shadow: 0 0 0 3px var(--focus); }
.picker-name { font-size: 11.5px; line-height: 1.2; text-align: center; color: var(--muted); }
.picker-item.on .picker-name { font-weight: 700; color: var(--text); }

/* ---------- setup ---------- */
.setup { display: grid; gap: 14px; padding-top: 18px; }
.back-link { justify-self: start; display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; margin-bottom: -10px; color: var(--muted); font-weight: 700; text-decoration: none; }
.hero { display: grid; gap: 6px; }
.hero h1 { font-family: var(--display); font-weight: 400; font-size: clamp(52px, 15vw, 68px); line-height: 1; }
.hero p { color: var(--muted); max-width: 34ch; }
.box { background: var(--surface); border-radius: 18px; padding: 16px; display: grid; gap: 12px; }
.box h2 { font-size: 17px; font-weight: 800; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice {
  appearance: none; cursor: pointer; text-align: left; min-height: 78px; padding: 12px; border-radius: 14px;
  border: 1.5px solid var(--line); background: none; display: grid; align-content: start; gap: 4px;
}
.choice strong { font-size: 16px; }
.choice span { font-size: 13.5px; color: var(--muted); }
.choice[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.names { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.names li { display: flex; align-items: center; gap: 10px; }
.names input {
  flex: 1; min-width: 0; height: 48px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--bg); color: var(--text); padding: 0 14px; font: inherit; font-size: 17px; font-weight: 600;
}
.names input::placeholder { color: var(--muted); font-weight: 400; }

/* ---------- top bar and players ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 6;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-block: 12px 6px; background: linear-gradient(var(--bg) 80%, transparent);
}
.turn { display: flex; align-items: center; gap: 10px; min-width: 0; }
.turn-text { display: grid; min-width: 0; }
.turn-name { font-family: var(--display); font-size: 26px; line-height: 1.05; color: var(--pc); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 8px; flex: none; }
.strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.strip-item {
  position: relative; min-width: 0; padding: 7px 4px 6px; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--surface);
  display: grid; justify-items: center; gap: 3px; transition: opacity .3s ease;
}
.strip-item .avatar { width: 32px; height: 32px; font-size: 14px; }
.strip-item.on { border-color: var(--pc); box-shadow: inset 0 0 0 1.5px var(--pc); }
.strip-item.out { opacity: .42; }
.strip-item.out .avatar { filter: grayscale(1); }
.strip-item.hit { animation: shake .5s ease 2; }
.strip-name { max-width: 100%; font-weight: 700; font-size: 13px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lives { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; max-width: 72px; }
.lives i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--life-off); }
.lives i.on { background: var(--life); border-color: var(--life); }
.lives.art i { width: 11px; height: 11px; border: 0; border-radius: 0; opacity: .25; filter: grayscale(1); }
.lives.art i.on { background: none; opacity: 1; filter: none; }
.lives.art svg { display: block; width: 100%; height: 100%; }
.lives i.losing { animation: lose 1.4s ease both; }
.res { max-width: 100%; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 800; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--surface-2); color: var(--text); }
.res.mex { background: var(--gold); color: var(--on-gold); }
.res.gone { background: none; color: var(--muted); }
.minus { position: absolute; top: 3px; right: 3px; padding: 1px 7px; border-radius: 999px; font-size: 13px; font-weight: 800; line-height: 1.5; background: var(--bust); color: var(--on-bust); animation: pop-in .4s cubic-bezier(.2, 1.6, .4, 1) both; }

/* ---------- stage ---------- */
.stage { display: grid; gap: 12px; }
.status { background: var(--surface); border-radius: 16px; padding: 12px 14px; display: grid; gap: 6px; color: var(--muted); }
.status b { color: var(--text); }
.limit b { color: var(--focus); }
.said { color: var(--focus) !important; font-family: var(--display); font-weight: 400; font-size: 1.15em; }

.cup-area { background: var(--surface); border-radius: 22px; padding: 10px 10px 14px; display: grid; gap: 6px; justify-items: center; text-align: center; }
.felt {
  position: relative; width: 100%; height: 220px; border-radius: 16px; overflow: hidden;
  display: grid; place-items: center;
  background: radial-gradient(120% 90% at 50% 40%, var(--felt), var(--felt-deep));
  box-shadow: inset 0 0 0 6px var(--felt-rim), inset 0 6px 22px rgba(0, 0, 0, .35);
}
.dice { display: flex; gap: 18px; justify-content: center; }
.die {
  width: 88px; height: 88px; border-radius: 22%; padding: 13%;
  background: var(--die); box-shadow: inset 0 -5px 0 var(--die-shade), 0 6px 0 rgba(0, 0, 0, .3), 0 10px 18px rgba(0, 0, 0, .3);
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
}
.die i { margin: 14%; border-radius: 50%; }
.die i.on { background: var(--pip); }
.dice.land .die { animation: land .42s cubic-bezier(.2, 1.5, .4, 1) both; }
.dice.land .die + .die { animation-delay: .06s; }
.cup {
  position: absolute; left: 50%; bottom: 6px; width: 236px; height: auto; translate: -50% 0;
  transition: transform .4s cubic-bezier(.3, 1.3, .5, 1), opacity .3s ease; transform-origin: 50% 90%;
  pointer-events: none;
}
.cup-area.lifted .cup { transform: translateY(-190px) rotate(-8deg); opacity: 0; }
.cup-area.covered .dice { visibility: hidden; }
.cup-area.peek .dice { visibility: visible; }
.cup-area.peek .cup { transform: translateY(-122px) rotate(-14deg); }
.cup-area.rolling .cup { animation: rattle .16s ease-in-out infinite; }
.throw-name { font-family: var(--display); font-weight: 400; font-size: 38px; line-height: 1.1; min-height: 42px; }
.throw-name.mex { color: var(--gold); }
.throw-name.rolling-text { color: var(--muted); font-size: 26px; }
.cup-sub { color: var(--muted); }
.cup-sub b { color: var(--text); }

.peek-btn {
  background: var(--surface-2); color: var(--text); border: 2px dashed var(--line);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.peek-btn svg { width: 26px; height: 26px; flex: none; }
.peek-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-style: solid; border-color: var(--accent); }

.picker-box { background: var(--surface); border-radius: 18px; padding: 14px; display: grid; gap: 12px; }
.pick-title { font-size: 16px; font-weight: 800; }
.pick-title .said { font-size: 1.2em; }
.used-row { color: var(--muted); font-weight: 700; }
.throw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.throw-btn {
  appearance: none; cursor: pointer; min-height: 50px; padding: 0 4px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface-2); color: var(--text);
  font-family: var(--display); font-size: 19px; line-height: 1.05;
}
.throw-btn.double { font-size: 15px; }
.throw-btn.mex { background: var(--gold); color: var(--on-gold); border-color: var(--gold); grid-column: span 2; font-size: 22px; }
.throw-btn:active { transform: translateY(2px); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  appearance: none; cursor: pointer; min-height: 48px; padding: 4px 14px 4px 4px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--surface-2); display: inline-flex; align-items: center; gap: 8px; font-weight: 700;
}
.chip .avatar { width: 36px; height: 36px; }
.chip.on { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 22%, var(--surface)); }

.summary { background: var(--surface); border-radius: 18px; padding: 14px; display: grid; gap: 10px; }
.sum-title { font-family: var(--display); font-weight: 400; font-size: 26px; }
.sum-head { font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.results li { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 6px 12px 6px 6px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid transparent; }
.results .avatar { width: 36px; height: 36px; }
.results li.low { border-color: var(--bust); background: color-mix(in srgb, var(--bust) 26%, var(--surface)); }
.r-name { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-val { font-family: var(--display); font-size: 22px; }
.results li.mex .r-val { color: var(--gold); }
.verdict { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.verdict b:first-child { color: var(--pc, var(--text)); }
.verdict.loss { box-shadow: inset 4px 0 0 var(--bust); animation: pop .3s ease; }
.verdict.tie { box-shadow: inset 4px 0 0 var(--focus); }
.verdict.tie b:first-child { color: var(--focus); }
.stage > .verdict { background: var(--surface); }

.claim { background: var(--surface); border-radius: 18px; padding: 16px; display: grid; gap: 4px; justify-items: center; text-align: center; }
.claim-val { font-family: var(--display); font-weight: 400; font-size: 64px; line-height: 1; color: var(--focus); }
.claim-val.mex { color: var(--gold); }
.claim-note { color: var(--muted); max-width: 34ch; }
.claim-note b { color: var(--text); }

/* ---------- handoff ---------- */
body.is-handoff #app { padding-bottom: 0; }
.handoff {
  appearance: none; border: 0; cursor: pointer; position: fixed; inset: 0; z-index: 15;
  display: grid; align-content: center; justify-items: center; gap: 18px; text-align: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
  background: radial-gradient(80% 60% at 50% 40%, color-mix(in srgb, var(--pc) 22%, var(--bg)), var(--bg));
  color: var(--text);
}
.handoff .eyebrow { color: var(--focus); font-size: 13px; }
.handoff-text { font-family: var(--display); font-size: clamp(30px, 9vw, 44px); line-height: 1.1; max-width: 16ch; }
.handoff-text b { font-weight: 400; color: var(--pc); }
.handoff-tap { color: var(--muted); font-weight: 700; animation: breathe 2s ease-in-out infinite; }

/* ---------- action bar ---------- */
.action-bar {
  position: fixed; z-index: 8; left: 50%; translate: -50% 0;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  width: min(calc(100% - 2 * max(16px, env(safe-area-inset-left, 0px))), 528px);
}
.action-bar:empty { display: none; }
.action-bar .btn { box-shadow: 0 3px 0 var(--accent-deep), 0 10px 30px var(--shadow); }
.action-bar .btn.ghost { box-shadow: 0 10px 30px var(--shadow); }
.action-bar .btn.bust { box-shadow: 0 3px 0 color-mix(in srgb, var(--bust) 60%, black), 0 10px 30px var(--shadow); }

/* ---------- end ---------- */
.end { display: grid; gap: 16px; padding-top: 26px; }
.end-hero { display: grid; gap: 8px; justify-items: center; text-align: center; }
.end-hero .big-avatar { animation: pop-in .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.end-hero h1 { font-family: var(--display); font-weight: 400; font-size: clamp(34px, 10vw, 48px); line-height: 1.05; color: var(--focus); }
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rank li { display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 10px; border-radius: 16px; background: var(--surface); }
.rank li.first { box-shadow: inset 0 0 0 1.5px var(--focus); }
.rank .place { width: 22px; text-align: center; font-family: var(--display); font-size: 20px; color: var(--muted); }
.rank .p-name { flex: 1; min-width: 0; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank .lives { max-width: 120px; }
.end-actions { display: grid; gap: 8px; }

/* ---------- sheets, modal, toast ---------- */
.backdrop { position: fixed; inset: 0; z-index: 20; background: var(--scrim); animation: fade .2s ease; }
.sheet {
  position: fixed; z-index: 21; bottom: 0; left: 50%; translate: -50% 0; width: min(100%, 560px); max-height: 86%; overflow-y: auto;
  border-radius: 22px 22px 0 0; background: var(--surface); display: grid; gap: 14px;
  padding-top: 10px; padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px));
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 40px var(--shadow); animation: rise .25s cubic-bezier(.2, .9, .3, 1);
}
.grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line); justify-self: center; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h3 { font-family: var(--display); font-weight: 400; font-size: 24px; }
.close-btn { appearance: none; border: 0; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); cursor: pointer; display: grid; place-items: center; }
.close-btn svg { width: 18px; height: 18px; }
.menu-list { display: grid; gap: 6px; }
.menu-item {
  appearance: none; border: 0; cursor: pointer; width: 100%; min-height: 54px; padding: 0 14px; border-radius: 14px;
  background: var(--surface-2); text-align: left; font-weight: 700; font-size: 16.5px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.menu-item.static { cursor: default; padding-block: 8px; }
.menu-item.danger { color: var(--danger-text); }
.toggle-row { appearance: none; border: 0; padding: 0; background: none; cursor: pointer; width: 100%; text-align: left; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.toggle-row > span:first-child { display: grid; gap: 2px; }
.toggle-row strong { font-size: 17px; font-weight: 800; }
.toggle-row .muted { font-size: 14px; }
.switch { flex: none; width: 52px; height: 32px; border-radius: 999px; position: relative; background: var(--line); transition: background .2s ease; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--text); transition: transform .2s ease; }
[aria-checked="true"] .switch { background: var(--accent); }
[aria-checked="true"] .switch::after { transform: translateX(20px); }
.rules { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.rules b, .sheet .muted b { color: var(--focus); }
.ladder { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 2px; font-weight: 800; font-size: 14px; }
.ladder span { padding: 2px 6px; border-radius: 8px; background: var(--surface-2); }
.ladder span.mex { background: var(--gold); color: var(--on-gold); }
.ladder i { font-style: normal; color: var(--muted); }
.modal-backdrop { position: fixed; inset: 0; z-index: 40; background: var(--scrim); animation: fade .2s ease; }
.modal {
  position: fixed; z-index: 41; left: 50%; top: 50%; translate: -50% -50%; width: min(calc(100% - 48px), 360px);
  padding: 20px; border-radius: 20px; background: var(--surface); box-shadow: 0 20px 60px var(--shadow);
  display: grid; gap: 10px; animation: pop .2s ease;
}
.modal h3 { font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1.1; }
.modal p { color: var(--muted); }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.modal-actions .btn { min-height: 48px; font-size: 16px; padding: 0 10px; }
.toast {
  position: fixed; z-index: 30; left: 50%; translate: -50% 0; bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  width: min(calc(100% - 32px), 528px); display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 16px; background: var(--paper); color: var(--ink);
  box-shadow: 0 12px 30px var(--shadow); font-weight: 600; font-size: 15px;
}
.toast span { flex: 1; min-width: 0; }
body.is-handoff .toast { display: none; }

@media (orientation: landscape) and (min-width: 640px) {
  #app {
    max-width: 1100px; padding-bottom: 92px;
    grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); column-gap: 18px; align-items: start;
  }
  #app > .topbar, #app > .setup, #app > .end { grid-column: 1 / -1; }
  #app > .strip { grid-column: 1; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
  #app > .status { grid-column: 1; }
  #app > .stage { grid-column: 2; grid-row: 2 / span 3; }
  .stage.split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .stage.split > .picker-box, .stage.split > .claim { grid-column: 2; grid-row: 1 / span 3; }
  .stage.split > .cup-area, .stage.split > .peek-btn { grid-column: 1; }
  .claim-val { font-size: 52px; }
  .throw-name { font-size: 30px; min-height: 34px; }
  #app > .action-bar { left: max(16px, env(safe-area-inset-left, 0px)); translate: none; width: min(320px, calc(40% - 16px)); }
  .felt { height: 150px; }
  .die { width: 66px; height: 66px; }
  .cup { width: 180px; }
  .cup-area.lifted .cup { transform: translateY(-150px) rotate(-8deg); }
  .cup-area.peek .cup { transform: translateY(-92px) rotate(-14deg); }
  .setup, .end { max-width: 560px; justify-self: center; width: 100%; }
  .handoff { grid-template-columns: auto auto; column-gap: 28px; align-content: center; justify-content: center; }
  .handoff .eyebrow, .handoff-tap { grid-column: 1 / -1; }
  .handoff .big-avatar { grid-row: 2; }
  .handoff-text { grid-row: 2; text-align: left; }
  .toast { left: auto; right: max(16px, env(safe-area-inset-right, 0px)); translate: none; width: min(420px, 55%); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
}

@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-4px) rotate(-2deg); } 40% { transform: translateX(4px) rotate(2deg); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
@keyframes lose { 0% { transform: scale(1); background: var(--life); border-color: var(--life); opacity: 1; filter: none; } 25% { transform: scale(1.9); background: var(--bust); border-color: var(--bust); opacity: 1; filter: none; } 100% { transform: scale(1); } }
@keyframes pop-in { from { transform: scale(.3); opacity: 0; } }
@keyframes land { from { transform: translateY(-36px) rotate(-30deg); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes rattle { 0%, 100% { transform: rotate(-5deg) translateX(-6px); } 50% { transform: rotate(5deg) translateX(6px) translateY(-4px); } }
@keyframes breathe { 50% { opacity: .55; } }
@keyframes rise { from { translate: -50% 30px; opacity: 0; } to { translate: -50% 0; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; scale: .95; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
