/* ===== Variables & Reset ===== */
:root {
  --gold: #c9a84c;
  --gold-light: #e8d48b;
  --gold-dark: #a8893a;
  --navy: #0f1a3a;
  --navy-light: #1a2a55;
  --navy-mid: #152045;
  --parchment: #f5f0e1;
  --parchment-dark: #e8dcc8;
  --white: #ffffff;
  --green: #2d8a4e;
  --orange: #ff8801;
  --blue: #2563eb;
  --pink: #db2777;
  --yellow: #f8e161;
  --brown: #92400e;
  --red-vs: #b91c1c;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.18);
  --font-display: 'Cinzel', serif;
  --font-body: 'Inter', sans-serif;
  --gold-border: 1px solid rgba(201,168,76,0.5);
  --gold-glow: 0 0 15px rgba(201,168,76,0.15);
  color-scheme: only light;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--navy);
  background-image:
    radial-gradient(ellipse at 50% 50%, rgba(30,50,100,0.3) 0%, transparent 70%),
    radial-gradient(circle at 20% 80%, rgba(201,168,76,0.05) 0%, transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(201,168,76,0.05) 0%, transparent 40%);
  color: var(--white);
  height: 100vh;
  overflow: hidden;
}

/* ===== Screens ===== */
.screen { display: none; height: 100vh; overflow: hidden; }
.screen.active { display: flex; }

/* ===== Setup Screen ===== */
#setup-screen {
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #0a0f28 100%);
}
.setup-container {
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(20px);
  border: 2px solid rgba(201,168,76,0.4);
  border-radius: 20px;
  padding: 3rem 2.5rem;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: var(--gold-glow), 0 20px 60px rgba(0,0,0,0.5);
}
.logo-area { margin-bottom: 2rem; }
.bible-icon {
  width: 60px; height: 60px;
  margin: 0 auto;
  color: var(--gold);
  filter: drop-shadow(0 0 15px rgba(201,168,76,0.5));
  animation: glow 2s ease-in-out infinite alternate;
}
@keyframes glow {
  from { filter: drop-shadow(0 0 10px rgba(201,168,76,0.3)); }
  to { filter: drop-shadow(0 0 25px rgba(201,168,76,0.7)); }
}
.logo-area h1 {
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: var(--gold);
  margin: 0.5rem 0 0.25rem;
  letter-spacing: 3px;
  text-shadow: 0 2px 10px rgba(201,168,76,0.3);
}
.subtitle { color: var(--gold-light); opacity: 0.7; font-size: 0.95rem; }
.setup-form label {
  display: block; text-align: left;
  font-weight: 600; margin-bottom: 0.5rem; color: var(--parchment);
}
.player-count-selector {
  display: flex; gap: 0.5rem; margin-bottom: 1.5rem;
}
.count-btn {
  flex: 1; padding: 0.7rem;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(201,168,76,0.2);
  border-radius: var(--radius);
  color: var(--parchment);
  font-size: 1.1rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
}
.count-btn:hover, .count-btn.active {
  background: rgba(201,168,76,0.2);
  border-color: var(--gold);
  color: var(--gold);
}
.name-input {
  width: 100%; padding: 0.65rem 1rem;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px; color: var(--white);
  font-size: 0.95rem; margin-bottom: 0.75rem;
  transition: border-color 0.2s;
}
.name-input:focus { outline: none; border-color: var(--gold); }
.name-input::placeholder { color: rgba(255,255,255,0.35); }

