/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-light: #60a5fa;
  --accent: #FF6B35;
  --bg: #080e1c;
  --bg2: #0c1426;
  --bg3: #111e35;
  --card: #0f1a2e;
  --border: #1a2e4a;
  --text: #e8f0ff;
  --text-muted: #6c84aa;
  --success: #22c55e;
  --error: #ef4444;
  --gold: #FFD700;
  --silver: #C0C0C0;
  --bronze: #CD7F32;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(37,99,235,0.22) 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ===== UTILITY ===== */
.hidden { display: none !important; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s, transform 0.1s;
  touch-action: manipulation;
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--brand-light);
  border: 1px solid var(--brand-light);
  border-radius: 12px;
  padding: 0.65rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s, transform 0.1s;
  touch-action: manipulation;
}
.btn-secondary:hover { background: rgba(96,165,250,0.12); }
.btn-secondary:active { transform: scale(0.98); }

.btn-danger {
  background: var(--error);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  touch-action: manipulation;
}
.btn-danger:hover { background: #c53030; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

.error-msg { color: var(--error); font-size: 0.9rem; margin-top: 0.5rem; text-align: center; }
.success-msg { color: var(--success); font-size: 0.9rem; margin-top: 0.5rem; text-align: center; }
.hint-text { color: var(--text-muted); font-size: 0.85rem; margin: 0.25rem 0 0.75rem; }

/* ===== PROFILE CHIP ===== */
.profile-chip {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 900;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0.45rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.chip-name {
  font-weight: 600;
  color: var(--text);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip-sep { opacity: 0.35; }
.chip-pin { font-family: monospace; font-weight: 700; color: var(--brand-light); letter-spacing: 0.15em; }
.chip-score { font-size: 0.78rem; font-weight: 700; color: var(--success); }

/* push views down so content isn't hidden behind the chip */
body.show-profile #view-game,
body.show-profile #view-leaderboard,
body.show-profile #view-history,
body.show-profile #view-countdown,
body.show-profile #view-tim { padding-top: 36px; }

/* ===== BOTTOM GLASS NAV ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  /* centre a pill horizontally, let it breathe from the edge */
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 0 1rem calc(1rem + env(safe-area-inset-bottom));
}

.bottom-nav-inner {
  /* pill shape */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  max-width: 420px;
  padding: 6px;
  border-radius: 40px;

  /* glass */
  background: rgba(8, 14, 28, 0.88);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);

  /* subtle rim light + shadow */
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 4px 16px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Each tab button */
.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 6px 9px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.38);
  cursor: pointer;
  border-radius: 34px;
  transition: color 0.22s ease, background 0.22s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Hover — desktop */
.bnav-item:not(.active):hover {
  color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.06);
}

/* Active pill — the key visual from the reference */
.bnav-item.active {
  background: rgba(255, 255, 255, 0.14);
  color: var(--brand-light);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

/* Logout red tint */
.bnav-logout {
  color: rgba(239, 68, 68, 0.48) !important;
}
.bnav-logout:hover, .bnav-logout:active {
  color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.1) !important;
}

.bnav-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  stroke-width: 1.9;
}

.bnav-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
}

/* Enough bottom clearance so content never hides under the nav */
#view-game,
#view-leaderboard,
#view-history,
#view-countdown {
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
}

/* ===== VIEWS ===== */
.view { display: none; }
.view.active { display: block; }

