/* ==========================================================================
   FS PERFECT SPIRAL - MINIMAL ZEN GLASSMORPHISM STYLESHEET
   Unified Scaled Viewport Standard (Mobile, iPad, PC)
   ========================================================================== */

:root {
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --bg-dark: #050710;
  --bg-card: rgba(12, 18, 34, 0.82);
  --border-glass: rgba(255, 255, 255, 0.12);
  --border-active: rgba(0, 243, 255, 0.45);

  --text-main: #f0f4fc;
  --text-muted: #8ca0be;

  --neon-cyan: #00f3ff;
  --glow-cyan: rgba(0, 243, 255, 0.4);
  --neon-gold: #ffd700;
  --glow-gold: rgba(255, 215, 0, 0.4);
  --neon-emerald: #00e626;
  --neon-magenta: #ff007f;

  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.6);
}

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

body {
  font-family: var(--font-body);
  background: radial-gradient(circle at 50% 20%, #0d172e 0%, #03060c 100%);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 8px 6px 16px;
  overflow-x: hidden;
  touch-action: manipulation;
}

.game-container {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ==========================================================================
   Compact Single-Row Header
   ========================================================================== */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 0.35rem 0.6rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.back-btn {
  text-decoration: none;
  font-size: 0.72rem;
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--neon-cyan);
}

.title-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
}

.title-badge span.spiral-icon {
  display: inline-block;
  animation: spinSpiral 18s linear infinite;
}

@keyframes spinSpiral {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.stat-chip {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-glass);
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-chip strong {
  color: var(--neon-cyan);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 800;
}

/* ==========================================================================
   Compact Controls Toolbar
   ========================================================================== */
.controls-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 0.3rem 0.5rem;
  gap: 0.4rem;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.glass-select {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0 0.45rem;
  height: 30px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.72rem;
  outline: none;
  cursor: pointer;
  max-width: 140px;
}

.glass-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  height: 30px;
  padding: 0 0.55rem;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.glass-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}

.glass-btn.icon-btn {
  width: 30px;
  padding: 0;
}

.glass-btn.active {
  border-color: var(--neon-cyan);
  background: rgba(0, 243, 255, 0.15);
  color: var(--neon-cyan);
}

.donate-pill-btn {
  background: rgba(0, 229, 163, 0.12) !important;
  border: 1px solid rgba(0, 229, 163, 0.4) !important;
  color: #00e5a3 !important;
  border-radius: 16px !important;
  padding: 0 0.55rem !important;
  font-size: 0.72rem !important;
}

/* ==========================================================================
   Maximized Canvas Play Area (55vh - 65vh standard)
   ========================================================================== */
.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 480px;
  height: 62vh;
  height: 62dvh;
  max-height: 560px;
  background: radial-gradient(circle at 50% 50%, #0a1122 0%, #03060c 100%);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: crosshair;
  touch-action: none;
}

canvas#spiral-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* HUD Overlay Prompts */
.hud-prompt {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(7, 12, 24, 0.88);
  border: 1px solid rgba(0, 243, 255, 0.35);
  box-shadow: 0 4px 16px rgba(0, 243, 255, 0.25);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 10;
  white-space: nowrap;
}

.hud-accuracy-pill {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(7, 12, 24, 0.9);
  border: 1px solid rgba(255, 215, 0, 0.35);
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.2);
  color: #fff;
  padding: 6px 16px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  pointer-events: none;
  z-index: 10;
}

.hud-accuracy-pill .score-num {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--neon-gold);
}

/* ==========================================================================
   Comparison & Result Modal Overlay
   ========================================================================== */
.canvas-overlay {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 14, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  z-index: 25;
  transition: opacity 0.3s ease;
}

.canvas-overlay.hidden {
  display: none !important;
}

.overlay-card {
  background: rgba(14, 22, 42, 0.95);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  padding: 1.25rem 1.1rem;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.score-badge-circle {
  width: 90px;
  height: 90px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 243, 255, 0.25) 0%, rgba(10, 20, 38, 0.8) 100%);
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 24px var(--glow-cyan);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: pulseScore 2s infinite ease-in-out;
}

@keyframes pulseScore {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px var(--glow-cyan); }
  50% { transform: scale(1.05); box-shadow: 0 0 32px var(--neon-cyan); }
}

.score-badge-circle.masterpiece {
  border-color: var(--neon-gold);
  box-shadow: 0 0 24px var(--glow-gold);
}

.score-badge-circle .score-digits {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
}

.score-badge-circle .score-label {
  font-size: 0.6rem;
  color: var(--neon-cyan);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-top: 3px;
}

.result-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
}

.result-feedback {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.comparison-legend {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.2rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 0.68rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-line {
  width: 16px;
  height: 3px;
  border-radius: 2px;
}

.legend-line.your-line {
  background: var(--neon-cyan);
  box-shadow: 0 0 6px var(--neon-cyan);
}

.legend-line.perfect-line {
  background: rgba(255, 255, 255, 0.4);
  border: 1px dashed #fff;
}

.overlay-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.25rem;
}

.btn-action-primary {
  flex: 1;
  background: linear-gradient(135deg, #00f3ff, #0077b6);
  color: #040814;
  border: none;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-action-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px var(--glow-cyan);
}

.btn-action-secondary {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  cursor: pointer;
}

/* ==========================================================================
   Virtual Trackpad / Mobile Control Strip
   (Unified Multi-Device Standard)
   ========================================================================== */
.mobile-touch-bar {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  padding: 0.35rem 0.6rem;
  align-items: center;
  gap: 0.5rem;
  touch-action: none;
}

.touch-bar-handle {
  flex: 1;
  height: 44px;
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px dashed rgba(0, 243, 255, 0.35);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0 0.8rem;
  cursor: ew-resize;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.touch-bar-handle:active,
.touch-bar-handle.active {
  background: rgba(0, 243, 255, 0.12);
  border-color: var(--neon-cyan);
  border-style: solid;
  box-shadow: inset 0 0 16px rgba(0, 243, 255, 0.25);
}

.touch-track-groove {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 243, 255, 0.4), transparent);
}

.touch-arrow {
  color: var(--neon-cyan);
  font-size: 0.8rem;
  font-weight: 800;
}

.touch-bar-label {
  font-size: 0.72rem;
  color: #a0aec0;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

.touch-action-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(0, 243, 255, 0.4);
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.2), rgba(0, 119, 182, 0.3));
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 243, 255, 0.25);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.touch-action-btn:active {
  transform: scale(0.92);
}

/* ==========================================================================
   Responsive Scaling for Tablet / iPad & PC
   (Keeps mobile layout scaled up)
   ========================================================================== */
@media (min-width: 651px) and (max-width: 1024px) {
  body {
    padding: 12px 10px;
  }
  .game-container {
    max-width: 680px;
    gap: 8px;
  }
  .canvas-wrapper {
    height: 560px;
    height: 64vh;
    height: 64dvh;
    max-height: 680px;
  }
}

@media (min-width: 1025px) {
  body {
    padding: 16px 12px;
  }
  .game-container {
    max-width: 680px;
    gap: 8px;
  }
  .canvas-wrapper {
    height: 580px;
    height: 65vh;
    height: 65dvh;
    max-height: 720px;
  }
}