/* ===== Buttons ===== */
.btn-primary {
  background: linear-gradient(135deg, #e8c84a 0%, #c9a84c 50%, #a8893a 100%);
  color: #1a1000; border: none;
  padding: 0.85rem 2rem;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: all 0.25s;
  letter-spacing: 1px;
  width: 100%; margin-top: 0.5rem;
  box-shadow: 0 4px 15px rgba(201,168,76,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
  text-shadow: 0 1px 0 rgba(255,255,255,0.2);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 25px rgba(201,168,76,0.5); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ===== Game Screen ===== */
#game-screen { flex-direction: column; }

/* ===== Game Header - Full Width Overlay ===== */
#game-header, #tv-game-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 11;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 2rem;
  background: linear-gradient(180deg, rgba(10,18,40,0.96) 0%, rgba(15,26,58,0.94) 100%);
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 4px 15px rgba(0,0,0,0.6);
  gap: 0.5rem;
}
#game-header::after, #tv-game-header::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232,200,74,0.6), transparent);
}
#current-player-info, #tv-current-player-info {
  display: flex; align-items: center; gap: 0.5rem;
  background: rgba(0,0,0,0.4);
  padding: 0.3rem 1rem;
  border-radius: 6px;
  border: 1px solid rgba(201,168,76,0.4);
}
#turn-label, #tv-turn-label {
  font-size: 0.8rem; opacity: 0.9;
  font-family: var(--font-display);
  letter-spacing: 2px;
  text-transform: uppercase;
}
#current-player-name, #tv-current-player-name {
  font-family: var(--font-display);
  font-size: 1.15rem; color: var(--gold);
  font-weight: 700;
  text-shadow: 0 0 12px rgba(201,168,76,0.5);
}
#wedge-display, #tv-wedge-display { display: flex; gap: 6px; }
#header-jokers-display, #tv-header-jokers {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin-left: auto;
  margin-right: 1.5rem;
}
.header-joker {
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(201,168,76,0.3);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.header-joker.active {
  filter: grayscale(0) drop-shadow(0 0 5px rgba(255, 215, 0, 0.35));
  border-color: var(--gold);
  background: rgba(201,168,76,0.1);
}
.header-joker.used {
  filter: grayscale(1) opacity(0.25);
  background: rgba(0,0,0,0.3);
  border-color: rgba(255,255,255,0.08);
}
.header-joker:hover {
  transform: scale(1.15) translateY(-1px);
}
.wedge-indicator {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(201,168,76,0.4);
  opacity: 0.3; transition: all 0.3s;
  box-shadow: 0 0 5px rgba(0,0,0,0.5);
}
.wedge-indicator.earned {
  opacity: 1; border-color: var(--gold);
  transform: scale(1.15);
  box-shadow: 0 0 8px rgba(201,168,76,0.4);
}
.wedge-indicator.green { background: var(--green); }
.wedge-indicator.orange { background: var(--orange); }
.wedge-indicator.blue { background: var(--blue); }
.wedge-indicator.pink { background: var(--pink); }
.wedge-indicator.yellow { background: var(--yellow); }
.wedge-indicator.brown { background: var(--brown); }

#game-main {
  flex: 1; display: flex;
  padding: 0.75rem; gap: 0.75rem;
  overflow: hidden;
  position: relative;
}

