/* Layout: one column — the roll, extras, the score card with its five areas, totals, the roll button 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;
  --glow: rgba(255, 107, 44, .16);
  --shade: rgba(8, 5, 4, .6);
  --shadow: rgba(0, 0, 0, .55);
  --player: #ffd54f;
  --on-player: #17110e;
  --paper: #f3e7cf;
  --paper-ink: #2b1d14;
  --paper-muted: #574436;
  --paper-line: rgba(43, 29, 20, .22);
  --cell: #fffaf0;
  --mark: #2b1d14;
  --got: #c8174f;
  --on-got: #ffffff;
  --got-tint: rgba(200, 23, 79, .14);
  --fox: #e2662b;
  --fox-cheek: #fffaf0;
  --fox-line: #2b1d14;
  --die-white: #fbf7ef;
  --pip-dark: #241813;
  --pip-light: #ffffff;
  --yellow: #f2c230; --yellow-ink: #2b1d14; --yellow-num: #7a5a00;
  --blue: #2a5fc0; --blue-ink: #ffffff; --blue-num: #1f4fa8;
  --green: #267a40; --green-ink: #ffffff; --green-num: #1f6e38;
  --orange: #ec7a1c; --orange-ink: #2b1d14; --orange-num: #9c4200;
  --purple: #7d3fb8; --purple-ink: #ffffff; --purple-num: #6a2ea3;
  --tint: 22%;
  --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; overflow-x: hidden;
  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: 14px;
}
.eyebrow, .label { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- 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; }
.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 { min-width: 52px; text-align: center; font-family: var(--display); font-size: 24px; }
.stepper output small { font-size: 15px; color: var(--muted); }

/* ---------- avatars ---------- */
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--player); color: var(--on-player); 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);
}
.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 { 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 ---------- */
.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 8px; 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(--player); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 8px; flex: none; }

/* ---------- roll ---------- */
.status { background: var(--surface); border-radius: 16px; padding: 12px 14px; display: grid; gap: 10px; }
.status p { color: var(--muted); }
.status b { color: var(--text); }
.dice-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.die {
  width: 42px; height: 42px; border-radius: 22%; padding: 6px;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), 0 2px 0 rgba(0, 0, 0, .35);
}
.die i { margin: 16%; border-radius: 50%; }
.die-white { background: var(--die-white); }
.die-yellow { background: var(--yellow); }
.die-blue { background: var(--blue); }
.die-green { background: var(--green); }
.die-orange { background: var(--orange); }
.die-purple { background: var(--purple); }
.die-white i.on, .die-yellow i.on, .die-orange i.on { background: var(--pip-dark); }
.die-blue i.on, .die-green i.on, .die-purple i.on { background: var(--pip-light); }
.dice-row.rolling .die { animation: tumble .3s ease-in-out infinite; }

/* ---------- extras ---------- */
.extras { background: var(--surface); border-radius: 16px; padding: 12px 14px; display: grid; gap: 10px; }
.ex-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.tokens, .fox-count { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.none { color: var(--muted); font-size: 14px; }
.token {
  appearance: none; cursor: pointer; position: relative; width: 44px; height: 44px; padding: 0; border-radius: 12px;
  border: 2px solid var(--got); background: var(--cell); color: var(--paper-ink); display: grid; place-items: center;
}
.token .rw-icon svg { width: 22px; height: 22px; display: block; }
.token .rw-icon b { font-size: 16px; }
.token.used { border-color: var(--line); }
.token.used .rw-icon { opacity: .3; }
.token .mark { position: absolute; inset: 8%; width: 84%; height: 84%; }
.rounds { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(36px, 1fr)); gap: 6px; }
.rounds li { display: grid; justify-items: center; align-content: start; gap: 5px; padding: 6px 2px 8px; border-radius: 12px; background: var(--surface-2); min-height: 62px; }
.rounds li.now { box-shadow: inset 0 0 0 2px var(--accent); }
.rounds li.past .round-no { color: var(--muted); }
.round-no { font-weight: 800; font-size: 14px; }

