/* ==========================================================================
   FINALS WEEK FROGGER: ROAD TO 100 — COMMERCIAL ARCADE STYLESHEET
   ========================================================================== */
:root {
  --bg-deep: #070b14;
  --bg-panel: rgba(15, 23, 42, 0.92);
  --bg-card: rgba(30, 41, 59, 0.88);
  --border-gold: #eab308;
  --border-subtle: rgba(148, 163, 184, 0.22);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-gold: #facc15;
  --accent-blue: #38bdf8;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-purple: #a855f7;
  --font-display: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 15%, #1e293b 0%, #090d16 70%, #05070c 100%);
  color: var(--text-main);
  font-family: var(--font-display);
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Main Arcade Wrapper */
.arcade-shell {
  width: 100%;
  max-width: 1180px;
  padding: 12px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Top Marquee Header */
.arcade-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, rgba(15,23,42,0.95) 0%, rgba(30,58,138,0.85) 100%);
  border: 2px solid rgba(250, 204, 21, 0.45);
  border-radius: 14px;
  padding: 10px 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.5);
}

.brand-titles h1 {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: linear-gradient(90deg, #ffffff 0%, #fef08a 55%, #facc15 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-titles p {
  font-size: 0.78rem;
  color: #cbd5e1;
  letter-spacing: 0.3px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-ui {
  background: rgba(15, 23, 42, 0.85);
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.16s ease;
}

.btn-ui:hover {
  border-color: var(--accent-gold);
  background: rgba(30, 41, 59, 0.95);
  transform: translateY(-1px);
}

.btn-ui.primary {
  background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
  color: #0f172a;
  border-color: #fef08a;
  font-weight: 800;
}

.btn-ui.primary:hover {
  filter: brightness(1.1);
}

.select-ui {
  background: rgba(15, 23, 42, 0.9);
  color: #facc15;
  border: 1px solid rgba(250, 204, 21, 0.45);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

/* HUD Dashboard Bar */
.hud-dashboard {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 10px;
}

.hud-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.hud-grade-card {
  border-color: rgba(250, 204, 21, 0.45);
  background: linear-gradient(90deg, rgba(15,23,42,0.95) 0%, rgba(30,41,59,0.92) 100%);
}

.grade-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.grade-label-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.letter-badge {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 1.45rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
  border: 2px solid rgba(255,255,255,0.4);
  transition: background 0.3s ease, transform 0.2s ease;
}

.grade-score-num {
  font-size: 1.5rem;
  font-weight: 900;
  color: #fef08a;
}

.grade-phase-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

/* 0 to 100 Progress Bar */
.grade-bar-track {
  width: 100%;
  height: 12px;
  background: rgba(15, 23, 42, 0.95);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.35);
  position: relative;
}

.grade-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ef4444 0%, #f97316 40%, #eab308 70%, #22c55e 100%);
  border-radius: 999px;
  transition: width 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.6);
}

.hud-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 3px;
  font-weight: 700;
}

.hud-stat-value {
  font-size: 1.25rem;
  font-weight: 900;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-subtext {
  font-size: 0.72rem;
  color: #cbd5e1;
  margin-top: 2px;
}

/* Dynamic Curve Status Ticker */
.curve-banner {
  background: rgba(15, 23, 42, 0.9);
  border-left: 4px solid var(--accent-gold);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #fef08a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.powerup-pills {
  display: flex;
  gap: 8px;
  align-items: center;
}

.power-pill {
  font-size: 0.74rem;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 800;
  display: none;
  align-items: center;
  gap: 5px;
}

.power-pill.active {
  display: inline-flex;
  animation: pulsePill 1s infinite alternate;
}

.pill-shield {
  background: rgba(56, 189, 248, 0.22);
  border: 1px solid #38bdf8;
  color: #bae6fd;
}

.pill-espresso {
  background: rgba(34, 197, 94, 0.22);
  border: 1px solid #22c55e;
  color: #bbf7d0;
}

.pill-wifi {
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid #ef4444;
  color: #fecaca;
}

@keyframes pulsePill {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}

/* Main Game Stage Layout */
.stage-container {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #050811;
  border: 3px solid rgba(250, 204, 21, 0.5);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.75);
}

