/* © 2026 FunApp https://funapp.io */
/* Fruit Ninja AGY - Antigravity Dojo Stylesheet */

:root {
  --bg-primary: #070913;
  --bg-surface: rgba(18, 22, 43, 0.75);
  --bg-card: rgba(26, 32, 60, 0.85);
  --accent-cyan: #00f0ff;
  --accent-purple: #9d4edd;
  --accent-pink: #ff007f;
  --accent-amber: #ffb703;
  --accent-green: #06d6a0;
  --text-main: #f8f9fa;
  --text-muted: #94a3b8;
  --border-glow: rgba(0, 240, 255, 0.3);
  --glass-blur: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: fixed;
  background-color: var(--bg-primary);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans TC', sans-serif;
  color: var(--text-main);
}

/* Stage Canvas */
#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  cursor: crosshair;
}

/* Overlay Layers */
.ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

/* FunApp Standard Navigation & Chrome */
.funapp-back-link {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-surface);
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  pointer-events: auto;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s;
}

.funapp-back-link:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

.funapp-back-link:active {
  transform: scale(0.96);
}

.settings-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  font-size: 20px;
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s;
}

.settings-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: var(--accent-cyan);
}

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

.armory-btn-top {
  position: fixed;
  top: 16px;
  right: 68px;
  z-index: 9999;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  font-size: 20px;
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s;
}

.armory-btn-top:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: var(--accent-purple);
}

/* In-Game HUD */
#hud {
  display: none;
  pointer-events: none;
}

#hud.active {
  display: block;
}

.hud-top-bar {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 6px 20px;
  background: rgba(11, 14, 29, 0.7);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
}

.hud-stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.hud-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 700;
}

.hud-stat-value {
  font-size: 26px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.6);
}

.lives-container {
  display: flex;
  gap: 6px;
  font-size: 20px;
}

.life-heart {
  transition: transform 0.3s ease, filter 0.3s ease;
  filter: drop-shadow(0 0 6px #ff0055);
}

.life-heart.lost {
  opacity: 0.25;
  filter: grayscale(1);
  transform: scale(0.8);
}

/* Anomaly Notification Banner */
.anomaly-banner {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  opacity: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px;
  background: linear-gradient(135deg, rgba(157, 78, 221, 0.8), rgba(0, 240, 255, 0.8));
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.4);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
  pointer-events: none;
  z-index: 100;
}

.anomaly-banner.show {
  transform: translateX(-50%) scale(1);
  opacity: 1;
}

/* Menu & Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 6, 14, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  pointer-events: auto;
}

.modal-overlay.active {
  display: flex;
}

.card-modal {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 240, 255, 0.15);
  animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes modalPop {
  from {
    transform: scale(0.92);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.game-title {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #00f0ff, #ff007f, #ffb703);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.game-subtitle {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--accent-cyan);
  text-transform: uppercase;
  margin-bottom: 24px;
}

/* Mode Selection Grid */
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.mode-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 16px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.mode-card:hover, .mode-card.active {
  background: rgba(0, 240, 255, 0.12);
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 240, 255, 0.25);
}

.mode-icon {
  font-size: 28px;
}

.mode-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.mode-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.high-score-badge {
  font-size: 11px;
  color: var(--accent-amber);
  font-weight: 600;
  margin-top: 2px;
}

/* Action Buttons */
.btn-primary {
  width: 100%;
  padding: 15px 24px;
  background: linear-gradient(135deg, #00f0ff, #7c4dff);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 240, 255, 0.35);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 240, 255, 0.5);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  width: 100%;
  padding: 13px 20px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Blade Selection Armory */
.blade-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.blade-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.blade-item:hover, .blade-item.selected {
  background: rgba(157, 78, 221, 0.15);
  border-color: var(--accent-purple);
}

.blade-item.selected {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
}

.blade-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.blade-icon {
  font-size: 24px;
}

.blade-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.blade-preview-strip {
  width: 50px;
  height: 6px;
  border-radius: 3px;
}

/* Settings Menu Items */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.setting-label {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

.select-control {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 16px; /* Avoid iOS auto-zoom */
  outline: none;
  cursor: pointer;
}

.select-control option {
  background: #12162b;
  color: #fff;
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: .3s;
  border-radius: 26px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-cyan);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* Game Over Stats */
.gameover-score-big {
  font-size: 56px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 20px rgba(0, 240, 255, 0.6);
  margin: 12px 0 4px;
}

.gameover-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
}

.stat-box {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 12px;
}

.stat-box-val {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}

.stat-box-lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

/* Version Tag */
#version-info {
  position: fixed;
  bottom: 8px;
  right: 8px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  z-index: 9999;
  pointer-events: none;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Mobile Responsive adjustments */
@media (max-width: 480px) {
  .card-modal {
    padding: 24px 18px;
    border-radius: 20px;
  }
  .game-title {
    font-size: 30px;
  }
  .hud-top-bar {
    top: 68px;
    gap: 14px;
    padding: 4px 14px;
  }
  .hud-stat-value {
    font-size: 22px;
  }
}
