/* ==========================================================================
   BENCHLAB — MODERN MINECRAFT ("ORE UI") DESIGN SYSTEM
   Dark Theme: Deepslate, Netherite & Emerald
   Light Theme: Overworld Daylight, Quartz & Grass
   ========================================================================== */

:root {
  /* Deepslate Dark Surfaces */
  --bg: #131519;
  --bg-pattern: rgba(255, 255, 255, 0.022);
  --bg-elev: #1d2027;
  --bg-card: #242832;
  --bg-card-hover: #2c313d;
  --bg-subtle: #1a1d24;
  --bg-slot: #14171d;
  --bg-input: #12151a;

  /* Crisp Block Borders & 3D Bevels */
  --outline: #090a0d;
  --border: #363c4b;
  --border-strong: #4d5568;
  --bevel-light: rgba(255, 255, 255, 0.09);
  --bevel-dark: rgba(0, 0, 0, 0.42);
  --slot-shadow-top: rgba(0, 0, 0, 0.55);
  --slot-highlight-bot: rgba(255, 255, 255, 0.06);

  /* Text Hierarchy */
  --text: #f1f4f9;
  --text-muted: #a6b0c3;
  --text-dim: #748099;

  /* Minecraft Ore Accents */
  --emerald: #4ea72e;
  --emerald-bright: #67c942;
  --emerald-dark: #2c6819;
  --emerald-deep: #1b430e;
  --emerald-soft: rgba(78, 167, 46, 0.18);
  --emerald-text: #86ef68;

  --accent: var(--emerald);
  --accent-soft: var(--emerald-soft);
  --accent-text: var(--emerald-text);

  /* Gold Ingot / Star Rating */
  --star: #ffcb3d;
  --star-dark: #b37a09;
  --star-glow: rgba(255, 203, 61, 0.35);
  --star-empty: #353c4c;

  /* XP Lime */
  --xp: #7eff38;
  --xp-dark: #2e7c10;

  /* Status Ores */
  --success: #58d94b;
  --success-soft: rgba(88, 217, 75, 0.16);
  --diamond: #38e0d0;
  --diamond-soft: rgba(56, 224, 208, 0.15);
  --warning: #ffb938;
  --warning-soft: rgba(255, 185, 56, 0.16);
  --amethyst: #c074ff;
  --amethyst-soft: rgba(192, 116, 255, 0.17);
  --danger: #ff5c5c;
  --danger-dark: #942323;
  --danger-soft: rgba(255, 92, 92, 0.16);

  /* Block Geometry */
  --radius-xs: 0px;
  --radius-sm: 2px;
  --radius-md: 2px;
  --radius-lg: 3px;
  --shadow-block: 0 4px 0 var(--outline), 0 8px 20px rgba(0, 0, 0, 0.36);
  --shadow-modal: 0 8px 0 var(--outline), 0 24px 56px rgba(0, 0, 0, 0.65);

  /* Typography */
  --font-display: 'Silkscreen', 'JetBrains Mono', monospace;
  --font-sans: 'Chakra Petch', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Responsive spacing */
  --topbar-h: 62px;
  --mobile-nav-h: 64px;
}

[data-theme='light'] {
  /* Overworld Daylight — Quartz, Birch & Stone */
  --bg: #e3e6dd;
  --bg-pattern: rgba(25, 34, 24, 0.038);
  --bg-elev: #f4f6f0;
  --bg-card: #fbfcf9;
  --bg-card-hover: #ffffff;
  --bg-subtle: #e9ece3;
  --bg-slot: #dfe3d8;
  --bg-input: #f0f2eb;

  --outline: #1e232a;
  --border: #b8c0b0;
  --border-strong: #879282;
  --bevel-light: rgba(255, 255, 255, 0.92);
  --bevel-dark: rgba(30, 35, 42, 0.14);
  --slot-shadow-top: rgba(30, 35, 42, 0.16);
  --slot-highlight-bot: rgba(255, 255, 255, 0.85);

  --text: #181c22;
  --text-muted: #4b5563;
  --text-dim: #667080;

  --emerald: #3c8527;
  --emerald-bright: #52a535;
  --emerald-dark: #255a16;
  --emerald-deep: #173b0d;
  --emerald-soft: rgba(60, 133, 39, 0.14);
  --emerald-text: #246314;

  --accent: var(--emerald);
  --accent-soft: var(--emerald-soft);
  --accent-text: var(--emerald-text);

  --star: #d98d07;
  --star-dark: #8c5900;
  --star-glow: rgba(217, 141, 7, 0.24);
  --star-empty: #c6cdc0;

  --xp: #38a818;
  --xp-dark: #1f680a;

  --success: #257a1c;
  --success-soft: rgba(37, 122, 28, 0.13);
  --diamond: #0b8a82;
  --diamond-soft: rgba(11, 138, 130, 0.13);
  --warning: #b06506;
  --warning-soft: rgba(176, 101, 6, 0.14);
  --amethyst: #7e22ce;
  --amethyst-soft: rgba(126, 34, 206, 0.12);
  --danger: #c82333;
  --danger-dark: #7f141e;
  --danger-soft: rgba(200, 35, 51, 0.12);

  --shadow-block: 0 4px 0 rgba(30, 35, 42, 0.82), 0 8px 18px rgba(30, 35, 42, 0.1);
  --shadow-modal: 0 6px 0 rgba(30, 35, 42, 0.88), 0 20px 44px rgba(30, 35, 42, 0.24);
}

