/* ========================================
   BITVERSE: The Binary Kingdom Saga
   Complete Stylesheet
   ======================================== */

/* CSS Variables */
:root {
  /* Primary Colors */
  --bg-dark: #0a0a0f;
  --bg-darker: #050508;
  --bg-card: #12121a;
  --bg-card-hover: #1a1a25;

  /* Accent Colors */
  --cyan: #00f5ff;
  --cyan-glow: rgba(0, 245, 255, 0.5);
  --magenta: #ff00ff;
  --magenta-glow: rgba(255, 0, 255, 0.5);
  --gold: #ffd700;
  --gold-glow: rgba(255, 215, 0, 0.5);
  --green: #00ff88;
  --green-glow: rgba(0, 255, 136, 0.5);
  --red: #ff3366;
  --red-glow: rgba(255, 51, 102, 0.5);
  --orange: #ff8800;
  --purple: #9933ff;
  --blue: #3366ff;

  /* Bit Colors */
  --bit-0: #334455;
  --bit-1: #00ff88;
  --bit-1-glow: rgba(0, 255, 136, 0.6);

  /* Text */
  --text-primary: #ffffff;
  --text-secondary: #aabbcc;
  --text-dim: #667788;

  /* Fonts */
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Rajdhani', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Game Container */
#game-container {
  position: relative;
  width: 100%;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top, #1a1a2e 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, #16213e 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
}

/* Particle Canvas */
#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Screens */
.screen {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 20px;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 0.5s ease;
}

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

/* ========================================
   MAIN MENU
   ======================================== */
#main-menu {
  justify-content: center;
  background:
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 30h60M30 0v60' stroke='%23ffffff08' fill='none'/%3E%3C/svg%3E"),
    var(--bg-dark);
}

.menu-content {
  text-align: center;
  max-width: 600px;
}

.title-container {
  margin-bottom: 30px;
}

.game-title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 900;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  position: relative;
}

.game-title .bit {
  color: var(--cyan);
  text-shadow:
    0 0 20px var(--cyan-glow),
    0 0 40px var(--cyan-glow),
    0 0 60px var(--cyan-glow);
  animation: glowPulse 2s ease-in-out infinite;
}

.game-title .verse {
  color: var(--magenta);
  text-shadow:
    0 0 20px var(--magenta-glow),
    0 0 40px var(--magenta-glow),
    0 0 60px var(--magenta-glow);
  animation: glowPulse 2s ease-in-out infinite 0.5s;
}

@keyframes glowPulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.3);
  }
}

.subtitle {
  font-family: var(--font-display);
  font-size: clamp(1rem, 3vw, 1.5rem);
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.binary-decoration {
  height: 40px;
  margin: 30px 0;
  overflow: hidden;
  position: relative;
}

.flowing-bits {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--cyan);
  opacity: 0.5;
  animation: flowBits 10s linear infinite;
}

.flowing-bits::before {
  content: '01001000 01100101 01101100 01101100 01101111 00100000 01000010 01101001 01110100 01110110 01100101 01110010 01110011 01100101';
  animation: typeBits 3s steps(80) infinite;
}

@keyframes flowBits {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(-100%);
  }
}

/* Menu Buttons */
.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 40px;
}

.menu-btn {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  padding: 18px 40px;
  border: 2px solid var(--cyan);
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.1), transparent);
  color: var(--cyan);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.menu-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 245, 255, 0.3),
    transparent
  );
  transition: left 0.5s ease;
}

.menu-btn:hover::before {
  left: 100%;
}

.menu-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(0, 245, 255, 0.2),
    rgba(0, 245, 255, 0.1)
  );
  box-shadow:
    0 0 20px var(--cyan-glow),
    inset 0 0 20px rgba(0, 245, 255, 0.1);
  transform: translateY(-2px);
}

.menu-btn .btn-icon {
  margin-right: 10px;
}

.menu-btn.secondary {
  border-color: var(--text-dim);
  color: var(--text-secondary);
  background: transparent;
}