/* ---------- rewards ---------- */
.rw {
  --rw-bg: var(--cell); --rw-ink: var(--paper-ink);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 5px; flex: none;
  min-width: 28px; height: 28px; padding: 0 3px; border-radius: 8px;
  background: var(--rw-bg); color: var(--rw-ink); box-shadow: inset 0 0 0 1px var(--paper-line);
  font-weight: 800; font-size: 14px; line-height: 1; --mark: var(--rw-ink);
}
.rw-icon { display: grid; place-items: center; }
.rw-icon svg { width: 20px; height: 20px; display: block; }
.rw-icon b { font-family: var(--body); font-weight: 800; }
.rw-label { padding-right: 4px; font-size: 13px; }
.rw-yellow { --rw-bg: var(--yellow); --rw-ink: var(--yellow-ink); }
.rw-blue { --rw-bg: var(--blue); --rw-ink: var(--blue-ink); }
.rw-green { --rw-bg: var(--green); --rw-ink: var(--green-ink); }
.rw-orange { --rw-bg: var(--orange); --rw-ink: var(--orange-ink); }
.rw-purple { --rw-bg: var(--purple); --rw-ink: var(--purple-ink); }
.rw.got { box-shadow: 0 0 0 2.5px var(--got); }
.rw.got::after {
  content: "✓"; position: absolute; top: -7px; right: -7px; width: 15px; height: 15px; border-radius: 50%;
  display: grid; place-items: center; background: var(--got); color: var(--on-got); font-family: var(--body); font-size: 10px; font-weight: 800;
}
.fox-mini svg { width: 18px; height: 18px; display: block; }

/* ---------- score card ---------- */
.card {
  background: var(--paper); border-radius: 18px; padding: 8px;
  display: grid; gap: 8px; color: var(--paper-ink);
  box-shadow: 0 12px 30px -18px rgba(0, 0, 0, .7);
}
.area-yellow { --area: var(--yellow); --area-ink: var(--yellow-ink); --area-num: var(--yellow-num); }
.area-blue { --area: var(--blue); --area-ink: var(--blue-ink); --area-num: var(--blue-num); }
.area-green { --area: var(--green); --area-ink: var(--green-ink); --area-num: var(--green-num); }
.area-orange { --area: var(--orange); --area-ink: var(--orange-ink); --area-num: var(--orange-num); }
.area-purple { --area: var(--purple); --area-ink: var(--purple-ink); --area-num: var(--purple-num); }
.area {
  min-width: 0; display: grid; gap: 6px; padding: 6px 8px 8px; border-radius: 14px;
  background: color-mix(in srgb, var(--area) var(--tint), var(--paper));
}
.area-head { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.area-head h2 { padding: 3px 10px; border-radius: 8px; background: var(--area); color: var(--area-ink); font-size: 14px; font-weight: 800; letter-spacing: .02em; }
.area-note { flex: 1; min-width: 0; font-size: 12px; font-weight: 600; color: var(--paper-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.area-score { margin-left: auto; min-width: 42px; padding: 2px 8px; border-radius: 8px; background: var(--cell); color: var(--area-num); text-align: center; font-family: var(--display); font-size: 19px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)) 50px; gap: 5px; }
.cell, .box-cell {
  appearance: none; border: 0; padding: 0; cursor: pointer; position: relative; min-width: 0;
  display: grid; place-items: center; border-radius: 9px;
  background: var(--cell); color: var(--area-num);
  font-family: var(--display); font-size: 21px; line-height: 1;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .08);
}
.cell { height: 50px; }
.cell .mark, .box-cell .mark { position: absolute; inset: 8%; width: 84%; height: 84%; pointer-events: none; }
.cell.marked .num { opacity: .3; }
.cell.printed { cursor: default; background: color-mix(in srgb, var(--area) 30%, var(--cell)); }
.cell.printed .mark { opacity: .55; }
.cell.corner { cursor: default; background: none; box-shadow: none; color: var(--paper-muted); font-family: var(--body); text-align: center; }
.cell.corner small { font-size: 11px; font-weight: 700; line-height: 1.15; }
.slot { min-width: 0; min-height: 34px; display: grid; place-items: center; border-radius: 9px; }
.slot.got { background: var(--got-tint); }
.col-slot.pts { background: var(--cell); color: var(--area-num); font-family: var(--display); font-size: 17px; }
.col-slot.pts.got { background: var(--area); color: var(--area-ink); box-shadow: 0 0 0 2.5px var(--got); }
.diag-slot { display: flex; gap: 2px; justify-content: center; }
.diag-arrow { font-weight: 800; color: var(--paper-muted); }
.track { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 11px 5px; }
.box-cell { height: 54px; }
.box-cell .min { font-size: 17px; }
.box-cell .val { font-size: 25px; }
.box-cell .mult { position: absolute; top: 3px; left: 5px; font-family: var(--body); font-size: 12px; font-weight: 800; color: var(--area-num); }
.box-cell.filled .min { opacity: .3; }
.box-cell.next { box-shadow: inset 0 0 0 2px var(--area-num); }
.box-cell .badge { position: absolute; right: 2px; bottom: -8px; min-width: 20px; height: 20px; padding: 0 2px; border-radius: 6px; font-size: 11.5px; }
.box-cell .badge .rw-icon svg { width: 15px; height: 15px; }
.box-cell .badge.got::after { top: -6px; right: -6px; width: 13px; height: 13px; font-size: 9px; }
.box-cell .badge.got { box-shadow: 0 0 0 2px var(--got); }
.ptable { display: grid; grid-template-columns: repeat(auto-fit, minmax(24px, 1fr)); gap: 2px; }
.ptable span { display: grid; justify-items: center; padding: 2px 0; border-radius: 6px; font-variant-numeric: tabular-nums; }
.ptable i { font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--paper-muted); }
.ptable b { font-size: 13px; color: var(--paper-ink); }
.ptable .on { background: var(--area); }
.ptable .on i, .ptable .on b { color: var(--area-ink); }
.ptable .past b { color: var(--paper-muted); }
@media (orientation: landscape) and (min-width: 640px) {
  #app {
    max-width: 1100px; padding-bottom: 92px;
    grid-template-columns: minmax(230px, 260px) minmax(0, 1fr); grid-auto-flow: row dense;
    column-gap: 16px; align-items: start;
  }
  #app > .topbar, #app > .setup, #app > .end { grid-column: 1 / -1; }
  #app > .card { grid-column: 2; grid-row: 2 / span 4; }
  #app > .status, #app > .extras, #app > .scorebar, #app > .action-bar { grid-column: 1; }
  #app > .action-bar { left: max(16px, env(safe-area-inset-left, 0px)); translate: none; width: 260px; }
  .card { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .kind-track { grid-column: 1 / -1; }
  .track { grid-template-columns: repeat(11, minmax(0, 1fr)); }
  .grid { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)) 44px; }
  .cell { height: 44px; font-size: 18px; }
  .box-cell { height: 48px; }
  .box-cell .val { font-size: 21px; }
  .box-cell .min { font-size: 15px; }
  .die { width: 30px; height: 30px; padding: 4px; }
  .dice-row { gap: 5px; flex-wrap: nowrap; }
  .setup, .end { max-width: 560px; justify-self: center; width: 100%; }
}

