/* ===========================================
   SPELLING BEE CONTEST — SMAN 24 GARUT
   =========================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bee-yellow: #ffc107;
  --bee-gold:   #ffb300;
  --bee-dark:   #1a1a2e;
  --bee-navy:   #16213e;
  --bee-accent: #0f3460;
  --bee-red:    #e94560;
  --bee-green:  #22c55e;
  --bee-white:  #ffffff;
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.2);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #1a1a2e 0%, #0f3460 50%, #16213e 100%);
  color: var(--bee-white);
  overflow-x: hidden;
  user-select: none;
}

body::before {
  content: '🐝';
  position: fixed;
  font-size: 150px;
  opacity: 0.04;
  top: 10%; left: 5%;
  transform: rotate(-15deg);
  pointer-events: none;
}
body::after {
  content: '🐝';
  position: fixed;
  font-size: 200px;
  opacity: 0.04;
  bottom: 5%; right: 5%;
  transform: rotate(20deg);
  pointer-events: none;
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 40px 20px;
  animation: fadeIn 0.5s ease;
}
.screen.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============== HEADER ============== */
.app-header { text-align: center; margin-bottom: 40px; }
.app-header h1 {
  font-size: 3.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffc107 0%, #ff6b6b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 2px;
  margin-bottom: 8px;
}
.app-header .subtitle {
  font-size: 1.1rem;
  color: #a0aec0;
  letter-spacing: 4px;
  text-transform: uppercase;
}
.app-header .bee { font-size: 4rem; display: inline-block; animation: buzz 2s ease-in-out infinite; }
@keyframes buzz {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50%      { transform: translateY(-8px) rotate(5deg); }
}

/* ============== CARDS ============== */
.card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 193, 7, 0.2);
  border-radius: 20px;
  padding: 30px;
  box-shadow: var(--shadow-md);
  max-width: 900px;
  margin: 0 auto 20px;
}
.card h2 { color: var(--bee-yellow); margin-bottom: 20px; font-size: 1.5rem; }

.bonus-rule {
  margin-top: 15px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(233, 69, 96, 0.15), rgba(255, 193, 7, 0.1));
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 12px;
  color: #fef3c7;
  font-size: 0.95rem;
  line-height: 1.7;
}
.bonus-rule .mul {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  background: rgba(255, 193, 7, 0.25);
  color: #ffc107;
  font-weight: 700;
  margin: 0 2px;
}

/* ============== BUTTONS ============== */
.btn {
  border: none;
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
  font-family: inherit;
}
.btn-primary { background: linear-gradient(135deg, #ffc107, #ff9800); color: #1a1a2e; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(255, 193, 7, 0.4); }

.btn-success { background: linear-gradient(135deg, #22c55e, #16a34a); color: white; }
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(34, 197, 94, 0.4); }

.btn-danger { background: linear-gradient(135deg, #e94560, #c13651); color: white; }
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(233, 69, 96, 0.4); }

.btn-secondary { background: rgba(255, 255, 255, 0.1); color: white; border: 1px solid rgba(255, 255, 255, 0.2); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.15); }

.btn-hint {
  background: rgba(233, 69, 96, 0.15);
  color: #fca5a5;
  border: 1px dashed rgba(233, 69, 96, 0.5);
  padding: 10px 18px;
  font-size: 0.9rem;
  position: relative;
}
.btn-hint:hover { background: rgba(233, 69, 96, 0.25); color: #fff; }
.btn-hint.used { opacity: 0.4; cursor: not-allowed; text-decoration: line-through; }
.btn-hint .cost {
  display: inline-block;
  background: #e94560;
  color: white;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  margin-left: 4px;
  font-weight: 700;
}

.btn-big { padding: 20px 40px; font-size: 1.3rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ============== SETUP SCREEN ============== */
.setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (max-width: 768px) { .setup-grid { grid-template-columns: 1fr; } }

.input-group { margin-bottom: 15px; }
.input-group label {
  display: block;
  margin-bottom: 6px;
  color: #ffc107;
  font-weight: 500;
}
.input-group input {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  border: 2px solid rgba(255, 193, 7, 0.3);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  color: white;
  font-family: inherit;
}
.input-group input:focus {
  outline: none;
  border-color: var(--bee-yellow);
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.2);
}

.participant-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.participant-list input {
  padding: 10px 14px;
  font-size: 0.95rem;
  border: 2px solid rgba(255, 193, 7, 0.3);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  color: white;
  font-family: inherit;
}
.participant-list input:focus { outline: none; border-color: var(--bee-yellow); }

.actions-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }

/* ============== GAME SCREEN ============== */
.round-banner {
  text-align: center;
  padding: 16px;
  margin-bottom: 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 193, 7, 0.05));
  border: 1px solid rgba(255, 193, 7, 0.3);
}
.round-banner h2 { font-size: 2rem; color: var(--bee-yellow); margin-bottom: 4px; }
.round-banner p { color: #cbd5e1; font-size: 1rem; }

.game-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
}
@media (max-width: 1024px) { .game-layout { grid-template-columns: 1fr; } }

/* scoreboard */
.scoreboard {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px;
  max-height: 80vh;
  overflow-y: auto;
}
.scoreboard h3 {
  color: var(--bee-yellow);
  margin-bottom: 16px;
  font-size: 1.2rem;
  text-align: center;
}
.score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.2s;
}
.score-item.current {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.3), rgba(255, 152, 0, 0.2));
  border: 2px solid var(--bee-yellow);
  transform: scale(1.02);
}
.score-item.eliminated { opacity: 0.35; text-decoration: line-through; }
.score-item .name { font-weight: 500; }
.score-item .score {
  background: var(--bee-yellow);
  color: #1a1a2e;
  padding: 3px 12px;
  border-radius: 20px;
  font-weight: 700;
  min-width: 40px;
  text-align: center;
}

