/* ============================================================
   MathCraft – style.css
   Minecraft-style Educational PWA
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --dirt:    #8B6040;
  --stone:   #7a7a7a;
  --iron:    #a0a0a0;
  --gold:    #FFD700;
  --diamond: #00BFFF;
  --sky:     #87CEEB;
  --night:   #1a1a2e;
  --night2:  #16213e;
  --night3:  #0f3460;
  --green:   #4CAF50;
  --red:     #e74c3c;
  --orange:  #FF9800;
  --white:   #f0f0f0;
  --shadow:  rgba(0,0,0,0.6);
  --font:    'Press Start 2P', monospace;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--night2);
  color: var(--white);
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.5;
  touch-action: manipulation;
  -webkit-font-smoothing: none;
  image-rendering: pixelated;
}

/* ---------- Screens ---------- */
.screen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--night2);
  animation: fadeIn 0.3s ease;
}
.screen.active { display: flex; }

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

/* ============================================================
   START SCREEN
   ============================================================ */
#screen-start {
  background: linear-gradient(180deg, #0d0d1a 0%, #16213e 50%, #1a1a2e 100%);
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.stars-bg {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 15%, white, transparent),
    radial-gradient(1px 1px at 30% 8%, white, transparent),
    radial-gradient(1px 1px at 55% 20%, white, transparent),
    radial-gradient(1px 1px at 75% 10%, white, transparent),
    radial-gradient(1px 1px at 90% 30%, white, transparent),
    radial-gradient(1px 1px at 20% 40%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 65% 35%, rgba(255,255,255,0.6), transparent),
    radial-gradient(2px 2px at 45% 5%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1px 1px at 85% 45%, white, transparent),
    radial-gradient(1px 1px at 5% 60%, rgba(255,255,255,0.5), transparent);
  pointer-events: none;
}

.start-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 20px;
  width: 100%;
  max-width: 500px;
}

.logo-block-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.deco-block {
  width: 48px;
  height: 48px;
  animation: bobble 2s ease-in-out infinite;
}
.deco-block:nth-child(2) { animation-delay: 0.3s; }
.deco-block:nth-child(3) { animation-delay: 0.6s; }
.deco-block:nth-child(4) { animation-delay: 0.9s; }

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

.game-title {
  font-size: 2rem;
  color: var(--gold);
  text-shadow: 4px 4px 0 #7a5000, 0 0 30px rgba(255,215,0,0.4);
  text-align: center;
  letter-spacing: 2px;
  line-height: 1.4;
}

.game-subtitle {
  font-size: 0.6rem;
  color: #a0c0ff;
  text-align: center;
  line-height: 2;
  text-shadow: 1px 1px 0 #000;
}

.start-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 280px;
}

.version-tag {
  font-size: 0.45rem;
  color: rgba(255,255,255,0.3);
  margin-top: 10px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  font-family: var(--font);
  font-size: 0.75rem;
  cursor: pointer;
  border: none;
  padding: 14px 20px;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.08s, filter 0.08s;
  position: relative;
  user-select: none;
  image-rendering: pixelated;
}
.btn:active { transform: scale(0.94) translateY(2px); filter: brightness(0.85); }

.btn-primary {
  background: var(--green);
  color: #fff;
  border-top: 4px solid #6fcf72;
  border-left: 4px solid #5dba60;
  border-right: 4px solid #3a8a3d;
  border-bottom: 4px solid #2d6e30;
  text-shadow: 1px 1px 0 #1a4a1c;
  box-shadow: 0 4px 0 #1a4a1c;
}

.btn-secondary {
  background: var(--stone);
  color: #fff;
  border-top: 4px solid #a0a0a0;
  border-left: 4px solid #909090;
  border-right: 4px solid #555;
  border-bottom: 4px solid #444;
  text-shadow: 1px 1px 0 #222;
  box-shadow: 0 4px 0 #333;
}

/* Extends .btn-primary for the divide mode button */
.btn-divide {
  background: #5a2d82;
  border-top: 4px solid #8b52c0;
  border-left: 4px solid #7a40b0;
  border-right: 4px solid #3a1a60;
  border-bottom: 4px solid #2d1450;
  text-shadow: 1px 1px 0 #1a0a3a;
  box-shadow: 0 4px 0 #1a0a3a;
}

