/* ============================================
   FOCUSQUEST — Apple Watch Optimized Game UI
   Palette: Volcanic Glass + Neon Cyan/Magenta
   Fonts: Orbitron (display) + Exo 2 (body)
   ============================================ */

:root {
  --bg:          #080810;
  --bg2:         #0f0f1a;
  --surface:     #13131f;
  --border:      #1e1e32;
  --neon-cyan:   #00f5ff;
  --neon-magenta:#ff2d78;
  --neon-yellow: #ffe600;
  --neon-green:  #39ff14;
  --neon-purple: #bf5fff;
  --text-primary:#e8e8ff;
  --text-dim:    #5a5a8a;
  --ring-size:   176px;
  --watch-w:     396px;
  --watch-h:     484px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: 'Exo 2', sans-serif;
  color: var(--text-primary);
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Particle Canvas ── */
#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* ── Screen System ── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 10;
  padding: 12px;
}

.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: scale(1);
}

/* ── HUD Screen ── */
#screen-hud {
  flex-direction: column;
  gap: 0;
  padding: 8px 10px 10px;
  justify-content: space-between;
  max-width: var(--watch-w);
  max-height: var(--watch-h);
  width: 100%;
  height: 100%;
}

/* ── Top Bar ── */
.top-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 0;
}

.level-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(135deg, #1a0a2e, #2d0a4e);
  border: 1px solid var(--neon-purple);
  border-radius: 8px;
  padding: 3px 7px;
  min-width: 38px;
  box-shadow: 0 0 10px rgba(191,95,255,0.3);
}

.level-label {
  font-family: 'Orbitron', monospace;
  font-size: 7px;
  color: var(--neon-purple);
  letter-spacing: 1px;
  line-height: 1;
}

.level-num {
  font-family: 'Orbitron', monospace;
  font-size: 18px;
  font-weight: 900;
  color: var(--neon-purple);
  line-height: 1;
  text-shadow: 0 0 12px var(--neon-purple);
}

.xp-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.xp-bar-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(191,95,255,0.2);
}

.xp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--neon-purple), var(--neon-cyan));
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 8px var(--neon-purple);
}

.xp-text {
  font-size: 8px;
  color: var(--text-dim);
  font-family: 'Orbitron', monospace;
  letter-spacing: 0.5px;
}

.streak-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(135deg, #1a0a00, #2e1500);
  border: 1px solid var(--neon-yellow);
  border-radius: 8px;
  padding: 3px 7px;
  min-width: 38px;
  box-shadow: 0 0 10px rgba(255,230,0,0.2);
}

.streak-fire {
  font-size: 10px;
  line-height: 1;
}

.streak-num {
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  font-weight: 900;
  color: var(--neon-yellow);
  line-height: 1;
  text-shadow: 0 0 10px var(--neon-yellow);
}

/* ── Boss Area ── */
.boss-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.boss-hp-bar-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.boss-name {
  font-family: 'Orbitron', monospace;
  font-size: 8px;
  color: var(--neon-magenta);
  letter-spacing: 1.5px;
  text-align: center;
  text-shadow: 0 0 8px var(--neon-magenta);
}

.boss-hp-track {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255,45,120,0.3);
  position: relative;
}

.boss-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff0040, var(--neon-magenta), #ff6b35);
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 0 10px rgba(255,45,120,0.6);
  position: relative;
}

.boss-hp-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 40%;
  background: rgba(255,255,255,0.15);
  border-radius: 4px 4px 0 0;
}

.boss-sprite {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

.boss-emoji {
  font-size: 32px;
  position: relative;
  z-index: 2;
  animation: boss-float 3s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(255,45,120,0.8));
}

.boss-aura {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,45,120,0.2) 0%, transparent 70%);
  animation: aura-pulse 2s ease-in-out infinite;
}

@keyframes boss-float {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-4px) rotate(3deg); }
}

@keyframes aura-pulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
}

/* ── Timer Ring ── */
.timer-ring-wrap {
  position: relative;
  width: var(--ring-size);
  height: var(--ring-size);
  flex-shrink: 0;
  margin: 0 auto;
}

.timer-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--surface);
  stroke-width: 10;
}

.ring-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 10;
}

.ring-progress {
  fill: none;
  stroke: var(--neon-cyan);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 553;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.5s ease;
  filter: drop-shadow(0 0 6px var(--neon-cyan));
}

.ring-progress.break-mode {
  stroke: var(--neon-green);
  filter: drop-shadow(0 0 6px var(--neon-green));
}

.ring-progress.long-break-mode {
  stroke: var(--neon-purple);
  filter: drop-shadow(0 0 6px var(--neon-purple));
}