/* ===== Left Sidebar (Categories - Overlay) ===== */
#left-sidebar {
  position: absolute;
  left: -4%;
  top: 9%;
  bottom: 3%;
  width: 22%;
  z-index: 10;
  display: flex; flex-direction: column;
  pointer-events: none;
}
.parchment-scroll {
  background: url('pergamino.png') center/100% 100% no-repeat;
  border: none;
  border-radius: 0;
  padding: 2.5rem 1rem 1.8rem 3.8rem;
  box-shadow: none;
  position: relative;
  overflow: hidden;
  color: #3b2f21;
}
/* Pseudo-elements disabled — image includes scroll curls */
.parchment-scroll::before { display: none; }
.parchment-scroll::after { display: none; }
.scroll-title {
  font-family: var(--font-display);
  font-size: 0.75rem; text-align: center;
  color: #3b2f21; margin-bottom: 0.5rem;
  margin-left: -1.8rem;
  text-transform: uppercase; letter-spacing: 1.5px;
  position: relative;
  padding-bottom: 0.4rem;
}
.scroll-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 50%;
  height: 1.5px;
  background: rgba(139,115,85,0.45);
}
#categories-legend, #tv-categories-legend { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; position: relative; z-index: 1; }
#categories-legend li, #tv-categories-legend li { display: flex; align-items: center; gap: 0.4rem; font-family: var(--font-display); font-size: 0.56rem; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
.cat-icon {
  width: 21px; height: 21px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.5rem; color: #fff; flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3), inset 0 -1px 3px rgba(0,0,0,0.4), inset 0 1px 3px rgba(255,255,255,0.4);
  border: 1px solid var(--gold);
}
.cat-icon.green { background: #2d8a4e; }
.cat-icon.orange { background: #ff8801; }
.cat-icon.blue { background: #2563eb; }
.cat-icon.pink { background: #db2777; }
.cat-icon.yellow { background: #f8e161; }
.cat-icon.brown { background: #92400e; }
.cat-icon.red {
  background: #991b1b;
  color: #fbbf24;
  font-size: 0.85rem;
  font-weight: bold;
  line-height: 1;
  text-shadow: 0 1px 1px rgba(0,0,0,0.5);
}
.legend-separator { height: 1px; background: rgba(139,115,85,0.2); margin: 0.15rem 0; }


/* ===== Board ===== */
#board-container {
  flex: 1;
  display: flex;
  align-items: center; justify-content: center;
  min-height: 0;
  position: relative;
  background: var(--navy);
  border-radius: var(--radius);
  border: 2px solid rgba(201,168,76,0.3);
  box-shadow: inset 0 0 60px rgba(0,0,0,0.4), var(--gold-glow);
  overflow: hidden;
}
#board-aspect-wrapper {
  position: relative;
  aspect-ratio: 1308 / 816;
  max-width: 100%; max-height: 100%;
  height: 100%;
}
#game-board {
  width: 100%; height: 100%;
  display: block;
  filter: drop-shadow(0 0 50px rgba(201,168,76,0.15));
}
.board-space {
  cursor: default; transition: filter 0.2s;
}
.board-space.highlight {
  filter: brightness(1.2) drop-shadow(0 0 10px #00f3ff);
  animation: pulse-space 0.6s ease-in-out infinite alternate;
}
@keyframes pulse-space {
  to {
    filter: brightness(1.4) drop-shadow(0 0 18px #00f3ff);
  }
}
.player-token {
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

/* ===== Sidebar (flex item alongside game-main) ===== */
#sidebar {
  width: 22%;
  min-width: 250px;
  max-width: 320px;
  display: flex; flex-direction: column; gap: 0.5rem;
  background: transparent;
  padding: 0.5rem 0;
  overflow-y: auto;
  z-index: 10;
}
#sidebar::-webkit-scrollbar { width: 5px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(201,168,76,0.4); border-radius: 4px; }

/* Dice Area - Premium */
#dice-area, #tv-dice-display {
  background: linear-gradient(145deg, rgba(20,35,70,0.9) 0%, rgba(10,20,50,0.95) 100%);
  border: 2px solid rgba(201,168,76,0.4);
  border-radius: var(--radius);
  padding: 0.6rem; text-align: center;
  box-shadow: 0 0 10px rgba(201,168,76,0.1);
  position: relative;
  margin-bottom: 0.4rem;
}
#dice-area::before, #tv-dice-display::before {
  content: 'Tu dado';
  display: block;
  font-family: var(--font-display);
  font-size: 0.6rem;
  color: var(--gold);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
#tv-dice-display::before {
  content: 'Dado de juego';
}
#dice, #tv-dice {
  width: 55px; height: 55px;
  margin: 0 auto 0.5rem;
  background: linear-gradient(145deg, #ffffff 0%, #f0ead8 100%);
  color: var(--navy); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 900;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4), inset 0 2px 4px rgba(255,255,255,0.8);
  font-family: var(--font-display);
  border: 2px solid rgba(201,168,76,0.5);
}
#dice.rolling, #tv-dice.rolling { animation: roll-dice 0.5s ease-out; }
@keyframes roll-dice {
  0% { transform: rotateZ(0deg) scale(1); }
  25% { transform: rotateZ(90deg) scale(1.1); }
  50% { transform: rotateZ(180deg) scale(0.95); }
  75% { transform: rotateZ(270deg) scale(1.05); }
  100% { transform: rotateZ(360deg) scale(1); }
}
#dice-area .btn-primary {
  font-size: 0.95rem;
  padding: 0.65rem 1.2rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: linear-gradient(180deg, #f5e08a 0%, #e8c84a 15%, #c9a84c 50%, #a8893a 85%, #8a6f2e 100%);
  border: 1px solid #d4a843;
  border-bottom: 3px solid #7a6228;
  border-top: 1px solid #f5e08a;
  box-shadow: 0 4px 8px rgba(0,0,0,0.4), inset 0 1px 2px rgba(255,255,255,0.5), inset 0 -1px 2px rgba(0,0,0,0.2);
  text-shadow: 0 1px 1px rgba(255,255,255,0.3);
  color: #1a1000;
  border-radius: 8px;
  transition: all 0.15s;
}
#dice-area .btn-primary:hover {
  background: linear-gradient(180deg, #fff0a0 0%, #f0d460 15%, #d4b050 50%, #b89540 85%, #9a7a30 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.4), inset 0 1px 2px rgba(255,255,255,0.6), 0 0 15px rgba(232,200,74,0.3);
}
#dice-area .btn-primary:active {
  transform: translateY(1px);
  border-bottom: 1px solid #7a6228;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4), inset 0 1px 2px rgba(0,0,0,0.2);
}
.btn-dice-icon {
  font-size: 1.4rem;
  vertical-align: middle;
  margin-right: 6px;
  line-height: 1;
  display: inline-block;
}
#dice-area::after, #tv-dice-display::after {
  content: 'Lanza el dado para avanzar';
  display: block;
  font-size: 0.5rem;
  color: rgba(255,255,255,0.4);
  margin-top: 0.3rem;
}
#tv-dice-display::after {
  content: 'Dado de juego';
}