/* ==================== RESET & BASE ==================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-pattern) 2px, transparent 2px),
    linear-gradient(90deg, var(--bg-pattern) 2px, transparent 2px);
  background-size: 32px 32px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

button,
input,
select,
textarea {
  font-family: inherit;
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--emerald-bright);
  outline-offset: 2px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-slot);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
}

kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 5px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  box-shadow: inset 0 -2px 0 var(--bevel-dark);
}

.hidden {
  display: none !important;
}

/* Crisp Grass/Emerald Pixel Accent Trim at Top of App */
.mc-top-trim {
  height: 5px;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 60;
  background:
    repeating-linear-gradient(
      90deg,
      #59b839 0px,
      #59b839 12px,
      #4ea72e 12px,
      #4ea72e 24px,
      #6cc949 24px,
      #6cc949 32px,
      #3c8527 32px,
      #3c8527 48px
    );
  border-bottom: 2px solid var(--outline);
}

/* ==================== TOPBAR ==================== */
.topbar {
  position: sticky;
  top: 5px;
  z-index: 50;
  background: color-mix(in srgb, var(--bg-elev) 95%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--outline);
  box-shadow: inset 0 -2px 0 var(--bevel-dark), 0 4px 16px rgba(0, 0, 0, 0.25);
}

.topbar-inner {
  max-width: 1540px;
  margin: 0 auto;
  min-height: var(--topbar-h);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-left,
.topbar-right,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* Brand Block */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 2px solid transparent;
  background: transparent;
  padding: 4px 8px 4px 4px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease, border-color 0.12s ease;
  flex-shrink: 0;
}

.brand:hover {
  background: var(--bg-subtle);
  border-color: var(--border);
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-slot);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -2px 0 var(--bevel-dark), 0 2px 0 var(--outline);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.08;
}

.brand-text strong {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.03em;
  color: var(--text);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

[data-theme='light'] .brand-text strong {
  text-shadow: none;
}

.brand-text small {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--star);
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* Primary Nav — Desktop Hotbar Slots */
.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 3px;
  background: var(--bg-slot);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--slot-shadow-top), inset -2px -2px 0 var(--slot-highlight-bot);
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s ease, color 0.1s ease, border-color 0.1s ease;
}

.nav-tab .nav-icon {
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-tab:hover {
  color: var(--text);
  background: var(--bg-card);
}

.nav-tab.active {
  background: var(--emerald);
  color: #ffffff;
  border-color: var(--outline);
  box-shadow: inset 2px 2px 0 var(--emerald-bright), inset -2px -2px 0 var(--emerald-dark);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}

.nav-tab.active .nav-icon {
  opacity: 1;
}

/* Search Inventory Slot */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--slot-shadow-top), inset -1px -1px 0 var(--slot-highlight-bot);
  padding: 0 10px;
  height: 36px;
  width: 220px;
  color: var(--text-muted);
  transition: border-color 0.12s ease, width 0.18s ease;
}

.search-box:focus-within {
  border-color: var(--emerald-bright);
  width: 265px;
  color: var(--text);
}

.search-box input {
  border: 0;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  width: 100%;
  min-width: 0;
  color: var(--text);
}

.search-box input::placeholder {
  color: var(--text-dim);
}

/* Tactile Block Pill & Icon Buttons */
.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 11px;
  border: 2px solid var(--outline);
  background: var(--bg-card);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -2px 0 var(--bevel-dark), 0 2px 0 var(--outline);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.08s ease, background 0.1s ease, color 0.1s ease;
}

.pill-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text);
}

.pill-btn:active {
  transform: translateY(2px);
  box-shadow: inset 2px 2px 0 var(--bevel-dark), 0 0 0 var(--outline);
}

/* Enchanted Blind Mode Active State */
.pill-btn[aria-pressed='true'] {
  background: linear-gradient(135deg, #5d2b97, #7a38c2 50%, #55238e);
  border-color: var(--outline);
  color: #f8edff;
  box-shadow:
    inset 2px 2px 0 rgba(226, 179, 255, 0.45),
    inset -2px -2px 0 rgba(48, 12, 84, 0.7),
    0 2px 0 var(--outline),
    0 0 12px rgba(192, 116, 255, 0.35);
}

.pill-live {
  color: var(--diamond);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 2px solid var(--outline);
  background: var(--bg-card);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -2px 0 var(--bevel-dark), 0 2px 0 var(--outline);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.08s ease, background 0.1s ease, color 0.1s ease;
}

.icon-btn-sm {
  width: 32px;
  height: 32px;
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text);
}

