@font-face { font-family: Fredoka; src: url(../fonts/fredoka-500.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Fredoka; src: url(../fonts/fredoka-600.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: Fredoka; src: url(../fonts/fredoka-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: Creepster; src: url(../fonts/creepster-400.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Reenie Beanie'; src: url(../fonts/reenie-beanie-400.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Share Tech Mono'; src: url(../fonts/share-tech-mono-400.woff2) format('woff2'); font-display: swap; }

:root {
  --cream: #f7eed9;
  --cream-2: #efe2c4;
  --teal-dark: #164e49;
  --teal-mid: #2c7c73;
  --teal-light: #6ec6b8;
  --coral: #e25d52;
  --coral-dark: #b53d33;
  --gold: #eab949;
  --ink: #1d1515;
  --ink-2: #3a2c2a;
  --muted: #6d5d52;
  --shadow: 0 6px 0 rgba(29, 21, 21, 0.25);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0d1716;
  color: var(--ink);
  font-family: Fredoka, 'Trebuchet MS', system-ui, sans-serif;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  touch-action: none;
}

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  color: inherit;
  touch-action: manipulation;
}

button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

button:disabled { opacity: 0.45; cursor: not-allowed; }

[hidden] { display: none !important; }

#loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 14px;
  justify-items: center;
  background: var(--teal-dark);
  color: var(--cream);
  font-size: 18px;
  z-index: 50;
  transition: opacity 0.5s;
}
#loading.gone { opacity: 0; pointer-events: none; }
.spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 6px solid rgba(247, 238, 217, 0.25);
  border-top-color: var(--coral);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.noscript { color: var(--cream); padding: 24px; max-width: 420px; text-align: center; }

.screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l));
  overflow-y: auto;
}
.panel-screen { background: rgba(13, 23, 22, 0.55); backdrop-filter: blur(2px); }
.panel-screen.side { background: transparent; backdrop-filter: none; justify-content: flex-end; }
#screen-title { background: linear-gradient(180deg, rgba(13, 23, 22, 0.15), rgba(13, 23, 22, 0.65)); }

.title-wrap {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 28px;
  align-items: center;
}
.sign {
  background: var(--teal-mid);
  color: var(--cream);
  border: 6px solid var(--cream);
  border-radius: 26px;
  padding: 22px 26px 18px;
  box-shadow: 0 10px 0 var(--teal-dark), 0 18px 40px rgba(0, 0, 0, 0.45);
  transform: rotate(-2deg);
  text-align: center;
}
.sign-top { font-weight: 700; letter-spacing: 0.24em; font-size: 13px; color: var(--gold); }
.sign h1 {
  margin: 4px 0 6px;
  font-family: Creepster, Fredoka, sans-serif;
  font-weight: 400;
  font-size: clamp(48px, 9vw, 104px);
  line-height: 0.92;
  letter-spacing: 0.02em;
  color: var(--cream);
  text-shadow: 0 5px 0 var(--coral-dark), 0 10px 22px rgba(0, 0, 0, 0.35);
}
.sign-tag { font-family: 'Reenie Beanie', cursive; font-size: 30px; color: #ffe7a3; }
.menu-col { display: grid; gap: 12px; }
.menu-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.big-btn {
  display: block;
  width: 100%;
  min-height: 54px;
  padding: 12px 18px;
  border-radius: 16px;
  background: var(--cream);
  color: var(--teal-dark);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.02em;
  box-shadow: 0 5px 0 #b9a888;
  transition: transform 0.08s, box-shadow 0.08s;
}
.big-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 #b9a888; }
.big-btn.primary { background: var(--coral); color: var(--cream); box-shadow: 0 5px 0 var(--coral-dark); }
.big-btn.primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--coral-dark); }
.big-btn.danger { background: #3a2c2a; color: var(--cream); box-shadow: 0 5px 0 #1d1515; }
.small-btn {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--cream-2);
  color: var(--teal-dark);
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 3px 0 #c7b48f;
}
.small-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #c7b48f; }
.screen .menu-col .small-btn { background: rgba(247, 238, 217, 0.92); }