.menu-btn.secondary:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

/* Hero Stats */
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 20px;
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat {
  font-family: var(--font-mono);
  font-size: 1rem;
}

.stat-label {
  color: var(--text-dim);
}

/* ========================================
   WORLD MAP
   ======================================== */
#world-map {
  padding-top: 80px;
}

.back-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  font-family: var(--font-display);
  font-size: 1rem;
  padding: 10px 20px;
  border: 1px solid var(--text-dim);
  background: rgba(0, 0, 0, 0.5);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: 100;
}

.back-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.map-title {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--gold);
  text-shadow: 0 0 20px var(--gold-glow);
  margin-bottom: 40px;
  text-align: center;
}

.map-container {
  width: 100%;
  max-width: 1200px;
  padding: 20px;
}

.world-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 25px;
  padding: 20px;
}

.world-node {
  background: var(--bg-card);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 25px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.world-node::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.05), transparent);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.world-node:hover::before {
  opacity: 1;
}

.world-node:hover {
  transform: translateY(-5px);
  border-color: var(--cyan);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.3),
    0 0 30px var(--cyan-glow);
}

.world-node.completed {
  border-color: var(--green);
}

.world-node.completed::after {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 10px;
  color: var(--green);
  font-size: 1.5rem;
}

.world-node.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.world-node.locked::after {
  content: '🔒';
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.2rem;
}

.world-node.boss-node {
  border-color: var(--red);
  background: linear-gradient(135deg, rgba(255, 51, 102, 0.1), var(--bg-card));
}

.world-node.boss-node:hover {
  border-color: var(--red);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.3),
    0 0 30px var(--red-glow);
}

.node-icon {
  font-size: 3rem;
  margin-bottom: 15px;
  filter: drop-shadow(0 0 10px currentColor);
}

.node-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.node-status {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ========================================
   TUTORIAL
   ======================================== */
#tutorial {
  padding-top: 80px;
}

.tutorial-content {
  max-width: 800px;
  width: 100%;
}

.tutorial-content h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--gold);
  text-align: center;
  margin-bottom: 40px;
}

.tutorial-sections {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.tutorial-section {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 25px;
}

.tutorial-section h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--cyan);
  margin-bottom: 15px;
}

.tutorial-section p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.6;
}

.highlight {
  color: var(--green);
  font-weight: 600;
}

.power-display {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 15px;
}

.power {
  font-family: var(--font-mono);
  background: rgba(0, 245, 255, 0.1);
  border: 1px solid var(--cyan);
  padding: 8px 12px;
  border-radius: 5px;
  font-size: 0.9rem;
  color: var(--cyan);
}

.operator-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-top: 15px;
}

.op-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  transition: all var(--transition-normal);
}

.op-card:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-3px);
}

.op-symbol {
  display: block;
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--magenta);
  margin-bottom: 5px;
}

.op-name {
  display: block;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.op-desc {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

code {
  font-family: var(--font-mono);
  background: rgba(0, 245, 255, 0.1);
  padding: 2px 8px;
  border-radius: 3px;
  color: var(--cyan);
}

/* ========================================
   GAME WORLD
   ======================================== */
#game-world {
  padding: 0;
}

.game-hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 25px;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.9),
    rgba(0, 0, 0, 0.5),
    transparent
  );
  z-index: 100;
}

.world-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--gold);
}

.hud-stats {
  display: flex;
  gap: 25px;
}

.hud-stat {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-primary);
}

.world-content {
  padding: 100px 20px 100px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 15px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.9), transparent);
  text-align: center;
}

.hint-box {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-secondary);
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  display: inline-block;
}

/* ========================================
   BINARY GRID COMPONENTS
   ======================================== */
.binary-grid {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 20px 0;
}