.icon-btn:active {
  transform: translateY(2px);
  box-shadow: inset 2px 2px 0 var(--bevel-dark);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--xp);
  border: 1px solid var(--outline);
  box-shadow: 0 0 8px var(--xp);
  animation: pixelPulse 1.6s steps(2, end) infinite;
}

@keyframes pixelPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

/* ==================== MINECRAFT 3D BEVELED BUTTONS & BADGES ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border: 2px solid var(--outline);
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.08s ease, filter 0.1s ease, background 0.1s ease, box-shadow 0.08s ease;
}

.btn-sm {
  min-height: 32px;
  padding: 0 10px;
  font-size: 10.5px;
}

/* Iconic Minecraft Launcher Emerald Play Button */
.btn-primary {
  background: var(--emerald);
  color: #ffffff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
  box-shadow:
    inset 2px 2px 0 var(--emerald-bright),
    inset -2px -3px 0 var(--emerald-dark),
    0 3px 0 var(--outline);
}

.btn-primary:hover {
  background: #58b836;
}

.btn-primary:active {
  transform: translateY(3px);
  box-shadow:
    inset 2px 2px 0 var(--emerald-dark),
    inset -2px -2px 0 var(--emerald-bright),
    0 0 0 var(--outline);
}

/* Stone Slab Secondary Button */
.btn-secondary {
  background: #373d4a;
  color: #f4f7fb;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  box-shadow:
    inset 2px 2px 0 rgba(255, 255, 255, 0.16),
    inset -2px -3px 0 rgba(0, 0, 0, 0.42),
    0 3px 0 var(--outline);
}

[data-theme='light'] .btn-secondary {
  background: #dce1d6;
  color: #181c22;
  text-shadow: none;
  box-shadow:
    inset 2px 2px 0 #ffffff,
    inset -2px -3px 0 #aeb6a6,
    0 3px 0 var(--outline);
}

.btn-secondary:hover {
  filter: brightness(1.09);
}

.btn-secondary:active {
  transform: translateY(3px);
  box-shadow: inset 2px 2px 0 var(--bevel-dark), 0 0 0 var(--outline);
}

/* Subtle Cobblestone Ghost Button */
.btn-ghost {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--text-muted);
  box-shadow: inset 1px 1px 0 var(--bevel-light), inset -1px -2px 0 var(--bevel-dark);
}

.btn-ghost:hover {
  background: var(--bg-card-hover);
  color: var(--text);
  border-color: var(--outline);
}

.btn-ghost:active {
  transform: translateY(1px);
}

/* Redstone Danger Button */
.btn-danger-ghost {
  background: #8f2626;
  color: #fff2f2;
  border-color: var(--outline);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  box-shadow:
    inset 2px 2px 0 #c94747,
    inset -2px -2px 0 #5a1313,
    0 2px 0 var(--outline);
}

.btn-danger-ghost:hover {
  background: #a82e2e;
}

.btn-danger-ghost:active {
  transform: translateY(2px);
  box-shadow: inset 2px 2px 0 #5a1313;
}

/* Ore Tag Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--bg-slot);
  color: var(--text-muted);
  border: 1.5px solid var(--border-strong);
  white-space: nowrap;
}

.badge-instant {
  background: var(--success-soft);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 55%, var(--outline));
}

.badge-server {
  background: var(--diamond-soft);
  color: var(--diamond);
  border-color: color-mix(in srgb, var(--diamond) 55%, var(--outline));
}

.badge-install {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 55%, var(--outline));
}

.badge-prompt-ok {
  background: var(--emerald-soft);
  color: var(--emerald-text);
  border-color: color-mix(in srgb, var(--emerald-bright) 55%, var(--outline));
}

.badge-note {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 55%, var(--outline));
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: none;
  white-space: normal;
}

/* ==================== MAIN WORKSPACE LAYOUT ==================== */
.main-content {
  max-width: 1540px;
  margin: 0 auto;
  padding: 22px 20px 64px;
}

.bench-layout {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.bench-main {
  min-width: 0;
}

/* ==================== SIDEBAR (WORLD SELECTOR / HOTBAR) ==================== */
.sidebar {
  position: sticky;
  top: 84px;
  background: var(--bg-card);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -2px 0 var(--bevel-dark), var(--shadow-block);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-heading {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--emerald-text);
  padding: 4px 8px 6px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-item {
  width: 100%;
  border: 2px solid transparent;
  background: var(--bg-slot);
  box-shadow: inset 2px 2px 0 var(--slot-shadow-top), inset -1px -1px 0 var(--slot-highlight-bot);
  padding: 10px 11px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: background 0.1s ease, border-color 0.1s ease, transform 0.08s ease;
}

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

.sidebar-item.active {
  background: color-mix(in srgb, var(--emerald) 22%, var(--bg-card));
  border-color: var(--emerald-bright);
  box-shadow:
    inset 3px 0 0 var(--emerald-bright),
    inset 0 2px 0 var(--bevel-light),
    inset 0 -2px 0 var(--bevel-dark);
}

.sidebar-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-item-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-item-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  background: var(--bg-elev);
  border: 1.5px solid var(--border-strong);
  padding: 1px 6px;
  flex-shrink: 0;
}

.sidebar-item.active .sidebar-item-count {
  background: var(--emerald);
  color: #fff;
  border-color: var(--outline);
}

.sidebar-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
}