/* ===== LOGIN ===== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: radial-gradient(ellipse at 50% 0%, rgba(37,99,235,0.15) 0%, transparent 70%);
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem 1.75rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.login-logo { font-size: 3rem; text-align: center; margin-bottom: 0.5rem; }
.login-title { text-align: center; font-size: 1.7rem; font-weight: 800; color: var(--brand-light); }
.login-subtitle { text-align: center; color: var(--text-muted); font-size: 0.88rem; margin: 0.25rem 0 1.5rem; }

.login-tabs {
  display: flex;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.tab-btn {
  flex: 1;
  padding: 0.65rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
  touch-action: manipulation;
}
.tab-btn.active { background: var(--brand); color: #fff; font-weight: 600; }

.tab-content { display: none; }
.tab-content.active { display: block; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.form-group input, .form-group select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
.form-group input:focus, .form-group select:focus { border-color: var(--brand); }

.pin-reveal { text-align: center; margin-top: 1rem; }
.pin-display {
  font-size: 2.5rem;
  font-weight: 900;
  letter-spacing: 0.3em;
  color: var(--brand-light);
  background: var(--bg3);
  border-radius: 12px;
  padding: 1rem;
  margin: 0.75rem 0;
  border: 2px solid var(--brand);
}
.pin-warning { color: var(--accent); font-size: 0.85rem; margin-bottom: 0.5rem; }
.pin-auto-msg { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 0.75rem; }

/* ===== PRE-GAME COUNTDOWN ===== */
.pre-game-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
}
.countdown-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  margin-bottom: 2rem;
  box-shadow: 0 8px 32px rgba(37,99,235,0.2);
}
.countdown-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.countdown-title { font-size: 1.5rem; font-weight: 800; color: var(--brand-light); margin-bottom: 0.4rem; }
.countdown-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2rem; }
.countdown-clock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.countdown-unit {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  min-width: 74px;
  text-align: center;
}
.cu-num {
  display: block;
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--brand-light);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cu-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.countdown-sep {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--border);
  padding-bottom: 1.5rem;
}
.pre-game-prizes { margin-top: 1rem; }

/* ===== END COUNTDOWN BAR ===== */
.end-countdown-bar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  text-align: center;
  padding: 0.45rem 1rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.end-countdown-bar strong { color: var(--accent); font-size: 0.95rem; }

/* ===== SCORE MODAL ===== */
.score-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
.score-modal-overlay.hidden { display: none; }
.score-modal-overlay.fading { animation: fadeOut 0.3s ease forwards; }