/* ---------- score bar ---------- */
.scorebar { background: var(--surface); border-radius: 16px; padding: 12px 14px; display: grid; gap: 10px; }
.points { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.pt { min-width: 34px; text-align: center; padding: 4px 6px; border-radius: 8px; font-weight: 800; }
.pt-yellow { background: var(--yellow); color: var(--yellow-ink); }
.pt-blue { background: var(--blue); color: var(--blue-ink); }
.pt-green { background: var(--green); color: var(--green-ink); }
.pt-orange { background: var(--orange); color: var(--orange-ink); }
.pt-purple { background: var(--purple); color: var(--purple-ink); }
.pt-fox { display: inline-flex; align-items: center; gap: 4px; background: var(--cell); color: var(--paper-ink); }
.op { color: var(--muted); font-weight: 700; }
.sum { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.points .total { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1; }

/* ---------- 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 rgba(0, 0, 0, .45); }

/* ---------- end ---------- */
.end { display: grid; gap: 16px; padding-top: 26px; }
.end-hero { display: grid; justify-items: center; gap: 6px; text-align: center; }
.end-hero .avatar { width: 64px; height: 64px; }
.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; border-radius: 16px; background: var(--surface); }
.rank li strong { margin-left: auto; font-family: var(--display); font-weight: 400; font-size: 24px; font-variant-numeric: tabular-nums; }
.rank li .pt { min-width: 84px; }
.rank li.first { box-shadow: inset 0 0 0 1.5px var(--focus); }
.rank .total { font-size: 30px; }
.p-name { font-weight: 800; }
.end-actions { display: grid; gap: 8px; }

/* ---------- sheets, modal, toast ---------- */
.backdrop { position: fixed; inset: 0; z-index: 20; background: var(--shade); 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 rgba(0, 0, 0, .5); animation: rise .25s cubic-bezier(.2, .9, .3, 1);
}
.picker-sheet { display: grid; gap: 14px; }
.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; }
.pick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pick {
  appearance: none; border: 0; cursor: pointer; min-height: 84px; padding: 12px 6px; border-radius: 16px;
  background: var(--surface-2); display: grid; justify-items: center; align-content: center; gap: 6px;
}
.pick .die { width: 52px; height: 52px; padding: 8px; }
.pick-sum { font-weight: 800; font-size: 14px; color: var(--muted); }
.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: 10px; }
.rules b { color: var(--focus); }
.modal-backdrop { position: fixed; inset: 0; z-index: 40; background: var(--shade); 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 rgba(0, 0, 0, .6);
  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(--paper-ink);
  box-shadow: 0 12px 30px var(--shadow); font-weight: 600; font-size: 15px;
}
.toast span { flex: 1; min-width: 0; }

@keyframes tumble { 0% { transform: rotate(-16deg) translateY(-3px); } 50% { transform: rotate(14deg) translateY(3px); } 100% { transform: rotate(-16deg) translateY(-3px); } }
@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; }
}
