:root {
  --bg1: #120404;
  --bg2: #3a0a0a;
  --bg3: #5e1010;
  --accent: #e8b923;
  --accent2: #c0392b;
  --text: #fff6e0;
  --muted: color-mix(in srgb, var(--text) 62%, transparent);
  --panel: rgba(8, 8, 14, 0.55);
  --panel-strong: rgba(8, 8, 14, 0.82);
  --line: rgba(255, 255, 255, 0.13);
  --good: #3ddc84;
  --bad: #ff5f5f;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 15% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, color-mix(in srgb, var(--accent2) 26%, transparent), transparent 60%),
    linear-gradient(160deg, var(--bg1), var(--bg2) 55%, var(--bg3));
  background-attachment: fixed;
  line-height: 1.45;
  transition: background 0.6s;
}

#bgParticles {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 0.5em; line-height: 1.2; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- controls ---------- */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s, background 0.15s, box-shadow 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent2)));
  color: #111;
  border-color: transparent;
  box-shadow: 0 4px 18px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, var(--accent), var(--accent)); }
.btn-danger { background: rgba(255, 70, 70, 0.18); border-color: rgba(255, 90, 90, 0.45); }
.btn-danger:hover:not(:disabled) { background: rgba(255, 70, 70, 0.32); }
.btn-good { background: rgba(61, 220, 132, 0.2); border-color: rgba(61, 220, 132, 0.5); }
.btn-good:hover:not(:disabled) { background: rgba(61, 220, 132, 0.34); }
.btn-sm { padding: 5px 10px; font-size: 0.85rem; border-radius: 8px; }
.btn-icon { padding: 6px 10px; }
.btn-block { width: 100%; }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 11px;
  min-width: 0;
  max-width: 100%;
}
select option { background: #1b1b22; color: #eee; }
textarea { resize: vertical; width: 100%; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
label.field > input, label.field > select { color: var(--text); font-size: 1rem; }
label.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.chip.accent { background: color-mix(in srgb, var(--accent) 25%, transparent); border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.chip.good { background: rgba(61, 220, 132, 0.18); border-color: rgba(61, 220, 132, 0.45); }
.chip.bad { background: rgba(255, 95, 95, 0.18); border-color: rgba(255, 95, 95, 0.45); }

/* ---------- app shell ---------- */

.app { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: var(--panel-strong);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.brand { font-weight: 800; font-size: 1.15rem; letter-spacing: 0.3px; white-space: nowrap; }
.brand .theme-name { font-weight: 500; font-size: 0.8rem; color: var(--muted); margin-left: 6px; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 8px 13px;
  border-radius: 9px;
  font-weight: 600;
  white-space: nowrap;
}
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.nav a.active { color: #111; background: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.token-pill {
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 22%, rgba(0, 0, 0, 0.3));
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  white-space: nowrap;
}
.token-pill.bump { animation: bump 0.5s; }
@keyframes bump { 40% { transform: scale(1.25); } }

main { flex: 1; padding: 18px; width: 100%; max-width: 1600px; margin: 0 auto; }
.page { display: none; }
.page.active { display: block; animation: fade-in 0.25s; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- wheel page ---------- */

.wheel-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}
.wheel-stage { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }
.wheel-canvas-wrap { position: relative; width: min(100%, calc(100vh - 240px), 760px); min-width: min(100%, 300px); aspect-ratio: 1; }
#wheelCanvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#wheelCanvas.dragging { cursor: grabbing; }
#wheelCanvas.locked { cursor: default; }
.pointer-label {
  min-height: 2.2em;
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  font-weight: 800;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spin-controls { display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(100%, 420px); }
.spin-btn {
  position: relative;
  overflow: hidden;
  font-size: 1.25rem;
  padding: 14px 40px;
  border-radius: 999px;
  width: 100%;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.spin-btn .charge {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: rgba(255, 255, 255, 0.45);
  pointer-events: none;
}
.spin-btn span { position: relative; }

.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: rgba(255, 255, 255, 0.06); border-radius: 10px; padding: 8px 10px; }
.stat b { display: block; font-size: 1.3rem; }
.stat span { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }

.pending-card {
  border: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, rgba(0, 0, 0, 0.5));
  border-radius: var(--radius);
  padding: 14px;
  animation: glow 2s infinite;
}
.pending-card .title { font-size: 1.35rem; font-weight: 800; margin: 4px 0 10px; }
@keyframes glow { 50% { box-shadow: 0 0 26px color-mix(in srgb, var(--accent) 55%, transparent); } }

.feed { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; }
.feed .item { padding: 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); }
.feed .item time { color: var(--muted); font-size: 0.75rem; margin-right: 6px; }
.online { display: flex; gap: 6px; flex-wrap: wrap; }
.online .chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }

.side-section + .side-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

@media (max-width: 1250px) {
  .wheel-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .wheel-layout .left { grid-column: 1 / -1; order: 3; }
}
@media (max-width: 860px) {
  .wheel-layout { grid-template-columns: minmax(0, 1fr); }
  .wheel-layout .left { order: 2; }
  .wheel-layout .right { order: 3; }
  main { padding: 12px; }
  .topbar { flex-wrap: wrap; padding: 8px 12px; }
  .nav { order: 3; flex-basis: 100%; }
}

/* ---------- movies page ---------- */

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type="search"] { flex: 1; min-width: 200px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { background: transparent; border: 0; color: var(--muted); padding: 8px 12px; font: inherit; cursor: pointer; }
.seg button.active { background: var(--accent); color: #111; font-weight: 700; }

.add-form { display: grid; grid-template-columns: minmax(0, 2fr) 110px minmax(0, 2fr) auto; gap: 8px; margin-bottom: 14px; }
@media (max-width: 700px) { .add-form { grid-template-columns: 1fr 1fr; } .add-form .title-in, .add-form .notes-in { grid-column: 1 / -1; } }

.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
table.grid th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  padding: 8px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel-strong);
  cursor: default;
}
table.grid th.sortable { cursor: pointer; }
table.grid td { padding: 6px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); vertical-align: middle; }
table.grid tr:hover td { background: rgba(255, 255, 255, 0.04); }
table.grid tr.watched td.title-cell { opacity: 0.55; text-decoration: line-through; }
table.grid input.cell { width: 100%; background: transparent; border-color: transparent; padding: 5px 7px; }
table.grid input.cell:hover { border-color: var(--line); }
table.grid input.cell:focus { background: rgba(0, 0, 0, 0.4); border-color: var(--accent); }
.weight-ctl { display: inline-flex; align-items: center; gap: 2px; }
.weight-ctl input { width: 58px; text-align: center; padding: 5px 4px; }
.chance-bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; min-width: 60px; }
.chance-bar i { display: block; height: 100%; background: var(--accent); }
.status-select { padding: 5px 8px; }
.status-select.watched { border-color: rgba(61, 220, 132, 0.5); }
.status-select.partial { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }

.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  cursor: pointer;
}
.dropzone.over { border-color: var(--accent); background: rgba(255, 255, 255, 0.05); }

/* ---------- arcade ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.game-card { display: flex; flex-direction: column; gap: 10px; }
.game-card .icon { font-size: 3rem; line-height: 1; }
.game-card p { margin: 0; color: var(--muted); flex: 1; }
.game-stage { position: relative; display: flex; justify-content: center; }
.game-stage canvas { max-width: 100%; height: auto; border-radius: 12px; display: block; touch-action: none; }
.game-hud { display: flex; justify-content: space-between; gap: 12px; font-weight: 700; margin-bottom: 8px; }
.touch-pad { display: none; gap: 10px; justify-content: center; margin-top: 10px; }
.touch-pad .btn { flex: 1; font-size: 1.4rem; padding: 14px; }
@media (pointer: coarse) { .touch-pad { display: flex; } }

.shake { animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- title of the dead ---------- */

.dead { --dead-accent: var(--accent); display: flex; flex-direction: column; gap: 8px; }
.dead-stage {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  background: #050308;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 12px 40px rgba(0, 0, 0, 0.6);
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  font-family: ui-monospace, Menlo, Consolas, "Courier New", monospace;
}
.dead-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.dead-labels { position: absolute; inset: 0; pointer-events: none; transition: opacity 0.6s; }
.dead-labels.fade { opacity: 0; }

