@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&family=Cinzel+Decorative:wght@700&family=MedievalSharp&display=swap');

/* ── Variables ───────────────────────────────────────────────────────── */
:root {
  --gold:       #C9A84C;
  --gold-light: #F0D080;
  --gold-dark:  #7A5C1E;
  --blue-deep:  #0D1B2A;
  --blue-mid:   #1A2744;
  --blue-light: #2A3E6A;
  --red:        #8B1A1A;
  --red-light:  #C02020;
  --text:       #EDE5CC;
  --shadow:     rgba(0,0,0,0.8);
}

/* ── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Cinzel', serif;
  color: var(--text);
  background: var(--blue-deep);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  user-select: none;
}

/* ── Background ───────────────────────────────────────────────────────── */
#bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
  z-index: 0;
  filter: blur(1px) brightness(0.6);
}

/* HotA battlefield background image */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: url('/assets/bg-hota.png');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  opacity: 0.22;
  animation: bg-shift 20s ease-in-out infinite alternate;
}

@keyframes bg-shift {
  0%   { filter: brightness(1) hue-rotate(0deg); }
  50%  { filter: brightness(1.1) hue-rotate(5deg); }
  100% { filter: brightness(0.9) hue-rotate(-5deg); }
}

#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

#bg-particles {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center,
    rgba(13,27,42,0.3) 0%,
    rgba(13,27,42,0.75) 70%,
    rgba(13,27,42,0.95) 100%);
  z-index: 2;
}

/* ── Layout ───────────────────────────────────────────────────────────── */
#app {
  position: relative;
  z-index: 10;
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: 90px 1fr 80px;
  gap: 12px;
  padding: 12px;
}

/* ── Header ───────────────────────────────────────────────────────────── */
#header {
  grid-column: 1 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.tournament-logo {
  height: 72px;
  filter: drop-shadow(0 0 12px var(--gold));
}

.header-title {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.8));
}

/* ── Left panel: Scores ───────────────────────────────────────────────── */
#panel-left {
  grid-column: 1;
  grid-row: 2 / 4;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Center: Wheel ────────────────────────────────────────────────────── */
#panel-center {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

/* ── Bottom bar: Timer ───────────────────────────────────────────────── */
#panel-bottom {
  grid-column: 2;
  grid-row: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

/* ── Gold Frame Panel ─────────────────────────────────────────────────── */
.panel {
  background: linear-gradient(160deg, rgba(26,39,68,0.92) 0%, rgba(13,27,42,0.95) 100%);
  border: 2px solid var(--gold-dark);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 0 20px rgba(201,168,76,0.15), inset 0 0 30px rgba(0,0,0,0.4);
  position: relative;
}

.panel::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 6px;
  pointer-events: none;
}

.panel-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--gold);
  border-style: solid;
}
.panel-corner.tl { top: 4px; left: 4px;   border-width: 2px 0 0 2px; }
.panel-corner.tr { top: 4px; right: 4px;  border-width: 2px 2px 0 0; }
.panel-corner.bl { bottom: 4px; left: 4px;  border-width: 0 0 2px 2px; }
.panel-corner.br { bottom: 4px; right: 4px; border-width: 0 2px 2px 0; }

.panel-title {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 0.75rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 10px;
  text-align: center;
}

/* ── Scoreboard ───────────────────────────────────────────────────────── */
#scoreboard {
  flex: 1;
}

.score-header {
  display: grid;
  grid-template-columns: 34px 1fr 52px 44px;
  gap: 6px;
  font-size: 0.6rem;
  color: var(--gold);
  letter-spacing: 1px;
  margin-bottom: 6px;
  padding: 0 4px;
  text-transform: uppercase;
  align-items: center;
}

.score-row {
  display: grid;
  grid-template-columns: 34px 1fr 52px 44px;
  gap: 6px;
  align-items: center;
  padding: 5px 6px;
  margin-bottom: 5px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(201,168,76,0.15);
  border-radius: 6px;
  transition: all 0.3s;
}