.btn-large {
  font-size: 0.85rem;
  padding: 16px 24px;
  min-height: 58px;
  width: 100%;
  letter-spacing: 1px;
}

.btn-icon {
  background: rgba(255,255,255,0.1);
  color: var(--white);
  border: 2px solid rgba(255,255,255,0.2);
  font-size: 1.2rem;
  padding: 8px 12px;
  min-width: 44px;
  min-height: 44px;
}
.btn-icon:hover { background: rgba(255,255,255,0.2); }

/* ============================================================
   GAME SCREEN
   ============================================================ */
#screen-game {
  background: linear-gradient(180deg, var(--sky) 0%, #c8e8f8 30%, #b0dff0 60%, var(--dirt) 100%);
  justify-content: flex-start;
  padding: 0;
  gap: 0;
}

/* ---- HUD ---- */
.game-hud {
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  gap: 8px;
  flex-shrink: 0;
}

.hp-display {
  display: flex;
  gap: 2px;
  font-size: 1.4rem;
  line-height: 1;
}
.heart { transition: filter 0.2s; }
.heart.empty { filter: grayscale(1) brightness(0.4); }

.xp-display {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.pickaxe-icon { font-size: 1.2rem; flex-shrink: 0; }
.xp-bar-wrap {
  flex: 1;
  height: 10px;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  overflow: hidden;
  min-width: 0;
}
.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #ffa500);
  width: 0%;
  transition: width 0.4s ease;
  box-shadow: 0 0 6px rgba(255,215,0,0.6);
}
.xp-label { font-size: 0.45rem; color: var(--gold); white-space: nowrap; flex-shrink: 0; }

/* ---- Mode indicator ---- */
.mode-indicator {
  width: 100%;
  max-width: 520px;
  text-align: center;
  font-size: 0.5rem;
  color: rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.35);
  padding: 4px 0;
  letter-spacing: 1px;
  flex-shrink: 0;
}

/* ---- Table Selector ---- */
.table-selector {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 10px;
  background: rgba(0,0,0,0.45);
  justify-content: center;
  flex-shrink: 0;
}

.table-btn {
  font-family: var(--font);
  font-size: 0.55rem;
  padding: 6px 10px;
  min-height: 36px;
  min-width: 50px;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.25);
  color: var(--white);
  cursor: pointer;
  transition: background 0.15s, transform 0.08s;
  user-select: none;
}
.table-btn:active { transform: scale(0.92); }
.table-btn.active {
  background: var(--gold);
  color: #2a1a00;
  border-color: #c8a800;
  text-shadow: none;
  box-shadow: 0 0 8px rgba(255,215,0,0.5);
}
.table-btn.locked {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---- Question Bubble ---- */
.question-bubble {
  background: rgba(0,0,0,0.75);
  border: 3px solid rgba(255,255,255,0.3);
  padding: 12px 20px;
  margin: 8px auto 0;
  max-width: 400px;
  width: calc(100% - 20px);
  text-align: center;
  position: relative;
  flex-shrink: 0;
}
.question-bubble::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 12px solid rgba(0,0,0,0.75);
}

#question-text {
  font-size: 1.5rem;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
  letter-spacing: 2px;
}

/* ---- Block Stage ---- */
.block-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 18px 0 8px;
  position: relative;
}

.block-container {
  position: relative;
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-block {
  width: 160px;
  height: 160px;
  position: relative;
  cursor: default;
  image-rendering: pixelated;
  transition: background-color 0.3s;
}

/* --- Block base style (Minecraft pixel look) --- */
.game-block,
.deco-block {
  background-color: var(--dirt);
  border-top: 6px solid rgba(255,255,255,0.4);
  border-left: 6px solid rgba(255,255,255,0.3);
  border-right: 6px solid rgba(0,0,0,0.3);
  border-bottom: 6px solid rgba(0,0,0,0.4);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.2);
  background-image:
    repeating-linear-gradient(0deg,   transparent, transparent 24px, rgba(0,0,0,0.05) 24px, rgba(0,0,0,0.05) 25px),
    repeating-linear-gradient(90deg,  transparent, transparent 24px, rgba(0,0,0,0.05) 24px, rgba(0,0,0,0.05) 25px);
}

