/* ==========================================================================
   Game 3: Hangmath (Number Comparison & Rescue Quest) Stylesheet
   ========================================================================== */

#hangmath-app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 16px 20px 30px;
  gap: 20px;
  position: relative;
  overflow-x: hidden;
}

/* Main Hangmath Workspace Layout */
.hangmath-workspace {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
  width: 100%;
}

@media (max-width: 1024px) {
  .hangmath-workspace {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Upper Arena: Rescue Track (Boat at -5, Path -5 to +5, Gallows at +5)
   ========================================================================== */

.hangmath-rescue-stage {
  background: var(--bg-card);
  border: 2px solid rgba(0, 85, 191, 0.3);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.rescue-stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
}

.rescue-status-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-white);
  display: flex;
  align-items: center;
  gap: 8px;
}

.rescue-meter-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.8rem;
  font-weight: 700;
}

.legend-safe {
  color: #00E676;
  text-shadow: 0 0 8px rgba(0, 230, 118, 0.4);
}

.legend-danger {
  color: #FF3B30;
  text-shadow: 0 0 8px rgba(255, 59, 48, 0.4);
}

/* Interactive Pathway Visual Container */
.pathway-arena-container {
  position: relative;
  height: 240px;
  background: radial-gradient(circle at 50% 100%, #111d33 0%, #080f1e 60%, #030712 100%);
  border: 2px solid #1e293b;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.9);
}

/* Left Harbor Shore & Waves (Safety -5) */
.harbor-dock-zone {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 140px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  z-index: 5;
  pointer-events: none;
}

.harbor-water-waves {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 150px;
  height: 60px;
  background: linear-gradient(180deg, rgba(0, 180, 255, 0.3) 0%, rgba(0, 85, 191, 0.8) 100%);
  border-radius: 0 24px 0 0;
  box-shadow: 0 0 20px rgba(0, 210, 255, 0.4);
  animation: ambientWaterWave 3s ease-in-out infinite alternate;
}

@keyframes ambientWaterWave {
  0% { transform: translateY(0) scaleY(1); }
  100% { transform: translateY(-4px) scaleY(1.08); }
}

/* The Wooden Sailboat */
.hangmath-sailboat {
  position: absolute;
  left: 12px;
  bottom: 24px;
  width: 90px;
  height: 95px;
  z-index: 10;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.7));
  animation: boatBobbing 2.4s ease-in-out infinite;
  transition: transform 1.8s cubic-bezier(0.2, 0.8, 0.3, 1), opacity 0.5s ease;
}

@keyframes boatBobbing {
  0%, 100% { transform: rotate(-2deg) translateY(0); }
  50% { transform: rotate(3deg) translateY(-6px); }
}

/* Sailboat Sailing Away Celebration */
.boat-sail-away {
  transform: translate3d(-350px, -20px, 0) rotate(-6deg) scale(0.9) !important;
  opacity: 0;
}

/* Right Gallows Zone (Danger +5) */
.gallows-zone {
  position: absolute;
  right: 14px;
  bottom: 18px;
  width: 90px;
  height: 160px;
  z-index: 6;
  pointer-events: none;
}

.hangmath-gallows {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.8));
}

/* 11 Stepping Stones Track (Indexed -5 to +5) */
.stepping-track-container {
  position: absolute;
  bottom: 22px;
  left: 110px;
  right: 110px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 7;
}

.step-stone {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1e293b;
  border: 2px solid #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-dim);
  transition: all 0.25s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
}

.step-stone::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
}