.bit-cell {
  width: 60px;
  height: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 2px solid var(--bit-0);
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.bit-cell.active {
  border-color: var(--bit-1);
  background: linear-gradient(
    135deg,
    rgba(0, 255, 136, 0.2),
    rgba(0, 255, 136, 0.05)
  );
  box-shadow: 0 0 20px var(--bit-1-glow);
}

.bit-cell:hover {
  transform: scale(1.05);
}

.bit-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--bit-0);
  transition: color var(--transition-fast);
}

.bit-cell.active .bit-value {
  color: var(--bit-1);
  text-shadow: 0 0 10px var(--bit-1-glow);
}

.bit-power {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  position: absolute;
  bottom: 5px;
}

.bit-index {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--cyan);
  position: absolute;
  top: 3px;
  right: 5px;
}

/* Large Bit Display */
.large-bit {
  width: 80px;
  height: 90px;
}

.large-bit .bit-value {
  font-size: 2.5rem;
}

/* ========================================
   DECIMAL DISPLAY
   ======================================== */
.decimal-display {
  background: var(--bg-card);
  border: 2px solid var(--cyan);
  border-radius: 15px;
  padding: 20px 40px;
  text-align: center;
  margin: 20px 0;
}

.decimal-label {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.decimal-value {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 700;
  color: var(--cyan);
  text-shadow: 0 0 20px var(--cyan-glow);
}

/* ========================================
   OPERATION DISPLAY
   ======================================== */
.operation-display {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 25px;
  margin: 20px 0;
  min-width: 400px;
}

.operation-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 10px 0;
  font-family: var(--font-mono);
  font-size: 1.3rem;
}

.operation-row.result {
  border-top: 2px solid var(--cyan);
  padding-top: 15px;
  margin-top: 15px;
}

.op-label {
  color: var(--text-dim);
  font-size: 0.9rem;
  min-width: 60px;
  text-align: right;
}

.op-bits {
  color: var(--text-primary);
  letter-spacing: 0.2em;
}

.op-symbol {
  color: var(--magenta);
  font-size: 1.5rem;
  min-width: 30px;
  text-align: center;
}

/* Highlighted bits */
.bit-highlight-1 {
  color: var(--green);
  text-shadow: 0 0 5px var(--green-glow);
}

.bit-highlight-0 {
  color: var(--red);
}

/* ========================================
   CONVERSION STEPS
   ======================================== */
.conversion-steps {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  padding: 25px;
  margin: 20px 0;
  max-width: 500px;
}

.conversion-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--gold);
  margin-bottom: 20px;
  text-align: center;
}

.step-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  margin: 8px 0;
  font-family: var(--font-mono);
  font-size: 1rem;
  opacity: 0;
  transform: translateX(-20px);
  transition: all 0.3s ease;
}

.step-row.visible {
  opacity: 1;
  transform: translateX(0);
}

.step-division {
  color: var(--text-secondary);
}

.step-quotient {
  color: var(--cyan);
}

.step-remainder {
  color: var(--green);
  font-weight: 700;
  padding: 3px 10px;
  background: rgba(0, 255, 136, 0.2);
  border-radius: 5px;
}

/* ========================================
   SHIFT ANIMATION
   ======================================== */
.shift-container {
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.shift-row {
  display: flex;
  gap: 5px;
  transition: transform 0.5s ease;
}

.shift-row.shifting-left {
  animation: shiftLeft 0.5s ease;
}

.shift-row.shifting-right {
  animation: shiftRight 0.5s ease;
}

@keyframes shiftLeft {
  0% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(-30px);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes shiftRight {
  0% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(30px);
  }
  100% {
    transform: translateX(0);
  }
}

.new-bit {
  animation: bitAppear 0.5s ease;
}

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

.falling-bit {
  animation: bitFall 0.5s ease forwards;
}

@keyframes bitFall {
  to {
    opacity: 0;
    transform: translateY(50px) scale(0);
  }
}

/* ========================================
   XOR EXPLOSION
   ======================================== */
.xor-explosion {
  position: relative;
}

.xor-cancel {
  animation: xorCancel 0.5s ease forwards;
}

@keyframes xorCancel {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.5);
    filter: brightness(2);
  }
  100% {
    opacity: 0;
    transform: scale(0);
  }
}