.panel {
  width: min(520px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background: var(--cream);
  border-radius: 24px;
  border: 5px solid var(--teal-mid);
  box-shadow: 0 8px 0 var(--teal-dark), 0 22px 50px rgba(0, 0, 0, 0.45);
  padding: 18px 20px 22px;
  grid-template-columns: minmax(0, 1fr);
  display: grid;
  gap: 12px;
  -webkit-user-select: text;
  user-select: text;
}
.panel.narrow { width: min(380px, 100%); }
.panel.wide { width: min(760px, 100%); }
.panel.center { text-align: center; justify-items: center; }
.panel header { display: flex; align-items: center; gap: 10px; }
.panel h2 { margin: 0; font-size: 26px; color: var(--teal-dark); font-weight: 700; }
.back {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--teal-mid);
  color: var(--cream);
  font-size: 22px;
  font-weight: 700;
  flex: none;
}
.muted { color: var(--muted); margin: 0; font-size: 15px; line-height: 1.4; }
.error { color: var(--coral-dark); margin: 0; min-height: 1.2em; font-weight: 600; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.row-btns .big-btn { flex: 1 1 180px; width: auto; }

.field { display: grid; gap: 6px; font-weight: 600; color: var(--teal-dark); }
input, select {
  min-width: 0;
  max-width: 100%;
  font: inherit;
  font-size: 17px;
  min-height: 46px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 3px solid var(--teal-light);
  background: #fffaf0;
  color: var(--ink);
  -webkit-user-select: text;
  user-select: text;
}
input:disabled { background: transparent; border-color: transparent; color: var(--ink); opacity: 1; }

.player-list { display: grid; gap: 8px; }
.pl-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 12px;
  min-height: 56px;
  border-radius: 14px;
  background: #fffaf0;
  border: 3px solid color-mix(in srgb, var(--pc, #ccc) 60%, transparent);
}
.pl-row input { flex: 1; min-width: 0; }
.pl-row select { flex: none; }
.pl-row.empty { color: var(--muted); border-style: dashed; border-color: #d9cbb0; justify-content: center; background: transparent; }
.pl-name { flex: 1; font-weight: 600; font-size: 17px; }
.pl-tag { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: var(--teal-light); color: var(--teal-dark); }
.pl-tag.host { background: var(--gold); color: var(--ink); }
.pl-lane { font-family: 'Share Tech Mono', monospace; color: var(--muted); font-size: 14px; }
.x-btn { width: 40px; height: 40px; border-radius: 10px; background: var(--cream-2); font-size: 22px; font-weight: 700; flex: none; }
.sb-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--pc); flex: none; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.15); }

.opts { display: grid; gap: 10px; }
.seg { display: grid; gap: 5px; }
.seg-label { font-weight: 600; color: var(--teal-dark); font-size: 15px; }
.seg-row { display: flex; background: var(--cream-2); border-radius: 14px; padding: 4px; gap: 4px; }
.seg-row button {
  flex: 1;
  min-height: 42px;
  border-radius: 10px;
  background: transparent;
  font-weight: 600;
  font-size: 15px;
  color: var(--teal-dark);
  padding: 6px 8px;
}
.seg-row button.on { background: var(--teal-mid); color: var(--cream); box-shadow: 0 2px 0 var(--teal-dark); }

.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.or::before, .or::after { content: ''; flex: 1; height: 2px; background: #e0d2b6; }
.join-row { display: flex; gap: 10px; }
.join-row input {
  flex: 1;
  min-width: 0;
  font-family: 'Share Tech Mono', monospace;
  font-size: 26px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-align: center;
}
.join-row .big-btn { width: auto; flex: none; }

.code-box { text-align: center; background: var(--teal-dark); color: var(--cream); border-radius: 18px; padding: 12px; display: grid; gap: 6px; justify-items: center; }
.code-box .muted { color: var(--teal-light); }
.code { font-family: 'Share Tech Mono', monospace; font-size: 46px; letter-spacing: 0.25em; color: var(--gold); padding-left: 0.25em; -webkit-user-select: all; user-select: all; }

.picker { display: grid; gap: 6px; }
.picker-label { font-weight: 600; color: var(--teal-dark); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 99px;
  background: var(--cream-2);
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--teal-dark);
}
.chip.on { background: var(--teal-mid); color: var(--cream); }
.swatch { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--cream); }