.dead-word {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 50% 100%;
  white-space: pre;
  padding: 5px 9px 6px;
  font: 700 16px/1 ui-monospace, Menlo, Consolas, "Courier New", monospace;
  letter-spacing: 0.02em;
  color: #f3efe6;
  background: rgba(6, 4, 10, 0.86);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.65);
  will-change: transform, opacity;
}
.dead-word::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  margin-left: -6px;
  border: 6px solid transparent;
  border-top-color: rgba(255, 255, 255, 0.25);
  border-bottom: 0;
}
.dead-word .done { color: var(--dead-accent); opacity: 0.75; }
.dead-word .next { text-decoration: underline; text-underline-offset: 3px; }
.dead-word.target {
  background: rgba(0, 0, 0, 0.95);
  border-color: var(--dead-accent);
  box-shadow: 0 0 0 1px var(--dead-accent), 0 0 18px color-mix(in srgb, var(--dead-accent) 55%, transparent);
}
.dead-word.target::after { border-top-color: var(--dead-accent); }
.dead-word.target .done { opacity: 1; }
.dead-word.target .next { text-decoration: none; color: #111; background: var(--dead-accent); border-radius: 2px; }
.dead-word.threat { background: rgba(48, 0, 0, 0.9); border-color: #ff4a3a; }
.dead-word.threat::after { border-top-color: #ff4a3a; }
.dead-word.pickup { background: rgba(0, 32, 14, 0.9); border-color: var(--good); }
.dead-word.pickup::after { border-top-color: var(--good); }
.dead-word.boss { font-size: 19px; border-color: #ff3b2f; }
.dead-word-count { margin-right: 10px; font-size: 0.7em; color: #ff6b5b; vertical-align: middle; }

.dead-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  pointer-events: none;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-shadow: 0 2px 4px #000, 0 0 2px #000;
}
.dead-hud-left, .dead-hud-right { display: flex; flex-direction: column; gap: 4px; }
.dead-hud-right { align-items: flex-end; }
.dead-lives span { font-size: 22px; margin-right: 2px; transition: filter 0.3s, opacity 0.3s; }
.dead-lives .out { filter: grayscale(1) brightness(0.35); opacity: 0.5; }
.dead-pips { display: inline-flex; gap: 2px; vertical-align: middle; }
.dead-pips i { width: 10px; height: 6px; border-radius: 2px; background: rgba(255, 255, 255, 0.22); }
.dead-pips i.on { background: var(--dead-accent); box-shadow: 0 0 6px var(--dead-accent); }
.dead-combo { letter-spacing: 0.08em; }
.dead-combo.hot { color: var(--dead-accent); }
.dead-acc, .dead-clock { opacity: 0.8; font-size: 12px; }
.dead-area {
  position: absolute;
  left: 14px;
  bottom: 10px;
  pointer-events: none;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.65);
  text-shadow: 0 1px 3px #000;
}

.dead-boss {
  position: absolute;
  top: 48px;
  left: 50%;
  width: min(60%, 420px);
  transform: translateX(-50%);
  pointer-events: none;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.25em;
  color: #ff6b5b;
  text-shadow: 0 1px 3px #000;
}
.dead-boss .bar { height: 10px; margin-top: 4px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.45); border-radius: 3px; background: rgba(0, 0, 0, 0.6); }
.dead-boss .bar i { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, #6d0000, #ff3b2f); transition: width 0.25s; }

.dead-banner { position: absolute; left: 0; right: 0; top: 36%; text-align: center; pointer-events: none; opacity: 0; }
.dead-banner.show { animation: dead-banner 2.4s ease forwards; }
.dead-banner b {
  display: block;
  font: 900 clamp(26px, 6vw, 56px)/1.05 Impact, "Arial Black", system-ui, sans-serif;
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 0 20px var(--dead-accent), 0 4px 0 #000;
}
.dead-banner span { display: block; margin-top: 6px; font-size: 14px; font-weight: 700; color: rgba(255, 255, 255, 0.85); text-shadow: 0 2px 4px #000; }
.dead-banner.boss b { color: #ff3b2f; text-shadow: 0 0 24px #a00, 0 4px 0 #000; }
@keyframes dead-banner {
  0% { opacity: 0; transform: scale(1.5); }
  12% { opacity: 1; transform: scale(1); }
  80% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.96); }
}

.dead-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(160, 0, 0, 0.9) 100%);
}
.dead-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: rgba(255, 20, 20, 0.28); }