/* Players Panel */
#players-panel, #tv-players-panel {
  background: linear-gradient(145deg, rgba(20,35,70,0.9) 0%, rgba(10,20,50,0.95) 100%);
  border: 2px solid #4fc3f7;
  border-radius: var(--radius); padding: 0.5rem;
  box-shadow: 0 0 10px rgba(79,195,247,0.15);
}
#players-panel h3 {
  font-family: var(--font-display);
  font-size: 0.6rem; color: var(--gold);
  margin-bottom: 0.4rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.player-card {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem; border-radius: 6px;
  margin-bottom: 0.3rem; transition: all 0.2s;
  border: 1px solid transparent;
}
.player-card:last-child { margin-bottom: 0; }
.player-card.active-player {
  background: rgba(79,195,247,0.1);
  border-color: rgba(79,195,247,0.3);
  box-shadow: 0 0 8px rgba(79,195,247,0.1);
}
.player-card-left { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; min-width: 0; }
.player-card-header { display: flex; align-items: center; gap: 0.3rem; }
.player-dot {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.5), 0 0 4px currentColor;
  border: 2px solid rgba(255,255,255,0.2);
}
.player-card-name { font-size: 0.55rem; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-card-wedges { display: flex; flex-direction: row; gap: 2px; flex-shrink: 0; }
.mini-wedge {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3); opacity: 0.3;
  cursor: pointer; transition: all 0.2s;
}
.mini-wedge.earned {
  opacity: 1; border-color: rgba(201,168,76,0.8);
  transform: scale(1.1);
  box-shadow: 0 0 4px rgba(201,168,76,0.5);
}
.player-card-jokers { display: flex; gap: 3px; }
.mini-joker {
  font-size: 9px; cursor: pointer; transition: all 0.2s; opacity: 1;
  width: 14px; height: 14px; display: flex; align-items: center; justify-content: center;
  border-radius: 3px; background: rgba(255,255,255,0.08); border: 1px solid rgba(201,168,76,0.2);
}
.mini-joker.used { opacity: 0.3; filter: grayscale(100%); background: transparent; border: 1px dashed rgba(255,255,255,0.3); }

/* Confetti */
.confetti-particle {
  position: fixed; width: 8px; height: 8px;
  pointer-events: none; z-index: 9999;
  animation: confetti-pop 1.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}
@keyframes confetti-pop {
  0% { transform: translate(-50%, -50%) scale(0) rotate(0deg); opacity: 1; }
  50% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1) rotate(720deg); opacity: 0; }
}