/* Block type colours */
.block-dirt    { background-color: #8B6040; }
.block-stone   { background-color: #7a7a7a; }
.block-iron    {
  background-color: #a0a0a0;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 24px, rgba(0,0,0,0.05) 24px, rgba(0,0,0,0.05) 25px),
    repeating-linear-gradient(90deg, transparent, transparent 24px, rgba(0,0,0,0.05) 24px, rgba(0,0,0,0.05) 25px),
    radial-gradient(circle at 30% 40%, rgba(210,130,50,0.4) 8px, transparent 9px),
    radial-gradient(circle at 70% 20%, rgba(210,130,50,0.3) 6px, transparent 7px),
    radial-gradient(circle at 55% 70%, rgba(210,130,50,0.35) 7px, transparent 8px);
}
.block-gold    {
  background-color: #7a7a7a;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 24px, rgba(0,0,0,0.05) 24px, rgba(0,0,0,0.05) 25px),
    repeating-linear-gradient(90deg, transparent, transparent 24px, rgba(0,0,0,0.05) 24px, rgba(0,0,0,0.05) 25px),
    radial-gradient(circle at 25% 35%, rgba(255,215,0,0.5) 10px, transparent 11px),
    radial-gradient(circle at 65% 25%, rgba(255,215,0,0.45) 8px, transparent 9px),
    radial-gradient(circle at 50% 65%, rgba(255,215,0,0.4) 9px, transparent 10px),
    radial-gradient(circle at 80% 60%, rgba(255,215,0,0.35) 7px, transparent 8px);
}
.block-diamond {
  background-color: #7a7a7a;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 24px, rgba(0,0,0,0.05) 24px, rgba(0,0,0,0.05) 25px),
    repeating-linear-gradient(90deg, transparent, transparent 24px, rgba(0,0,0,0.05) 24px, rgba(0,0,0,0.05) 25px),
    radial-gradient(circle at 20% 30%, rgba(0,191,255,0.55) 9px, transparent 10px),
    radial-gradient(circle at 60% 20%, rgba(0,191,255,0.5) 7px, transparent 8px),
    radial-gradient(circle at 45% 70%, rgba(0,191,255,0.5) 8px, transparent 9px),
    radial-gradient(circle at 80% 55%, rgba(0,191,255,0.45) 6px, transparent 7px),
    radial-gradient(circle at 35% 55%, rgba(0,191,255,0.35) 5px, transparent 6px);
}

/* ---- Crack overlay ---- */
.block-crack-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  opacity: 0;
}
.block-crack-1 .block-crack-overlay {
  opacity: 1;
  background-image:
    linear-gradient(135deg, transparent 40%, rgba(0,0,0,0.5) 41%, transparent 42%),
    linear-gradient(45deg, transparent 55%, rgba(0,0,0,0.4) 56%, transparent 58%),
    linear-gradient(160deg, transparent 30%, rgba(0,0,0,0.35) 31%, transparent 33%);
}
.block-crack-2 .block-crack-overlay {
  opacity: 1;
  background-image:
    linear-gradient(135deg, transparent 20%, rgba(0,0,0,0.55) 21%, transparent 23%),
    linear-gradient(45deg, transparent 40%, rgba(0,0,0,0.5) 41%, transparent 44%),
    linear-gradient(160deg, transparent 15%, rgba(0,0,0,0.4) 16%, transparent 19%),
    linear-gradient(100deg, transparent 60%, rgba(0,0,0,0.45) 61%, transparent 64%),
    linear-gradient(70deg, transparent 50%, rgba(0,0,0,0.35) 51%, transparent 54%);
}

/* ---- Block animations ---- */
@keyframes blockHit {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  20%  { transform: translateX(-8px) rotate(-1deg); }
  40%  { transform: translateX(8px) rotate(1deg); }
  60%  { transform: translateX(-5px); }
  80%  { transform: translateX(4px); }
}
.block-hit { animation: blockHit 0.3s ease; }

@keyframes blockWrong {
  0%, 100% { background-color: inherit; filter: none; }
  25%  { filter: brightness(0.6) sepia(1) saturate(5) hue-rotate(-20deg); }
  75%  { filter: brightness(0.7) sepia(1) saturate(4) hue-rotate(-15deg); }
}
.block-wrong { animation: blockWrong 0.4s ease; }

@keyframes blockExplode {
  0%   { transform: scale(1); opacity: 1; }
  50%  { transform: scale(1.3); opacity: 0.6; }
  100% { transform: scale(0.1); opacity: 0; }
}
.block-explode { animation: blockExplode 0.5s ease forwards; }

@keyframes blockAppear {
  0%   { transform: scale(0.3) rotate(-5deg); opacity: 0; }
  60%  { transform: scale(1.1) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.block-appear { animation: blockAppear 0.4s cubic-bezier(0.34,1.56,0.64,1) forwards; }

/* ---- Pickaxe swing ---- */
@keyframes pickaxeSwing {
  0%   { transform: rotate(0deg) translateX(0); }
  30%  { transform: rotate(-25deg) translateX(-5px); }
  60%  { transform: rotate(10deg) translateX(5px); }
  100% { transform: rotate(0deg) translateX(0); }
}
.pickaxe-swing { animation: pickaxeSwing 0.3s ease; }

/* ---- Item popup float ---- */
@keyframes itemFloat {
  0%   { transform: translateY(0) scale(0.5); opacity: 1; }
  70%  { transform: translateY(-80px) scale(1.2); opacity: 1; }
  100% { transform: translateY(-110px) scale(0.8); opacity: 0; }
}
.item-popup {
  position: absolute;
  font-size: 2rem;
  pointer-events: none;
  opacity: 0;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}
.item-popup.floating { animation: itemFloat 1s ease forwards; }

/* ---- Answer Display ---- */
.answer-display-wrap {
  width: 100%;
  max-width: 520px;
  padding: 4px 12px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.answer-display {
  font-size: 1.6rem;
  color: #fff;
  background: rgba(0,0,0,0.7);
  border: 3px solid rgba(255,255,255,0.4);
  padding: 8px 24px;
  text-align: center;
  min-width: 120px;
  letter-spacing: 4px;
  text-shadow: 2px 2px 0 #000;
}

@keyframes cursorBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
.answer-cursor {
  display: inline-block;
  animation: cursorBlink 0.8s infinite;
}

/* ---- Numpad ---- */
.numpad {
  width: 100%;
  max-width: 360px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px 12px 12px;
  flex-shrink: 0;
  margin: 0 auto;
}

.numpad-btn {
  font-family: var(--font);
  font-size: 1.1rem;
  min-height: 70px;
  min-width: 70px;
  background: rgba(80,80,100,0.85);
  color: var(--white);
  border-top: 4px solid rgba(255,255,255,0.3);
  border-left: 4px solid rgba(255,255,255,0.2);
  border-right: 4px solid rgba(0,0,0,0.35);
  border-bottom: 4px solid rgba(0,0,0,0.45);
  cursor: pointer;
  transition: transform 0.07s, filter 0.07s;
  text-shadow: 1px 1px 0 #000;
  user-select: none;
  -webkit-user-select: none;
}
.numpad-btn:active {
  transform: scale(0.91) translateY(2px);
  filter: brightness(0.8);
}

.numpad-backspace {
  background: rgba(180, 80, 0, 0.85);
  border-color: rgba(255,160,0,0.4) rgba(0,0,0,0.4) rgba(0,0,0,0.5) rgba(255,160,0,0.3);
}
.numpad-check {
  background: rgba(40, 140, 40, 0.9);
  border-color: rgba(100,200,100,0.4) rgba(0,0,0,0.35) rgba(0,0,0,0.45) rgba(100,200,100,0.3);
  font-size: 1.4rem;
}

/* ---- Streak ---- */
.streak-display {
  font-size: 0.5rem;
  color: var(--gold);
  text-align: center;
  padding: 2px 0 6px;
  text-shadow: 1px 1px 0 #000;
  flex-shrink: 0;
}

/* ============================================================
   DISCOVERIES SCREEN
   ============================================================ */
#screen-discoveries {
  background: linear-gradient(180deg, var(--night) 0%, var(--night2) 100%);
  padding: 0 12px 24px;
  gap: 12px;
}

/* ---- Discoveries tabs ---- */
.discoveries-tabs {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 520px;
  padding: 4px 0 0;
  flex-shrink: 0;
}

.tab-btn {
  font-family: var(--font);
  font-size: 0.55rem;
  flex: 1;
  padding: 10px 8px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.5);
  border: 2px solid rgba(255,255,255,0.12);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.tab-btn.active {
  background: rgba(255,215,0,0.15);
  color: var(--gold);
  border-color: rgba(255,215,0,0.4);
  text-shadow: 1px 1px 0 #000;
}
.tab-btn:active { filter: brightness(0.85); }

.screen-header {
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0 4px;
  flex-shrink: 0;
}

.screen-title {
  font-size: 1rem;
  color: var(--gold);
  text-shadow: 2px 2px 0 #7a5000;
  flex: 1;
}

.discoveries-xp-total {
  font-size: 0.7rem;
  color: #ffe080;
  text-shadow: 1px 1px 0 #000;
  text-align: center;
  background: rgba(255,215,0,0.1);
  border: 2px solid rgba(255,215,0,0.3);
  padding: 8px 20px;
  width: 100%;
  max-width: 520px;
}

.table-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 520px;
}

.table-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  font-size: 0.7rem;
  position: relative;
  cursor: default;
  user-select: none;
}

.table-cell.locked {
  background-color: #3a3a3a;
  border-top: 5px solid rgba(255,255,255,0.15);
  border-left: 5px solid rgba(255,255,255,0.1);
  border-right: 5px solid rgba(0,0,0,0.3);
  border-bottom: 5px solid rgba(0,0,0,0.4);
  color: rgba(255,255,255,0.3);
}
.table-cell.unlocked {
  background-color: var(--stone);
  border-top: 5px solid rgba(255,255,255,0.4);
  border-left: 5px solid rgba(255,255,255,0.3);
  border-right: 5px solid rgba(0,0,0,0.3);
  border-bottom: 5px solid rgba(0,0,0,0.4);
  color: var(--white);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.2);
}
.table-cell.unlocked.block-dirt    { background-color: var(--dirt); }
.table-cell.unlocked.block-stone   { background-color: var(--stone); }
.table-cell.unlocked.block-iron    { background-color: var(--iron); }
.table-cell.unlocked.block-gold    { background-color: var(--gold); color: #333; }
.table-cell.unlocked.block-diamond { background-color: var(--diamond); color: #003; }
.table-cell.mastered {
  background-color: #b8860b;
  border-top: 5px solid rgba(255,255,255,0.5);
  border-left: 5px solid rgba(255,255,255,0.4);
  border-right: 5px solid rgba(0,0,0,0.2);
  border-bottom: 5px solid rgba(0,0,0,0.3);
  color: #fff8e1;
  box-shadow: 0 0 12px rgba(255,215,0,0.35), inset 0 0 0 2px rgba(255,215,0,0.3);
}

.table-cell .cell-num      { font-size: 1rem; }
.table-cell .cell-icon     { font-size: 1.4rem; }
.table-cell .cell-lock     { font-size: 1.2rem; opacity: 0.4; }
.table-cell .cell-accuracy { font-size: 0.4rem; color: #ffe; margin-top: 2px; }

@keyframes starSpin {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1); }
}
.star-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.8rem;
  animation: starSpin 3s linear infinite;
}