/* stage */
.stage {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 30px;
}

.current-player {
  text-align: center;
  margin-bottom: 20px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(233, 69, 96, 0.2), rgba(233, 69, 96, 0.05));
  border-radius: 12px;
  border: 1px solid rgba(233, 69, 96, 0.3);
}
.current-player .label { color: #cbd5e1; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 2px; }
.current-player .name { font-size: 2rem; color: white; font-weight: 700; margin-top: 4px; }

/* word card */
.word-card {
  background: linear-gradient(135deg, #ffc107, #ff9800);
  color: #1a1a2e;
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  margin-bottom: 20px;
  box-shadow: 0 20px 50px rgba(255, 193, 7, 0.3);
  position: relative;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.word-level-tag {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(26, 26, 46, 0.85);
  color: #ffc107;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Multiplier badge */
.bonus-badge {
  position: absolute;
  top: 15px;
  left: 15px;
  background: rgba(26, 26, 46, 0.85);
  color: #22c55e;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s;
}
.bonus-badge .mult {
  background: #22c55e;
  color: #1a1a2e;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 800;
}
.bonus-badge.reduced { color: #f59e0b; }
.bonus-badge.reduced .mult { background: #f59e0b; }
.bonus-badge.low { color: #e94560; }
.bonus-badge.low .mult { background: #e94560; color: white; }

/* Gambar wrapper dengan overlay */
.word-image-wrap {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  background: rgba(26, 26, 46, 0.2);
  border: 3px solid rgba(26, 26, 46, 0.15);
}
.word-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.word-image-wrap img.loaded { display: block; }
.word-emoji-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8rem;
  background: linear-gradient(135deg, rgba(26, 26, 46, 0.1), rgba(26, 26, 46, 0.2));
}
.word-image-wrap img.loaded ~ .word-emoji-fallback { display: none; }

/* overlay "tersembunyi" */
.reveal-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1a1a2e, #0f3460);
  color: #ffc107;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5;
  gap: 8px;
  text-align: center;
  padding: 20px;
}
.reveal-overlay .reveal-icon { font-size: 3rem; opacity: 0.6; }
.reveal-overlay .reveal-text { font-size: 1.1rem; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.reveal-overlay .reveal-hint { font-size: 0.85rem; color: #94a3b8; max-width: 250px; }
.word-image-wrap.revealed .reveal-overlay { display: none; }

/* teks kata */
.word-text {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: capitalize;
}
.word-text.hidden { display: none; }

/* Kotak huruf */
.letter-boxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 100%;
}
.letter-boxes.hidden { display: none; }
.letter-box {
  width: 52px;
  height: 60px;
  background: rgba(26, 26, 46, 0.9);
  color: #ffc107;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.3);
  transition: all 0.3s;
}
.letter-box.filled {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  transform: rotateY(360deg);
}
.letter-box.revealed-all {
  background: linear-gradient(135deg, #0f3460, #16213e);
  color: #ffc107;
}
@media (max-width: 600px) {
  .letter-box { width: 38px; height: 46px; font-size: 1.3rem; }
}

/* Info block (definition / translation) */
.info-block {
  background: rgba(26, 26, 46, 0.85);
  color: #ffc107;
  padding: 12px 18px;
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.info-block.hidden { display: none; }
.info-block .info-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #ffc107;
  font-weight: 700;
}
.info-block .info-text {
  color: white;
  font-size: 1rem;
  line-height: 1.5;
  font-style: italic;
}

/* waiting card */
.waiting-card {
  background: rgba(255, 255, 255, 0.04);
  border: 2px dashed rgba(255, 193, 7, 0.3);
  border-radius: 20px;
  padding: 60px 40px;
  text-align: center;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}
.waiting-card .icon { font-size: 5rem; margin-bottom: 20px; opacity: 0.5; }
.waiting-card .text { font-size: 1.2rem; color: #cbd5e1; }

/* timer */
.timer-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
}
.timer-ring {
  position: relative;
  width: 100px;
  height: 100px;
  transition: transform 0.15s;
}
.timer-ring svg { transform: rotate(-90deg); }
.timer-ring circle {
  fill: none;
  stroke-width: 8;
}
.timer-ring .bg { stroke: rgba(255,255,255,0.1); }
.timer-ring .fg {
  stroke: var(--bee-yellow);
  stroke-dasharray: 282.74;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
  stroke-linecap: round;
}
.timer-ring .fg.warning { stroke: #ff9800; }
.timer-ring .fg.danger  { stroke: #e94560; }
.timer-ring .time-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: white;
}

/* Pulse saat timer kritis */
.timer-ring.warning { animation: pulseWarn 1s infinite; }
.timer-ring.danger  { animation: pulseDanger 0.5s infinite; }
.timer-ring.danger .time-text { color: #e94560; text-shadow: 0 0 10px #e94560; }

@keyframes pulseWarn {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}
@keyframes pulseDanger {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(233, 69, 96, 0.5)); }
  50%      { transform: scale(1.12); filter: drop-shadow(0 0 20px rgba(233, 69, 96, 0.9)); }
}

/* Screen shake saat 5 detik terakhir */
.stage.shake { animation: shake 0.5s infinite; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-3px); }
  75%      { transform: translateX(3px); }
}

/* control buttons */
.control-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hint-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 15px; }

/* final round */
.final-buzzer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}
.final-buzzer button {
  padding: 20px;
  font-size: 1.1rem;
  font-weight: 700;
  border: 2px solid rgba(255, 193, 7, 0.3);
  background: rgba(255, 255, 255, 0.05);
  color: white;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.final-buzzer button:hover { background: rgba(255, 193, 7, 0.2); transform: translateY(-2px); }
.final-buzzer button.selected { background: linear-gradient(135deg, #ffc107, #ff9800); color: #1a1a2e; border-color: #ffc107; }
.final-buzzer button:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }

/* ============== RESULTS ============== */
.podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 20px;
  margin: 40px 0;
}
.podium-place {
  background: linear-gradient(180deg, rgba(255, 193, 7, 0.15), rgba(255, 193, 7, 0.05));
  border-radius: 16px 16px 0 0;
  padding: 25px 20px;
  text-align: center;
  min-width: 180px;
  border: 1px solid rgba(255, 193, 7, 0.3);
}
.podium-place.first  { height: 260px; background: linear-gradient(180deg, rgba(255, 215, 0, 0.3), rgba(255, 215, 0, 0.05)); border-color: gold; }
.podium-place.second { height: 210px; background: linear-gradient(180deg, rgba(192, 192, 192, 0.25), rgba(192, 192, 192, 0.05)); border-color: silver; }
.podium-place.third  { height: 170px; background: linear-gradient(180deg, rgba(205, 127, 50, 0.25), rgba(205, 127, 50, 0.05)); border-color: #cd7f32; }

.podium-place .medal { font-size: 3.5rem; margin-bottom: 8px; }
.podium-place .rank-name { font-size: 1.3rem; font-weight: 700; margin-bottom: 6px; }
.podium-place .rank-score { font-size: 1.1rem; color: var(--bee-yellow); font-weight: 600; }

.other-ranks { max-width: 700px; margin: 30px auto; }
.other-ranks .rank-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 20px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

/* ============== UTIL ============== */
.pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255, 193, 7, 0.2);
  color: var(--bee-yellow);
  margin: 0 4px;
}
.flash-correct { animation: flashGreen 0.8s; }
.flash-wrong   { animation: flashRed 0.8s; }
@keyframes flashGreen {
  0%, 100% { box-shadow: 0 20px 50px rgba(255, 193, 7, 0.3); }
  50%      { box-shadow: 0 0 60px rgba(34, 197, 94, 0.8); }
}
@keyframes flashRed {
  0%, 100% { box-shadow: 0 20px 50px rgba(255, 193, 7, 0.3); }
  50%      { box-shadow: 0 0 60px rgba(233, 69, 96, 0.8); }
}

.toggle-row {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  margin-bottom: 15px; font-size: 0.9rem; color: #cbd5e1;
}
.toggle-row input { transform: scale(1.3); cursor: pointer; }

/* scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }
::-webkit-scrollbar-thumb { background: rgba(255, 193, 7, 0.5); border-radius: 4px; }

/* modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 1px solid rgba(255, 193, 7, 0.3);
  border-radius: 16px;
  padding: 30px;
  max-width: 500px;
  width: 100%;
  text-align: center;
}
.modal h3 { color: var(--bee-yellow); margin-bottom: 15px; font-size: 1.5rem; }
.modal p { margin-bottom: 20px; color: #cbd5e1; line-height: 1.6; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* print */
@media print {
  body { background: white; color: black; }
  body::before, body::after { display: none; }
  .screen:not(#screen-result) { display: none !important; }
  .actions-row { display: none; }
  .podium-place { border: 2px solid #333 !important; background: white !important; color: black !important; }
  .podium-place .rank-score { color: #b45309 !important; }
}
