:root {
  --bg0: #0b1020;
  --bg1: #141c33;
  --ink: #f4f0e8;
  --muted: #a9b2c9;
  --gold: #f5c542;
  --amber: #ff8a3d;
  --lime: #b8f34d;
  --cyan: #4de3d0;
  --danger: #ff5d6c;
  --panel: rgba(18, 26, 48, 0.78);
  --line: rgba(255, 255, 255, 0.1);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --font-display: "Bebas Neue", Impact, sans-serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(255, 138, 61, 0.22), transparent 55%),
    radial-gradient(900px 600px at 90% 0%, rgba(77, 227, 208, 0.16), transparent 50%),
    radial-gradient(700px 500px at 50% 100%, rgba(245, 197, 66, 0.12), transparent 55%),
    linear-gradient(160deg, var(--bg0), var(--bg1) 55%, #0a0e1a);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

body {
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

.bg-noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.bg-orbs {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(245, 197, 66, 0.15), transparent 28%),
    radial-gradient(circle at 80% 70%, rgba(77, 227, 208, 0.12), transparent 30%);
  animation: drift 12s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-2%, 2%, 0) scale(1.05); }
}

.screen,
.home {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 16px 14px 40px;
  overflow-x: hidden;
}

.page-player .game-screen {
  padding-top: 12px;
}

.compact-top {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.compact-top h2 {
  margin: 0;
  font-size: clamp(1rem, 4.2vw, 1.35rem);
  line-height: 1.15;
}

.top-score {
  text-align: right;
  display: grid;
  gap: 2px;
}

.top-score > span {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  line-height: 1;
  color: var(--gold);
}

.top-score small {
  color: var(--muted);
  font-size: 0.72rem;
}

.top-score small b {
  color: var(--ink);
}

.score-value.pop,
.top-score > span.pop {
  transform: scale(1.08);
  color: var(--lime);
  display: inline-block;
  transition: transform 0.15s ease;
}

.home {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 18px;
  text-align: center;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--cyan);
}

.eyebrow.tight {
  letter-spacing: 0.14em;
  margin-bottom: 4px;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(4.5rem, 16vw, 8rem);
  line-height: 0.9;
  letter-spacing: 0.04em;
  background: linear-gradient(110deg, #fff7df 10%, var(--gold) 40%, var(--amber) 75%, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 10px 40px rgba(245, 197, 66, 0.2);
  animation: brandPulse 3.5s ease-in-out infinite;
}

.brand-sm {
  font-size: clamp(3rem, 12vw, 4.5rem);
}

@keyframes brandPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}

.tagline,
.home-foot,
.hint {
  color: var(--muted);
  margin: 0;
}

.role-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

