/* ==========================================
   CineAHO Suika Watermelon Game CSS Styles
   ========================================== */

/* Inherits portal theme settings */
:root {
  --bg-color: #060913;
  --panel-bg: rgba(14, 20, 38, 0.55);
  --panel-border: rgba(255, 255, 255, 0.05);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  
  --grad-purple: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  --grad-blue: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --grad-green: linear-gradient(135deg, #10b981 0%, #047857 100%);
  --grad-gold: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  
  --font-main: 'Noto Sans KR', 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-card: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
}

.wm-page-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 3rem;
}

/* Glassmorphism Panel Helper */
.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  transition: var(--transition-smooth);
}
.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.08);
}

/* Hero Section */
.wm-hero-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem;
  border-radius: 20px;
}
.hero-left-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}
.badge-capsule {
  display: inline-flex;
  align-items: center;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #818cf8;
  width: fit-content;
}
.pulse-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #ef4444;
  border-radius: 50%;
  margin-right: 6px;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  animation: pulse-dot-anim 1.6s infinite;
}
@keyframes pulse-dot-anim {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.hero-wm-title {
  font-family: var(--font-display), var(--font-main);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 30%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-left-info p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Game Layout */
.game-layout {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  gap: 1.5rem;
  align-items: start;
}

/* Left: Evolution Panel */
.evolution-panel {
  padding: 1.5rem;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.panel-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.75rem;
}
.panel-header h3 {
  font-size: 0.95rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-header p {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.evolution-chain-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.chain-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.02);
  transition: var(--transition-smooth);
}
.chain-item.highlight {
  color: #ffffff;
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.35);
  transform: translateX(4px);
}
.fruit-badge {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
}

/* Center: Canvas Area */
.canvas-panel-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}
.next-preview-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  width: 100%;
  max-width: 440px;
  border-radius: 12px;
}
.preview-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}
.preview-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.preview-fruit-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e11d48; /* cherry default */
  box-shadow: 0 0 10px rgba(225, 29, 72, 0.5);
  transition: all 0.3s ease;
}
.preview-fruit-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.canvas-container {
  position: relative;
  width: 440px;
  height: 600px;
  overflow: hidden;
  border-radius: 20px;
  background: rgba(8, 12, 28, 0.7);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.6), 0 8px 30px rgba(0,0,0,0.4);
  cursor: crosshair;
}
.canvas-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Deadline overlay indicators */
.warning-line-indicator {
  position: absolute;
  top: 20%;
  left: 0;
  width: 100%;
  height: 2px;
  background-image: linear-gradient(to right, #ef4444 60%, transparent 40%);
  background-size: 10px 2px;
  pointer-events: none;
  z-index: 5;
  opacity: 0.7;
}

.drop-guide-line {
  position: absolute;
  top: 0;
  left: 220px; /* modified dynamically */
  width: 1.5px;
  height: 20%;
  background-image: linear-gradient(to bottom, var(--text-muted) 50%, transparent 50%);
  background-size: 2px 8px;
  pointer-events: none;
  z-index: 4;
  opacity: 0.4;
  transition: opacity 0.2s;
}

.countdown-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 8rem;
  font-weight: 900;
  font-family: var(--font-display);
  color: rgba(239, 68, 68, 0.9);
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  z-index: 10;
  display: none;
  animation: countdownPulse 1s infinite;
}
@keyframes countdownPulse {
  0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.7; }
  50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.7; }
}

/* Right: Control Panel */
.control-panel {
  padding: 1.5rem;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.scoreboard {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.score-card {
  padding: 1rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.score-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
}
.score-val {
  font-size: 1.8rem;
  font-weight: 900;
  font-family: var(--font-display);
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.guide-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.guide-list li {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.guide-list li i {
  font-size: 0.85rem;
  margin-top: 2px;
}
.guide-list strong {
  color: var(--text-main);
}

.game-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.btn {
  padding: 0.85rem;
  border-radius: 12px;
  border: none;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}
.btn-restart {
  background: var(--grad-blue);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.25);
}
.btn-restart:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
}
.btn-sound {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}
.btn-sound:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-main);
}