/* Safety Zone Stepping Stones (-5 to -1) */
.step-stone[data-step="-5"] { border-color: #00E676; color: #00E676; box-shadow: 0 0 10px rgba(0, 230, 118, 0.4); }
.step-stone[data-step="-4"] { border-color: #10B981; color: #10B981; }
.step-stone[data-step="-3"] { border-color: #34D399; color: #34D399; }
.step-stone[data-step="-2"] { border-color: #6EE7B7; color: #6EE7B7; }
.step-stone[data-step="-1"] { border-color: #A7F3D0; color: #A7F3D0; }

/* Neutral Ground (0) */
.step-stone[data-step="0"] { border-color: #FBBF24; color: #FBBF24; box-shadow: 0 0 8px rgba(251, 191, 36, 0.3); }

/* Danger Zone Stepping Stones (+1 to +5) */
.step-stone[data-step="1"] { border-color: #FCA5A5; color: #FCA5A5; }
.step-stone[data-step="2"] { border-color: #F87171; color: #F87171; }
.step-stone[data-step="3"] { border-color: #EF4444; color: #EF4444; }
.step-stone[data-step="4"] { border-color: #DC2626; color: #DC2626; }
.step-stone[data-step="5"] { border-color: #FF3B30; color: #FF3B30; box-shadow: 0 0 12px rgba(255, 59, 48, 0.5); }

.step-stone.active-current-step {
  transform: scale(1.35) translateY(-4px);
  background: var(--lego-blue);
  border-color: var(--accent-cyan) !important;
  color: #FFFFFF !important;
  box-shadow: 0 0 20px var(--accent-cyan), 0 6px 12px rgba(0, 0, 0, 0.8) !important;
  z-index: 12;
}

/* Walking Hero Mini-Figure */
.hangmath-hero-character {
  position: absolute;
  bottom: 48px;
  width: 48px;
  height: 64px;
  margin-left: -24px;
  z-index: 15;
  transition: left 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.25s ease;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.8));
  pointer-events: none;
}

.hero-walking-left {
  animation: heroStepLeft 0.4s ease;
}

.hero-walking-right {
  animation: heroStumbleRight 0.4s ease;
}

@keyframes heroStepLeft {
  0% { transform: scaleX(1) translateY(0); }
  50% { transform: scaleX(-1) translateY(-14px) rotate(-10deg); }
  100% { transform: scaleX(1) translateY(0); }
}

@keyframes heroStumbleRight {
  0% { transform: scaleX(1) translateY(0); }
  50% { transform: scaleX(1) translateY(-8px) rotate(12deg); }
  100% { transform: scaleX(1) translateY(0); }
}

/* Hero Gallows Hanged Animation (Lose Condition) */
.hero-hanged {
  animation: gallowsHoist 1.2s cubic-bezier(0.2, 0.8, 0.3, 1) forwards !important;
}

@keyframes gallowsHoist {
  0% { transform: translateY(0) rotate(0); }
  40% { transform: translateY(-48px) rotate(15deg); }
  70% { transform: translateY(-42px) rotate(-10deg); }
  100% { transform: translateY(-45px) rotate(4deg); }
}

/* Hero Boat Escape (Win Condition) */
.hero-board-boat {
  animation: boardBoatJump 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes boardBoatJump {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.15) rotate(-10deg); }
  100% { transform: translateY(-8px) scale(0.85); opacity: 0; }
}

/* ==========================================================================
   Lower Arena: Number Comparison Cards
   ========================================================================== */

.hangmath-comparison-arena {
  background: var(--bg-card);
  border: 2px solid rgba(0, 85, 191, 0.3);
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.comparison-prompt-banner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.comparison-prompt-title {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--text-white);
  letter-spacing: -0.5px;
}

.comparison-prompt-title span {
  color: var(--accent-cyan);
  text-shadow: 0 0 12px var(--accent-cyan-glow);
}

.comparison-prompt-sub {
  font-size: 0.9rem;
  color: var(--text-dim);
}

/* Side-by-Side Comparison Cards Grid */
.comparison-cards-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
  width: 100%;
  max-width: 580px;
}

@media (max-width: 560px) {
  .comparison-cards-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

.comparison-vs-badge {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.compare-num-btn {
  background: radial-gradient(circle at 35% 35%, #0e2238 0%, #071324 100%);
  border: 3px solid var(--lego-blue);
  border-radius: var(--radius-xl);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  box-shadow: 
    0 8px 0 var(--lego-blue-dark),
    0 14px 28px rgba(0, 0, 0, 0.7),
    0 0 20px rgba(0, 85, 191, 0.3);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  user-select: none;
}

.compare-num-btn::before,
.compare-num-btn::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  top: 10px;
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.4), 0 2px 4px rgba(0, 0, 0, 0.5);
}

.compare-num-btn::before { left: 14px; }
.compare-num-btn::after { right: 14px; }

.compare-num-btn:hover {
  transform: translateY(-6px) scale(1.04);
  border-color: #00D2FF;
  box-shadow: 
    0 12px 0 var(--lego-blue-dark),
    0 20px 35px rgba(0, 85, 191, 0.55),
    0 0 30px rgba(0, 210, 255, 0.5);
}

.compare-num-btn:active {
  transform: translateY(4px) scale(0.98);
  box-shadow: 0 2px 0 var(--lego-blue-dark), 0 6px 12px rgba(0, 0, 0, 0.6);
}

.compare-num-val {
  font-family: var(--font-mono);
  font-size: 3.4rem;
  font-weight: 900;
  color: #FFFFFF;
  text-shadow: 0 0 15px rgba(0, 210, 255, 0.8), 0 4px 8px rgba(0, 0, 0, 0.8);
  letter-spacing: 2px;
}

.compare-card-tag {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* Choice Success & Error Flash on Cards */
.compare-num-btn.flash-correct {
  border-color: #00E676 !important;
  background: radial-gradient(circle at 35% 35%, #0e381b 0%, #072410 100%) !important;
  box-shadow: 0 0 35px #00E676, 0 8px 0 #006636 !important;
  transform: scale(1.06);
}

.compare-num-btn.flash-wrong {
  border-color: #FF3B30 !important;
  background: radial-gradient(circle at 35% 35%, #380e0e 0%, #240707 100%) !important;
  box-shadow: 0 0 35px #FF3B30, 0 8px 0 #80100a !important;
  animation: cardShake 0.4s ease;
}

@keyframes cardShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px) rotate(-2deg); }
  75% { transform: translateX(8px) rotate(2deg); }
}

/* ==========================================================================
   Eagle Hub Card Styles in Main 12-Box Hub
   ========================================================================== */

#box-game-hangmath.active-game-box {
  background: linear-gradient(180deg, #2a1b0a 0%, #150d05 100%);
  border-color: #F59E0B;
  box-shadow: 
    0 6px 0 #92400E,
    0 10px 25px rgba(245, 158, 11, 0.35),
    0 0 15px rgba(245, 158, 11, 0.3);
}

#box-game-hangmath.active-game-box:hover {
  border-color: #FBBF24;
  box-shadow: 
    0 8px 0 #92400E,
    0 16px 35px rgba(245, 158, 11, 0.6),
    0 0 30px rgba(251, 191, 36, 0.6);
}

#box-game-hangmath .box-ribbon-badge {
  background: #F59E0B;
  color: #150d05;
}

.eagle-avatar-stage {
  width: 96px;
  height: 96px;
  min-width: 96px;
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  transition: transform 0.25s ease;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.7));
}

.eagle-avatar-stage svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.active-game-box:hover .eagle-avatar-stage {
  transform: scale(1.12) rotate(-3deg);
}

/* Game Over Loss Overlay */
.gameover-card {
  max-width: 500px;
  width: 100%;
  background: var(--bg-card-elevated);
  border: 3px solid #EF4444;
  border-radius: var(--radius-xl);
  padding: 36px 28px;
  text-align: center;
  box-shadow: 0 0 60px rgba(239, 68, 68, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: victoryPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gameover-card h2 {
  font-size: 2.2rem;
  font-weight: 900;
  color: #FF3B30;
}