.dead-end {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  background: rgba(0, 0, 0, 0);
  transition: opacity 1.2s, background 2.4s;
}
.dead-end.show { opacity: 1; background: rgba(0, 0, 0, 0.6); }
.dead-end b { font: 900 clamp(36px, 8vw, 76px)/1 Impact, "Arial Black", system-ui, sans-serif; letter-spacing: 0.08em; color: #d41414; text-shadow: 0 0 30px #600, 0 5px 0 #000; }
.dead-end.victory b { color: var(--dead-accent); text-shadow: 0 0 30px var(--dead-accent), 0 5px 0 #000; }

.dead-pop {
  position: absolute;
  left: 50%;
  top: 58%;
  pointer-events: none;
  font-size: 18px;
  font-weight: 900;
  color: var(--dead-accent);
  text-shadow: 0 2px 4px #000;
  animation: dead-pop 1.2s ease-out forwards;
}
@keyframes dead-pop {
  from { opacity: 1; transform: translate(-50%, 0) scale(1.2); }
  to { opacity: 0; transform: translate(-50%, -60px) scale(1); }
}

.dead-focus {
  position: absolute;
  left: 50%;
  bottom: 14%;
  transform: translateX(-50%);
  padding: 8px 16px;
  pointer-events: none;
  border: 1px solid var(--dead-accent);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.78);
  font-weight: 700;
  animation: dead-pulse 1.4s ease-in-out infinite;
}
.dead-focus[hidden] { display: none; }
@keyframes dead-pulse { 50% { opacity: 0.55; } }
/* Invisible but focusable so mobile keyboards open; 16px avoids iOS zoom-on-focus. */
.dead-input { position: absolute; left: 50%; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; font-size: 16px; pointer-events: none; }
.dead-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; }
.dead-help { margin: 0; text-align: center; }