/* Game Log */
#game-log {
  background: linear-gradient(145deg, rgba(20,35,70,0.9) 0%, rgba(10,20,50,0.95) 100%);
  border: 2px solid rgba(201,168,76,0.5);
  border-radius: var(--radius); padding: 0.5rem;
  flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 0 10px rgba(201,168,76,0.1);
}
#game-log h3 {
  font-family: var(--font-display); font-size: 0.6rem; color: var(--gold);
  margin-bottom: 0.3rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}
#log-list {
  list-style: none; overflow-y: auto; flex: 1;
  font-size: 0.55rem; opacity: 0.8;
}
#log-list li { padding: 0.15rem 0; border-bottom: 1px solid rgba(201,168,76,0.08); }

/* ===== Direction Buttons ===== */
#direction-buttons {
  background: linear-gradient(145deg, rgba(20,35,70,0.95) 0%, rgba(10,20,50,0.98) 100%);
  border: 2px solid rgba(201,168,76,0.4);
  border-radius: var(--radius);
  padding: 1rem;
  animation: modal-in 0.3s ease-out;
  box-shadow: var(--gold-glow);
}
.direction-label {
  font-size: 0.85rem; color: var(--gold);
  font-weight: 600; margin-bottom: 0.75rem;
  text-align: center;
  font-family: var(--font-display);
  letter-spacing: 1px;
}
.direction-btn {
  width: 100%; padding: 0.65rem 1rem;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 8px; color: var(--white);
  font-size: 0.9rem; cursor: pointer;
  margin-bottom: 0.5rem; transition: all 0.2s;
  display: flex; align-items: center; gap: 0.5rem;
}
.direction-btn:hover {
  background: rgba(255,255,255,0.12);
  transform: translateX(4px);
}
.dir-dot {
  width: 12px; height: 12px;
  border-radius: 50%; display: inline-block; flex-shrink: 0;
}