.xor-particle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--magenta);
  border-radius: 50%;
  animation: particleExplode 0.8s ease forwards;
}

@keyframes particleExplode {
  0% {
    opacity: 1;
    transform: scale(1) translate(0, 0);
  }
  100% {
    opacity: 0;
    transform: scale(0) translate(var(--x, 50px), var(--y, -50px));
  }
}

/* ========================================
   ENEMY DISPLAY
   ======================================== */
.enemy-container {
  background: linear-gradient(135deg, rgba(255, 51, 102, 0.1), var(--bg-card));
  border: 2px solid var(--red);
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  margin: 20px 0;
  position: relative;
}

.enemy-icon {
  font-size: 5rem;
  margin-bottom: 15px;
  animation: enemyFloat 2s ease-in-out infinite;
}

@keyframes enemyFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.enemy-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--red);
  margin-bottom: 10px;
}

.enemy-health-bar {
  width: 100%;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  margin: 15px 0;
}

.enemy-health-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--orange));
  border-radius: 10px;
  transition: width 0.5s ease;
}

.enemy-bits {
  margin-top: 20px;
}

/* ========================================
   INPUT FIELDS
   ======================================== */
.bit-input-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin: 20px 0;
}

.number-input {
  font-family: var(--font-mono);
  font-size: 2rem;
  padding: 15px 30px;
  background: var(--bg-card);
  border: 2px solid var(--cyan);
  border-radius: 10px;
  color: var(--cyan);
  text-align: center;
  width: 200px;
  transition: all var(--transition-fast);
}

.number-input:focus {
  outline: none;
  box-shadow: 0 0 20px var(--cyan-glow);
}

.binary-input {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  padding: 15px 30px;
  background: var(--bg-card);
  border: 2px solid var(--green);
  border-radius: 10px;
  color: var(--green);
  text-align: center;
  width: 300px;
  letter-spacing: 0.2em;
}

.binary-input:focus {
  outline: none;
  box-shadow: 0 0 20px var(--green-glow);
}

/* ========================================
   ACTION BUTTONS
   ======================================== */
.action-btn {
  font-family: var(--font-display);
  font-size: 1rem;
  padding: 15px 30px;
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  border: none;
  color: var(--bg-dark);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px var(--cyan-glow);
}

.btn-danger {
  background: linear-gradient(135deg, var(--red), var(--orange));
  border: none;
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px var(--red-glow);
}

.btn-success {
  background: linear-gradient(135deg, var(--green), #00cc66);
  border: none;
  color: var(--bg-dark);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px var(--green-glow);
}

.btn-magic {
  background: linear-gradient(135deg, var(--magenta), var(--purple));
  border: none;
  color: white;
}

.btn-magic:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px var(--magenta-glow);
}

.btn-group {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 20px 0;
}

/* ========================================
   SPELL CARDS
   ======================================== */
.spell-cards {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 20px 0;
}

.spell-card {
  background: var(--bg-card);
  border: 2px solid var(--purple);
  border-radius: 15px;
  padding: 20px;
  min-width: 150px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.spell-card:hover {
  transform: translateY(-5px);
  border-color: var(--magenta);
  box-shadow: 0 10px 30px var(--magenta-glow);
}

.spell-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 20px var(--gold-glow);
}

.spell-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.spell-name {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.spell-desc {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ========================================
   SUBSEQUENCE DISPLAY
   ======================================== */
.subsequence-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  margin: 20px 0;
  max-width: 600px;
}

.subsequence-item {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  transition: all var(--transition-fast);
}

.subsequence-item:hover {
  border-color: var(--cyan);
  background: var(--bg-card-hover);
}

.subsequence-mask {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--magenta);
  margin-bottom: 8px;
}

.subsequence-result {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--text-primary);
}

/* ========================================
   TWO'S COMPLEMENT DISPLAY
   ======================================== */