/* ==================== HERO BANNER & KPI BLOCKS ==================== */
.hero-banner {
  position: relative;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--emerald) 18%, var(--bg-card)) 0%, var(--bg-card) 58%),
    var(--bg-card);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -3px 0 var(--bevel-dark), var(--shadow-block);
  padding: 22px 24px;
  margin-bottom: 20px;
  overflow: hidden;
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    var(--emerald-bright) 0,
    var(--emerald-bright) 16px,
    var(--emerald) 16px,
    var(--emerald) 32px
  );
}

.hero-banner.hero-compact {
  padding: 18px 22px;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-banner h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(18px, 2.3vw, 25px);
  letter-spacing: 0.01em;
  line-height: 1.25;
  color: var(--text);
}

.hero-banner p {
  margin: 8px 0 0;
  color: var(--text-muted);
  max-width: 720px;
  font-size: 14px;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.kpi-card {
  background: var(--bg-slot);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--slot-shadow-top), inset -2px -2px 0 var(--slot-highlight-bot);
  padding: 12px 14px;
  min-width: 0;
}

.kpi-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  font-weight: 700;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: clamp(17px, 2vw, 22px);
  font-weight: 700;
  margin-top: 4px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--text);
  word-break: break-word;
}

.kpi-value.kpi-leader {
  font-size: clamp(13px, 1.5vw, 15.5px);
  line-height: 1.3;
}

.kpi-value small {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ==================== OVERVIEW CARDS ==================== */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 16px;
}

.overview-card {
  background: var(--bg-card);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -3px 0 var(--bevel-dark), var(--shadow-block);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.1s ease, background 0.1s ease;
}

.overview-card:hover {
  transform: translateY(-2px);
  border-color: var(--emerald-bright);
  background: var(--bg-card-hover);
}

.overview-card:active {
  transform: translateY(1px);
}

.overview-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.overview-card h2 {
  margin: 7px 0 0;
  font-family: var(--font-display);
  font-size: 15.5px;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.overview-desc {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-muted);
}

.overview-prompt-preview {
  background: var(--bg-slot);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--slot-shadow-top), inset -1px -1px 0 var(--slot-highlight-bot);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.overview-prompt-preview.empty {
  font-family: var(--font-sans);
  font-style: italic;
  color: var(--text-dim);
}

.overview-footer {
  margin-top: auto;
  padding-top: 11px;
  border-top: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ==================== PROMPT BOOK / SIGN CARD ==================== */
.prompt-card {
  background: var(--bg-card);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -3px 0 var(--bevel-dark), var(--shadow-block);
  margin-bottom: 18px;
  overflow: hidden;
}

.prompt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 16px;
  background: var(--bg-subtle);
  border-bottom: 2px solid var(--outline);
}

.prompt-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text);
}

.prompt-path {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-slot);
  padding: 2px 7px;
  border: 1.5px solid var(--border);
  word-break: break-all;
}

.prompt-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.prompt-body {
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}

.prompt-body.collapsed {
  max-height: 170px;
  overflow: hidden;
  position: relative;
}

.prompt-body.collapsed::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 58px;
  background: linear-gradient(transparent, var(--bg-card));
  pointer-events: none;
}

.prompt-body p {
  margin: 0 0 8px;
}

.prompt-body p:last-child {
  margin-bottom: 0;
}

.prompt-body ul {
  margin: 4px 0 10px;
  padding-left: 20px;
}

.prompt-body li {
  margin-bottom: 4px;
}

.prompt-empty-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* ==================== TOOLBAR & INPUTS ==================== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.select-input {
  height: 36px;
  padding: 0 10px;
  border: 2px solid var(--outline);
  background: var(--bg-card);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -2px 0 var(--bevel-dark);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  max-width: 100%;
}

.select-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 11px;
  border: 2px solid var(--outline);
  background: var(--bg-card);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -2px 0 var(--bevel-dark);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.checkbox-pill input {
  width: 15px;
  height: 15px;
  accent-color: var(--emerald);
  cursor: pointer;
}

/* ==================== MODEL SUBMISSION CARDS ==================== */
.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 315px), 1fr));
  gap: 16px;
}

.model-card {
  background: var(--bg-card);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -3px 0 var(--bevel-dark), var(--shadow-block);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.1s ease, border-color 0.1s ease, background 0.1s ease;
  min-width: 0;
}

.model-card:hover {
  border-color: var(--emerald-bright);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.model-card.blind-card {
  border-color: color-mix(in srgb, var(--amethyst) 65%, var(--outline));
}

.model-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.model-card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
}

.model-card-path {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 3px;
  word-break: break-all;
}

.model-card-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

.model-card-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stack-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.stack-chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  background: var(--bg-slot);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}

/* ==================== 1-6 PIXEL STAR RATING INVENTORY SLOT ==================== */
.card-rating-box {
  background: var(--bg-slot);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--slot-shadow-top), inset -2px -2px 0 var(--slot-highlight-bot);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rating-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.rating-score-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--star);
}