.score-modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem 2.5rem;
  text-align: center;
  min-width: 260px;
  max-width: 320px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  animation: slideUp 0.25s ease;
}
.score-modal-points {
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--success);
  line-height: 1;
  margin-bottom: 0.6rem;
}
.score-modal-msg {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.score-modal-msg strong { color: var(--brand-light); }
.score-modal-bar {
  margin-top: 1.2rem;
  height: 3px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.score-modal-progress {
  height: 100%;
  width: 100%;
  background: var(--brand);
  border-radius: 3px;
  transition: width 3s linear;
}

@keyframes fadeIn  { from { opacity:0 } to { opacity:1 } }
@keyframes fadeOut { from { opacity:1 } to { opacity:0 } }
@keyframes slideUp { from { transform:translateY(20px);opacity:0 } to { transform:translateY(0);opacity:1 } }

/* ===== CONFIRM MODAL ===== */
.confirm-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
.confirm-modal-overlay.hidden { display: none; }
.confirm-modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.75rem 2rem;
  text-align: center;
  min-width: 260px;
  max-width: 320px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  animation: slideUp 0.25s ease;
}
.confirm-modal-msg {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}
.confirm-modal-btns {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ===== WRONG GUESS INFO ===== */
.wrong-guess-info {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.25rem;
}
.wrong-guess-info.warn { color: #ef4444; }

/* ===== TEST MODE BANNER ===== */
.test-mode-banner {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
  text-align: center;
  padding: 0.6rem 1rem;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
}

/* ===== GAME END BANNER ===== */
.game-end-banner {
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff;
  text-align: center;
  padding: 1rem;
  font-weight: 700;
  font-size: 1rem;
}

/* ===== GAME LAYOUT ===== */
.game-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}

/* ===== PUZZLE SECTION ===== */
.puzzle-section { margin-bottom: 2rem; }
.puzzle-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.75rem;
}
.puzzle-header-left { display: flex; flex-direction: column; gap: 0.3rem; }
.puzzle-header h2 { font-size: 1.2rem; color: var(--brand-light); }

.break-counter {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.35rem 0.9rem;
  text-align: center;
  flex-shrink: 0;
}
.break-counter span:first-child { font-size: 1.4rem; font-weight: 800; color: var(--accent); display: block; }
.break-label { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; }

/* ===== DIFFICULTY BADGE ===== */
.difficulty-badge {
  display: inline-block;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  width: fit-content;
}
.difficulty-badge.mudah { background: rgba(34,197,94,0.15); color: #22c55e; border: 1px solid rgba(34,197,94,0.35); }
.difficulty-badge.sedang { background: rgba(245,158,11,0.15); color: #f59e0b; border: 1px solid rgba(245,158,11,0.35); }
.difficulty-badge.sulit { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.35); }
.difficulty-badge.sangat_sulit { background: rgba(88,28,135,0.25); color: #c084fc; border: 1px solid rgba(192,132,252,0.4); }

/* ===== NO PUZZLE / END ===== */
.no-puzzle, .game-end-msg {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.no-puzzle-icon { font-size: 3rem; margin-bottom: 1rem; }

/* ===== LEVEL UP ===== */
.levelup-msg {
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: linear-gradient(135deg, rgba(37,99,235,0.12), rgba(34,197,94,0.08));
  border: 1px solid var(--brand);
  border-radius: 20px;
  margin-bottom: 1rem;
}
.levelup-icon { font-size: 2.8rem; margin-bottom: 0.75rem; }
.levelup-msg p { font-size: 1.05rem; font-weight: 600; color: var(--brand-light); margin-bottom: 1.25rem; }
.levelup-btn { max-width: 200px; margin: 0 auto; }

/* ===== COMPLETED ===== */
.completed-msg {
  text-align: center;
  padding: 3rem 1.5rem;
}
.completed-icon { font-size: 4rem; margin-bottom: 0.75rem; }
.completed-title { font-size: 1.4rem; font-weight: 800; color: var(--gold); margin-bottom: 0.5rem; }
.completed-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.25rem; }
.retry-btn { margin: 0 auto; max-width: 180px; display: block; }

/* ===== PUZZLE QUESTION ===== */
.puzzle-question {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand-light);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
}

/* ===== PUZZLE WRAPPER ===== */
.puzzle-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}
.puzzle-image {
  position: relative;
  width: min(460px, 92vw);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(37,99,235,0.25);
  border: 2px solid var(--border);
}
.puzzle-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* ===== TILE GRID ===== */
.tile-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
}
.tile {
  background: var(--brand);
  border: 1px solid rgba(255,255,255,0.07);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background 0.15s;
}
.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 4px,
    rgba(255,255,255,0.03) 4px,
    rgba(255,255,255,0.03) 8px
  );
}
.tile:hover { background: #3b7fff; }
.tile.breaking { animation: tileBreak 0.35s forwards; }
@keyframes tileBreak {
  0%   { transform: scale(1); opacity: 1; }
  40%  { transform: scale(1.12) rotate(4deg); opacity: 0.8; }
  100% { transform: scale(0) rotate(14deg); opacity: 0; pointer-events: none; }
}
.tile.broken { opacity: 0; pointer-events: none; }

/* ===== SOLVED / LOCKED ===== */
.solved-msg {
  text-align: center;
  padding: 1.25rem;
  background: linear-gradient(135deg, rgba(34,197,94,0.12), rgba(37,99,235,0.1));
  border: 1px solid var(--success);
  border-radius: 14px;
  margin-bottom: 1rem;
}
.solved-icon { font-size: 2.2rem; margin-bottom: 0.4rem; }
.solved-msg p { color: var(--success); font-weight: 600; }
.btn-next-puzzle {
  margin-top: 0.85rem;
  padding: 0.55rem 1.4rem;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-next-puzzle:disabled { opacity: 0.5; cursor: default; }
.btn-next-puzzle.hidden { display: none; }

.locked-msg {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,107,53,.08);
  border: 1px solid rgba(255,107,53,.4);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font-size: 0.82rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.locked-msg.hidden { display: none !important; }
.locked-msg svg { width: 18px; height: 18px; flex-shrink: 0; }
.locked-msg strong { color: #ffb38a; font-size: 0.88rem; }

/* ===== GUESS FORM ===== */
.guess-form {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}
.guess-form input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  min-width: 0;
}
.guess-form input:focus { border-color: var(--brand); }
.guess-btn { width: auto; white-space: nowrap; flex-shrink: 0; }
.day-info { font-size: 0.82rem; color: var(--text-muted); }

/* ===== PRIZE SECTION ===== */
.section-title { font-size: 1.2rem; color: var(--gold); margin-bottom: 1rem; }
.prize-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.9rem;
}
.prize-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.prize-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(37,99,235,0.2); }
.prize-card-rank {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--brand);
  color: #fff;
  border-radius: 6px;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
}
.prize-card-rank.rank-1 { background: var(--gold); color: #000; }
.prize-card-rank.rank-2 { background: var(--silver); color: #000; }
.prize-card-rank.rank-3 { background: var(--bronze); color: #000; }

.prize-card-img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--bg3); }
.prize-card-img-placeholder {
  width: 100%; aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg3); font-size: 2rem; color: var(--text-muted);
}
.prize-card-body { padding: 0.65rem; }
.prize-card-name { font-weight: 700; font-size: 0.88rem; margin-bottom: 0.2rem; }
.prize-card-desc { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.prize-card-winner { font-size: 0.78rem; color: var(--brand-light); font-style: italic; }
.prize-card-winner.pending { color: var(--text-muted); }
.prize-loading { color: var(--text-muted); text-align: center; padding: 1rem; }

/* ===== LEADERBOARD ===== */
.view-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 1.75rem 1rem;
}
.view-title { font-size: 1.4rem; font-weight: 800; color: var(--brand-light); margin-bottom: 1.25rem; }