/* ===== Bottom Bar (Overlay) ===== */
#bottom-bar {
  position: absolute;
  bottom: 0;
  left: 17%;
  right: 32%;
  z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: 0.45rem 1.8rem;
  background: linear-gradient(180deg, rgba(10,20,45,0.96) 0%, rgba(5,10,25,0.98) 100%);
  border: 1.5px solid var(--gold-dark);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  gap: 0.5rem;
  box-shadow: 0 -4px 15px rgba(0,0,0,0.4), inset 0 1px 2px rgba(255,255,255,0.1);
  pointer-events: none;
}
#bottom-bar .crown-icon {
  font-size: 1rem;
  color: var(--gold);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  display: inline-block;
  animation: float-crown 3s ease-in-out infinite alternate;
}
@keyframes float-crown {
  from { transform: translateY(0); }
  to { transform: translateY(-2px); }
}
#bottom-bar .bar-text {
  font-size: 0.68rem;
  color: var(--parchment);
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
#bottom-bar .bar-verse {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* ===== Modal ===== */
.modal {
  display: none; position: fixed; inset: 0;
  z-index: 1000; align-items: center; justify-content: center;
}
.modal.active { display: flex; }
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
}
.modal-content {
  position: relative; z-index: 1;
  background: linear-gradient(145deg, var(--navy-light) 0%, var(--navy) 100%);
  border: 2px solid rgba(201,168,76,0.4);
  border-radius: 20px; padding: 2rem;
  max-width: 520px; width: 92%;
  animation: modal-in 0.3s ease-out;
  box-shadow: 0 0 40px rgba(201,168,76,0.15), 0 20px 60px rgba(0,0,0,0.5);
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.q-category-label {
  display: inline-block; padding: 0.3rem 1rem;
  border-radius: 20px; font-size: 0.8rem;
  font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 1rem;
}
.q-text {
  font-size: 1.1rem; line-height: 1.6;
  margin-bottom: 1.5rem; color: var(--parchment);
}
.q-options { display: flex; flex-direction: column; gap: 0.6rem; }
.q-option-btn {
  width: 100%; padding: 0.85rem 1.2rem;
  background: rgba(255,255,255,0.07);
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: var(--radius); color: var(--white);
  font-size: 0.95rem; cursor: pointer;
  text-align: left; transition: all 0.2s;
}
.q-option-btn:hover:not(:disabled) {
  background: rgba(201,168,76,0.15);
  border-color: var(--gold);
}
.q-option-btn.correct {
  background: rgba(45,138,78,0.3) !important;
  border-color: var(--green) !important;
}
.q-option-btn.wrong {
  background: rgba(220,38,38,0.3) !important;
  border-color: #dc2626 !important;
}
.q-result {
  text-align: center; font-size: 1.3rem;
  font-weight: 700; margin: 1rem 0 0.5rem;
  font-family: var(--font-display);
}
.q-result.correct-result { color: #4ade80; }
.q-result.wrong-result { color: #f87171; }
.q-reference {
  text-align: center; font-size: 0.82rem;
  opacity: 0.6; font-style: italic; margin-bottom: 0.5rem;
}
.hidden { display: none !important; }

/* ===== Victory ===== */
.victory-content { text-align: center; }
.victory-icon { font-size: 4rem; animation: bounce 1s infinite; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}
.victory-content h2 {
  font-family: var(--font-display);
  font-size: 2rem; color: var(--gold); margin: 0.5rem 0;
}
#winner-name {
  font-size: 1.3rem; color: var(--gold-light);
  font-family: var(--font-display);
}
.victory-sub { font-size: 0.9rem; opacity: 0.6; margin: 0.5rem 0 1.5rem; }

/* ===== Mode Selector ===== */
.mode-selector {
  display: flex; gap: 0.75rem; margin-bottom: 1.5rem;
}
.mode-btn {
  flex: 1; padding: 1rem 0.5rem;
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(201,168,76,0.15);
  border-radius: var(--radius);
  color: var(--parchment);
  cursor: pointer; transition: all 0.25s;
  display: flex; flex-direction: column;
  align-items: center; gap: 0.3rem;
  text-align: center;
}
.mode-btn:hover {
  background: rgba(201,168,76,0.1);
  border-color: rgba(201,168,76,0.4);
}
.mode-btn.active {
  background: rgba(201,168,76,0.15);
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(201,168,76,0.2);
}
.mode-icon { font-size: 1.8rem; }
.mode-title {
  font-family: var(--font-display);
  font-size: 0.85rem; font-weight: 700;
  letter-spacing: 0.5px;
}
.mode-desc {
  font-size: 0.65rem; opacity: 0.5;
}

/* ===== TV Join Hint ===== */
.tv-join-hint {
  text-align: center;
  margin-bottom: 1.5rem;
  padding: 0.6rem 1rem;
  background: rgba(201,168,76,0.05);
  border: 1px dashed rgba(201,168,76,0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.tv-join-hint span {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
}
.tv-join-link {
  font-family: var(--font-display);
  font-size: 0.75rem;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: 0.5px;
  transition: all 0.2s;
}
.tv-join-link:hover {
  color: var(--gold-light);
  text-shadow: 0 0 8px rgba(201,168,76,0.4);
}

/* ===== Online Panel ===== */
.divider-text {
  text-align: center; margin: 1rem 0;
  position: relative;
}
.divider-text::before {
  content: '';
  position: absolute; top: 50%; left: 0; right: 0;
  height: 1px;
  background: rgba(201,168,76,0.2);
}
.divider-text span {
  position: relative; z-index: 1;
  background: rgba(15,26,58,0.95);
  padding: 0 0.75rem;
  font-size: 0.8rem; color: rgba(255,255,255,0.4);
  text-transform: uppercase; letter-spacing: 1px;
}
.join-row {
  display: flex; gap: 0.5rem; align-items: stretch;
}
.join-row .name-input { flex: 1; margin-bottom: 0; }
.join-row .btn-primary { margin-top: 0; }
.online-error {
  color: #f87171; font-size: 0.8rem;
  text-align: center; margin-top: 0.75rem;
  padding: 0.5rem; border-radius: 6px;
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.2);
}

/* ===== Lobby ===== */
.room-code-display {
  text-align: center; margin-bottom: 1.25rem;
  padding: 1rem;
  background: rgba(0,0,0,0.3);
  border-radius: var(--radius);
  border: 1px solid rgba(201,168,76,0.3);
}
.room-code-label {
  font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 2px; color: rgba(255,255,255,0.5);
  display: block; margin-bottom: 0.4rem;
}
.room-code-row {
  display: flex; align-items: center;
  justify-content: center; gap: 0.75rem;
}
.room-code-big {
  font-family: 'Courier New', monospace;
  font-size: 2.2rem; font-weight: 900;
  color: var(--gold); letter-spacing: 6px;
  text-shadow: 0 0 20px rgba(201,168,76,0.4);
}
.copy-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 6px; padding: 0.4rem 0.6rem;
  cursor: pointer; font-size: 1rem;
  transition: all 0.2s; color: var(--parchment);
}
.copy-btn:hover {
  background: rgba(201,168,76,0.15);
  border-color: var(--gold);
}

#lobby-players-list {
  display: flex; flex-direction: column; gap: 0.5rem;
  margin-bottom: 1rem;
}
.lobby-player {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  transition: all 0.3s;
  animation: lobby-player-in 0.3s ease-out;
}
@keyframes lobby-player-in {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}
.lobby-player-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74,222,128,0.5);
  animation: dot-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.lobby-player-dot.offline {
  background: #6b7280; box-shadow: none;
  animation: none;
}
.lobby-player-name {
  font-size: 0.9rem; font-weight: 600; flex: 1;
}
.lobby-player-badge {
  font-size: 0.6rem; text-transform: uppercase;
  letter-spacing: 1px; padding: 0.2rem 0.5rem;
  border-radius: 4px; font-weight: 700;
}
.lobby-player-badge.host {
  background: rgba(201,168,76,0.2);
  color: var(--gold);
  border: 1px solid rgba(201,168,76,0.3);
}
.lobby-status {
  text-align: center; font-size: 0.8rem;
  color: rgba(255,255,255,0.4); margin-bottom: 0.75rem;
}