.score-row:hover {
  background: rgba(201,168,76,0.08);
  border-color: rgba(201,168,76,0.35);
}

/* Player avatar circle in scoreboard */
.score-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold-dark);
  background: var(--blue-mid);
  flex-shrink: 0;
  display: block;
  transition: border-color 0.3s;
}

.score-row:hover .score-avatar { border-color: var(--gold); }

.score-avatar-placeholder {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--gold-dark);
  background: var(--blue-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--gold-dark);
  flex-shrink: 0;
}

.score-name {
  font-size: 0.82rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-val {
  text-align: center;
  font-size: 0.85rem;
}

.score-wins  { color: var(--gold); }
.score-games { color: var(--text); font-size: 0.78rem; opacity: 0.7; }

/* ── Wheel canvas ─────────────────────────────────────────────────────── */
#wheel-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#wheel-canvas {
  border-radius: 50%;
  box-shadow: 0 0 40px rgba(201,168,76,0.4), 0 0 80px rgba(201,168,76,0.15);
}

#wheel-pointer {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 28px solid var(--gold);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.8));
  z-index: 5;
}

/* ── Timer ────────────────────────────────────────────────────────────── */
#timer-display {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 1.6rem;
  color: var(--gold-light);
  text-shadow: 0 0 20px rgba(201,168,76,0.6);
  letter-spacing: 4px;
  min-width: 160px;
  text-align: center;
}

#timer-label {
  font-size: 0.65rem;
  color: var(--gold-dark);
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
}

/* ── Info Panel ───────────────────────────────────────────────────────── */
#tournament-banner {
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--gold-dark);
  box-shadow: 0 0 12px rgba(0,0,0,0.6);
}

.info-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  font-size: 0.8rem;
  border-bottom: 1px solid rgba(201,168,76,0.1);
}

.info-label { color: var(--gold-dark); font-size: 0.7rem; }
.info-value { color: var(--gold-light); font-weight: 700; }

/* ── Selected Participant ─────────────────────────────────────────────── */
#selected-wrap {
  text-align: center;
}

#selected-name {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 1.1rem;
  color: var(--gold-light);
  text-shadow: 0 0 16px var(--gold);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ── Question Overlay ─────────────────────────────────────────────────── */
#question-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

#question-overlay.active {
  opacity: 1;
  pointer-events: all;
}

#question-card {
  max-width: 900px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  background: linear-gradient(160deg, rgba(26,39,68,0.97) 0%, rgba(13,27,42,0.99) 100%);
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 0 60px rgba(201,168,76,0.4), 0 0 120px rgba(201,168,76,0.1);
  position: relative;
  opacity: 0;
  transform: scale(0.75) translateY(-30px);
}

#question-overlay.active #question-card {
  animation: card-enter 0.65s cubic-bezier(0.22,1.4,0.36,1) forwards;
}

@keyframes card-enter {
  0%   { opacity: 0; transform: scale(0.7) translateY(-40px); filter: brightness(2.5) blur(4px); }
  40%  { opacity: 1; filter: brightness(1.4) blur(0); }
  70%  { transform: scale(1.03) translateY(3px); filter: brightness(1.1); }
  100% { opacity: 1; transform: scale(1) translateY(0); filter: brightness(1); }
}

/* Staggered entrance for card children */
#question-overlay.active .q-participant {
  animation: slide-down 0.45s ease-out 0.3s both;
}
#question-overlay.active .q-theme {
  animation: slide-down 0.4s ease-out 0.42s both;
}
#question-overlay.active .q-divider {
  animation: expand-x 0.5s ease-out 0.5s both;
}
#question-overlay.active .q-atoms {
  animation: slide-up 0.5s ease-out 0.55s both;
}
#question-overlay.active #q-answer-wrap {
  animation: slide-up 0.4s ease-out 0.65s both;
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes expand-x {
  from { transform: scaleX(0); opacity: 0; }
  to   { transform: scaleX(1); opacity: 1; }
}

