/* =============================================================
   Chest Dash — MC Inventory Chaos Game
   Androdom Design System + MC Override Palette
   ============================================================= */

/* ── 0. MC Color Variables ─────────────────────────────────── */
:root {
  --mc-dirt:      #6B4226;
  --mc-dirt-l:    #8B6914;
  --mc-stone:     #5C5C5C;
  --mc-stone-l:   #9D9D9D;
  --mc-grass:     #4A7C2F;
  --mc-grass-b:   #5D9B47;
  --mc-wood:      #BC9862;
  --mc-obsidian:  #1B1029;
  --mc-gold:      #FCDB05;
  --mc-redstone:  #CC0000;
  --mc-diamond:   #2CCDB1;
  --mc-emerald:   #17AE62;
  --mc-ender:     #0E0620;
  --mc-lapis:     #1D3EA8;
  --mc-iron:      #D0CECA;
  --mc-netherite: #47393A;
  --mc-hp-red:    #E3160E;
  --mc-hp-dark:   #6B0A06;

  /* Item placeholder colors */
  --item-dirt:         #8B6914;
  --item-stone:        #7F7F7F;
  --item-wood:         #A0784C;
  --item-grass:        #5D9B47;
  --item-diamond:      #2CCDB1;
  --item-gold:         #FCDB05;
  --item-iron:         #C8C8C8;
  --item-redstone:     #CC2200;
  --item-lapis:        #3355BB;
  --item-emerald:      #17AE62;
  --item-obsidian:     #3B2850;
  --item-coal:         #2D2D2D;
  --item-sand:         #DEC680;
  --item-gravel:       #7B6F6A;
  --item-ender:        #5C2E7E;
  /* Weapons */
  --item-wood-sword:   #A0784C;
  --item-stone-sword:  #7F7F7F;
  --item-iron-sword:   #C8C8C8;
  --item-gold-sword:   #FCDB05;
  --item-diamond-sword:#2CCDB1;
  --item-nether-sword: #47393A;
  /* Armor */
  --item-leather:      #A06040;
  --item-iron-armor:   #A8A8A8;
  --item-diamond-armor:#2CCDB1;
  --item-nether-armor: #3A2A30;

  /* Androdom dark-mode theme */
  --bg-main:        #0a0a0a;
  --bg-surface:     #111318;
  --bg-card:        #1a1f2b;
  --border-color:   #2a3040;
  --text-primary:   #FAF8F5;
  --text-secondary: #94a3b8;
  --text-muted:     #8a8377;
  --accent-color:   #CD5C3E;
  --bg-hover:       #1e293b;
}

html[data-theme="light"] {
  --bg-main:        #d4c5a9;
  --bg-surface:     #c8b990;
  --bg-card:        #f5efe0;
  --border-color:   #a08060;
  --text-primary:   #1a0e05;
  --text-secondary: #4a3520;
  --text-muted:     #5f4b2d;
  --accent-color:   #CD5C3E;
  --bg-hover:       #e8d9bc;
}

/* ── 1. Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Baseline keyboard focus visibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent-color) !important;
  outline-offset: 2px !important;
}

html {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ── 2. MC Background Pattern ─────────────────────────────── */
.mc-bg-pattern {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 15px, rgba(0,0,0,0.06) 15px, rgba(0,0,0,0.06) 16px),
    repeating-linear-gradient(90deg, transparent, transparent 15px, rgba(0,0,0,0.06) 15px, rgba(0,0,0,0.06) 16px);
}

html[data-theme="light"] .mc-bg-pattern {
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 15px, rgba(90,60,20,0.08) 15px, rgba(90,60,20,0.08) 16px),
    repeating-linear-gradient(90deg, transparent, transparent 15px, rgba(90,60,20,0.08) 15px, rgba(90,60,20,0.08) 16px);
}

/* ── 3. Navbar ──────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 10, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  height: 52px;
}
html[data-theme="light"] .navbar { background: rgba(180, 150, 100, 0.92); }

.navbar-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
}

.brand-link {
  display: flex; align-items: center; gap: 0.5rem;
  text-decoration: none; color: var(--text-primary);
  font-weight: 700; font-size: 0.9rem; flex-shrink: 0;
}
.brand-text-accent { color: var(--accent-color); }

.tool-pill-wrapper {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 0.5rem;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--border-color);
  border-radius: 2rem;
  padding: 0.2rem 0.75rem 0.2rem 0.6rem;
}
html[data-theme="light"] .tool-pill-wrapper { background: rgba(0,0,0,0.08); }

.tool-pill-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-secondary); }
.tool-pill-nav { display: flex; }
.tool-pill-active {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.6rem; font-weight: 700; color: var(--mc-gold); text-decoration: none;
}

.right-cluster { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }

.theme-toggle-btn, .portal-btn, .github-link, .help-btn {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.4rem 0.6rem;
  background: var(--bg-hover); border: 1px solid var(--border-color); border-radius: 0.5rem;
  color: var(--text-secondary); cursor: pointer; font-size: 0.78rem; font-weight: 500;
  text-decoration: none; transition: color 0.2s, background 0.2s;
}
.theme-toggle-btn:hover, .portal-btn:hover, .github-link:hover, .help-btn:hover { color: var(--text-primary); background: var(--border-color); }
.portal-btn span { font-size: 0.75rem; }

.help-dropdown { position: relative; display: inline-flex; align-items: center; }
.help-popup-content {
  visibility: hidden;
  position: absolute;
  top: 130%;
  right: 0;
  background-color: #1a1a1a;
  color: #fff;
  border: 2px solid var(--mc-gold);
  border-radius: 4px;
  padding: 0.5rem;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.2s, visibility 0.2s;
  width: max-content;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.6);
}
html[data-theme="light"] .help-popup-content {
  background-color: #dfceab;
  color: #201000;
  border-color: #8c6a38;
}
.help-dropdown:hover .help-popup-content, .help-btn:focus + .help-popup-content {
  visibility: visible;
  opacity: 1;
}

/* ── 4. Stats Bar ──────────────────────────────────────────── */
.stats-bar {
  position: relative;
  z-index: 10;
  background: rgba(10,10,10,0.75);
  border-bottom: 2px solid var(--mc-stone);
  backdrop-filter: blur(8px);
  padding: 0.5rem 1.5rem;
}
html[data-theme="light"] .stats-bar {
  background: rgba(100, 70, 35, 0.9);
  border-color: var(--mc-dirt);
}

.stats-bar-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.stats-row {
  display: flex;
  align-items: center;
  width: 100%;
}

.stats-row-upper {
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.4rem;
}