.howto { margin: 0; padding-left: 22px; display: grid; gap: 8px; line-height: 1.4; }
.howto b { color: var(--coral-dark); }
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; font-size: 14px; color: var(--muted); }
kbd {
  display: inline-block;
  min-width: 26px;
  padding: 2px 6px;
  margin-right: 3px;
  border-radius: 6px;
  background: var(--teal-dark);
  color: var(--cream);
  font-family: 'Share Tech Mono', monospace;
  text-align: center;
  box-shadow: 0 2px 0 #08201e;
}

.pass-dot { width: 64px; height: 64px; border-radius: 50%; box-shadow: 0 0 0 6px var(--cream-2); }

#podium { display: grid; gap: 8px; }
.pod-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  grid-template-areas: 'rank name score' 'rank title score';
  align-items: center;
  column-gap: 12px;
  padding: 10px 14px;
  border-radius: 16px;
  background: #fffaf0;
  border-left: 10px solid var(--pc);
}
.pod-row.r1 { background: #fff1c2; }
.pod-rank { grid-area: rank; font-family: Creepster, Fredoka, sans-serif; font-size: 36px; color: var(--teal-mid); text-align: center; }
.pod-name { grid-area: name; font-weight: 700; font-size: 20px; }
.pod-title { grid-area: title; font-size: 12px; letter-spacing: 0.1em; color: var(--coral-dark); font-weight: 700; }
.pod-score { grid-area: score; font-family: 'Share Tech Mono', monospace; font-size: 38px; color: var(--teal-dark); }
#awards { display: flex; flex-wrap: wrap; gap: 8px; }
.award { background: var(--teal-dark); color: var(--cream); border-radius: 14px; padding: 8px 12px; display: grid; gap: 2px; font-size: 14px; }
.award b { color: var(--gold); font-size: 15px; }

.cards-full { display: grid; gap: 10px; }
.fc { border-radius: 14px; background: #fffaf0; border: 3px solid var(--pc); padding: 8px; display: grid; gap: 6px; overflow-x: auto; }
.fc-name { font-weight: 700; color: var(--teal-dark); }
.fc-grid { display: grid; grid-template-columns: repeat(var(--frames, 10), minmax(34px, 1fr)); gap: 3px; min-width: 360px; }
.fc-cell { background: var(--cream-2); border-radius: 8px; text-align: center; font-family: 'Share Tech Mono', monospace; padding: 3px 2px; }
.fc-n { font-size: 11px; color: var(--muted); }
.fc-rolls { display: flex; justify-content: center; gap: 2px; min-height: 18px; }
.fc-rolls span { min-width: 12px; font-size: 15px; color: var(--coral-dark); }
.fc-t { font-size: 17px; color: var(--teal-dark); min-height: 22px; }

#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud button, #hud input, #hud .card { pointer-events: auto; }

#scoreboard {
  position: absolute;
  top: calc(8px + var(--safe-t));
  left: calc(8px + var(--safe-l));
  display: grid;
  gap: 4px;
  max-width: calc(100% - 170px - var(--safe-l) - var(--safe-r));
}
.sb-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 6px;
  background: rgba(22, 78, 73, 0.88);
  color: var(--cream);
  border-radius: 12px;
  border: 2px solid transparent;
  font-size: 13px;
  transition: transform 0.2s, background 0.2s;
  transform-origin: left center;
}
.sb-row.active { border-color: var(--gold); background: rgba(22, 78, 73, 0.96); }
.sb-row.left { opacity: 0.45; }
.sb-name { width: 86px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.sb-frames { display: flex; gap: 2px; }
.sb-f { display: grid; background: rgba(247, 238, 217, 0.12); border-radius: 5px; width: 30px; text-align: center; font-family: 'Share Tech Mono', monospace; }
.sb-f.last { width: 40px; }
.sb-f.cur { background: rgba(234, 185, 73, 0.35); }
.sb-rolls { display: flex; justify-content: flex-end; gap: 1px; font-size: 11px; line-height: 13px; height: 13px; padding: 0 2px; }
.sb-rolls i { font-style: normal; min-width: 8px; color: #ffcfb0; }
.sb-f b { font-weight: 400; font-size: 12px; line-height: 14px; height: 14px; }
.sb-frames.compact .sb-f { width: 22px; }
.sb-frames.compact .sb-f.last { width: 30px; }
.sb-frames.compact .sb-rolls { font-size: 9px; line-height: 11px; height: 11px; }
.sb-frames.compact .sb-f b { font-size: 10px; }
.sb-total { font-family: 'Share Tech Mono', monospace; font-size: 20px; min-width: 36px; text-align: right; color: var(--gold); }

#topbar {
  position: absolute;
  top: calc(8px + var(--safe-t));
  right: calc(8px + var(--safe-r));
  display: flex;
  gap: 8px;
}
.icon-btn {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(247, 238, 217, 0.92);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
  display: grid;
  place-items: center;
}
.i-pause, .i-cam, .i-emote { display: block; position: relative; width: 22px; height: 22px; }
.i-pause::before, .i-pause::after { content: ''; position: absolute; top: 2px; width: 7px; height: 18px; border-radius: 2px; background: var(--teal-dark); }
.i-pause::before { left: 3px; }
.i-pause::after { right: 3px; }
.i-cam::before { content: ''; position: absolute; left: 1px; top: 5px; width: 15px; height: 12px; border-radius: 3px; background: var(--teal-dark); }
.i-cam::after { content: ''; position: absolute; right: 0; top: 7px; border: 4px solid transparent; border-right: 7px solid var(--teal-dark); border-left: 0; height: 0; }
.i-emote::before { content: ''; position: absolute; inset: 1px; border-radius: 50%; border: 3px solid var(--teal-dark); }
.i-emote::after { content: ''; position: absolute; left: 6px; right: 6px; bottom: 5px; height: 4px; border-radius: 0 0 6px 6px; background: var(--coral); }

#emotes {
  position: absolute;
  top: calc(64px + var(--safe-t));
  right: calc(8px + var(--safe-r));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(22, 78, 73, 0.95);
}
#emotes button { min-height: 44px; padding: 6px 12px; border-radius: 12px; background: var(--cream); color: var(--teal-dark); font-weight: 600; font-size: 14px; }

