/* Alt. 25m - Design System & Stylesheet */

/* Reset & Variables */
:root {
  --bg-dark: #070a13;
  --glass-bg: rgba(10, 15, 26, 0.5);
  --glass-bg-hover: rgba(15, 23, 42, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-focus: rgba(16, 185, 129, 0.4);
  --glass-border-rest: rgba(245, 158, 11, 0.4);
  --glass-shadow: 0 16px 40px 0 rgba(0, 0, 0, 0.6);
  
  --primary: #10b981;
  --primary-rgb: 16, 185, 129;
  --primary-gradient: linear-gradient(135deg, #10b981 0%, #047857 100%);
  --primary-glow: 0 0 20px rgba(16, 185, 129, 0.3);
  
  --accent: #f59e0b;
  --accent-rgb: 245, 158, 11;
  --accent-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --accent-glow: 0 0 20px rgba(245, 158, 11, 0.3);
  
  --danger: #ef4444;
  --danger-gradient: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  
  --font-ui: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-lg: 20px;
  --border-radius-md: 12px;
}

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

body {
  font-family: var(--font-ui);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
}

/* Background Cross-fade Transition */
.bg-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: -2;
  opacity: 0;
  transform: scale(1.03);
  transition: opacity 2s ease-in-out, transform 20s linear;
}

.bg-layer.active {
  opacity: 1;
  transform: scale(1);
}

.bg-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(180deg, rgba(7, 10, 19, 0.35) 0%, rgba(7, 10, 19, 0.75) 100%);
  z-index: -1;
}

/* Scrollbar Style */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(7, 10, 19, 0.3);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Glassmorphism Panel Base */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--glass-shadow);
  transition: var(--transition-smooth);
}

/* Common Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: var(--border-radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
  transition: var(--transition-smooth);
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--primary-gradient);
  border-color: rgba(16, 185, 129, 0.2);
  box-shadow: var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.5);
}

.btn-accent {
  background: var(--accent-gradient);
  border-color: rgba(245, 158, 11, 0.2);
  box-shadow: var(--accent-glow);
}

.btn-accent:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.5);
}

.btn-danger {
  background: var(--danger-gradient);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

/* Audio Initialization Overlay */
.audio-init-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background-color: var(--bg-dark);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.8s ease-in-out;
}

.audio-init-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.init-card {
  max-width: 520px;
  width: 100%;
  padding: 40px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(245, 158, 11, 0.2) 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  margin-bottom: 24px;
  color: var(--primary);
}

.init-card h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #a1a1aa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.init-card .subtitle {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 24px;
  font-weight: 500;
}

.init-card .desc {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 32px;
}

/* App Layout */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.app-wrapper.hidden {
  display: none;
  opacity: 0;
}

/* Navbar */
.app-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  margin-bottom: 32px;
  border-radius: var(--border-radius-md);
  z-index: 10;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-main);
  font-weight: 700;
  font-size: 1.25rem;
  cursor: pointer;
}

.nav-logo svg {
  color: var(--primary);
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.hidden {
  display: none !important;
}

/* Scenes Main Grid */
.scene {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: sceneFadeIn 0.5s ease-out;
}

@keyframes sceneFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* HOME SCENE */
.home-intro {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 48px;
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 50%, #9ca3af 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1.6;
}

.routes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* Route Cards */
.route-card {
  position: relative;
  overflow: hidden;
  height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 32px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.route-card-bg {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background-size: cover;
  background-position: center;
  z-index: -1;
  transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
  filter: brightness(0.65) contrast(1.05);
}

.route-card:hover .route-card-bg {
  transform: scale(1.08);
  filter: brightness(0.75) contrast(1.05);
}

.route-card:hover {
  transform: translateY(-8px);
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--glass-bg-hover);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.8);
}

.route-badge {
  position: absolute;
  top: 24px;
  left: 24px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
  letter-spacing: 0.5px;
}

.route-badge.challenge {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  color: #60a5fa;
}

.route-badge.epic {
  background: rgba(167, 139, 250, 0.2);
  border-color: rgba(167, 139, 250, 0.4);
  color: #c084fc;
}

.route-name {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.route-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}

.meta-item svg {
  color: var(--text-dim);
}