/* Pulsing gold border while question is open */
#question-overlay.active #question-card {
  animation: card-enter 0.65s cubic-bezier(0.22,1.4,0.36,1) forwards,
             border-pulse 2.5s ease-in-out 0.8s infinite;
}
@keyframes border-pulse {
  0%, 100% { box-shadow: 0 0 60px rgba(201,168,76,0.4), 0 0 120px rgba(201,168,76,0.1); }
  50%       { box-shadow: 0 0 90px rgba(201,168,76,0.65), 0 0 180px rgba(201,168,76,0.25), inset 0 0 40px rgba(201,168,76,0.07); }
}

/* Flash ring burst on overlay open */
#question-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}
#question-overlay.active::after {
  animation: ring-burst 0.6s ease-out forwards;
}
@keyframes ring-burst {
  0%   { box-shadow: 0 0 0 0 rgba(201,168,76,0.6); opacity: 1; }
  100% { box-shadow: 0 0 0 120px rgba(201,168,76,0); opacity: 0; }
}

#question-card::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: 8px;
  pointer-events: none;
}

/* ── Question close button ───────────────────────────────────────────── */
#q-close-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--gold-dark);
  background: rgba(139,26,26,0.4);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}

#q-close-btn:hover {
  background: var(--red-light);
  border-color: #FF4040;
  transform: scale(1.1);
  box-shadow: 0 0 12px rgba(255,50,50,0.4);
}

.q-participant {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 1rem;
  color: var(--gold);
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: 2px;
}

.q-theme {
  font-size: 0.75rem;
  color: var(--gold-dark);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 24px;
}

.q-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dark), transparent);
  margin-bottom: 24px;
}

.q-atoms {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.q-atom-text {
  font-size: 1.5rem;
  line-height: 1.6;
  text-align: center;
  color: var(--text);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.q-atom-image img {
  max-width: 100%;
  max-height: 50vh;
  border-radius: 8px;
  border: 2px solid var(--gold-dark);
  box-shadow: 0 0 20px rgba(0,0,0,0.6);
}

.q-atom-video video {
  max-width: 100%;
  max-height: 50vh;
  border-radius: 8px;
  border: 2px solid var(--gold-dark);
}

.q-atom-audio {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.audio-wave {
  width: 200px;
  height: 60px;
}

audio {
  width: 100%;
  max-width: 500px;
  filter: invert(1) hue-rotate(180deg);
}

/* ── Particle animation ───────────────────────────────────────────────── */
.particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: floatUp linear infinite;
}

@keyframes floatUp {
  0%   { transform: translateY(0) scale(1); opacity: 0.8; }
  100% { transform: translateY(-100vh) scale(0.2); opacity: 0; }
}

/* ── Answer countdown & reveal ───────────────────────────────────────────── */
#q-answer-wrap {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.q-answer-countdown {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.7rem;
  color: var(--gold-dark);
  letter-spacing: 2px;
  text-transform: uppercase;
}

#q-countdown-num {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 2rem;
  color: var(--gold-light);
  text-shadow: 0 0 20px rgba(201,168,76,0.6);
  min-width: 56px;
  text-align: center;
  transition: color 0.3s;
}

#q-countdown-num.urgent {
  color: #FF4040;
  text-shadow: 0 0 20px rgba(255,50,50,0.8);
  animation: pulse 0.5s ease-in-out infinite;
}

.q-answer-box {
  width: 100%;
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 20px 28px;
  background: rgba(201,168,76,0.07);
  box-shadow: 0 0 30px rgba(201,168,76,0.2);
  animation: answer-reveal 0.6s cubic-bezier(0.34,1.56,0.64,1);
  text-align: center;
}

@keyframes answer-reveal {
  0%   { transform: scaleY(0.3); opacity: 0; }
  100% { transform: scaleY(1);   opacity: 1; }
}

.q-answer-label {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 0.65rem;
  color: var(--gold);
  letter-spacing: 4px;
  margin-bottom: 10px;
}