#lane-tabs {
  position: absolute;
  top: calc(64px + var(--safe-t));
  right: calc(8px + var(--safe-r));
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 50%;
}
#emotes:not([hidden]) ~ #lane-tabs { display: none; }
.tabs-label { color: var(--cream); font-size: 12px; text-shadow: 0 1px 2px #000; }
#lane-tabs button { min-height: 36px; padding: 4px 10px; border-radius: 99px; background: rgba(22, 78, 73, 0.9); color: var(--cream); border: 2px solid var(--pc); font-size: 13px; font-weight: 600; }
#lane-tabs button.on { background: var(--pc); color: var(--ink); }

#banner {
  position: absolute;
  top: 26%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0;
  text-align: center;
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.2, 1.6, 0.4, 1);
  pointer-events: none;
  width: min(92vw, 720px);
}
#banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.b-title {
  font-family: Creepster, Fredoka, sans-serif;
  font-size: clamp(44px, 10vw, 96px);
  line-height: 1;
  color: var(--cream);
  -webkit-text-stroke: 2px #5c1418;
  text-shadow: 0 6px 0 #5c1418, 0 12px 30px rgba(0, 0, 0, 0.5);
}
.b-sub { margin-top: 6px; font-size: clamp(15px, 3.6vw, 20px); color: var(--cream); font-weight: 600; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8); }
.tone-strike .b-title { color: var(--gold); }
.tone-spare .b-title { color: var(--teal-light); -webkit-text-stroke-color: #0e2b28; text-shadow: 0 6px 0 #0e2b28, 0 12px 30px rgba(0, 0, 0, 0.5); }
.tone-gutter .b-title { color: #b9c6c8; -webkit-text-stroke-color: #1b2a2b; text-shadow: 0 6px 0 #1b2a2b; }
.tone-event .b-title, .tone-curse .b-title { color: #b7ffb8; -webkit-text-stroke-color: #14321a; text-shadow: 0 6px 0 #14321a, 0 0 30px rgba(140, 255, 176, 0.6); }
.tone-card .b-title { color: #ffd1f0; -webkit-text-stroke-color: #4b1a3c; text-shadow: 0 6px 0 #4b1a3c; font-size: clamp(36px, 8vw, 70px); }
.tone-split .b-title { color: var(--coral); }

#toasts {
  position: absolute;
  left: 50%;
  bottom: calc(150px + var(--safe-b));
  transform: translateX(-50%);
  display: grid;
  gap: 6px;
  justify-items: center;
  width: min(92vw, 460px);
}
.toast {
  background: rgba(29, 21, 21, 0.86);
  color: var(--cream);
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 15px;
  text-align: center;
  animation: toast-in 0.25s ease-out;
  transition: opacity 0.4s, transform 0.4s;
}
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

#hint {
  position: absolute;
  left: 50%;
  bottom: calc(118px + var(--safe-b));
  transform: translateX(-50%);
  color: var(--cream);
  font-size: 15px;
  text-align: center;
  text-shadow: 0 1px 3px #000, 0 0 8px rgba(0, 0, 0, 0.6);
  width: min(92vw, 560px);
}

#readout {
  position: absolute;
  right: calc(16px + var(--safe-r));
  bottom: calc(118px + var(--safe-b));
  font-family: 'Share Tech Mono', monospace;
  color: var(--gold);
  font-size: 26px;
  text-shadow: 0 2px 4px #000;
  opacity: 0;
  transition: opacity 0.3s;
}
#readout.flash { opacity: 1; }

#power {
  position: absolute;
  right: calc(18px + var(--safe-r));
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: min(38vh, 260px);
  border-radius: 16px;
  background: rgba(29, 21, 21, 0.75);
  border: 3px solid var(--cream);
  overflow: hidden;
}
.power-fill {
  position: absolute;
  inset: 0;
  transform-origin: bottom;
  background: linear-gradient(0deg, var(--teal-light), var(--gold) 60%, var(--coral));
  transform: scaleY(0);
}
.power-sweet { position: absolute; left: 0; right: 0; top: 12%; height: 22%; border-top: 2px dashed rgba(255, 255, 255, 0.7); border-bottom: 2px dashed rgba(255, 255, 255, 0.7); }
#power span { position: absolute; bottom: -24px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--cream); }

#controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px calc(10px + var(--safe-r)) calc(10px + var(--safe-b)) calc(10px + var(--safe-l));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(0deg, rgba(13, 23, 22, 0.7), transparent);
}
.ctl-move { display: flex; align-items: center; gap: 6px; background: rgba(22, 78, 73, 0.9); border-radius: 18px; padding: 6px; }
.ctl-label { color: var(--cream); font-size: 12px; font-weight: 600; }
.hold-btn {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--cream);
  color: var(--teal-dark);
  font-size: 22px;
  box-shadow: 0 3px 0 #b9a888;
}
.hold-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #b9a888; }
.ctl-hook {
  flex: 1;
  max-width: 340px;
  display: grid;
  gap: 2px;
  background: rgba(22, 78, 73, 0.9);
  border-radius: 18px;
  padding: 8px 14px;
  pointer-events: auto;
}
.ctl-hook input { pointer-events: auto; width: 100%; min-height: 32px; padding: 0; border: 0; background: transparent; accent-color: var(--gold); }
.hook-ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--teal-light); }
.ctl-hand { display: flex; gap: 8px; min-width: 0; }
.card {
  width: 74px;
  height: 92px;
  border-radius: 12px;
  background: linear-gradient(160deg, #3d2a52, #1e1430);
  border: 3px solid #b993d6;
  color: #f3e6ff;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  padding: 6px 4px;
  position: relative;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4);
  transition: transform 0.15s;
}
.card.k-curse { background: linear-gradient(160deg, #24502d, #0f2614); border-color: #8cffb0; color: #e4ffe9; }
.card.armed { transform: translateY(-14px) rotate(-3deg); border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold), 0 10px 20px rgba(0, 0, 0, 0.5); }
.card-glyph { font-family: Creepster, Fredoka, sans-serif; font-size: 34px; line-height: 1.2; }
.card-name { font-size: 10px; font-weight: 700; line-height: 1.05; text-align: center; max-width: 100%; overflow-wrap: break-word; padding: 0 2px; letter-spacing: -0.2px; }
.card-key { position: absolute; top: 3px; left: 6px; font-family: 'Share Tech Mono', monospace; font-size: 11px; opacity: 0.7; }

@media (max-width: 760px) {
  .title-wrap { grid-template-columns: 1fr; gap: 18px; }
  .sign { padding: 16px; }
  .sign-tag { font-size: 24px; }
  .panel { padding: 14px 14px 18px; border-radius: 20px; }
  .panel h2 { font-size: 22px; }
  .panel-screen.side { align-items: flex-end; padding-top: 42vh; }
  .panel-screen.side .panel { max-height: 58vh; }
  .sb-name { width: 62px; }
  .sb-total { font-size: 17px; min-width: 30px; }
  #scoreboard { max-width: calc(100% - 132px); }
  .icon-btn { width: 42px; height: 42px; border-radius: 12px; }
  #topbar { gap: 6px; }
  #controls { flex-wrap: wrap; align-items: stretch; }
  .ctl-hand { order: -1; width: 100%; justify-content: flex-end; }
  .card { width: 64px; height: 78px; }
  .card-name { font-size: 9px; }
  .card-glyph { font-size: 28px; }
  .ctl-hook { padding: 6px 12px; }
  .hold-btn { width: 50px; height: 50px; }
  #hint { bottom: calc(188px + var(--safe-b)); font-size: 14px; width: min(86vw, 420px); }
  #toasts { bottom: calc(232px + var(--safe-b)); }
  #readout { bottom: calc(196px + var(--safe-b)); font-size: 22px; }
}

@media (max-width: 420px) {
  .sb-frames.compact .sb-f { width: 17px; }
  .sb-frames.compact .sb-f.last { width: 24px; }
  .sb-frames.compact .sb-rolls i { min-width: 5px; }
  .sb-name { width: 50px; font-size: 12px; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .title-wrap { grid-template-columns: 1.1fr 1fr; gap: 16px; }
  .sign h1 { font-size: 52px; }
  .sign-tag { font-size: 20px; }
  .big-btn { min-height: 46px; font-size: 17px; padding: 8px 14px; }
  .menu-col { gap: 8px; }
  #controls { padding-top: 4px; }
  .card { width: 58px; height: 70px; }
  .card-glyph { font-size: 24px; }
  #hint { bottom: calc(96px + var(--safe-b)); width: min(44vw, 420px); }
  #toasts { bottom: calc(120px + var(--safe-b)); }
  .panel-screen.side { padding-top: 16px; align-items: center; }
  .panel-screen.side .panel { max-height: 100%; width: min(420px, 55%); }
}

@media (prefers-reduced-motion: reduce) {
  #banner, .toast, .card { transition: none; animation: none; }
}
.b-title:empty { display: none; }