/* ===== Leave / Secondary Button ===== */
.btn-secondary {
  background: transparent;
  color: rgba(255,255,255,0.5);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 0.6rem 1.5rem;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  width: 100%; margin-top: 0.5rem;
  letter-spacing: 0.5px;
}
.btn-secondary:hover {
  color: #f87171;
  border-color: rgba(248,113,113,0.4);
  background: rgba(248,113,113,0.05);
}

/* ===== Loading Dots ===== */
.loading-dots {
  display: flex; gap: 0.3rem;
  justify-content: center;
}
.loading-dots span {
  font-size: 2rem; color: var(--gold);
  animation: loading-dot 1.4s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes loading-dot {
  0%, 100% { opacity: 0.2; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-5px); }
}

/* ===== Online Game Header Addition ===== */
#online-leave-btn {
  background: transparent;
  border: 1px solid rgba(248,113,113,0.3);
  color: #f87171;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.65rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-display);
  letter-spacing: 0.5px;
}
#online-leave-btn:hover {
  background: rgba(248,113,113,0.1);
  border-color: #f87171;
}

/* ===== Responsive - Mobile ===== */
@media (max-width: 900px) {
  /* Allow scrolling on mobile */
  body {
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .screen { height: auto; min-height: 100vh; overflow: visible; }
  #game-screen { height: auto; min-height: 100vh; }

  /* Setup screen */
  .setup-container { padding: 1.5rem 1rem; width: 95%; max-width: 100%; }
  .logo-area h1 { font-size: 1.6rem; letter-spacing: 1px; }
  .subtitle { font-size: 0.8rem; }
  .mode-selector { flex-direction: column; }
  .mode-btn { font-size: 0.85rem; padding: 0.8rem; }

  /* Game header - compact sticky bar */
  #game-header {
    position: sticky;
    top: 0;
    padding: 0.4rem 0.75rem;
    flex-wrap: wrap;
    gap: 0.3rem;
    z-index: 50;
  }
  #current-player-info { padding: 0.2rem 0.6rem; }
  #turn-label { font-size: 0.6rem; letter-spacing: 1px; }
  #current-player-name { font-size: 0.85rem; }
  .wedge-indicator { width: 15px; height: 15px; }
  #wedge-display { gap: 3px; }
  #header-jokers-display { margin-right: 0.5rem; gap: 0.25rem; }
  .header-joker { width: 20px; height: 20px; font-size: 0.6rem; }

  /* Game main - vertical column layout */
  #game-main {
    flex-direction: column;
    overflow: visible;
    padding: 0.5rem;
    gap: 0.5rem;
    position: static;
  }

  /* Board container - must not clip on mobile */
  #board-container {
    flex: none !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    border: none;
    box-shadow: none;
    background: transparent;
  }
  #board-aspect-wrapper {
    aspect-ratio: unset !important;
    height: auto !important;
    max-height: none !important;
    max-width: 100% !important;
    display: flex;
    flex-direction: column;
  }
  #game-board {
    width: 100%;
    height: 55vw;
    min-height: 200px;
    max-height: 350px;
    flex-shrink: 0;
    border: 2px solid rgba(201,168,76,0.3);
    border-radius: var(--radius);
  }

  /* Hide left sidebar categories and bottom bar */
  #left-sidebar { display: none; }
  #bottom-bar { display: none; }

  /* Sidebar - normal flow below board */
  #sidebar {
    position: static;
    width: 100%;
    top: auto; right: auto; bottom: auto;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0;
    overflow: visible;
  }

  /* Dice area - horizontal row, always visible */
  #dice-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
  }
  #dice-area::before { content: none; }
  #dice-area::after { content: none; }
  #dice {
    width: 42px; height: 42px;
    font-size: 1.4rem;
    margin: 0;
    flex-shrink: 0;
  }
  #dice-area .btn-primary {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    flex: 1;
  }
  .btn-dice-icon { font-size: 1.1rem; margin-right: 4px; }

  /* Direction buttons */
  #direction-buttons { padding: 0.75rem; }
  .direction-label { font-size: 0.75rem; margin-bottom: 0.5rem; }
  .direction-btn { font-size: 0.8rem; padding: 0.5rem 0.75rem; }

  /* Players panel */
  #players-panel { padding: 0.4rem; }
  #players-panel h3 { font-size: 0.55rem; margin-bottom: 0.25rem; }
  .player-card { padding: 0.3rem; gap: 0.3rem; }
  .player-dot { width: 10px; height: 10px; }
  .player-card-name { font-size: 0.5rem; }
  .mini-wedge { width: 14px; height: 14px; }
  .mini-joker { width: 12px; height: 12px; font-size: 7px; }

  /* Game log */
  #game-log { max-height: 120px; flex: none; }
  #game-log h3 { font-size: 0.55rem; }
  #log-list { font-size: 0.5rem; }
  #log-list li { padding: 0.1rem 0; }

  /* Modals */
  .modal-content {
    width: 95%;
    max-width: 95%;
    padding: 1.25rem;
    border-radius: 14px;
    max-height: 85vh;
    overflow-y: auto;
  }
  .q-category-label { font-size: 0.7rem; padding: 0.2rem 0.75rem; margin-bottom: 0.75rem; }
  .q-text { font-size: 0.95rem; line-height: 1.5; margin-bottom: 1rem; }
  .q-options { gap: 0.4rem; }
  .q-option-btn { font-size: 0.85rem; padding: 0.6rem 0.8rem; }
  .q-result { font-size: 1.1rem; margin: 0.75rem 0 0.3rem; }
  .q-reference { font-size: 0.75rem; }
  .btn-primary { font-size: 0.9rem; padding: 0.6rem 1rem; }

  /* Victory */
  .victory-icon { font-size: 3rem; }
  .victory-content h2 { font-size: 1.5rem; }
  #winner-name { font-size: 1rem; }
  .victory-sub { font-size: 0.8rem; }

  /* Online panel */
  .online-create-join { flex-direction: column; gap: 0.75rem; }
  .online-create-join .btn-primary { font-size: 0.85rem; }
  #lobby-player-list { font-size: 0.8rem; }
  #online-leave-btn { font-size: 0.7rem; padding: 0.3rem 0.75rem; }
}