/* Game Over Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(6, 9, 19, 0.75);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-box {
  width: 100%;
  max-width: 460px;
  padding: 2.25rem;
  border-radius: 24px;
  position: relative;
  transform: translateY(30px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  border: 1px solid rgba(255,255,255,0.06);
}
.modal-overlay.open .modal-box {
  transform: translateY(0);
}

.game-over-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.modal-header h3 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
}

.final-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}
.final-stat-item {
  background: rgba(255,255,255,0.015);
  border: 1px solid rgba(255,255,255,0.03);
  padding: 1rem;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.final-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
}
.final-val {
  font-size: 1.35rem;
  font-weight: 900;
}
.final-val.text-blue { color: #60a5fa; }
.final-val.text-purple { color: #c084fc; }

.btn-restart-modal {
  background: var(--grad-purple);
  color: #ffffff;
  border: none;
  padding: 0.85rem 2rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
  transition: var(--transition-smooth);
}
.btn-restart-modal:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.4);
}

/* Light Theme Variables overrides */
[data-theme="light"] {
  --bg-color: #f8fafc;
  --panel-bg: rgba(255, 255, 255, 0.7);
  --panel-border: rgba(15, 23, 42, 0.06);
  --panel-hover-border: rgba(59, 130, 246, 0.3);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --shadow-card: 0 12px 40px 0 rgba(15, 23, 42, 0.08);
}

[data-theme="light"] body {
  background-color: var(--bg-color);
  color: var(--text-main);
}
[data-theme="light"] .hero-wm-title {
  background: linear-gradient(135deg, #0f172a 30%, #475569 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
[data-theme="light"] .chain-item {
  background: rgba(15, 23, 42, 0.01);
  border-color: rgba(15, 23, 42, 0.03);
  color: var(--text-muted);
}
[data-theme="light"] .chain-item.highlight {
  color: #7e22ce;
  background: rgba(168, 85, 247, 0.06);
  border-color: rgba(168, 85, 247, 0.2);
}
[data-theme="light"] .canvas-container {
  background: rgba(241, 245, 249, 0.95);
  box-shadow: inset 0 0 15px rgba(15, 23, 42, 0.05), 0 8px 30px rgba(15, 23, 42, 0.06);
}
[data-theme="light"] .score-card {
  background: rgba(15, 23, 42, 0.01);
  border-color: rgba(15, 23, 42, 0.04);
}
[data-theme="light"] .btn-sound {
  background: rgba(15, 23, 42, 0.02);
  border-color: rgba(15, 23, 42, 0.05);
}
[data-theme="light"] .btn-sound:hover {
  background: rgba(15, 23, 42, 0.05);
}
[data-theme="light"] .modal-overlay {
  background: rgba(248, 250, 252, 0.7);
}
[data-theme="light"] .modal-box {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
}
[data-theme="light"] .final-stat-item {
  background: rgba(15, 23, 42, 0.01);
  border-color: rgba(15, 23, 42, 0.03);
}

/* Tablet & Mobile Responsiveness */
@media (max-width: 1080px) {
  .game-layout {
    grid-template-columns: 1fr;
    max-width: 500px;
    margin: 0 auto;
  }
  .evolution-panel {
    order: 3;
  }
  .canvas-panel-wrapper {
    order: 1;
  }
  .control-panel {
    order: 2;
  }
}

@media (max-width: 500px) {
  .canvas-container {
    width: 320px;
    height: auto;
    aspect-ratio: 440 / 600;
  }
  .next-preview-box {
    max-width: 320px;
    padding: 0.6rem 1rem;
  }
  .wm-hero-section {
    padding: 1.25rem;
  }
}