.rating-score-pill span {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}

.rating-votes-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}

.star-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
}

.star-btn {
  border: 0;
  background: transparent;
  padding: 3px;
  min-width: 28px;
  min-height: 28px;
  cursor: pointer;
  color: var(--star-empty);
  transition: transform 0.1s steps(2, end), color 0.1s ease, filter 0.1s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.star-btn:hover {
  transform: scale(1.18) translateY(-1px);
}

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

.star-btn.filled,
.star-btn.preview {
  color: var(--star);
  filter: drop-shadow(0 0 6px var(--star-glow));
}

.star-hover-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 6px;
  font-weight: 600;
  min-width: 74px;
}

.model-card-actions {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.model-card-actions .btn-primary {
  flex: 1;
}

/* ==================== TEST & RATE STUDIO ==================== */
.studio-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.studio-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

.studio-bar {
  flex: 0 0 auto;
  min-height: 58px;
  padding: 8px 14px;
  background: var(--bg-elev);
  border-bottom: 2px solid var(--outline);
  box-shadow: inset 0 -2px 0 var(--bevel-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.studio-bar-left,
.studio-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.studio-bar-left {
  flex: 1 1 auto;
}

.studio-nav-arrows {
  display: inline-flex;
  gap: 4px;
  flex-shrink: 0;
}

.studio-title-block {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}

.studio-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.studio-title-row strong {
  font-family: var(--font-display);
  font-size: 13.5px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.studio-subtitle {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewport-group {
  display: inline-flex;
  padding: 2px;
  background: var(--bg-slot);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--slot-shadow-top);
}

.vp-btn {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 5px 8px;
  cursor: pointer;
}

.vp-btn:hover {
  color: var(--text);
}

.vp-btn.active {
  background: var(--emerald);
  color: #ffffff;
  box-shadow: inset 1px 1px 0 var(--emerald-bright), inset -1px -1px 0 var(--emerald-dark);
}

.studio-body {
  flex: 1 1 auto;
  display: flex;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.studio-stage {
  flex: 1 1 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0a0c10;
  overflow: auto;
  min-width: 0;
}

.studio-prompt-drawer {
  width: 100%;
  max-height: 220px;
  overflow: auto;
  background: var(--bg-card);
  border-bottom: 2px solid var(--outline);
  padding: 12px 18px;
  flex-shrink: 0;
}

.studio-stage-inner {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  min-height: 0;
}

.studio-frame-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.studio-stage-inner.vp-desktop {
  padding: 16px;
}
.studio-stage-inner.vp-desktop iframe {
  width: 1440px;
  max-width: 100%;
  flex: 1 1 0;
  min-height: 0;
  border: 2px solid var(--border-strong);
  box-shadow: var(--shadow-block);
}

.studio-stage-inner.vp-tablet {
  padding: 16px;
}
.studio-stage-inner.vp-tablet iframe {
  width: 820px;
  max-width: 100%;
  flex: 1 1 0;
  min-height: 0;
  border: 2px solid var(--border-strong);
  box-shadow: var(--shadow-block);
}

.studio-stage-inner.vp-mobile {
  padding: 16px;
}
.studio-stage-inner.vp-mobile iframe {
  width: 390px;
  max-width: 100%;
  flex: 0 1 min(844px, 100%);
  height: min(844px, 100%);
  min-height: 0;
  border: 3px solid var(--border-strong);
  box-shadow: var(--shadow-block);
}

.preview-iframe {
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
  border: 0;
  background: #000;
}

.stage-notice {
  max-width: 580px;
  width: 92%;
  background: var(--bg-card);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -3px 0 var(--bevel-dark), var(--shadow-modal);
  padding: 24px;
  text-align: left;
}

.stage-notice h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 16px;
}

.stage-notice p {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 13.5px;
}

.terminal-log {
  background: #090b0f;
  color: #86ef68;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  padding: 12px;
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.7);
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 12px;
}

/* Pixelated Block Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--emerald-bright);
  border-right-color: var(--star);
  animation: spin 0.75s steps(8, end) infinite;
  display: inline-block;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.studio-hint-bar {
  width: 100%;
  background: var(--bg-elev);
  border-top: 2px solid var(--outline);
  padding: 6px 14px;
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.studio-panel-backdrop {
  display: none;
}

/* Studio Right Rating Panel */
.studio-panel {
  flex: 0 0 380px;
  width: 380px;
  background: var(--bg-elev);
  border-left: 2px solid var(--outline);
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.studio-panel-mobile-head {
  display: none;
}

.panel-section {
  background: var(--bg-card);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -2px 0 var(--bevel-dark);
  padding: 14px;
}

.panel-section h3 {
  margin: 0 0 11px;
  font-family: var(--font-display);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--emerald-text);
}

.big-star-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-slot);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--slot-shadow-top), inset -1px -1px 0 var(--slot-highlight-bot);
  margin-bottom: 8px;
}

.big-star-picker .star-btn {
  min-width: 38px;
  min-height: 38px;
}

.big-star-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}