@media (min-width: 720px) {
  .role-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 980px) {
  .role-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.role-card {
  display: grid;
  gap: 8px;
  text-align: left;
  text-decoration: none;
  color: inherit;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.role-card:hover,
.role-card:focus-visible {
  transform: translateY(-4px) scale(1.01);
  border-color: rgba(245, 197, 66, 0.45);
  outline: none;
}

.role-player {
  background:
    linear-gradient(145deg, rgba(245, 197, 66, 0.12), transparent 45%),
    var(--panel);
}

.role-admin {
  background:
    linear-gradient(145deg, rgba(77, 227, 208, 0.1), transparent 45%),
    var(--panel);
}

.role-observer {
  background:
    linear-gradient(145deg, rgba(184, 243, 77, 0.12), transparent 45%),
    var(--panel);
}

.role-kicker {
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.role-card strong {
  font-size: 1.35rem;
}

.role-card span:last-child {
  color: var(--muted);
  font-size: 0.95rem;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-block;
  margin-bottom: 18px;
}

.form-panel,
.panel,
.admin-totals,
.team-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-panel {
  display: grid;
  gap: 14px;
  padding: 22px;
  margin-top: 12px;
}

label {
  display: grid;
  gap: 8px;
  text-align: left;
  font-size: 0.9rem;
  color: var(--muted);
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  padding: 14px 16px;
  font: inherit;
  font-size: 1rem;
}

input:focus {
  outline: 2px solid rgba(245, 197, 66, 0.45);
  border-color: transparent;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, opacity 0.12s ease;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  color: #1a1206;
  background: linear-gradient(120deg, var(--gold), var(--amber));
}

.btn-danger {
  color: white;
  background: linear-gradient(120deg, #ff7a86, var(--danger));
}

.btn-ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.error {
  color: #ffb4bc;
  margin: 0;
}

.game-top,
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.game-top h2,
.admin-header h1 {
  margin: 0;
}

.status-pill {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  white-space: nowrap;
}

.status-pill.live {
  color: #102008;
  background: linear-gradient(120deg, var(--lime), var(--cyan));
  border-color: transparent;
  animation: livePulse 1.4s ease-in-out infinite;
}

.status-pill.paused {
  color: #1a1206;
  background: linear-gradient(120deg, var(--gold), var(--amber));
  border-color: transparent;
  animation: none;
}

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184, 243, 77, 0.35); }
  50% { box-shadow: 0 0 0 10px rgba(184, 243, 77, 0); }
}

.score-hero {
  margin: 22px 0 8px;
  text-align: center;
}

.score-label {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.score-value {
  font-family: var(--font-display);
  font-size: clamp(3.4rem, 14vw, 5.5rem);
  letter-spacing: 0.03em;
  line-height: 1;
  color: var(--gold);
  transition: transform 0.15s ease;
}

.score-value.pop {
  transform: scale(1.08);
  color: var(--lime);
}

.score-meta {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.score-meta b {
  color: var(--ink);
}

.clicker-stage {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 4px 0 14px;
  user-select: none;
  width: 100%;
  overflow: hidden;
}

.fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 3;
}

.clicker {
  position: relative;
  z-index: 2;
  width: min(280px, 68vw);
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 28px;
  transform: translateZ(0);
  transition: transform 0.08s cubic-bezier(0.2, 0.9, 0.2, 1), filter 0.12s ease;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.55));
  -webkit-user-drag: none;
  touch-action: manipulation;
}

.clicker img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  border-radius: 24px;
}

.clicker-ring {
  position: absolute;
  inset: 4%;
  border-radius: 50% 50% 42% 42%;
  border: 2px solid transparent;
  pointer-events: none;
}

.clicker:active,
.clicker.pressed {
  transform: scale(0.9);
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.45)) brightness(1.08);
}

.clicker.disabled {
  cursor: not-allowed;
  filter: grayscale(0.35) brightness(0.75);
}

.clicker.ripple::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 42%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 243, 180, 0.9), rgba(255, 138, 61, 0));
  transform: translate(-50%, -50%) scale(1);
  animation: ripple 0.45s ease-out forwards;
}

@keyframes ripple {
  to {
    transform: translate(-50%, -50%) scale(16);
    opacity: 0;
  }
}

.float-score {
  position: absolute;
  z-index: 5;
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--lime);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
  animation: floatUp 0.85s ease-out forwards;
  pointer-events: none;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translate(-50%, 0) scale(0.8); }
  100% { opacity: 0; transform: translate(-50%, -90px) scale(1.25); }
}

.particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  animation: particle 0.7s ease-out forwards;
}

@keyframes particle {
  to {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(0.2);
  }
}

.panels {
  display: grid;
  gap: 16px;
}

@media (min-width: 860px) {
  .panels {
    grid-template-columns: 1.2fr 0.8fr;
  }
}