.leaderboard-table, .history-table {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.lb-loading { text-align: center; padding: 2rem; color: var(--text-muted); }

/* ===== PODIUM LEADERBOARD ===== */
.podium-wrap { padding: 1.2rem 0.5rem 0.75rem; }

/* Stage: 2nd | 1st | 3rd aligned at the bottom */
.podium-stage {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}
.podium-block {
  flex: 1;
  max-width: 170px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.podium-block.empty { pointer-events: none; }

/* Name + score card floating above the base */
.pod-info {
  text-align: center;
  padding: 10px 8px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  margin-bottom: 8px;
}
.podium-block.me .pod-info { border-color: var(--brand); background: rgba(37,99,235,.1); }
.pod-name { font-weight: 700; font-size: 0.88rem; word-break: break-word; line-height: 1.3; }
.pod-score { font-weight: 800; font-size: 1.05rem; color: var(--accent); margin-top: 4px; }
.pod-you { font-size: 0.68rem; color: var(--brand-light); }
.pod-team { font-size: 0.68rem; color: var(--text-muted); margin-top: 3px; }

/* Platform base */
.pod-base {
  width: 100%;
  border-radius: 6px 6px 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10px;
}
.pod-medal { font-size: 1.5rem; line-height: 1; }

.p1 .pod-base { height: 100px; background: linear-gradient(180deg,rgba(255,215,0,.18) 0%,rgba(255,215,0,.07) 100%); border: 1px solid rgba(255,215,0,.4); border-bottom: none; }
.p2 .pod-base { height: 70px;  background: linear-gradient(180deg,rgba(192,192,192,.15) 0%,rgba(192,192,192,.06) 100%); border: 1px solid rgba(192,192,192,.35); border-bottom: none; }
.p3 .pod-base { height: 50px;  background: linear-gradient(180deg,rgba(205,127,50,.15) 0%,rgba(205,127,50,.06) 100%); border: 1px solid rgba(205,127,50,.35); border-bottom: none; }

/* 4th & 5th runner-up rows */
.podium-runners {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}
.runner-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}
.runner-row:last-child { border-bottom: none; }
.runner-row.me { background: rgba(37,99,235,.1); border-left: 3px solid var(--brand); }
.runner-rank { font-weight: 800; font-size: 0.9rem; text-align: center; }
.runner-rank.r4 { color: #38bdf8; }
.runner-rank.r5 { color: #a78bfa; }
.runner-name { font-weight: 600; font-size: 0.9rem; }
.runner-team { display: block; font-size: 0.7rem; color: var(--text-muted); margin-top: 1px; }
.runner-score { font-weight: 700; color: var(--accent); white-space: nowrap; }

/* Own rank when outside top 5 */
.podium-me { border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 4px; }
.podium-me-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.65rem 1rem;
  background: rgba(37,99,235,.1);
  border: 1px solid var(--brand);
  border-radius: 10px;
}
.podium-me-rank { font-weight: 800; color: var(--brand-light); min-width: 34px; font-size: 0.9rem; }
.podium-me-name { flex: 1; font-weight: 600; font-size: 0.9rem; }
.podium-me-score { font-weight: 700; color: var(--accent); white-space: nowrap; }

/* HISTORY */
.hist-row {
  display: grid;
  grid-template-columns: 100px 1fr 65px 55px;
  align-items: center;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  gap: 0.4rem;
}
.hist-row:last-child { border-bottom: none; }
.hist-row.hist-header { background: var(--bg3); font-weight: 700; font-size: 0.78rem; color: var(--text-muted); }
.hist-date { color: var(--text-muted); font-size: 0.82rem; }
.hist-score { font-weight: 700; color: var(--accent); text-align: center; }
.hist-day { text-align: center; color: var(--text-muted); }
.hist-solved { text-align: center; }
.hist-solved.yes { color: var(--success); }
.hist-solved.no { color: var(--error); }

/* summary line above history */
.hist-summary {
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}

/* missed / never-played rows */
.hist-missed-header {
  padding: 0.55rem 1rem 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  letter-spacing: .04em;
}
.hist-row-missed { opacity: .6; background: rgba(100,116,139,.05); }

/* admin adjustment rows in player history */
.hist-adj-header {
  padding: 0.55rem 1rem 0.3rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  letter-spacing: .04em;
}
.hist-adj-row {
  background: rgba(139,92,246,.06);
  grid-template-columns: 100px 28px 65px 1fr;
}
.hist-adj-icon { text-align: center; font-size: 1rem; }
.hist-adj-comment { font-size: 0.78rem; color: var(--text-muted); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-adj-pos { color: #22c55e; }
.hist-adj-neg { color: #ef4444; }

/* ===== MOBILE ===== */
/* ===== RESOURCE HUD ===== */
.game-hud {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 13px 14px;
  margin-bottom: 16px;
}
.hud-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.hud-k {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.hud-v {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}
.hud-v strong {
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.hud-v small { font-size: 0.74rem; color: var(--text-muted); }
.hud-day { text-align: right; }
.hud-day-v {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--brand-light);
}
.hud-meter {
  display: flex;
  gap: 3px;
  margin-bottom: 9px;
}
.hud-seg {
  flex: 1;
  height: 7px;
  border-radius: 3px;
  background: var(--brand);
  transition: background 0.25s, opacity 0.25s;
}
.hud-seg.hud-seg-spent { background: var(--bg3); opacity: 0.7; }
.hud-seg.hud-seg-low { background: var(--accent); }
.hud-foot {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.74rem;
  color: var(--text-muted);
}
.hud-foot strong { color: var(--brand-light); }
.hud-foot-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

/* ===== PRIZE STRIP (game view) ===== */
.prize-strip-section { margin-top: 24px; }
.prize-strip-section .section-title { font-size: 0.95rem; margin-bottom: 0; }
.prize-strip {
  display: flex !important;
  gap: 10px;
  overflow-x: auto;
  padding: 12px 2px 8px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.prize-strip::-webkit-scrollbar { display: none; }
.prize-strip .prize-card {
  flex: 0 0 128px;
  scroll-snap-align: start;
  transform: none;
}
.prize-strip .prize-card:hover {
  transform: none;
  box-shadow: none;
}

/* Hide dayInfo — info now lives in the HUD */
.day-info { display: none; }

@media (max-width: 520px) {
  .guess-form { flex-direction: column; }
  .guess-btn { width: 100%; }

  .countdown-unit { min-width: 60px; padding: 0.7rem 0.75rem; }
  .cu-num { font-size: 1.7rem; }

  .podium-stage { gap: 5px; }
  .pod-name { font-size: 0.8rem; }
  .pod-score { font-size: 0.95rem; }
  .p1 .pod-base { height: 80px; }
  .p2 .pod-base { height: 56px; }
  .p3 .pod-base { height: 40px; }
  .runner-row { padding: 0.55rem 0.75rem; gap: 8px; }

  .hist-row { grid-template-columns: 82px 1fr 52px 42px; padding: 0.55rem 0.75rem; font-size: 0.8rem; }
  .hist-date { font-size: 0.76rem; }

  .prize-cards { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.65rem; }

  .game-layout { padding: 1rem 0.75rem; }
  .view-container { padding: 1.25rem 0.75rem; }

  .end-countdown-bar { font-size: 0.82rem; }
  .login-card { padding: 1.75rem 1.25rem; }
}

/* ===== TIM VIEW ===== */
#view-tim {
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
}
body.show-profile #view-tim { padding-top: 36px; }

.tim-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.tim-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.tim-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}
.tim-search-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.tim-search-wrap input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 0.6rem 0.85rem;
  font-size: 0.95rem;
}
.tim-search-wrap input:focus { outline: none; border-color: var(--brand); }
.tim-search-btn {
  width: auto;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  white-space: nowrap;
}
.tim-results { margin-top: 0.75rem; }
.tim-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  background: var(--bg3);
  border-radius: 10px;
  margin-bottom: 0.5rem;
}
.tim-result-name {
  font-size: 0.95rem;
  font-weight: 600;
}
.tim-loading, .tim-empty {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.75rem 0;
}

/* Incoming invite card */
.tim-invite-card {
  background: var(--bg3);
  border-radius: 10px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.tim-invite-info { flex: 1; min-width: 0; }
.tim-invite-from { display: block; font-weight: 700; font-size: 0.95rem; }
.tim-invite-sub { display: block; font-size: 0.8rem; color: var(--text-muted); }
.tim-invite-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

/* Outgoing invite */
.tim-outgoing-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--bg3);
  border-radius: 10px;
  padding: 0.75rem;
}
.tim-outgoing-name {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
}

/* In-team — teammate card */
.tim-mate-card {
  background: linear-gradient(135deg, rgba(37,99,235,0.15), rgba(96,165,250,0.08));
  border: 1px solid rgba(96,165,250,0.25);
  border-radius: 16px;
  padding: 1.25rem 1.1rem;
  margin-bottom: 1rem;
}
.tim-mate-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}
.tim-mate-avatar {
  width: 48px;
  height: 48px;
  background: rgba(96,165,250,0.18);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.tim-mate-detail { flex: 1; min-width: 0; }
.tim-mate-name { font-size: 1.1rem; font-weight: 700; }
.tim-mate-level { font-size: 0.82rem; color: var(--brand-light); margin-top: 0.15rem; }
.tim-mate-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Leave confirmation */
.tim-confirm {
  margin-top: 0.75rem;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 12px;
  padding: 0.9rem;
  font-size: 0.9rem;
  line-height: 1.45;
}
.tim-confirm p { margin-bottom: 0.75rem; }
.tim-confirm-btns { display: flex; flex-direction: column; gap: 0.5rem; }

/* Nav badge for Tim */
.bnav-tim-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bnav-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  border-radius: 999px;
  padding: 2px 5px;
  min-width: 16px;
  text-align: center;
}

/* Reuse admin act-btn styles for player Tim view */
.act-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: none;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
  touch-action: manipulation;
}
.act-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.act-approve {
  background: rgba(34,197,94,0.15);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.3);
}
.act-approve:hover { background: rgba(34,197,94,0.25); }
.act-reject {
  background: rgba(239,68,68,0.12);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.25);
}
.act-reject:hover { background: rgba(239,68,68,0.22); }