.big-star-caption strong {
  color: var(--star);
  font-family: var(--font-display);
  font-size: 12px;
}

.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 12px 0 5px;
}

.text-input,
.textarea-input {
  width: 100%;
  background: var(--bg-input);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--slot-shadow-top), inset -1px -1px 0 var(--slot-highlight-bot);
  padding: 9px 11px;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
}

.text-input:focus,
.textarea-input:focus {
  border-color: var(--emerald-bright);
}

.textarea-input {
  min-height: 78px;
  resize: vertical;
}

.criteria-toggle {
  background: transparent;
  border: 0;
  color: var(--diamond);
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 4px 0;
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.criteria-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 2px solid var(--border);
}

.criteria-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ==================== XP-BAR HISTOGRAM & SCORE BARS ==================== */
.histogram {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.hist-row {
  display: grid;
  grid-template-columns: 32px 1fr 26px;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.hist-bar-track,
.score-bar-track {
  position: relative;
  height: 11px;
  background: var(--bg-slot);
  border: 2px solid var(--outline);
  overflow: hidden;
}

/* Segmented Minecraft XP Bar tick marks */
.hist-bar-track::after,
.score-bar-track::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 10px,
    rgba(0, 0, 0, 0.35) 10px,
    rgba(0, 0, 0, 0.35) 12px
  );
  pointer-events: none;
}