#gameCanvas {
  display: block;
  width: 100%;
  max-width: 960px;
  height: auto;
  aspect-ratio: 15 / 13;
  background: #0f172a;
  cursor: pointer;
}

/* Distraction Phone Notification Popups (60+ Grade Curve Hazard) */
.phone-popup {
  position: absolute;
  bottom: 18px;
  right: 18px;
  width: 285px;
  background: rgba(15, 23, 42, 0.96);
  border: 2px solid #38bdf8;
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.8);
  z-index: 25;
  transform: translateY(150%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.phone-popup.show {
  transform: translateY(0);
}

.phone-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  font-weight: 800;
  color: #38bdf8;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.phone-popup-body {
  font-size: 0.82rem;
  color: #f1f5f9;
  line-height: 1.35;
}

.phone-dismiss-btn {
  margin-top: 8px;
  width: 100%;
  padding: 5px;
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid #38bdf8;
  color: #e0f2fe;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

/* Overlay Modals (Start, Pause, Victory 100, Game Over, Legend) */
.stage-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 11, 20, 0.86);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 40;
}

.stage-overlay.hidden {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 640px;
  background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
  border: 2px solid var(--border-gold);
  border-radius: 18px;
  padding: 26px 28px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
  max-height: 92%;
  overflow-y: auto;
}

.modal-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.18);
  border: 1px solid #facc15;
  color: #fef08a;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.modal-card h2 {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 8px;
  color: #ffffff;
}

.modal-card p.lead {
  font-size: 0.96rem;
  color: #cbd5e1;
  line-height: 1.5;
  margin-bottom: 18px;
}

/* Obstacle & Pickup Grid inside Modal */
.legend-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  text-align: left;
  margin-bottom: 20px;
}

.legend-item {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend-item img {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.legend-item h4 {
  font-size: 0.84rem;
  color: #fef08a;
  margin-bottom: 2px;
}

.legend-item p {
  font-size: 0.74rem;
  color: #cbd5e1;
  line-height: 1.3;
}

/* Report Card Stats Grid */
.transcript-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0 22px;
}

.transcript-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(250, 204, 21, 0.3);
  border-radius: 10px;
  padding: 12px 8px;
}

.transcript-box .t-val {
  font-size: 1.45rem;
  font-weight: 900;
  color: #facc15;
}

.transcript-box .t-lbl {
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
  margin-top: 3px;
}

.btn-launch {
  background: linear-gradient(135deg, #facc15 0%, #eab308 50%, #ca8a04 100%);
  color: #0f172a;
  font-size: 1.1rem;
  font-weight: 900;
  padding: 13px 32px;
  border-radius: 12px;
  border: 2px solid #fef08a;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  box-shadow: 0 8px 25px rgba(234, 179, 8, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-launch:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 32px rgba(234, 179, 8, 0.65);
}

/* On-Screen Touch / Click D-Pad & Footer Legend */
.bottom-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px 18px;
}

.controls-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  font-size: 0.82rem;
  color: #cbd5e1;
}

.key-cap {
  display: inline-block;
  background: #1e293b;
  border: 1px solid #64748b;
  border-bottom-width: 3px;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 800;
  color: #f8fafc;
  font-size: 0.75rem;
}

.dpad-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dpad-btn {
  width: 44px;
  height: 40px;
  border-radius: 8px;
  background: #1e293b;
  border: 1px solid rgba(250, 204, 21, 0.4);
  color: #fef08a;
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dpad-btn:active {
  background: #eab308;
  color: #0f172a;
}

@media (max-width: 860px) {
  .hud-dashboard {
    grid-template-columns: 1fr 1fr;
  }
  .legend-grid {
    grid-template-columns: 1fr;
  }
}