.q-answer-text {
  font-size: 1.4rem;
  color: var(--gold-light);
  text-shadow: 0 0 16px rgba(201,168,76,0.5);
  line-height: 1.5;
}

/* ── Music toggle button ──────────────────────────────────────────────── */
#music-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--gold-dark);
  background: rgba(13,27,42,0.85);
  color: var(--gold-dark);
  font-size: 1.2rem;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: all 0.25s;
  display: flex;
  align-items: center;
  justify-content: center;
}
#music-btn:hover        { border-color: var(--gold); color: var(--gold); transform: scale(1.1); }
#music-btn.on           { border-color: var(--gold); color: var(--gold-light);
                          box-shadow: 0 0 14px rgba(201,168,76,0.4); animation: music-pulse 2s ease-in-out infinite; }
@keyframes music-pulse  { 0%,100%{box-shadow:0 0 8px rgba(201,168,76,0.3)} 50%{box-shadow:0 0 20px rgba(201,168,76,0.6)} }

/* ── Player History Sidebar ───────────────────────────────────────────── */
#history-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
#history-backdrop.open { opacity: 1; pointer-events: all; }

#history-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 300px;
  height: 100vh;
  z-index: 81;
  background: linear-gradient(180deg, rgba(13,20,35,0.98) 0%, rgba(13,27,42,0.99) 100%);
  border-right: 2px solid var(--gold-dark);
  box-shadow: 4px 0 40px rgba(0,0,0,0.7), inset -1px 0 0 rgba(201,168,76,0.1);
  transform: translateX(-105%);
  transition: transform 0.35s cubic-bezier(0.34,1.2,0.64,1);
  overflow-y: auto;
  padding: 24px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
#history-panel.open { transform: translateX(0); }

#history-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--gold-dark);
  background: rgba(139,26,26,0.35);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
#history-close:hover { background: var(--red-light); border-color: #FF4040; transform: scale(1.1); }

#history-avatar-wrap {
  display: flex;
  justify-content: center;
  margin: 10px 0 14px;
}

#history-avatar-img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid var(--gold-dark);
  background: var(--blue-mid);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--gold-dark);
  box-shadow: 0 0 20px rgba(201,168,76,0.25);
  flex-shrink: 0;
}
#history-avatar-img img { width: 100%; height: 100%; object-fit: cover; }

#history-player-name {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 1rem;
  color: var(--gold-light);
  text-align: center;
  letter-spacing: 1px;
  margin-bottom: 16px;
  text-shadow: 0 0 12px rgba(201,168,76,0.4);
}

#history-stats {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 18px;
  padding: 10px 0;
  border-top: 1px solid rgba(201,168,76,0.15);
  border-bottom: 1px solid rgba(201,168,76,0.15);
}