.hist-bar-fill {
  height: 100%;
  background: linear-gradient(180deg, #ffe270 0%, var(--star) 55%, var(--star-dark) 100%);
  transition: width 0.25s steps(12, end);
}

.score-bar-fill {
  height: 100%;
  background: linear-gradient(180deg, #a4ff66 0%, var(--xp) 55%, var(--xp-dark) 100%);
  transition: width 0.25s steps(12, end);
}

.reviews-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.review-item {
  background: var(--bg-slot);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--slot-shadow-top);
  padding: 10px 11px;
  font-size: 13px;
}

.review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.review-comment {
  margin: 5px 0 0;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.review-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
  margin-top: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ==================== COMPARE VIEW ==================== */
.compare-controls {
  background: var(--bg-card);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -3px 0 var(--bevel-dark), var(--shadow-block);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.compare-mobile-switcher {
  display: none;
  gap: 4px;
  padding: 3px;
  background: var(--bg-slot);
  border: 2px solid var(--outline);
  margin-bottom: 12px;
}

.compare-switch-btn {
  flex: 1;
  border: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 11px;
  padding: 7px 8px;
  cursor: pointer;
}

.compare-switch-btn.active {
  background: var(--emerald);
  color: #ffffff;
  border-color: var(--outline);
  box-shadow: inset 2px 2px 0 var(--emerald-bright), inset -2px -2px 0 var(--emerald-dark);
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.compare-pane {
  background: var(--bg-card);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -3px 0 var(--bevel-dark), var(--shadow-block);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.compare-pane-head {
  padding: 10px 14px;
  background: var(--bg-subtle);
  border-bottom: 2px solid var(--outline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.compare-pane-head strong {
  font-family: var(--font-display);
  font-size: 13px;
}

.compare-frame-wrap {
  height: clamp(440px, 60vh, 680px);
  background: #090b0f;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compare-pane-footer {
  padding: 12px 14px;
  border-top: 2px solid var(--outline);
  background: var(--bg-elev);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==================== LEADERBOARD ==================== */
.leaderboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.table-card {
  background: var(--bg-card);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -3px 0 var(--bevel-dark), var(--shadow-block);
  overflow: hidden;
}

.table-card-head {
  padding: 14px 18px;
  background: var(--bg-subtle);
  border-bottom: 2px solid var(--outline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.table-card-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14.5px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  background: var(--bg-slot);
  border-bottom: 2px solid var(--outline);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: var(--bg-card-hover);
}

/* Minecraft Ore Rank Blocks */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  background: var(--bg-slot);
  color: var(--text-muted);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -2px 0 var(--bevel-dark);
}

/* Gold Block */
.rank-1 {
  background: linear-gradient(135deg, #ffe26a, #f2a911);
  color: #2b1a00;
  box-shadow: inset 2px 2px 0 #fff4b8, inset -2px -2px 0 #9c6200;
}

/* Diamond Block */
.rank-2 {
  background: linear-gradient(135deg, #74f7ea, #24bfb2);
  color: #032c29;
  box-shadow: inset 2px 2px 0 #c2fff8, inset -2px -2px 0 #106b63;
}

/* Copper Block */
.rank-3 {
  background: linear-gradient(135deg, #f09565, #c95f2e);
  color: #2c1003;
  box-shadow: inset 2px 2px 0 #ffc7a8, inset -2px -2px 0 #783211;
}

.score-bar-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 185px;
}

.score-bar-track {
  flex: 1;
}

/* ==================== MODAL & ADVANCEMENT TOAST ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 8, 12, 0.78);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-card {
  background: var(--bg-elev);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--bevel-light), inset -2px -3px 0 var(--bevel-dark), var(--shadow-modal);
  width: 100%;
  max-width: 760px;
  max-height: 88vh;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  padding: 13px 18px;
  background: var(--bg-subtle);
  border-bottom: 2px solid var(--outline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1.3;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
}

.modal-foot {
  padding: 12px 18px;
  background: var(--bg-subtle);
  border-top: 2px solid var(--outline);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.doc-pre {
  background: var(--bg-slot);
  border: 2px solid var(--outline);
  box-shadow: inset 2px 2px 0 var(--slot-shadow-top);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 360px;
  overflow: auto;
  line-height: 1.55;
}

.asset-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  gap: 12px;
  margin-top: 12px;
}

.asset-thumb {
  background: var(--bg-slot);
  border: 2px solid var(--outline);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.1s ease;
}

.asset-thumb:hover {
  border-color: var(--emerald-bright);
}

.asset-thumb img {
  width: 100%;
  height: 150px;
  object-fit: contain;
  background: #0a0c10;
  border: 1px solid var(--border);
}

/* Minecraft Advancement Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: calc(100vw - 32px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 2px solid var(--outline);
  box-shadow:
    inset 0 0 0 2px var(--border-strong),
    0 4px 0 var(--outline),
    0 12px 28px rgba(0, 0, 0, 0.45);
  color: var(--text);
  padding: 11px 15px;
  font-size: 13px;
  animation: toastSlideIn 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

.toast-icon {
  width: 28px;
  height: 28px;
  background: var(--bg-slot);
  border: 2px solid var(--outline);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--star);
  flex-shrink: 0;
}

.toast-content {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  min-width: 0;
}

.toast-title {
  font-family: var(--font-display);
  font-size: 10.5px;
  color: var(--star);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.toast-msg {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==========================================================================
   RESPONSIVE OPTIMIZATION FOR ALL SCREEN SIZES
   ========================================================================== */

/* Small Laptop / Compact Desktop (<= 1220px) */
@media (max-width: 1220px) {
  .topbar-inner {
    padding: 8px 14px;
    gap: 8px;
  }
  .search-box {
    width: 175px;
  }
  .search-box:focus-within {
    width: 210px;
  }
  .bench-layout {
    grid-template-columns: 244px minmax(0, 1fr);
    gap: 18px;
  }
  .studio-panel {
    flex: 0 0 340px;
    width: 340px;
  }
}

/* Tablet Landscape & Portrait (<= 1024px) */
@media (max-width: 1024px) {
  .topbar-inner {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .topbar-left {
    flex: 1 1 auto;
  }
  .topbar-right {
    flex: 1 1 auto;
    justify-content: flex-end;
  }
  .search-box {
    flex: 1 1 180px;
    max-width: 280px;
  }
  .search-box:focus-within {
    width: auto;
  }

  .main-content {
    padding: 18px 16px 56px;
  }

  /* Sidebar becomes a sleek Horizontal Benchmark Hotbar Strip */
  .bench-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .sidebar {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
    gap: 8px;
    scrollbar-width: thin;
  }
  .sidebar-heading {
    display: none;
  }
  .sidebar-item {
    min-width: 190px;
    max-width: 230px;
    flex: 0 0 auto;
    scroll-snap-align: start;
    padding: 9px 11px;
  }

  /* KPIs become clean 2x2 grid */
  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Compare view becomes stackable + mobile switcher enabled */
  .compare-mobile-switcher {
    display: flex;
  }
  .compare-grid {
    grid-template-columns: 1fr;
  }
  .compare-grid.mode-left .compare-pane[data-pane='right'],
  .compare-grid.mode-right .compare-pane[data-pane='left'] {
    display: none;
  }
  .compare-frame-wrap {
    height: clamp(360px, 56vh, 520px);
  }
}

/* Studio Drawer Switch for Narrow Tablets & Mobile (<= 900px) */
@media (max-width: 900px) {
  .studio-panel-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 15;
    background: rgba(6, 8, 12, 0.65);
  }
  .studio-panel-backdrop.hidden {
    display: none !important;
  }
  .studio-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    width: 100%;
    flex: none;
    max-height: 78dvh;
    border-left: 0;
    border-top: 3px solid var(--emerald-bright);
    box-shadow: 0 -10px 36px rgba(0, 0, 0, 0.65);
    padding: 14px 14px calc(18px + env(safe-area-inset-bottom));
    animation: sheetUp 0.18s ease;
  }
  .studio-panel-mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
  }
  .studio-panel-mobile-head strong {
    font-family: var(--font-display);
    font-size: 12.5px;
    color: var(--star);
  }
  @keyframes sheetUp {
    from {
      transform: translateY(24px);
      opacity: 0.6;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
}

/* Mobile Phones (<= 767px) — Bedrock Hotbar Navigation */
@media (max-width: 767px) {
  /* Disable backdrop-filter on mobile so it does not trap position:fixed .main-nav inside .topbar */
  .topbar {
    backdrop-filter: none;
    background: var(--bg-elev);
  }

  .topbar-inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      'brand actions'
      'search search';
    align-items: center;
    padding: 8px 12px;
    gap: 8px;
  }

  .topbar-left,
  .topbar-right {
    display: contents;
  }

  .brand {
    grid-area: brand;
    padding: 2px 4px 2px 0;
  }

  .topbar-actions {
    grid-area: actions;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: nowrap;
  }

  .pill-btn {
    height: 34px;
    padding: 0 9px;
    font-size: 12px;
  }

  .pill-label {
    display: none;
  }

  .pill-label-keep {
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .search-box {
    grid-area: search;
    width: 100%;
    max-width: none;
    height: 38px;
  }

  .search-box kbd {
    display: none;
  }

  /* Fixed Bottom Minecraft Hotbar for Primary Views */
  .main-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 65;
    margin: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--bg-elev);
    border: 0;
    border-top: 2px solid var(--outline);
    box-shadow: inset 0 2px 0 var(--bevel-light), 0 -4px 18px rgba(0, 0, 0, 0.45);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .nav-tab {
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 7px 4px;
    font-size: 9.5px;
    min-height: 48px;
    background: var(--bg-slot);
    border: 2px solid var(--outline);
    box-shadow: inset 2px 2px 0 var(--slot-shadow-top);
  }

  .nav-tab.active {
    background: var(--emerald);
    border-color: #ffffff;
    box-shadow: inset 2px 2px 0 var(--emerald-bright), inset -2px -2px 0 var(--emerald-dark);
  }

  .main-content {
    padding: 14px 12px calc(var(--mobile-nav-h) + 28px + env(safe-area-inset-bottom));
  }

  .hero-banner {
    padding: 16px 14px;
    margin-bottom: 14px;
  }

  .hero-banner.hero-compact {
    padding: 14px;
  }

  .hero-top .toolbar-group {
    width: 100%;
  }

  .hero-top .toolbar-group .btn {
    flex: 1 1 auto;
  }

  .kpi-row {
    gap: 8px;
    margin-top: 14px;
  }

  .kpi-card {
    padding: 10px 11px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .toolbar-group {
    width: 100%;
  }

  .select-input,
  .checkbox-pill {
    flex: 1 1 auto;
    min-height: 38px;
  }

  /* Touch-friendly stars on mobile */
  .star-btn {
    min-width: 34px;
    min-height: 34px;
  }

  .star-hover-label {
    margin-left: 2px;
    flex-basis: 100%;
    margin-top: 2px;
  }

  /* Studio mobile cleanup */
  .studio-bar {
    padding: 8px 10px;
    gap: 6px;
  }
  .viewport-group,
  .studio-subtitle,
  .studio-hint-bar {
    display: none;
  }
  .studio-bar-right {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  .studio-bar-right .btn-sm {
    flex: 1 1 auto;
    padding: 0 8px;
  }

  /* Compare mobile cleanup */
  .compare-controls {
    padding: 12px;
  }
  .compare-controls .toolbar-group {
    width: 100%;
  }
  .compare-controls .select-input {
    width: 100%;
  }

  /* Toast sits cleanly above the bottom hotbar */
  .toast-container {
    bottom: calc(var(--mobile-nav-h) + 14px + env(safe-area-inset-bottom));
    right: 12px;
    left: 12px;
    max-width: none;
  }

  .modal-backdrop {
    padding: 10px;
    align-items: flex-end;
  }
  .modal-card {
    max-height: 90dvh;
  }

  /* Responsive Stacked Leaderboard Cards on Mobile */
  .data-table thead {
    display: none;
  }
  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }
  .data-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }
  .data-table tr {
    background: var(--bg-slot);
    border: 2px solid var(--outline);
    box-shadow: inset 2px 2px 0 var(--slot-shadow-top);
    padding: 10px 12px;
  }
  .data-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    text-align: right;
  }
  .data-table td:last-child {
    border-bottom: 0;
    padding-bottom: 2px;
  }
  .data-table td::before {
    content: attr(data-label);
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-dim);
    text-align: left;
    flex-shrink: 0;
  }
  .data-table td.td-no-label::before {
    display: none;
  }
  .data-table td.td-action {
    justify-content: flex-end;
    padding-top: 10px;
  }
  .score-bar-cell {
    min-width: 0;
    flex: 1;
    justify-content: flex-end;
  }
  .score-bar-track {
    max-width: 120px;
  }
}

/* Extra-Small Phones (<= 400px) */
@media (max-width: 400px) {
  .brand-text small {
    display: none;
  }
  .brand-text strong {
    font-size: 13.5px;
  }
  .btn-text-hide-xs {
    display: none;
  }
  .pill-label-keep {
    display: none;
  }
  .big-star-picker {
    padding: 6px;
  }
  .big-star-picker .star-btn {
    min-width: 34px;
    min-height: 34px;
  }
}

/* ==================== GLOBAL PROTECTION & TURNSTILE ==================== */
.vote-shield-note {
  margin-top: 10px;
  padding: 7px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  color: var(--emerald-text);
  background: var(--emerald-soft);
  border: 1px solid var(--emerald-dark);
  text-align: center;
}

.review-item-mine {
  border-color: var(--emerald-dark);
}

.turnstile-slot {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
}
