/* Fonts loaded locally via <link> in HTML */

:root {
  --bg-gradient: linear-gradient(135deg, #050714 0%, #0c102b 50%, #160a29 100%);
  --panel-bg: rgba(13, 17, 38, 0.75);
  --panel-border: rgba(0, 243, 255, 0.25);
  --cyan-glow: #00f3ff;
  --gold-glow: #ffd700;
  --purple-glow: #b000ff;
  --pink-glow: #ff007f;
  --crimson-glow: #ff4d6d;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Prompt', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--bg-gradient);
  color: #f0f4f8;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  user-select: none;
}

.game-container {
  width: 100%;
  max-width: 720px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 1rem;
}

/* Header & Stats Bar */
.game-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 0.75rem 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.glass-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.glass-btn:hover {
  background: rgba(0, 243, 255, 0.2);
  border-color: var(--cyan-glow);
  transform: translateY(-2px);
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.4);
}

.icon-btn {
  padding: 0.5rem 0.75rem;
}

.donate-btn {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 77, 109, 0.2));
  border-color: rgba(255, 215, 0, 0.4);
  color: var(--gold-glow);
}

.donate-btn:hover {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.4), rgba(255, 77, 109, 0.4));
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.5);
}

.stats-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.stat-badge {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.35rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-badge.highlight {
  border-color: var(--gold-glow);
  background: rgba(255, 215, 0, 0.08);
}

.stat-badge.combo-badge {
  border-color: var(--purple-glow);
  background: rgba(176, 0, 255, 0.1);
}

.stat-label {
  font-size: 0.65rem;
  font-family: var(--font-heading);
  letter-spacing: 1px;
  color: #94a3b8;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--cyan-glow);
}

.stat-badge.highlight .stat-value {
  color: var(--gold-glow);
}

.stat-badge.combo-badge .stat-value {
  color: var(--pink-glow);
}

.action-btns {
  display: flex;
  gap: 0.4rem;
}

/* Main Canvas Wrapper */
.canvas-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 600px;
  background: rgba(6, 9, 24, 0.85);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), inset 0 0 40px rgba(0, 243, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}

/* Canvas Overlay Cards */
.canvas-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 20, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 10;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  cursor: pointer;
}

.canvas-overlay.hidden {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.overlay-card {
  background: rgba(13, 18, 42, 0.95);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 1.25rem 1.4rem;
  text-align: center;
  max-width: 380px;
  width: 92%;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 243, 255, 0.1);
  cursor: default;
}

.glow-title {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--cyan-glow), var(--pink-glow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.25rem;
}

.subtitle {
  color: #94a3b8;
  font-size: 0.85rem;
  margin-bottom: 0.9rem;
  line-height: 1.4;
}

.controls-guide {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1rem;
  text-align: left;
}

.guide-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  font-size: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.key-badge {
  background: rgba(0, 243, 255, 0.15);
  border: 1px solid var(--cyan-glow);
  color: var(--cyan-glow);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-family: var(--font-heading);
  font-weight: bold;
  white-space: nowrap;
}

.key-icon {
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.guide-text {
  color: #e2e8f0;
  font-size: 0.8rem;
}

.start-hint {
  display: block;
  margin-top: 0.55rem;
  font-size: 0.75rem;
  color: #64748b;
  animation: pulseOpacity 2s infinite ease-in-out;
}

@keyframes pulseOpacity {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.95; }
}

.primary-btn {
  background: linear-gradient(135deg, var(--cyan-glow), #00a8ff);
  color: #060918;
  border: none;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0.85rem 1.8rem;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 24px rgba(0, 243, 255, 0.6);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.75rem 1.2rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.donate-accent-btn {
  background: linear-gradient(135deg, #ffd700, #ff8531);
  color: #060918;
  border: none;
  font-family: var(--font-heading);
  font-weight: bold;
  font-size: 0.95rem;
  padding: 0.75rem 1.2rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.donate-accent-btn:hover {
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

/* Controls Footer */
.controls-footer {
  text-align: center;
  padding: 0.5rem;
  color: #94a3b8;
  font-size: 0.85rem;
}

/* Game Over Specific Overrides */
.glow-title-modal {
  font-family: var(--font-heading);
  font-size: 2rem;
  text-align: center;
  color: var(--pink-glow);
  margin-bottom: 1rem;
}

.score-summary {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.score-row {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
}

.score-highlight {
  font-family: var(--font-heading);
  font-weight: bold;
  color: var(--cyan-glow);
  font-size: 1.4rem;
}

.best-highlight {
  font-family: var(--font-heading);
  font-weight: bold;
  color: var(--gold-glow);
  font-size: 1.4rem;
}

.new-record {
  text-align: center;
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid var(--gold-glow);
  color: var(--gold-glow);
  padding: 0.5rem;
  border-radius: 10px;
  font-weight: bold;
  font-size: 0.9rem;
}

.new-record.hidden {
  display: none;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 243, 255, 0.95);
  color: #060918;
  padding: 0.75rem 1.5rem;
  border-radius: 30px;
  font-weight: bold;
  font-family: var(--font-heading);
  box-shadow: 0 8px 24px rgba(0, 243, 255, 0.5);
  z-index: 9999;
  transition: all 0.3s ease;
}

.toast.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
}

/* Mobile & Tablet Responsive Adjustments */
@media (max-width: 600px) {
  .game-container {
    padding: 0.5rem;
    gap: 0.6rem;
  }
  .overlay-card {
    padding: 1rem 1.15rem;
    max-width: 340px;
    border-radius: 16px;
  }
  .glow-title {
    font-size: 1.45rem;
  }
  .subtitle {
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
  }
  .controls-guide {
    gap: 0.35rem;
    margin-bottom: 0.85rem;
  }
  .guide-item {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
  }
  .primary-btn {
    padding: 0.7rem 1.2rem;
    font-size: 0.95rem;
  }
}