.dead-rank { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0, 0, 0, 0.35); }
.dead-grade { width: 110px; text-align: center; font: 900 96px/1 Impact, "Arial Black", system-ui, sans-serif; text-shadow: 0 0 24px currentColor, 0 4px 0 #000; }
.dead-grade.g-S { color: #ffd700; }
.dead-grade.g-A { color: #7ee787; }
.dead-grade.g-B { color: #58a6ff; }
.dead-grade.g-C { color: #d2a8ff; }
.dead-grade.g-D { color: #f0883e; }
.dead-grade.g-E { color: #ff5f5f; }
.dead-rank-body { flex: 1; min-width: 200px; }
.dead-rank-title { margin-bottom: 6px; font-weight: 900; letter-spacing: 0.18em; color: #ff5f5f; }
.dead-rank-title.victory { color: var(--accent); }
.dead-rank table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.dead-rank td { padding: 3px 0; border-bottom: 1px solid var(--line); }
.dead-rank td:last-child { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
  .dead-hud { padding: 6px 8px; font-size: 11px; }
  .dead-hud-left, .dead-hud-right { gap: 1px; }
  .dead-lives span { font-size: 13px; }
  .dead-acc, .dead-clock { font-size: 10px; }
  .dead-boss { top: 34px; font-size: 10px; }
  .dead-area { left: 8px; bottom: 6px; font-size: 9px; }
  .dead-focus { bottom: 10%; padding: 5px 12px; font-size: 12px; white-space: nowrap; }
  .dead-banner span { font-size: 11px; }
  .dead-help { font-size: 0.78rem; }
  .dead-grade { width: 80px; font-size: 72px; }
}

/* ---------- modal, toast, fx ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.66);
  animation: fade-in 0.18s;
}
.modal {
  position: relative;
  width: min(100%, 520px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: linear-gradient(160deg, color-mix(in srgb, var(--bg2) 70%, #000), color-mix(in srgb, var(--bg1) 85%, #000));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.modal.wide { width: min(100%, 900px); }
.modal .close-x { position: absolute; top: 10px; right: 12px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 560px); }
.toast {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s;
  text-align: center;
}
.toast.error { border-left-color: var(--bad); }
.toast.good { border-left-color: var(--good); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

.banner {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translate(-50%, 0);
  z-index: 2500;
  pointer-events: none;
  padding: 16px 30px;
  border-radius: 18px;
  font-size: clamp(1.2rem, 3.4vw, 2.1rem);
  font-weight: 800;
  text-align: center;
  background: var(--panel-strong);
  border: 2px solid var(--accent);
  box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 45%, transparent);
  animation: banner-in 0.45s cubic-bezier(0.2, 1.6, 0.4, 1), fade-out 0.5s 2.6s forwards;
  max-width: 92vw;
}
@keyframes banner-in { from { opacity: 0; transform: translate(-50%, -30px) scale(0.7); } }
@keyframes fade-out { to { opacity: 0; } }

.flyby {
  position: fixed;
  z-index: 2400;
  left: 0;
  font-size: clamp(3rem, 8vw, 6rem);
  pointer-events: none;
  animation: flyby 3.2s linear forwards;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
}
@keyframes flyby {
  0% { transform: translateX(-20vw) translateY(0) rotate(-6deg); }
  50% { transform: translateX(50vw) translateY(-6vh) rotate(4deg); }
  100% { transform: translateX(115vw) translateY(0) rotate(-6deg); }
}

#fxCanvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2600; }

.announcer {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2700;
  text-align: center;
  pointer-events: none;
  animation: announcer-up 0.4s ease-out, announcer-down 0.4s 5.2s ease-in forwards;
}
.announcer .bubble {
  background: rgba(0, 0, 0, 0.9);
  color: #fff8dc;
  padding: 14px 28px;
  border-radius: 18px;
  font-size: clamp(1.05rem, 2.6vw, 1.45rem);
  font-weight: 800;
  border: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  max-width: min(92vw, 640px);
}
.announcer .mic { font-size: 4rem; line-height: 1.1; }
@keyframes announcer-up { from { transform: translate(-50%, 90px); opacity: 0; } }
@keyframes announcer-down { to { transform: translate(-50%, 90px); opacity: 0; } }

/* ---------- slot machine ---------- */

.slot-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 16px; }
@media (max-width: 760px) { .slot-wrap { grid-template-columns: 1fr; } }
.slot-machine {
  position: relative;
  background: linear-gradient(180deg, #2a2a33, #16161c);
  border-radius: 20px;
  padding: 16px 70px 16px 16px;
  border: 3px solid color-mix(in srgb, var(--accent) 70%, #555);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.6), 0 0 30px color-mix(in srgb, var(--accent) 25%, transparent);
  text-align: center;
}
.slot-machine canvas { width: 100%; max-width: 380px; aspect-ratio: 380 / 220; border-radius: 10px; box-shadow: 0 0 16px #000; }
.slot-result { min-height: 3em; margin: 10px 0; padding: 8px 12px; border-radius: 10px; background: rgba(0, 0, 0, 0.5); color: #ffe8a1; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.lever {
  position: absolute;
  right: 14px;
  top: 30px;
  width: 36px;
  height: 200px;
  touch-action: none;
  cursor: grab;
}
.lever .track { position: absolute; left: 14px; top: 20px; width: 8px; height: 170px; border-radius: 4px; background: linear-gradient(90deg, #666, #aaa, #666); }
.lever .knob {
  position: absolute;
  left: 0;
  top: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff8a8a, #d11 60%, #800);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}
.reward-guide { font-size: 0.83rem; }
.reward-guide ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px; }
.reward-guide li b { display: inline-block; min-width: 64px; }
.reward-guide hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

.pick-list { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.pick-list button { text-align: left; }

/* ---------- login ---------- */

.login-wrap { position: relative; z-index: 1; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: min(100%, 380px); display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { text-align: center; font-size: 1.9rem; margin: 0; }
.login-card .sub { text-align: center; margin: 0; }
.error-text { color: var(--bad); min-height: 1.2em; font-size: 0.9rem; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