/* ===== BET EVENT SECTION ===== */
.bet-event-section {
  background: linear-gradient(135deg, rgba(217,119,6,0.12) 0%, rgba(180,83,9,0.08) 100%);
  border: 1px solid rgba(217,119,6,0.4);
  border-radius: 16px;
  margin-bottom: 1rem;
  overflow: hidden;
}
.bet-event-inner { padding: 1rem; }
.bet-event-header { margin-bottom: 0.6rem; }
.bet-event-badge {
  display: inline-block;
  background: rgba(217,119,6,0.25);
  border: 1px solid rgba(217,119,6,0.5);
  color: #fbbf24;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}
.bet-event-question {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
}
.bet-locked-preview {
  background: rgba(0,0,0,0.4);
  border: 1px dashed rgba(217,119,6,0.35);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem 1rem;
  margin-bottom: 0.75rem;
}
.bet-form { display: flex; flex-direction: column; gap: 0.4rem; }
.bet-form-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.bet-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.bet-amount-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid rgba(217,119,6,0.4);
  border-radius: 10px;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.55rem 0.75rem;
  outline: none;
  -moz-appearance: textfield;
}
.bet-amount-input::-webkit-outer-spin-button,
.bet-amount-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.bet-amount-input:focus { border-color: #fbbf24; }
.bet-poin-label { color: #fbbf24; font-weight: 700; font-size: 0.95rem; white-space: nowrap; }
.bet-balance-info { font-size: 0.78rem; color: var(--text-muted); }
.bet-active-info {
  font-size: 0.85rem;
  color: #fbbf24;
  background: rgba(217,119,6,0.1);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  margin-bottom: 0.6rem;
}
.bet-result-icon { font-size: 3rem; text-align: center; margin: 0.5rem 0; }
.bet-result-msg {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 0.35rem;
}
.bet-result-points {
  font-size: 1.1rem;
  font-weight: 800;
  text-align: center;
}

/* Admin bet event status badge */
.bet-admin-status {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  display: inline-block;
}
.bet-admin-active   { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.bet-admin-inactive { background: rgba(100,116,139,0.15); color: #94a3b8; border: 1px solid rgba(100,116,139,0.3); }