.mix-record {
  font-size: 0.6rem;
  color: #a0e0ff;
  text-align: center;
  padding: 10px 16px;
  background: rgba(0,100,200,0.15);
  border: 2px solid rgba(0,150,255,0.3);
  width: 100%;
  max-width: 520px;
}

.pickaxe-progress {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pickaxe-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.1);
  padding: 8px 12px;
  font-size: 0.5rem;
}
.pickaxe-row .pk-icon { font-size: 1rem; }
.pickaxe-row .pk-name { flex: 1; color: #ccc; }
.pickaxe-row .pk-req  { color: var(--gold); }
.pickaxe-row.unlocked .pk-name { color: #90ee90; }

/* ============================================================
   CRAFTING SCREEN
   ============================================================ */
#screen-crafting {
  background: linear-gradient(180deg, #1a0a00 0%, #2d1500 50%, #1a0a00 100%);
  justify-content: center;
  gap: 16px;
  padding: 20px;
}

.crafting-title {
  font-size: 1.2rem;
  color: var(--gold);
  text-shadow: 3px 3px 0 #5a3000;
  text-align: center;
}
.crafting-subtitle {
  font-size: 0.65rem;
  color: #e0c070;
  text-align: center;
}

.crafting-grid-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.crafting-grid {
  display: grid;
  grid-template-columns: repeat(3, 70px);
  grid-template-rows: repeat(3, 70px);
  gap: 4px;
  background: rgba(0,0,0,0.4);
  border: 4px solid #5a3a00;
  padding: 8px;
}

.crafting-cell {
  width: 70px;
  height: 70px;
  background: rgba(255,255,255,0.06);
  border: 3px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  opacity: 0;
}
.crafting-cell.revealed {
  opacity: 1;
  animation: cellPop 0.25s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
@keyframes cellPop {
  0%   { transform: scale(0); opacity: 0; }
  80%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.crafting-arrow {
  font-size: 2rem;
  color: var(--gold);
  text-shadow: 2px 2px 0 #5a3000;
}

.crafting-result {
  width: 100px;
  height: 100px;
  background: rgba(255,215,0,0.1);
  border: 4px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
}

.crafting-result-item {
  font-size: 3rem;
  opacity: 0;
  transition: opacity 0.5s;
}
.crafting-result-item.visible {
  opacity: 1;
  animation: resultGlow 1.5s ease infinite;
}
@keyframes resultGlow {
  0%, 100% { filter: drop-shadow(0 0 6px var(--gold)) drop-shadow(0 0 12px rgba(255,215,0,0.4)); }
  50%       { filter: drop-shadow(0 0 16px var(--gold)) drop-shadow(0 0 30px rgba(255,215,0,0.7)); }
}

.crafting-item-name {
  font-size: 0.75rem;
  color: var(--gold);
  text-align: center;
  text-shadow: 2px 2px 0 #5a3000;
  min-height: 1.5em;
}

/* ============================================================
   TOAST & OVERLAYS
   ============================================================ */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(0,0,0,0.9);
  color: var(--white);
  font-family: var(--font);
  font-size: 0.6rem;
  padding: 12px 20px;
  border: 2px solid rgba(255,255,255,0.2);
  z-index: 200;
  transition: transform 0.3s, opacity 0.3s;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  max-width: 320px;
  white-space: nowrap;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.game-over-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-over-box {
  background: var(--night);
  border: 4px solid var(--red);
  padding: 30px 40px;
  text-align: center;
  animation: fadeIn 0.2s ease;
}
.game-over-text { font-size: 1.4rem; color: var(--red); text-shadow: 2px 2px 0 #800; }
.game-over-sub  { font-size: 0.6rem; color: #ffaaaa; margin-top: 12px; }

/* ============================================================
   RESPONSIVE – iPad Portrait 768-1024px
   ============================================================ */
@media (min-width: 520px) {
  .game-hud, .table-selector, .question-bubble,
  .answer-display-wrap, .streak-display,
  .numpad {
    max-width: 520px;
    align-self: center;
  }
  #question-text { font-size: 1.8rem; }
  .numpad { max-width: 400px; }
  .numpad-btn { min-height: 76px; font-size: 1.25rem; }
  .game-block { width: 180px; height: 180px; }
}

@media (max-height: 700px) {
  .game-block   { width: 120px; height: 120px; }
  .block-stage  { padding: 8px 0 4px; }
  .numpad-btn   { min-height: 58px; font-size: 0.95rem; }
  #question-text { font-size: 1.2rem; }
}

@media (max-height: 600px) {
  .game-block  { width: 90px; height: 90px; }
  .numpad-btn  { min-height: 52px; }
}

/* ============================================================
   SCREEN TRANSITIONS
   ============================================================ */
.screen-transition {
  animation: fadeIn 0.3s ease;
}

/* ============================================================
   SCROLLBAR (webkit)
   ============================================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); }