.hstat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.hstat-val  { font-family: 'Cinzel Decorative', cursive; font-size: 1.3rem; color: var(--gold-light); }
.hstat-val.win  { color: #6FCF6F; }
.hstat-val.loss { color: #CF6F6F; }
.hstat-label { font-size: 0.58rem; color: var(--gold-dark); letter-spacing: 1px; text-transform: uppercase; }

.history-section-title {
  font-family: 'Cinzel Decorative', cursive;
  font-size: 0.65rem;
  color: var(--gold-dark);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

#history-list { display: flex; flex-direction: column; gap: 6px; }

.hm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  border-left: 3px solid transparent;
  transition: background 0.2s;
}
.hm-row.win  { border-left-color: #6FCF6F; }
.hm-row.loss { border-left-color: #CF6F6F; }

.hm-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 1px;
  flex-shrink: 0;
}
.hm-badge.win  { background: rgba(111,207,111,0.2); color: #8FEF8F; }
.hm-badge.loss { background: rgba(207,111,111,0.2); color: #EF8F8F; }

.hm-body { flex: 1; min-width: 0; }
.hm-opp  { font-size: 0.8rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-score { font-size: 0.68rem; color: var(--gold-dark); margin-top: 1px; }
.hm-date  { font-size: 0.6rem; color: rgba(201,168,76,0.4); flex-shrink: 0; }

/* Scoreboard rows clickable */
.score-row { cursor: pointer; }

/* ── Scrollbar ────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 2px; }

/* ── Responsive: large tablet ─────────────────────────────────────────── */
@media (max-width: 1200px) {
  #app { grid-template-columns: 220px 1fr; }
}

/* ── Responsive: small tablet / landscape phone ────────────────────────── */
@media (max-width: 900px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    padding: 8px;
    gap: 8px;
  }

  body { overflow: auto; }

  #header {
    grid-column: 1;
    grid-row: 1;
    gap: 10px;
    flex-wrap: wrap;
  }

  .tournament-logo { height: 44px; }
  .header-title { font-size: 1.4rem; }

  #panel-left {
    grid-column: 1;
    grid-row: 4;
  }

  #panel-center {
    grid-column: 1;
    grid-row: 2;
  }


  #panel-bottom {
    grid-column: 1;
    grid-row: 5;
  }
}

/* ── Responsive: mobile phones ─────────────────────────────────────────── */
@media (max-width: 600px) {
  body { overflow-x: hidden; overflow-y: auto; }

  #app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto;
    height: auto;
    min-height: 100svh;
    padding: 6px;
    gap: 6px;
  }

  /* Row order: header → wheel → timer → scoreboard → info */
  #header    { grid-column: 1; grid-row: 1; flex-wrap: wrap; padding: 4px 0; }
  #panel-center { grid-column: 1; grid-row: 2; }
  #panel-bottom { grid-column: 1; grid-row: 3; }
  #panel-left   { grid-column: 1; grid-row: 4; }

  .tournament-logo { height: 36px; }

  .header-title { font-size: 1.1rem; }

  /* ── Header subtitle ── */
  #header > div > div:last-child { font-size: 0.5rem !important; letter-spacing: 1px !important; }

  /* ── Wheel ── */
  #panel-center { gap: 10px; }

  #wheel-pointer {
    border-left-width: 10px;
    border-right-width: 10px;
    border-top-width: 20px;
    top: -12px;
  }

  #selected-name { font-size: 0.9rem; }

  /* ── Timer ── */
  #timer-display { font-size: 1.2rem; letter-spacing: 2px; }
  #timer-label   { font-size: 0.55rem; letter-spacing: 1px; }

  /* ── Scoreboard ── */
  .score-header, .score-row {
    grid-template-columns: 28px 1fr 40px 34px;
    gap: 4px;
  }
  .score-avatar, .score-avatar-placeholder { width: 24px; height: 24px; font-size: 0.65rem; }
  .score-name  { font-size: 0.75rem; }
  .score-val   { font-size: 0.78rem; }
  .panel-title { font-size: 0.65rem; }


  /* ── Question card ── */
  #question-card {
    width: 96%;
    max-height: 92svh;
    padding: 20px 16px 16px;
    border-radius: 10px;
  }

  #q-close-btn {
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  .q-participant { font-size: 0.85rem; letter-spacing: 1px; }
  .q-theme       { font-size: 0.65rem; letter-spacing: 1px; margin-bottom: 14px; }
  .q-divider     { margin-bottom: 14px; }
  .q-atom-text   { font-size: 1.1rem; line-height: 1.5; }
  .q-atom-image img { max-height: 38vh; }
  .q-atom-video video { max-height: 35vh; }

  #q-countdown-num { font-size: 1.5rem; min-width: 40px; }
  .q-answer-box { padding: 14px 16px; }
  .q-answer-text { font-size: 1.05rem; }

  /* ── Panel padding ── */
  .panel { padding: 10px; }
}

/* ── Very small phones (≤360px) ─────────────────────────────────────────── */
@media (max-width: 360px) {
  .header-title { font-size: 0.95rem; }
  .tournament-logo { height: 28px; }
  #timer-display { font-size: 1rem; }
  .q-atom-text   { font-size: 1rem; }
}