.twos-complement-display {
  background: var(--bg-card);
  border: 2px solid var(--purple);
  border-radius: 15px;
  padding: 25px;
  margin: 20px 0;
}

.sign-bit-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.sign-label {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-secondary);
}

.sign-value {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  padding: 8px 15px;
  border-radius: 5px;
}

.sign-positive {
  background: rgba(0, 255, 136, 0.2);
  color: var(--green);
  border: 1px solid var(--green);
}

.sign-negative {
  background: rgba(255, 51, 102, 0.2);
  color: var(--red);
  border: 1px solid var(--red);
}

.range-display {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
}

.range-item {
  text-align: center;
}

.range-label {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.range-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  color: var(--cyan);
}

/* ========================================
   MODALS
   ======================================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 40px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  position: relative;
  animation: modalPop 0.3s ease;
}

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

.modal-content.victory {
  border: 2px solid var(--gold);
  box-shadow: 0 0 50px var(--gold-glow);
}

.modal-content.defeat {
  border: 2px solid var(--red);
  box-shadow: 0 0 50px var(--red-glow);
}

.modal-content.lesson {
  border: 2px solid var(--cyan);
  max-width: 700px;
  text-align: left;
}

.modal-content h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-bottom: 20px;
}

.victory h2 {
  color: var(--gold);
}

.defeat h2 {
  color: var(--red);
}

.lesson h2 {
  color: var(--cyan);
  text-align: center;
}

.victory-stats {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  margin-bottom: 30px;
}

.victory-stats p {
  margin: 10px 0;
}

#lesson-content {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 25px;
}

#lesson-content h3 {
  color: var(--gold);
  margin: 20px 0 10px;
  font-family: var(--font-display);
}

#lesson-content code {
  font-size: 1rem;
}

#lesson-content .example-box {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 15px;
  margin: 15px 0;
  font-family: var(--font-mono);
}

/* ========================================
   WORLD-SPECIFIC STYLES
   ======================================== */

/* World 1 - Binary Village */
.harvest-field {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin: 20px 0;
}

.harvest-item {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.1), var(--bg-card));
  border: 2px solid var(--green);
  border-radius: 15px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.harvest-item:hover {
  transform: scale(1.05);
  box-shadow: 0 0 25px var(--green-glow);
}

.harvest-item.collected {
  opacity: 0.3;
  pointer-events: none;
}

.harvest-power {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  color: var(--green);
}

.harvest-value {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--text-primary);
  margin-top: 10px;
}

/* World 3 - Addition Arena */
.addition-display {
  background: var(--bg-card);
  border: 2px solid var(--orange);
  border-radius: 20px;
  padding: 30px;
  margin: 20px 0;
}

.carry-row {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.carry-bit {
  width: 40px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--orange);
}

.addition-line {
  width: 100%;
  height: 2px;
  background: var(--orange);
  margin: 15px 0;
}

/* World 8 - XOR Mines */
.mine-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin: 20px 0;
}

.crystal {
  background: linear-gradient(135deg, rgba(153, 51, 255, 0.2), var(--bg-card));
  border: 2px solid var(--purple);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.crystal:hover {
  transform: scale(1.05);
  box-shadow: 0 0 25px var(--magenta-glow);
}

.crystal.matched {
  animation: crystalMatch 0.5s ease forwards;
}

@keyframes crystalMatch {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
    filter: brightness(2);
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

.crystal-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  color: var(--magenta);
}

/* World 12 - Final Boss */
.titan-container {
  background: linear-gradient(
    135deg,
    rgba(255, 51, 102, 0.1),
    rgba(153, 51, 255, 0.1),
    var(--bg-card)
  );
  border: 3px solid var(--red);
  border-radius: 25px;
  padding: 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.titan-container::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent,
    var(--red-glow),
    transparent,
    var(--magenta-glow),
    transparent
  );
  animation: titanRotate 10s linear infinite;
  opacity: 0.3;
}