.ring-progress.paused {
  animation: ring-blink 1s ease-in-out infinite;
}

@keyframes ring-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.timer-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.session-type-label {
  font-family: 'Orbitron', monospace;
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px var(--neon-cyan);
  transition: color 0.5s ease, text-shadow 0.5s ease;
}

.session-type-label.break-mode {
  color: var(--neon-green);
  text-shadow: 0 0 8px var(--neon-green);
}

.session-type-label.long-break-mode {
  color: var(--neon-purple);
  text-shadow: 0 0 8px var(--neon-purple);
}

.timer-digits {
  font-family: 'Orbitron', monospace;
  font-size: 38px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1;
  text-shadow: 0 0 20px rgba(0,245,255,0.4);
  transition: transform 0.1s ease;
}

.timer-digits.tick {
  transform: scale(1.04);
}

.session-count {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

.session-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  border: 1px solid var(--text-dim);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.session-dot.done {
  background: var(--neon-cyan);
  border-color: var(--neon-cyan);
  box-shadow: 0 0 6px var(--neon-cyan);
}

.session-dot.current {
  background: var(--neon-yellow);
  border-color: var(--neon-yellow);
  box-shadow: 0 0 8px var(--neon-yellow);
  animation: dot-pulse 1s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.4); }
}

/* ── Controls ── */
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  padding: 4px 0;
}

.btn-main {
  position: relative;
  background: linear-gradient(135deg, #003344, #005566);
  border: 2px solid var(--neon-cyan);
  border-radius: 50px;
  color: var(--neon-cyan);
  font-family: 'Orbitron', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 12px 28px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 0 20px rgba(0,245,255,0.3), inset 0 0 20px rgba(0,245,255,0.05);
  min-width: 120px;
}

.btn-main:active {
  transform: scale(0.94);
  box-shadow: 0 0 30px rgba(0,245,255,0.6);
}

.btn-main.paused-state {
  border-color: var(--neon-yellow);
  color: var(--neon-yellow);
  background: linear-gradient(135deg, #1a1400, #2e2200);
  box-shadow: 0 0 20px rgba(255,230,0,0.3), inset 0 0 20px rgba(255,230,0,0.05);
}

.btn-main.running-state {
  border-color: var(--neon-magenta);
  color: var(--neon-magenta);
  background: linear-gradient(135deg, #1a0010, #2e0020);
  box-shadow: 0 0 20px rgba(255,45,120,0.3), inset 0 0 20px rgba(255,45,120,0.05);
}

.btn-main.small {
  font-size: 11px;
  padding: 9px 20px;
  min-width: 90px;
}

.btn-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(0,245,255,0.15), transparent 60%);
  pointer-events: none;
}

.btn-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

.btn-icon:active {
  transform: scale(0.9);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0,245,255,0.3);
}

/* ── Combo Display ── */
.combo-display {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.combo-display.visible {
  opacity: 1;
  transform: translateY(0);
}

.combo-label {
  font-family: 'Orbitron', monospace;
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 2px;
}

.combo-value {
  font-family: 'Orbitron', monospace;
  font-size: 16px;
  font-weight: 900;
  color: var(--neon-yellow);
  text-shadow: 0 0 12px var(--neon-yellow);
  animation: combo-bounce 0.3s ease;
}

@keyframes combo-bounce {
  0% { transform: scale(1.5); }
  100% { transform: scale(1); }
}

/* ── XP Popup ── */
#xp-popups {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}

.xp-popup {
  position: absolute;
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--neon-yellow);
  text-shadow: 0 0 10px var(--neon-yellow);
  animation: xp-float 1.5s ease-out forwards;
  white-space: nowrap;
}

@keyframes xp-float {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  50% { opacity: 1; transform: translateY(-30px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-60px) scale(0.8); }
}

/* ── Damage Numbers ── */
#damage-numbers {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}

.damage-num {
  position: absolute;
  font-family: 'Orbitron', monospace;
  font-size: 20px;
  font-weight: 900;
  color: var(--neon-magenta);
  text-shadow: 0 0 12px var(--neon-magenta);
  animation: damage-float 1s ease-out forwards;
  white-space: nowrap;
}

@keyframes damage-float {
  0% { opacity: 1; transform: translateY(0) scale(1.2); }
  100% { opacity: 0; transform: translateY(-50px) scale(0.7); }
}