html[data-theme="light"] .stats-row-upper {
  border-bottom-color: rgba(0, 0, 0, 0.12);
}

.stats-row-lower {
  justify-content: flex-start;
  gap: 2.5rem;
}

/* Ensure fixed width/flex alignments for lower stats to prevent text shifting layout */
.stat-hp {
  min-width: 220px;
}
.stat-luck-container {
  min-width: 90px;
}
.stat-atk-container {
  min-width: 90px;
}
.stat-def-container {
  min-width: 90px;
}
.stat-points-container {
  min-width: 130px;
}

/* Responsive adjustment for stats bar on smaller screens */
@media (max-width: 992px) {
  .stats-row {
    flex-wrap: wrap;
    gap: 0.8rem;
  }
  .stats-row-upper {
    justify-content: flex-start;
  }
  .stats-row-lower {
    justify-content: flex-start;
    gap: 1.5rem;
  }
}

.stat-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.5rem;
  text-shadow: 1px 1px 0 #000;
}

.stat-icon { font-size: 0.95rem; line-height: 1; }
.stat-label { color: #ccc; }
html[data-theme="light"] .stat-label { color: #f0f0f0; }
.stat-value { color: var(--mc-gold); }

/* Hearts */
.hearts-row {
  display: flex;
  gap: 1px;
  align-items: center;
}
.heart {
  font-size: 0.8rem;
  line-height: 1;
  transition: opacity 0.2s;
}
.heart.empty { opacity: 0.2; filter: grayscale(1); }

/* Tier badge */
.tier-badge {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.45rem;
  padding: 0.25rem 0.6rem;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid currentColor;
}
.tier-beginner  { color: var(--mc-stone-l); }
.tier-explorer  { color: var(--mc-emerald); }
.tier-warrior   { color: var(--mc-diamond); }
.tier-chaotic   { color: var(--mc-redstone); }
.tier-legendary { color: var(--mc-gold); }

/* ── 5. Game Workspace Layout ─────────────────────────────── */
.game-workspace {
  position: relative; z-index: 1; flex: 1;
  display: flex; gap: 0.8rem;
  padding: 0.8rem 1.5rem;
  max-width: 1050px; margin: 0 auto; width: 100%;
  justify-content: center;
}

.game-left { flex: 1; max-width: 600px; display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.game-right { width: 280px; flex-shrink: 0; display: flex; flex-direction: column; gap: 0.4rem; }

/* ── 5b. Mobile Controls ────────────────────────────────────── */
.mobile-controls {
  display: flex; flex-direction: column; gap: 0.4rem;
}
.mobile-modes {
  display: flex; gap: 0.3rem; flex-wrap: wrap;
}
.mode-btn {
  flex: 1; padding: 0.4rem 0.2rem;
  background: var(--mc-bg-dark); border: 2px solid var(--mc-stone); border-radius: 2px;
  color: var(--text-secondary); font-family: 'Press Start 2P', monospace; font-size: 0.35rem;
  cursor: pointer; transition: all 0.1s; text-align: center;
}
html[data-theme="light"] .mode-btn { background: #d0c0a0; color: #403020; border-color: #a09070; }
.mode-btn.active {
  background: #332a15; border-color: var(--mc-gold); color: #fff;
}
html[data-theme="light"] .mode-btn.active { background: #b09a55; color: #fff; border-color: #5a4010; }

@media (min-width: 900px) {
  .mobile-controls { display: none; }
}

/* ── 6. MC Section Panel ───────────────────────────────────── */
.mc-section {
  position: relative;
  background: rgba(20, 20, 20, 0.82);
  border: 2px solid var(--mc-stone);
  border-radius: 4px;
  padding: 0.4rem;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 4px 4px 0 rgba(0,0,0,0.5);
  transition: z-index 0.1s;
}
.mc-section:hover {
  z-index: 10;
}
html[data-theme="light"] .mc-section {
  background: rgba(200, 175, 130, 0.9);
  border-color: var(--mc-dirt);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25), 4px 4px 0 rgba(80,50,20,0.4);
}

.mc-section-header {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.6rem; color: var(--mc-stone-l);
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.4rem;
  text-transform: uppercase; letter-spacing: 0.05em;
}
html[data-theme="light"] .mc-section-header { color: #5a3a15; }
.mc-section-icon { font-size: 0.9rem; }

/* Chest shortcuts */
.chest-shortcuts {
  display: flex; gap: 0.3rem; margin-left: auto; flex-wrap: wrap;
}

.shortcut-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.35rem;
  padding: 0.2rem 0.4rem;
  background: var(--bg-hover);
  border: 1px solid var(--mc-stone);
  border-radius: 2px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.shortcut-btn:hover { color: var(--mc-gold); background: var(--border-color); }

/* ── 7. Inventory Grid & Slots ─────────────────────────────── */
.mc-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 2px;
}
.mc-grid-3x3 { grid-template-columns: repeat(3, 1fr); width: 140px; margin: 0 auto; }
.mc-grid-1x1 { grid-template-columns: repeat(1, 1fr); width: 45px; }

.crafting-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.5rem;
}
.crafting-arrow {
  font-family: 'Press Start 2P', monospace;
  font-size: 1rem;
  color: var(--mc-gold);
}

.mc-slot {
  aspect-ratio: 1;
  background: #313131;
  border: 2px solid;
  border-top-color: #1a1a1a;
  border-left-color: #1a1a1a;
  border-right-color: #7a7a7a;
  border-bottom-color: #7a7a7a;
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.1s;
  min-width: 0;
  overflow: visible;
  user-select: none;
}
html[data-theme="light"] .mc-slot {
  background: #a09080;
  border-top-color: #7a6a5a; border-left-color: #7a6a5a;
  border-right-color: #d0c0a0; border-bottom-color: #d0c0a0;
}

.mc-slot:hover { filter: brightness(1.35); z-index: 99; }
.mc-slot.drag-over { filter: brightness(1.8); border-color: var(--mc-diamond) !important; }
.mc-slot.dragging-source { opacity: 0.3; }
.mc-slot.selected-slot { outline: 2px solid var(--mc-gold); outline-offset: -2px; }
.mc-slot.shift-hint { background: rgba(44,205,177,0.12); }

/* Hotbar */
.mc-hotbar { margin-top: 2px; }
.mc-hotbar .mc-slot {
  border-top-color: #a08020; border-left-color: #a08020;
  border-right-color: var(--mc-gold); border-bottom-color: var(--mc-gold);
  background: #3a3010;
}
html[data-theme="light"] .mc-hotbar .mc-slot {
  background: #c8a840;
  border-top-color: #906010; border-left-color: #906010;
  border-right-color: #f0d060; border-bottom-color: #f0d060;
}

.mc-hotbar-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.45rem; color: var(--mc-gold);
  text-transform: uppercase; margin: 0.3rem 0 0.1rem;
  letter-spacing: 0.08em;
}

.mc-item {
  width: 78%; height: 78%;
  border-radius: 2px;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  image-rendering: pixelated;
  background-size: 80%;
  background-repeat: no-repeat;
  background-position: center;
  box-shadow: inset -2px -2px 0 rgba(0,0,0,0.4), inset 2px 2px 0 rgba(255,255,255,0.2);
}

.mc-item-count {
  position: absolute; bottom: -2px; right: 0;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.35rem; color: #fff;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000;
  line-height: 1;
}

/* Weapon indicator glyph */
.mc-item-glyph {
  font-size: 0.6rem;
  position: absolute;
  top: 0; left: 0;
  line-height: 1;
  filter: drop-shadow(1px 1px 0 #000);
}

/* Item colors — blocks */
.item-dirt     { background-color: var(--item-dirt); }
.item-stone    { background-color: var(--item-stone); }
.item-wood     { background-color: var(--item-wood); }
.item-grass    { background-color: var(--item-grass); }
.item-diamond  { background-color: var(--item-diamond); }
.item-gold     { background-color: var(--item-gold); }
.item-iron     { background-color: var(--item-iron); }
.item-redstone { background-color: var(--item-redstone); }
.item-lapis    { background-color: var(--item-lapis); }
.item-emerald  { background-color: var(--item-emerald); }
.item-obsidian { background-color: var(--item-obsidian); }
.item-coal     { background-color: var(--item-coal); }
.item-sand     { background-color: var(--item-sand); }
.item-gravel   { background-color: var(--item-gravel); }
.item-ender    { background-color: var(--item-ender); }
.item-apple        { background-color: #7f0000; }
.item-stick        { background-color: #523418; }
.item-tnt          { background-color: #b71c1c; }
.item-bone         { background-color: #9e9e9e; }
.item-rotten-flesh { background-color: #558b2f; }
.item-slimeball    { background-color: #4caf50; }
.item-golden-apple { background-color: #ff6f00; }
.item-bucket       { background-color: #616161; }
.item-book         { background-color: #4e342e; }
.item-ender-eye    { background-color: #004d40; }
.item-apple-machine { background-color: #c62828; border: 2px dashed #ff8a80; }
.item-wheat-farm   { background-color: #fbc02d; border: 2px dashed #827717; }
.item-auto-miner   { background-color: #424242; border: 2px dashed #9e9e9e; }

/* Item colors — weapons */
.item-wood-sword    { background-color: var(--item-wood-sword); }
.item-stone-sword   { background-color: var(--item-stone-sword); }
.item-iron-sword    { background-color: var(--item-iron-sword); }
.item-gold-sword    { background-color: var(--item-gold-sword); }
.item-diamond-sword { background-color: var(--item-diamond-sword); }
.item-nether-sword  { background-color: var(--item-nether-sword); }
/* Item colors — armor */
.item-leather      { background-color: var(--item-leather); }
.item-iron-armor   { background-color: var(--item-iron-armor); }
.item-diamond-armor{ background-color: var(--item-diamond-armor); }
.item-nether-armor { background-color: var(--item-nether-armor); }

/* ── 9. Run Button (Redesigned) ──────────────────────────────── */
.steve-section { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; text-align: center; }

.run-btn, .steve-btn {
  width: 100%; padding: 0.8rem 1rem;
  background: #3c8527;
  border: 4px solid #000;
  box-shadow: 
    inset -4px -4px 0px 0px #1b4f12,
    inset 4px 4px 0px 0px #76c650,
    0 4px 0px 0px rgba(0,0,0,0.4);
  image-rendering: pixelated;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  border-radius: 0px;
  transition: transform 0.1s, box-shadow 0.1s;
}
.run-btn:hover:not(:disabled), .steve-btn:hover:not(:disabled) {
  background: #479d2f;
  box-shadow: 
    inset -4px -4px 0px 0px #1e5a14,
    inset 4px 4px 0px 0px #86db5e,
    0 6px 0px 0px rgba(0,0,0,0.4);
  transform: translateY(-2px);
}
.run-btn:active:not(:disabled), .steve-btn:active:not(:disabled) {
  background: #2e681e;
  box-shadow: 
    inset 4px 4px 0px 0px #143c0d,
    inset -4px -4px 0px 0px #5ea341,
    0 1px 0px 0px rgba(0,0,0,0.4);
  transform: translateY(3px);
}
.run-btn.triggered { animation: run-pulse 0.4s ease; }
.run-btn:disabled, .steve-btn:disabled { 
  opacity: 0.6; 
  cursor: not-allowed; 
  filter: grayscale(0.7); 
  border-color: #555;
  box-shadow: 
    inset -4px -4px 0px 0px #222,
    inset 4px 4px 0px 0px #888,
    0 2px 0px 0px rgba(0,0,0,0.2); 
  transform: none; 
}

@keyframes run-pulse {
  0%  { filter: brightness(1); }
  30% { filter: brightness(1.8) saturate(1.2); }
  100%{ filter: brightness(1); }
}

.run-btn-idle { display: flex; align-items: center; justify-content: center; gap: 0.8rem; width: 100%; }
.run-pixel-icon { display: inline-block; animation: float 2s ease-in-out infinite; filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.5)); }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.run-label { font-family: 'Press Start 2P', monospace; font-size: 0.8rem; color: #fff; text-shadow: 2px 2px 0 rgba(0,0,0,0.8); letter-spacing: 0.05em; }

.click-counter { font-family: 'Press Start 2P', monospace; font-size: 0.55rem; color: var(--text-secondary); display: flex; gap: 0.3rem; align-items: center; }
.click-number { color: var(--mc-gold); font-size: 0.75rem; }

/* ── 10. Dice Sidebar ─────────────────────────────────────── */
.dice-section { text-align: center; }
.dice-result { font-family: 'Press Start 2P', monospace; font-size: 2.5rem; color: var(--mc-gold); text-shadow: 2px 2px 0 rgba(0,0,0,0.5); padding: 0.2rem; min-height: 2.5rem; display: flex; align-items: center; justify-content: center; }
.dice-type { font-family: 'Press Start 2P', monospace; font-size: 0.45rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.1em; min-height: 1rem; }

/* ── 11. EMBEDDED DICE CONTAINER ────────────────────────── */
.run-btn-dice {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid var(--mc-stone);
  border-radius: 4px;
  animation: popup-fade-in 0.2s ease;
}
html[data-theme="light"] .run-btn-dice {
  background: rgba(200, 184, 144, 0.4);
  border-color: var(--mc-dirt);
}

.run-dice-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.55rem;
  color: var(--mc-gold);
  text-shadow: 1px 1px 0 rgba(0,0,0,0.8);
}

.run-btn-dice .dice-face {
  width: 64px;
  height: 64px;
  background: #222;
  border: 3px solid var(--mc-stone-l);
  border-radius: 6px;
  font-family: 'Press Start 2P', monospace;
  font-size: 1.6rem;
  color: var(--mc-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s, filter 0.1s;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.5);
  border-top-color: #888; border-left-color: #888;
  border-right-color: #333; border-bottom-color: #333;
}
.run-btn-dice .dice-face:hover:not(:disabled) { filter: brightness(1.2); transform: scale(1.05); }
.run-btn-dice .dice-face:active:not(:disabled) { transform: scale(0.95); }

.run-btn-dice .dice-face.rolling {
  animation: dice-roll 0.12s linear infinite;
  color: #fff;
  background: #333;
}

@keyframes dice-roll {
  0%  { transform: rotate(-8deg) scale(1.02); }
  25% { transform: rotate(8deg)  scale(0.98); }
  50% { transform: rotate(-4deg) scale(1.01); }
  75% { transform: rotate(4deg)  scale(0.99); }
  100%{ transform: rotate(0deg)  scale(1.00); }
}

.run-btn-dice .dice-face.rolled {
  animation: none;
  color: var(--mc-gold);
  font-size: 1.8rem;
  background: #111;
}

.run-dice-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.45rem;
}

@keyframes popup-fade-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── 12. Action Log ─────────────────────────────────────────── */
.log-section { flex: 1; display: flex; flex-direction: column; min-height: 150px; }

.action-log {
  flex: 1;
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  border-radius: 2px;
  padding: 0.4rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;   /* ← newest entries at bottom */
  gap: 1px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.45rem;
  line-height: 1.6;
  scrollbar-width: thin;
  scrollbar-color: var(--mc-stone) transparent;
}
html[data-theme="light"] .action-log { background: #1a1208; border-color: #3a2a10; }

.log-entry { display: block; word-break: break-word; }
.log-info    { color: #c0c0c0; }
.log-reward  { color: #4ade80; }
.log-penalty { color: #f87171; }
.log-dice    { color: #fb923c; }
.log-event   { color: var(--mc-diamond); }
.log-death   { color: var(--mc-gold); text-decoration: underline; }

/* ── 13. Footer ─────────────────────────────────────────────── */
.footer {
  position: relative; z-index: 1;
  border-top: 1px solid var(--border-color);
  background: rgba(10, 10, 10, 0.9);
  width: 100%; margin-top: auto;
}
.footer-inner {
  max-width: 1400px; margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex; align-items: center; justify-content: center; gap: 0.75rem;
  font-size: 0.75rem; color: var(--text-secondary); flex-wrap: wrap;
}
.footer-inner a { color: var(--text-secondary); text-decoration: none; transition: color 0.2s; }
.footer-inner a:hover { color: var(--text-primary); }
.footer-sep { opacity: 0.4; }

/* ── 13b. Biome Chips & Achievements & Events ───────────────── */
.biome-group {
  display: flex;
  gap: 0.35rem;
}
.biome-chip {
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.4rem;
  font-family: 'Press Start 2P', monospace;
  text-transform: uppercase;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  text-shadow: 1px 1px 0 rgba(0,0,0,0.8);
}
.biome-forest  { background-color: #3b7a24; }
.biome-desert  { background-color: #d1b46a; color: #3a2205; }
.biome-swamp   { background-color: #2d5a27; }
.biome-taiga   { background-color: #4a7a8a; }
.biome-ocean   { background-color: #1a4a8a; }
.biome-nether  { background-color: #7a1515; }
.biome-end     { background-color: #3a157a; }

/* Locked biome (End) */
.biome-chip.locked {
  position: relative;
  cursor: not-allowed;
}
.biome-chip.locked::after {
  font-size: 0.55rem;
}


.stat-points {
  color: var(--mc-gold);
  font-size: 0.6rem !important;
}

/* Last Event Card */
.last-event-card {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.5rem;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--mc-stone);
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: center;
  text-align: center;
}
.last-event-rarity {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.4rem;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  color: #fff;
}
.rarity-common     { background: var(--mc-stone); }
.rarity-uncommon   { background: var(--mc-grass); }
.rarity-rare       { background: var(--mc-lapis); }
.rarity-epic       { background: #a855f7; }
.rarity-legendary  { background: var(--mc-gold); color: #000; font-weight: bold; }

.last-event-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.45rem;
  color: var(--text-primary);
}

/* Shortcuts Reference Table */
.shortcuts-ref {
  padding: 0.4rem;
}
.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.65rem;
}
.shortcuts-table tr {
  border-bottom: 1px solid var(--border-color);
}
.shortcuts-table tr:last-child {
  border-bottom: none;
}
.shortcuts-table td {
  padding: 0.1rem 0.1rem;
  vertical-align: middle;
}
.sk-key {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.4rem;
  color: var(--mc-gold);
  white-space: nowrap;
}
html[data-theme="light"] .sk-key {
  color: #734812;
}
.sk-desc {
  color: var(--text-secondary);
  text-align: right;
}

/* Achievement Toast */
.achievement-toast {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  background: #2a1f11;
  border: 3px solid #5a3a1a;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.6);
  max-width: 320px;
  animation: toast-slide-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes toast-slide-in {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.achievement-toast.hide {
  animation: toast-slide-out 0.3s ease forwards;
}
@keyframes toast-slide-out {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}
.achievement-icon {
  width: 32px;
  height: 32px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  image-rendering: pixelated;
  display: inline-block;
  flex-shrink: 0;
}
.achievement-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.achievement-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.35rem;
  color: var(--mc-gold);
  text-transform: uppercase;
}
.achievement-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.45rem;
  color: #fff;
}

/* ── 14. Standard Buttons ────────────────────────────────────── */
.btn { display:inline-flex; align-items:center; gap:0.4rem; padding:0.5rem 1rem; border-radius:0.5rem; font-size:0.85rem; font-weight:600; cursor:pointer; border:1px solid transparent; transition:all 0.2s; text-decoration:none; }
.btn-primary  { background:var(--accent-color); color:#fff; }
.btn-secondary{ background:var(--bg-hover); color:var(--text-primary); border-color:var(--border-color); }
.btn-success  { background:#16a34a; color:#fff; }
.btn-full     { width:100%; justify-content:center; }

/* ── 14.5 Achievements Grid ─────────────────────────────────── */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border: 2px solid var(--mc-border-dark);
  border-radius: 4px;
}

.achievement-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.3rem;
  background: var(--mc-bg-dark);
  border: 2px solid var(--mc-border-light);
  border-radius: 3px;
  position: relative;
  transition: all 0.2s ease;
  cursor: help;
  opacity: 0.4;
  filter: grayscale(1);
}

.achievement-card.unlocked {
  opacity: 1;
  filter: grayscale(0);
  border-color: var(--mc-gold);
  background: linear-gradient(135deg, rgba(234, 184, 57, 0.12), var(--mc-bg-dark));
  box-shadow: 0 0 8px rgba(234, 184, 57, 0.25);
}

.achievement-card-icon {
  width: 20px;
  height: 20px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  image-rendering: pixelated;
  margin-bottom: 0.2rem;
  display: block;
}

.achievement-card-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.35rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.achievement-card.unlocked .achievement-card-title {
  color: var(--mc-gold);
  text-shadow: 1px 1px 0 rgba(0,0,0,0.6);
}

/* Tooltip on hover */
.achievement-card .tooltip-text {
  visibility: hidden;
  width: 170px;
  background-color: #141414;
  color: #fff;
  text-align: center;
  border: 2px solid var(--mc-gold);
  padding: 0.5rem;
  border-radius: 4px;
  position: absolute;
  z-index: 100;
  bottom: 115%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.48rem;
  font-family: 'Press Start 2P', monospace;
  line-height: 1.5;
  box-shadow: 0 4px 10px rgba(0,0,0,0.7);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.achievement-card:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

.achievements-progress {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.5rem;
  color: var(--mc-gold);
  margin-left: auto;
}

/* Minecraft Item Tooltip */
.mc-item .mc-tooltip {
  visibility: hidden;
  position: absolute;
  z-index: 9999;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  padding: 6px 8px;
  background: rgba(16, 0, 16, 0.94);
  border: 2px solid #2e0066;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transition: opacity 0.12s ease, visibility 0.12s;
  pointer-events: none;
  text-align: center;
  font-family: 'Press Start 2P', monospace;
  line-height: 1.4;
}

/* Position adjustment: chest tooltips point downwards, inventory upwards */
.mc-grid[data-grid="chest"] .mc-tooltip {
  top: 120%;
  bottom: auto;
}
.mc-grid[data-grid="inventory"] .mc-tooltip,
.mc-grid[data-grid="hotbar"] .mc-tooltip {
  bottom: 120%;
  top: auto;
}

.mc-item:hover .mc-tooltip {
  visibility: visible;
  opacity: 1;
}

.mc-tooltip-title {
  font-size: 0.44rem;
  color: #fff;
  display: block;
}

/* Custom rarity/type colors in tooltip titles */
.mc-item.item-diamond .mc-tooltip-title,
.mc-item.item-diamond-sword .mc-tooltip-title,
.mc-item.item-diamond-armor .mc-tooltip-title {
  color: #55ffff !important;
}
.mc-item.item-gold .mc-tooltip-title,
.mc-item.item-gold-sword .mc-tooltip-title,
.mc-item.item-golden-apple .mc-tooltip-title {
  color: var(--mc-gold) !important;
}
.mc-item.item-emerald .mc-tooltip-title,
.mc-item.item-ender-eye .mc-tooltip-title {
  color: #55ff55 !important;
}
.mc-item.item-nether-sword .mc-tooltip-title,
.mc-item.item-nether-armor .mc-tooltip-title {
  color: #ff55ff !important;
}

.mc-tooltip-stat {
  font-size: 0.38rem;
  color: #55ff55;
  margin-top: 4px;
  display: block;
}

/* Reset Button */
.reset-btn {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #BE555F;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.4rem;
  transition: all 0.2s ease;
}

.reset-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #BE555F;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
}

.reset-btn:active {
  transform: scale(0.95);
}

/* ── 14.6 Death Screen ──────────────────────────────────────── */
.death-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(139, 0, 0, 0.76);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  backdrop-filter: blur(2.5px);
}

.death-screen-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-height: 90vh;
  overflow-y: auto;
  width: min(420px, 92vw);
  padding: 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.death-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 2.2rem;
  color: #ff2222;
  text-shadow: 4px 4px 0 #000;
  margin: 0;
  animation: death-text-shake 0.4s infinite alternate;
}

@keyframes death-text-shake {
  0% { transform: rotate(-1deg); }
  100% { transform: rotate(1deg); }
}

.death-score-row {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.75rem;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
}

#death-score {
  color: var(--mc-gold);
}

.death-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7rem;
  color: #fff;
  background: #5c5c5c;
  border: 3px solid;
  border-top-color: #8c8c8c; border-left-color: #8c8c8c;
  border-right-color: #373737; border-bottom-color: #373737;
  padding: 0.65rem 1.5rem;
  border-radius: 2px;
  cursor: pointer;
  box-shadow: 0 4px 0 #111;
  transition: filter 0.1s, transform 0.1s;
  white-space: nowrap;
}

.death-btn:hover {
  filter: brightness(1.15);
}

.death-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #111;
  border-top-color: #373737; border-left-color: #373737;
  border-right-color: #8c8c8c; border-bottom-color: #8c8c8c;
}

/* ── "New Game" red variant ── */
.death-btn-new {
  background: #b71c1c;
  border-top-color: #ef5350;
  border-left-color: #ef5350;
  border-right-color: #5d0000;
  border-bottom-color: #5d0000;
  color: #ffffff;
}
.death-btn-new:hover {
  background: #c62828;
}

/* ── Two buttons side-by-side layout ── */
.death-action-row {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── 14.7 Time of Day Indicator ─────────────────────────────── */
.time-group { gap: 0.4rem; align-items: center; }
.time-icon { font-size: 0.95rem; transition: all 0.5s ease; line-height: 1; }

.time-bar-track {
  width: 44px;
  height: 5px;
  background: rgba(255,255,255,0.12);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
}
.time-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--mc-gold);
  border-radius: 3px;
  transition: width 0.35s ease, background 0.6s ease;
}

/* ── 14.8 Night / Day Body Overlay ──────────────────────────── */
body.is-night::after {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(8, 4, 28, 0.38);
  pointer-events: none;
  z-index: 0;
  animation: night-fade-in 1.5s ease forwards;
}
@keyframes night-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Biome-specific ambient tints on the background pattern */
body.biome-nether .mc-bg-pattern { background-color: rgba(80, 5, 5, 0.09); }
body.biome-end    .mc-bg-pattern { background-color: rgba(30, 0, 80, 0.12); }
body.biome-swamp  .mc-bg-pattern { background-color: rgba(5,  45, 10, 0.07); }
body.biome-taiga  .mc-bg-pattern { background-color: rgba(80, 130, 200, 0.06); }
body.biome-ocean  .mc-bg-pattern { background-color: rgba(5,  20, 80, 0.10); }

/* ── Biome Body Backgrounds ── */
/* ── Biome Body Backgrounds ── */
body.biome-forest {
  background-color: #2b4d1b !important;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(56, 102, 38, 0.6) 0%, rgba(26, 46, 17, 0.95) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(0, 0, 0, 0.1) 19px, rgba(0, 0, 0, 0.1) 20px),
    repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(0, 0, 0, 0.1) 19px, rgba(0, 0, 0, 0.1) 20px) !important;
}
body.biome-forest.is-night {
  background-color: #0b1408 !important;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(17, 31, 13, 0.7) 0%, rgba(5, 10, 4, 0.98) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(0, 0, 0, 0.25) 19px, rgba(0, 0, 0, 0.25) 20px),
    repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(0, 0, 0, 0.25) 19px, rgba(0, 0, 0, 0.25) 20px) !important;
}
body.biome-desert {
  background-color: #d6b565 !important;
  background-image: 
    radial-gradient(circle at 30% 20%, rgba(245, 215, 135, 0.8) 0%, rgba(186, 148, 65, 0.95) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 15px, rgba(0, 0, 0, 0.08) 15px, rgba(0, 0, 0, 0.08) 16px),
    repeating-linear-gradient(90deg, transparent, transparent 15px, rgba(0, 0, 0, 0.08) 15px, rgba(0, 0, 0, 0.08) 16px) !important;
}
body.biome-desert.is-night {
  background-color: #2b200b !important;
  background-image: 
    radial-gradient(circle at 30% 20%, rgba(77, 56, 18, 0.7) 0%, rgba(20, 15, 5, 0.98) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 15px, rgba(0, 0, 0, 0.25) 15px, rgba(0, 0, 0, 0.25) 16px),
    repeating-linear-gradient(90deg, transparent, transparent 15px, rgba(0, 0, 0, 0.25) 15px, rgba(0, 0, 0, 0.25) 16px) !important;
}
body.biome-swamp {
  background-color: #1a2e16 !important;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(42, 64, 30, 0.7) 0%, rgba(15, 26, 12, 0.97) 100%),
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0, 0, 0, 0.12) 10px, rgba(0, 0, 0, 0.12) 12px),
    repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(0, 0, 0, 0.12) 10px, rgba(0, 0, 0, 0.12) 12px) !important;
}
body.biome-swamp.is-night {
  background-color: #0b1409 !important;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(20, 31, 16, 0.7) 0%, rgba(5, 10, 4, 0.99) 100%),
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0, 0, 0, 0.25) 10px, rgba(0, 0, 0, 0.25) 12px),
    repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(0, 0, 0, 0.25) 10px, rgba(0, 0, 0, 0.25) 12px) !important;
}
body.biome-taiga {
  background-color: #2b3b4d !important;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(68, 92, 117, 0.6) 0%, rgba(26, 36, 48, 0.95) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 25px, rgba(255, 255, 255, 0.05) 25px, rgba(255, 255, 255, 0.05) 26px),
    repeating-linear-gradient(90deg, transparent, transparent 25px, rgba(255, 255, 255, 0.05) 25px, rgba(255, 255, 255, 0.05) 26px) !important;
}
body.biome-taiga.is-night {
  background-color: #0f1620 !important;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(28, 41, 56, 0.7) 0%, rgba(7, 10, 15, 0.99) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 25px, rgba(255, 255, 255, 0.08) 25px, rgba(255, 255, 255, 0.08) 26px),
    repeating-linear-gradient(90deg, transparent, transparent 25px, rgba(255, 255, 255, 0.08) 25px, rgba(255, 255, 255, 0.08) 26px) !important;
}
body.biome-ocean {
  background-color: #0b224d !important;
  background-image: 
    radial-gradient(circle at 50% 10%, rgba(27, 72, 153, 0.7) 0%, rgba(6, 19, 43, 0.97) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 30px, rgba(255, 255, 255, 0.03) 30px, rgba(255, 255, 255, 0.03) 31px),
    repeating-linear-gradient(90deg, transparent, transparent 30px, rgba(255, 255, 255, 0.03) 30px, rgba(255, 255, 255, 0.03) 31px) !important;
}
body.biome-ocean.is-night {
  background-color: #030a1c !important;
  background-image: 
    radial-gradient(circle at 50% 10%, rgba(10, 29, 64, 0.7) 0%, rgba(2, 6, 18, 0.99) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 30px, rgba(255, 255, 255, 0.05) 30px, rgba(255, 255, 255, 0.05) 31px),
    repeating-linear-gradient(90deg, transparent, transparent 30px, rgba(255, 255, 255, 0.05) 30px, rgba(255, 255, 255, 0.05) 31px) !important;
}
body.biome-nether {
  background-color: #2e0808 !important;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(117, 21, 21, 0.75) 0%, rgba(36, 6, 6, 0.98) 100%),
    repeating-linear-gradient(45deg, transparent, transparent 15px, rgba(0, 0, 0, 0.3) 15px, rgba(0, 0, 0, 0.3) 17px),
    repeating-linear-gradient(-45deg, transparent, transparent 15px, rgba(0, 0, 0, 0.3) 15px, rgba(0, 0, 0, 0.3) 17px) !important;
}
body.biome-end {
  background-color: #140d1a !important;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(56, 34, 77, 0.7) 0%, rgba(10, 6, 13, 0.99) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 12px, rgba(0, 0, 0, 0.4) 12px, rgba(0, 0, 0, 0.4) 14px),
    repeating-linear-gradient(90deg, transparent, transparent 12px, rgba(0, 0, 0, 0.4) 12px, rgba(0, 0, 0, 0.4) 14px) !important;
}

html[data-theme='light'] body.biome-forest {
  background-color: #5c8f47 !important;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(123, 175, 104, 0.85) 0%, rgba(70, 112, 54, 0.95) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(255, 255, 255, 0.15) 19px, rgba(255, 255, 255, 0.15) 20px),
    repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(255, 255, 255, 0.15) 19px, rgba(255, 255, 255, 0.15) 20px) !important;
}
html[data-theme='light'] body.biome-desert {
  background-color: #e5d194 !important;
  background-image: 
    radial-gradient(circle at 30% 20%, rgba(240, 225, 175, 0.9) 0%, rgba(200, 175, 115, 0.98) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 15px, rgba(255, 255, 255, 0.2) 15px, rgba(255, 255, 255, 0.2) 16px),
    repeating-linear-gradient(90deg, transparent, transparent 15px, rgba(255, 255, 255, 0.2) 15px, rgba(255, 255, 255, 0.2) 16px) !important;
}
html[data-theme='light'] body.biome-swamp {
  background-color: #4a6338 !important;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(99, 122, 80, 0.85) 0%, rgba(60, 80, 45, 0.95) 100%),
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255, 255, 255, 0.12) 10px, rgba(255, 255, 255, 0.12) 12px),
    repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(255, 255, 255, 0.12) 10px, rgba(255, 255, 255, 0.12) 12px) !important;
}
html[data-theme='light'] body.biome-taiga {
  background-color: #b0bec5 !important;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(207, 216, 220, 0.9) 0%, rgba(144, 164, 174, 0.98) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 25px, rgba(255, 255, 255, 0.2) 25px, rgba(255, 255, 255, 0.2) 26px),
    repeating-linear-gradient(90deg, transparent, transparent 25px, rgba(255, 255, 255, 0.2) 25px, rgba(255, 255, 255, 0.2) 26px) !important;
}
html[data-theme='light'] body.biome-ocean {
  background-color: #3b68d6 !important;
  background-image: 
    radial-gradient(circle at 50% 10%, rgba(90, 130, 240, 0.9) 0%, rgba(45, 80, 180, 0.98) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 30px, rgba(255, 255, 255, 0.15) 30px, rgba(255, 255, 255, 0.15) 31px),
    repeating-linear-gradient(90deg, transparent, transparent 30px, rgba(255, 255, 255, 0.15) 30px, rgba(255, 255, 255, 0.15) 31px) !important;
}
html[data-theme='light'] body.biome-nether {
  background-color: #a64f4f !important;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(190, 100, 100, 0.85) 0%, rgba(140, 60, 60, 0.95) 100%),
    repeating-linear-gradient(45deg, transparent, transparent 15px, rgba(255, 255, 255, 0.15) 15px, rgba(255, 255, 255, 0.15) 17px),
    repeating-linear-gradient(-45deg, transparent, transparent 15px, rgba(255, 255, 255, 0.15) 15px, rgba(255, 255, 255, 0.15) 17px) !important;
}
html[data-theme='light'] body.biome-end {
  background-color: #9c8fb3 !important;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(187, 178, 198, 0.9) 0%, rgba(130, 120, 150, 0.98) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 12px, rgba(255, 255, 255, 0.2) 12px, rgba(255, 255, 255, 0.2) 14px),
    repeating-linear-gradient(90deg, transparent, transparent 12px, rgba(255, 255, 255, 0.2) 12px, rgba(255, 255, 255, 0.2) 14px) !important;
}

/* ── 14.9 Quest Section ─────────────────────────────────────── */
.quests-section { padding: 0.6rem; }
.quests-list    { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.25rem; }

.quest-card {
  background: rgba(0,0,0,0.28);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 0.5rem 0.6rem;
  transition: border-color 0.25s;
}
html[data-theme="light"] .quest-card { background: rgba(0,0,0,0.07); }
.quest-card:hover { border-color: rgba(255,255,255,0.2); }

.quest-card.quest-complete {
  border-color: var(--mc-gold);
  background: rgba(252, 219, 5, 0.07);
  animation: quest-glow 0.6s ease;
}
@keyframes quest-glow {
  0%   { box-shadow: 0 0 0 0 rgba(252, 219, 5, 0); }
  50%  { box-shadow: 0 0 12px 4px rgba(252, 219, 5, 0.45); }
  100% { box-shadow: 0 0 0 0 rgba(252, 219, 5, 0); }
}

.quest-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  margin-bottom: 0.3rem;
}
.quest-icon { font-size: 0.85rem; line-height: 1; flex-shrink: 0; margin-top: 1px; }
.quest-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.42rem;
  color: var(--text-primary);
  line-height: 1.45;
  flex: 1;
}
.quest-name.permanent { color: var(--mc-diamond); }

.quest-desc {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.36rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  line-height: 1.6;
}

.quest-progress-bar-track {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.3rem;
  border: 1px solid rgba(255,255,255,0.07);
}
html[data-theme="light"] .quest-progress-bar-track { background: rgba(0,0,0,0.12); }

.quest-progress-bar-fill {
  height: 100%;
  background: var(--mc-emerald);
  border-radius: 3px;
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 2px;
}
.quest-card.quest-complete .quest-progress-bar-fill { background: var(--mc-gold); }

.quest-progress-text {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.36rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.quest-reward { color: var(--mc-gold); }

.quests-completed {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.5rem;
  color: var(--mc-gold);
  margin-left: auto;
}

/* ── 15. Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .game-workspace { flex-direction: column; padding: 0.75rem; }
  .game-right { width: 100%; }
  .steve-btn { padding: 0.75rem; }
  .action-log { max-height: 200px; }
  .stats-bar { padding: 0.4rem 0.75rem; }
}
@media (max-width: 500px) {
  .mc-grid { gap: 2px; }
  .tool-pill-wrapper { display: none; }
  .chest-shortcuts { display: none; }
  .time-group { display: none; }
}

/* Fix Action Log height */
.action-log {
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

/* �� 15. Recipes List ������������������������������������������ */
.recipes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.2rem;
}

.recipe-item {
  width: 38px;
  height: 38px;
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid #333;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: not-allowed;
  position: relative;
  transition: all 0.2s;
  opacity: 0.5;
  filter: grayscale(1);
}

.recipe-item.active {
  cursor: pointer;
  border-color: var(--mc-gold);
  background: rgba(44, 205, 177, 0.15);
  opacity: 1;
  filter: none;
}

.recipe-item.active:hover {
  background: rgba(44, 205, 177, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 0 rgba(0,0,0,0.5);
}

.recipe-item.active:active {
  transform: translateY(0);
  box-shadow: 0 2px 0 rgba(0,0,0,0.5);
}

.recipe-icon {
  width: 70%;
  height: 70%;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  image-rendering: pixelated;
}

/* Tooltip for recipes */
.recipe-item .mc-tooltip {
  visibility: hidden;
  position: absolute;
  z-index: 1000;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 180px;
  padding: 6px 8px;
  background: rgba(16, 0, 16, 0.94);
  border: 2px solid var(--mc-gold);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transition: opacity 0.1s ease;
  pointer-events: none;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.4rem;
  line-height: 1.5;
  text-align: left;
}

.recipe-item:hover .mc-tooltip {
  visibility: visible;
  opacity: 1;
}

.recipe-tooltip-title {
  color: var(--mc-gold);
  font-size: 0.45rem;
  margin-bottom: 0.2rem;
  border-bottom: 1px solid #333;
  padding-bottom: 0.2rem;
}

.recipe-tooltip-req {
  color: #ccc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.recipe-tooltip-req.missing {
  color: #ff5252;
}
.recipe-tooltip-req.ok {
  color: var(--mc-emerald);
}

/* ── Missing Items & New Features ── */
:root {
  --item-apple: #7f0000;
  --item-stick: #523418;
  --item-tnt: #b71c1c;
  --item-bone: #9e9e9e;
  --item-rotten-flesh: #558b2f;
  --item-slimeball: #4caf50;
  --item-golden-apple: #ff6f00;
  --item-bucket: #616161;
  --item-water-bucket: #00b0ff;
  --item-book: #4e342e;
  --item-ender-eye: #004d40;
  --item-bread: #a1887f;
  --item-potion-heal: #ff1744;
  --item-potion-fire-res: #ff9100;
  --item-potion-strength: #aa00ff;
}

.item-apple { background-color: var(--item-apple) !important; }
.item-stick { background-color: var(--item-stick) !important; }
.item-tnt { background-color: var(--item-tnt) !important; }
.item-bone { background-color: var(--item-bone) !important; }
.item-rotten-flesh { background-color: var(--item-rotten-flesh) !important; }
.item-slimeball { background-color: var(--item-slimeball) !important; }
.item-golden-apple { background-color: var(--item-golden-apple) !important; }
.item-bucket { background-color: var(--item-bucket) !important; }
.item-water-bucket { background-color: var(--item-water-bucket) !important; }
.item-book { background-color: var(--item-book) !important; }
.item-ender-eye { background-color: var(--item-ender-eye) !important; }
.item-bread { background-color: var(--item-bread) !important; }
.item-potion-heal { background-color: var(--item-potion-heal) !important; }
.item-potion-fire-res { background-color: var(--item-potion-fire-res) !important; }
.item-potion-strength { background-color: var(--item-potion-strength) !important; }

/* Trash UI */
.trash-btn { font-size: 1.2rem; cursor: pointer; background: transparent; border: none; transition: transform 0.2s; padding: 0.2rem; }
.trash-btn:hover { transform: scale(1.1); }
.trash-btn.drag-over { transform: scale(1.2); filter: drop-shadow(0 0 5px red); }

/* Durability Bar */
.mc-durability-track { position: absolute; bottom: 2px; left: 2px; right: 2px; height: 3px; background: rgba(0,0,0,0.5); z-index: 5; }
.mc-durability-fill { height: 100%; background: #55ff55; }
.mc-durability-fill.med { background: #ffff55; }
.mc-durability-fill.low { background: #ff5555; }

/* Boss UI */
.boss-hp-bar { width: 100%; height: 12px; background: #333; border: 1px solid #111; position: relative; margin-top: 4px; overflow: hidden; }
.boss-hp-fill { height: 100%; background: var(--mc-redstone); transition: width 0.3s; }
.boss-hp-text { position: absolute; top: -1px; left: 0; width: 100%; text-align: center; font-size: 0.45rem; color: #fff; text-shadow: 1px 1px 0 #000; line-height: 12px; z-index: 2; }
.player-hp-fill { background: var(--mc-emerald); transition: width 0.3s; }

/* Boss animations */
@keyframes shake { 
  0% { transform: translate(1px, 1px) rotate(0deg); } 
  10% { transform: translate(-1px, -2px) rotate(-1deg); } 
  20% { transform: translate(-3px, 0px) rotate(1deg); } 
  30% { transform: translate(3px, 2px) rotate(0deg); } 
  40% { transform: translate(1px, -1px) rotate(1deg); } 
  50% { transform: translate(-1px, 2px) rotate(-1deg); } 
  60% { transform: translate(-3px, 1px) rotate(0deg); } 
  70% { transform: translate(3px, 1px) rotate(-1deg); } 
  80% { transform: translate(-1px, -1px) rotate(1deg); } 
  90% { transform: translate(1px, 2px) rotate(0deg); } 
  100% { transform: translate(1px, -2px) rotate(-1deg); } 
}
.shake { animation: shake 0.4s; }

/* Accessible visually-hidden class for screen readers and SEO */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}


/* Breadcrumb Navigation */
.breadcrumb-nav {
  padding: 0.75rem 1.5rem 0.25rem;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}
.breadcrumb-list {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted, #9ca3af);
  flex-wrap: wrap;
}
.breadcrumb-item a {
  color: var(--text-secondary, #94a3b8);
  text-decoration: none;
  transition: color 0.2s ease;
}
.breadcrumb-item a:hover {
  color: var(--accent-color, #CD5C3E);
}
.breadcrumb-item.active {
  color: var(--text-primary, #FAF8F5);
  font-weight: 500;
}
.breadcrumb-separator {
  color: var(--text-muted, #6b7280);
  opacity: 0.5;
  font-size: 0.75rem;
}

html.embed-mode .breadcrumb-nav {
  display: none !important;
}



/* Form Controls & Select Dropdowns */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary, #94a3b8);
}

.form-select, select.form-select, select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--text-primary, #FAF8F5);
  background-color: var(--bg-card, #0f172a);
  border: 1px solid var(--border-color, #1e293b);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-select:focus-visible, select.form-select:focus-visible, select:focus-visible {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-glow, rgba(205, 92, 62, 0.2));
}

.form-select option, select option {
  background-color: var(--bg-surface, #0f172a);
  color: var(--text-primary, #FAF8F5);
  padding: 0.5rem;
}

html[data-theme="light"] .form-select option,
html[data-theme="light"] select option {
  background-color: #ffffff;
  color: #0f172a;
}



/* Recommended Tool Card Styles */
.tool-card,
.tool-card-mini {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  text-decoration: none !important;
  color: var(--text-primary) !important;
  transition: all 0.2s ease;
}

.tool-card:hover,
.tool-card-mini:hover {
  background: var(--bg-panel);
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: var(--card-shadow);
}

.tool-card-icon,
.tool-card-mini .tool-icon {
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 0.5rem;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tool-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tool-card-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.tool-card-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.35;
}