@keyframes titanRotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.titan-icon {
  font-size: 8rem;
  position: relative;
  z-index: 1;
  animation: titanPulse 2s ease-in-out infinite;
}

@keyframes titanPulse {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 20px var(--red));
  }
  50% {
    transform: scale(1.1);
    filter: drop-shadow(0 0 40px var(--magenta));
  }
}

/* ========================================
   PROGRESS BAR
   ======================================== */
.progress-container {
  width: 100%;
  max-width: 400px;
  margin: 20px 0;
}

.progress-bar {
  width: 100%;
  height: 15px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  border-radius: 10px;
  transition: width 0.5s ease;
}

/* ========================================
   TORCH LIGHTS (for counting set bits)
   ======================================== */
.torch-row {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin: 20px 0;
}

.torch {
  width: 50px;
  height: 80px;
  background: linear-gradient(180deg, var(--bg-card), #1a1a25);
  border-radius: 5px 5px 10px 10px;
  position: relative;
  transition: all var(--transition-normal);
}

.torch::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 30px;
  background: var(--bit-0);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  transition: all var(--transition-normal);
}

.torch.lit::before {
  background: radial-gradient(
    circle at 50% 50%,
    #fff,
    var(--orange),
    var(--red)
  );
  box-shadow:
    0 0 20px var(--orange),
    0 0 40px var(--red-glow);
  animation: flame 0.3s ease-in-out infinite alternate;
}

@keyframes flame {
  from {
    transform: translateX(-50%) scale(1) rotate(-5deg);
  }
  to {
    transform: translateX(-50%) scale(1.1) rotate(5deg);
  }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
  .game-title {
    font-size: 3rem;
  }

  .world-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .operator-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .bit-cell {
    width: 45px;
    height: 55px;
  }

  .bit-value {
    font-size: 1.5rem;
  }

  .hud-stats {
    gap: 10px;
    font-size: 0.8rem;
  }

  .harvest-field {
    grid-template-columns: repeat(2, 1fr);
  }

  .mine-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .game-title {
    font-size: 2.5rem;
  }

  .subtitle {
    font-size: 0.9rem;
    letter-spacing: 0.15em;
  }

  .menu-btn {
    padding: 15px 25px;
    font-size: 1rem;
  }

  .hero-stats {
    flex-direction: column;
    gap: 10px;
  }

  .world-grid {
    grid-template-columns: 1fr;
  }

  .power-display {
    flex-direction: column;
  }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.text-center {
  text-align: center;
}
.text-left {
  text-align: left;
}
.text-right {
  text-align: right;
}

.mt-20 {
  margin-top: 20px;
}
.mb-20 {
  margin-bottom: 20px;
}
.my-20 {
  margin-top: 20px;
  margin-bottom: 20px;
}

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

.gap-10 {
  gap: 10px;
}
.gap-20 {
  gap: 20px;
}

.w-full {
  width: 100%;
}
.max-w-600 {
  max-width: 600px;
}

/* Section styling for game worlds */
.world-section {
  width: 100%;
  max-width: 800px;
  margin-bottom: 30px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--gold);
  text-align: center;
  margin-bottom: 20px;
}

.section-description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 25px;
  line-height: 1.6;
}

/* Timer display */
.timer-display {
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--orange);
  text-shadow: 0 0 10px var(--orange);
}

.timer-display.danger {
  color: var(--red);
  animation: timerPulse 0.5s ease-in-out infinite;
}

@keyframes timerPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Success/Error feedback */
.feedback {
  padding: 15px 25px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 15px 0;
  animation: feedbackPop 0.3s ease;
}

@keyframes feedbackPop {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.feedback.success {
  background: rgba(0, 255, 136, 0.2);
  border: 1px solid var(--green);
  color: var(--green);
}

.feedback.error {
  background: rgba(255, 51, 102, 0.2);
  border: 1px solid var(--red);
  color: var(--red);
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
  background: var(--cyan);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--magenta);
}