/* ── Level Up Screen ── */
.levelup-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  animation: levelup-entrance 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes levelup-entrance {
  0% { transform: scale(0.5) rotate(-10deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.levelup-stars {
  font-size: 20px;
  color: var(--neon-yellow);
  text-shadow: 0 0 15px var(--neon-yellow);
  letter-spacing: 8px;
  animation: stars-spin 2s linear infinite;
}

@keyframes stars-spin {
  0% { letter-spacing: 8px; }
  50% { letter-spacing: 14px; }
  100% { letter-spacing: 8px; }
}

.levelup-title {
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--neon-yellow);
  text-shadow: 0 0 20px var(--neon-yellow);
}

.levelup-num {
  font-family: 'Orbitron', monospace;
  font-size: 72px;
  font-weight: 900;
  color: var(--text-primary);
  text-shadow: 0 0 30px var(--neon-cyan), 0 0 60px rgba(0,245,255,0.3);
  line-height: 1;
}

.levelup-reward {
  font-size: 11px;
  color: var(--neon-cyan);
  letter-spacing: 1px;
  font-family: 'Orbitron', monospace;
}

/* ── Achievement Screen ── */
.achievement-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  background: linear-gradient(135deg, #0a0a1a, #1a0a2e);
  border: 2px solid var(--neon-purple);
  border-radius: 20px;
  padding: 24px 20px;
  box-shadow: 0 0 40px rgba(191,95,255,0.3);
  animation: ach-entrance 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 280px;
  width: 100%;
}

@keyframes ach-entrance {
  0% { transform: translateY(40px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.achievement-icon {
  font-size: 40px;
  animation: trophy-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes trophy-bounce {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

.achievement-title {
  font-family: 'Orbitron', monospace;
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--neon-purple);
  text-shadow: 0 0 8px var(--neon-purple);
}

.achievement-name {
  font-family: 'Orbitron', monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.achievement-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
}

/* ── Boss Defeat Screen ── */
.boss-defeat-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  animation: defeat-entrance 0.5s ease;
}

@keyframes defeat-entrance {
  0% { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.defeat-explosion {
  font-size: 60px;
  animation: explode 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes explode {
  0% { transform: scale(0) rotate(0deg); }
  50% { transform: scale(1.5) rotate(20deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.defeat-title {
  font-family: 'Orbitron', monospace;
  font-size: 18px;
  font-weight: 900;
  color: var(--neon-yellow);
  text-shadow: 0 0 20px var(--neon-yellow);
  letter-spacing: 2px;
}

.defeat-reward {
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  color: var(--neon-green);
  text-shadow: 0 0 12px var(--neon-green);
}

.defeat-loot {
  font-size: 12px;
  color: var(--text-dim);
}

/* ── Settings Screen ── */
.settings-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px 16px;
  animation: settings-slide 0.3s ease;
}

@keyframes settings-slide {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.settings-title {
  font-family: 'Orbitron', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--neon-cyan);
  text-align: center;
  text-shadow: 0 0 8px var(--neon-cyan);
  margin-bottom: 4px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.setting-label {
  font-size: 11px;
  color: var(--text-dim);
  font-family: 'Exo 2', sans-serif;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.setting-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--neon-cyan);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  line-height: 1;
}

.step-btn:active {
  background: var(--neon-cyan);
  color: var(--bg);
  transform: scale(0.9);
}

.step-val {
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 24px;
  text-align: center;
}

.step-unit {
  font-size: 9px;
  color: var(--text-dim);
}

.toggle-btn {
  background: linear-gradient(135deg, #003322, #005533);
  border: 1px solid var(--neon-green);
  border-radius: 20px;
  color: var(--neon-green);
  font-family: 'Orbitron', monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 5px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 1px;
}

.toggle-btn.off {
  background: linear-gradient(135deg, #1a0a0a, #2e1010);
  border-color: var(--neon-magenta);
  color: var(--neon-magenta);
}

.settings-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
  font-family: 'Exo 2', sans-serif;
  font-size: 10px;
  padding: 7px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.btn-secondary:active {
  border-color: var(--neon-magenta);
  color: var(--neon-magenta);
}

/* ── Screen flash effect ── */
.screen-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  animation: flash 0.3s ease-out;
}

@keyframes flash {
  0% { opacity: 0.6; }
  100% { opacity: 0; }
}

/* ── Shake animation ── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.shake {
  animation: shake 0.4s ease;
}

/* ── Responsive: actual Apple Watch sizes ── */
@media (max-width: 430px) {
  :root {
    --ring-size: 160px;
  }
  .timer-digits { font-size: 34px; }
  .level-num { font-size: 16px; }
  .streak-num { font-size: 12px; }
}

@media (max-width: 390px) {
  :root {
    --ring-size: 150px;
  }
  .timer-digits { font-size: 30px; }
  .btn-main { padding: 10px 22px; font-size: 12px; min-width: 100px; }
}

@media (max-width: 320px) {
  :root {
    --ring-size: 136px;
  }
  .timer-digits { font-size: 26px; }
  .boss-emoji { font-size: 26px; }
}