.panel {
  padding: 18px;
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.upgrades {
  display: grid;
  gap: 10px;
}

.upgrade {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.upgrade-title {
  font-weight: 800;
}

.upgrade-desc,
.upgrade-level {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.86rem;
}

.upgrade button {
  justify-self: end;
  white-space: nowrap;
}

.leaderboard {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.leaderboard li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
}

.leaderboard li.mine {
  border-color: rgba(245, 197, 66, 0.45);
  background: rgba(245, 197, 66, 0.08);
}

.leaderboard .rank {
  color: var(--muted);
  margin-right: 8px;
}

.leaderboard .pts {
  font-weight: 800;
  color: var(--gold);
}

.logout-btn {
  margin-top: 22px;
  width: 100%;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.admin-totals {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

@media (min-width: 700px) {
  .admin-totals {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat {
  display: grid;
  gap: 4px;
}

.stat span {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat strong {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 0.03em;
  color: var(--gold);
}

.teams-stats {
  display: grid;
  gap: 12px;
}

.team-card {
  padding: 18px;
}

.team-card h3 {
  margin: 0 0 8px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.team-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(77, 227, 208, 0.12);
  border: 1px solid rgba(77, 227, 208, 0.25);
  font-size: 0.82rem;
}

.chip.gold {
  background: rgba(245, 197, 66, 0.12);
  border-color: rgba(245, 197, 66, 0.28);
}

.empty {
  color: var(--muted);
  margin: 0;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.muted {
  color: var(--muted);
}

.tiny {
  font-size: 0.8rem;
  margin: 4px 0 0;
}

.joker-board {
  padding: 12px;
  margin: 0 0 14px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.joker-board-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.joker-board-head h3 {
  margin: 0;
  font-size: 1rem;
}

.joker-sub {
  margin: 0 0 8px;
}

.joker-line {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

@media (min-width: 720px) {
  .joker-line {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.joker-slot {
  min-width: 0;
  min-height: 0;
}

.joker-empty {
  height: 100%;
  aspect-ratio: 3 / 4;
  min-height: 0;
  border: 2px dashed rgba(245, 197, 66, 0.35);
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.03);
}

.joker-card {
  position: relative;
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  cursor: grab;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 4px;
  justify-items: stretch;
  align-content: start;
  color: inherit;
  font: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  overflow: visible;
}

.joker-card .joker-name {
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
  order: 0;
}

.joker-frame {
  display: flex;
  flex-direction: column;
  width: 100%;
  aspect-ratio: 3 / 4.35;
  border-radius: 12px;
  border: 2px solid rgba(245, 197, 66, 0.85);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(18, 26, 48, 0.55));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  overflow: hidden;
  box-sizing: border-box;
  min-height: 0;
}

.joker-frame img,
.joker-card img {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  aspect-ratio: auto;
  object-fit: contain;
  object-position: center bottom;
  border-radius: 0;
  pointer-events: none;
  background: transparent;
  display: block;
}

.joker-frame .joker-effect {
  flex: 0 0 auto;
  width: 100%;
  padding: 4px 5px 5px;
  font-size: 0.55rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  color: rgba(245, 240, 230, 0.92);
  background: rgba(8, 12, 24, 0.72);
  border-top: 1px solid rgba(245, 197, 66, 0.35);
  max-height: 3.6em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.joker-frame .joker-timer {
  flex: 0 0 auto;
  font-size: 0.52rem;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  line-height: 1.15;
  padding: 0 4px 4px;
  background: rgba(8, 12, 24, 0.72);
}

.joker-card .joker-live {
  position: absolute;
  top: 22px;
  right: 4px;
  background: var(--lime);
  color: #102008;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 999px;
  z-index: 2;
}

.compact-booster {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.compact-booster .booster-btn {
  width: 56px;
}

.joker-card.active .joker-frame {
  border-color: var(--lime);
  box-shadow: 0 0 0 2px rgba(184, 243, 77, 0.35),
    0 0 18px rgba(184, 243, 77, 0.25);
}

.joker-card.active {
  animation: jokerPulse 0.9s ease-in-out infinite;
}

.joker-card.flash .joker-frame {
  animation: jokerFlash 0.35s ease-in-out 4;
}

.joker-card.disabled {
  filter: grayscale(0.85) brightness(0.7);
  opacity: 0.7;
}

.joker-card.dragging {
  opacity: 0.55;
  transform: scale(0.96);
}

@keyframes jokerPulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px) scale(1.02); }
}

@keyframes jokerFlash {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.55); }
}

.steal-banner {
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(120deg, #ff7a86, var(--danger));
  color: white;
  font-weight: 800;
  font-size: 0.85rem;
  animation: livePulse 1.2s ease-in-out infinite;
}

.modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(560px, calc(100vw - 20px));
  width: min(560px, calc(100vw - 20px));
  max-height: min(94vh, 920px);
  margin: auto;
  overflow: visible;
}

dialog.modal[open] {
  display: flex;
  flex-direction: column;
}

.modal::backdrop {
  background: rgba(4, 8, 18, 0.78);
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  color: var(--ink);
  max-height: min(92vh, 900px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  box-sizing: border-box;
}

.modal-wide {
  max-width: 100%;
  width: 100%;
}

.modal-joker-img {
  width: 120px;
  height: 160px;
  object-fit: contain;
  object-position: center bottom;
  margin: 0 auto 12px;
  border-radius: 12px;
  background: transparent;
  display: block;
}

.modal-card h3 {
  margin: 0 0 8px;
  text-align: center;
}

.modal-card > .muted {
  text-align: center;
}

.step-box {
  margin: 12px 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(245, 197, 66, 0.08);
  border: 1px solid rgba(245, 197, 66, 0.22);
  font-size: 0.92rem;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}

.shop-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  max-height: 60vh;
  overflow-x: hidden;
  overflow-y: auto;
}

.shop-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.shop-item img {
  width: 56px;
  border-radius: 8px;
}

.shop-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.breakdown-body {
  overflow-x: hidden;
  word-break: break-word;
}

.breakdown-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.breakdown-summary div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.breakdown-summary strong {
  font-size: 0.95rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.breakdown-summary span {
  color: var(--muted);
  font-size: 0.85rem;
}

.breakdown-steps {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}

.breakdown-steps li {
  display: grid;
  gap: 2px;
}

.breakdown-steps li.glow strong {
  color: var(--lime);
}

.grant-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}

.grant-row select {
  flex: 1;
  min-width: 160px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
}

.booster-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.booster-btn {
  position: relative;
  width: 92px;
  flex-shrink: 0;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 12px;
  transition: transform 0.12s ease;
}

.booster-btn:hover:not(:disabled) {
  transform: scale(1.04) rotate(-2deg);
}

.booster-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.booster-btn:disabled,
.booster-btn.empty {
  opacity: 0.45;
  cursor: not-allowed;
}

.booster-btn img {
  width: 100%;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

.booster-count {
  position: absolute;
  right: -6px;
  bottom: -6px;
  background: linear-gradient(120deg, var(--gold), var(--amber));
  color: #1a1206;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 999px;
  border: 2px solid #0b1020;
}

.booster-copy strong {
  display: block;
}

.pack-modal-card {
  text-align: center;
}

.pack-modal-card.choosing .pack-stage {
  min-height: 0;
  margin-bottom: 4px;
}

.pack-modal-card.choosing .pack-visual {
  width: min(88px, 28vw);
  opacity: 0.55;
  margin: 0 auto;
}

.pack-modal-card.choosing .pack-status {
  font-size: 0.85rem;
}

.pack-stage {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 0;
  align-content: center;
}

.pack-visual {
  width: min(160px, 42vw);
  border-radius: 14px;
  transform-origin: center;
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.5));
}

.pack-visual.opening {
  animation: packShake 0.18s linear infinite, packPulse 0.9s ease-in-out infinite;
}

.pack-visual.burst {
  animation: packBurst 0.45s ease-out forwards;
}

@keyframes packShake {
  0% { transform: rotate(0deg) translateX(0); }
  25% { transform: rotate(-6deg) translateX(-4px); }
  50% { transform: rotate(6deg) translateX(4px); }
  75% { transform: rotate(-4deg) translateX(-2px); }
  100% { transform: rotate(0deg) translateX(0); }
}

@keyframes packPulse {
  0%, 100% { filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.5)) brightness(1); }
  50% { filter: drop-shadow(0 16px 40px rgba(255, 93, 108, 0.45)) brightness(1.15); }
}

@keyframes packBurst {
  0% { transform: scale(1) rotate(0); opacity: 1; }
  40% { transform: scale(1.18) rotate(-4deg); opacity: 1; }
  100% { transform: scale(0.55) rotate(8deg); opacity: 0.35; }
}

.pack-status {
  margin: 0;
  color: var(--gold);
  font-weight: 800;
}

.pack-choices h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.pack-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
  width: 100%;
  overflow: visible;
}

@media (min-width: 520px) {
  .pack-options {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
}

.pack-option {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 8px;
  justify-items: center;
  align-content: start;
  text-align: center;
  padding: 12px;
  border-radius: 16px;
  border: 2px solid rgba(245, 197, 66, 0.75);
  background: rgba(8, 12, 24, 0.92);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.pack-option:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  border-color: var(--gold);
}

.pack-option .joker-frame {
  width: min(140px, 100%);
}

.pack-option strong {
  font-size: 0.95rem;
  line-height: 1.2;
}

.pack-option > span:last-child {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

@media (max-width: 520px) {
  .compact-top {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "left status"
      "score score";
  }

  .compact-top .top-left { grid-area: left; }
  .compact-top .status-pill { grid-area: status; justify-self: end; }
  .compact-top .top-score {
    grid-area: score;
    text-align: left;
    margin-top: 4px;
  }

  .clicker {
    width: min(240px, 72vw);
  }

  .panels {
    grid-template-columns: 1fr;
  }

  .upgrade {
    grid-template-columns: 1fr;
  }

  .upgrade button {
    justify-self: stretch;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn {
    width: 100%;
  }
}

/* Observer screen */
.observer-screen {
  width: min(1200px, 100%);
}

.observer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.observer-header-right {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.observer-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.obs-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  gap: 14px;
}

.obs-card.leader {
  border-color: rgba(245, 197, 66, 0.45);
  box-shadow: 0 0 0 1px rgba(245, 197, 66, 0.2), var(--shadow);
}

.obs-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.obs-card h2 {
  margin: 0;
  display: inline;
  font-size: 1.35rem;
}

.obs-rank {
  color: var(--muted);
  margin-right: 6px;
  font-weight: 800;
}

.obs-score {
  font-family: var(--font-display);
  font-size: 2.6rem;
  line-height: 1;
  color: var(--gold);
}

.obs-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.obs-metrics div {
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 4px;
}

.obs-metrics span {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.obs-metrics strong {
  font-size: 1.05rem;
}

.obs-card section h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.obs-players {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.obs-players li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.92rem;
}

.obs-players .player-stats {
  color: var(--muted);
  white-space: nowrap;
}

.obs-players .pts {
  color: var(--gold);
}

.obs-jokers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}

.obs-joker {
  position: relative;
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0.72rem;
  font-weight: 700;
}

.obs-joker .joker-frame {
  width: 64px;
}

.obs-joker img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  border-radius: 0;
  background: transparent;
}

.obs-joker.active .joker-frame {
  border-color: var(--lime);
}

.obs-joker.off {
  opacity: 0.5;
  filter: grayscale(0.8);
}

.obs-joker em {
  position: absolute;
  top: 4px;
  right: 4px;
  font-style: normal;
  background: var(--lime);
  color: #102008;
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 999px;
}

.admin-actions a.btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