.route-desc {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.btn-route-start {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

.route-card:hover .btn-route-start {
  background: var(--primary-gradient);
  border-color: rgba(16, 185, 129, 0.3);
  color: #fff;
  box-shadow: var(--primary-glow);
}

/* TIMER SCENE */
.timer-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.timer-card {
  width: 100%;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-color: var(--glass-border);
}

.timer-card.state-focusing {
  border-color: var(--glass-border-focus);
}

.timer-card.state-resting {
  border-color: var(--glass-border-rest);
}

.timer-route-header {
  text-align: center;
  margin-bottom: 28px;
  width: 100%;
}

.route-badge-small {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.timer-route-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.timer-status-indicator {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.timer-status-indicator.resting {
  color: var(--accent);
}

.pulse-green::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary);
  box-shadow: 0 0 8px var(--primary);
  animation: pulseAnimation 1.5s infinite alternate;
}

.pulse-orange::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulseAnimation 1.5s infinite alternate;
}

@keyframes pulseAnimation {
  from { transform: scale(0.85); opacity: 0.5; }
  to { transform: scale(1.2); opacity: 1; }
}

/* Clock Ring & Digital Timer */
.clock-area {
  position: relative;
  width: 220px;
  height: 220px;
  margin-bottom: 28px;
}

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

.progress-ring-bg {
  stroke: rgba(255, 255, 255, 0.04);
}

.progress-ring-bar {
  stroke: var(--primary);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.1s linear, stroke 0.5s ease;
  filter: drop-shadow(0px 0px 8px rgba(16, 185, 129, 0.4));
}

.state-resting .progress-ring-bar {
  stroke: var(--accent);
  filter: drop-shadow(0px 0px 8px rgba(245, 158, 11, 0.4));
}

.digital-time {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3.25rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  letter-spacing: -1px;
}

/* Altitude Progress Area */
.altitude-progress-wrapper {
  width: 100%;
  margin-bottom: 28px;
}

.altitude-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.altitude-label strong {
  color: var(--text-main);
}

.altitude-bar-outer {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

.altitude-bar-inner {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 3px;
  width: 0%;
  transition: width 1s linear;
}

.state-resting .altitude-bar-inner {
  background: var(--accent-gradient);
}

/* Ambient Sound Controller */
.ambient-control-panel {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--border-radius-md);
  padding: 16px 20px;
  margin-bottom: 28px;
  transition: var(--transition-smooth);
}

.ambient-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ambient-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ambient-title svg {
  color: var(--primary);
}

.state-resting .ambient-title svg {
  color: var(--accent);
}

.btn-audio-mute {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: var(--transition-smooth);
}

.btn-audio-mute:hover {
  color: var(--text-main);
}

.volume-slider-wrapper {
  display: flex;
  align-items: center;
  width: 100%;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  transition: transform 0.1s ease;
}

.state-resting .volume-slider::-webkit-slider-thumb {
  background: var(--accent);
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

.bird-chirp-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--primary);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.bird-chirp-indicator.active {
  opacity: 0.8;
  transform: translateY(0);
}

/* Timer Controls Grid */
.timer-actions {
  display: flex;
  gap: 16px;
  width: 100%;
}

.timer-actions .btn {
  flex: 1;
}

/* Photo attribution info overlay */
.photo-attribution-box {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 5;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.photo-attribution-box svg {
  opacity: 0.7;
}

/* SUMMARY SCENE */
.summary-container {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

.summary-card {
  padding: 40px;
  display: flex;
  flex-direction: column;
}

.main-summary {
  align-items: center;
  text-align: center;
  border-color: rgba(16, 185, 129, 0.25);
}

.summary-icon-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(245, 158, 11, 0.1) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 28px;
  color: var(--accent);
}

.trophy-glow {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  border-radius: 50%;
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.25);
  animation: pulseTrophy 2s infinite alternate;
}

@keyframes pulseTrophy {
  from { transform: scale(0.95); opacity: 0.5; }
  to { transform: scale(1.05); opacity: 1; }
}

.summary-title {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.summary-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.stats-row {
  display: flex;
  width: 100%;
  justify-content: space-around;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 24px 0;
  margin-bottom: 32px;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-val {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
}

.stat-lbl {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.summary-actions {
  width: 100%;
}

.summary-actions .btn {
  width: 100%;
}

/* Contribute Box */
.contribute-card {
  justify-content: center;
}

.contribute-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: #fff;
}

.contribute-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.contribute-incentive {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.incentive-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.incentive-item svg {
  color: var(--primary);
  flex-shrink: 0;
  margin-top: 2px;
}

.btn-contribute {
  width: 100%;
  text-align: center;
  font-weight: 600;
  font-size: 1.05rem;
}

/* Footer styling */
.app-footer {
  text-align: center;
  padding: 24px 0 12px;
  margin-top: 48px;
}

.app-footer p {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Landscape orientation check / Desktop priority info */
@media (max-height: 500px) {
  .app-navbar { margin-bottom: 12px; padding: 10px 20px; }
  .home-intro { margin-bottom: 20px; }
  .routes-grid { gap: 16px; }
  .route-card { height: 260px; padding: 16px; }
  .route-name { font-size: 1.25rem; }
  .route-desc { display: none; }
}

/* Responsive Scaling Rules for tablets/medium screens */
@media (max-width: 1024px) {
  .routes-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .app-wrapper {
    padding: 16px;
  }
  .hero-title {
    font-size: 2.25rem;
  }
  .routes-grid {
    grid-template-columns: 1fr;
  }
  .route-card {
    height: 340px;
  }
  .summary-container {
    grid-template-columns: 1fr;
  }
  .clock-area {
    width: 180px;
    height: 180px;
  }
  .digital-time {
    font-size: 2.75rem;
  }
}
