:root {
  --bg-canvas: #080C14;
  --bg-surface: #0F1624;
  --bg-elevated: #151E30;
  --bg-input: #0B111D;
  --border-subtle: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.24);
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --accent: #FF1733;
  --accent-2: #FF4D6D;
  --accent-hover: #E0142D;
  --accent-soft: rgba(255, 23, 51, 0.14);
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius-sm: 7px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-canvas);
  background-image:
    radial-gradient(ellipse 70% 45% at 18% -8%, rgba(255, 23, 51, 0.11), transparent 60%),
    radial-gradient(ellipse 60% 45% at 88% 0%, rgba(56, 189, 248, 0.07), transparent 55%);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Custom Sleek Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 22, 36, 0.4);
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.22);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.38);
}

.hidden {
  display: none !important;
}

code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.07);
  padding: 2px 6px;
  border-radius: 5px;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.num {
  font-variant-numeric: tabular-nums;
}

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

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes mcGlint {
  0% { background-position: -140% -140%; }
  100% { background-position: 240% 240%; }
}

.view-animate {
  animation: viewEnter 0.22s var(--ease);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 15px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.14s var(--ease), background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
  white-space: nowrap;
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.985);
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.btn-sm {
  height: 31px;
  padding: 0 11px;
  font-size: 12px;
}

.btn-full {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, #FF1733 0%, #E11D48 100%);
  color: #FFFFFF;
  box-shadow: 0 2px 12px rgba(255, 23, 51, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #FF2A44 0%, #F43F5E 100%);
  box-shadow: 0 4px 18px rgba(255, 23, 51, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-secondary {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.85) 0%, rgba(21, 30, 48, 0.95) 100%);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: linear-gradient(180deg, rgba(38, 51, 74, 0.95) 0%, rgba(27, 38, 59, 1) 100%);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.13);
  border-color: rgba(239, 68, 68, 0.34);
  color: #FCA5A5;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.24);
  border-color: rgba(239, 68, 68, 0.55);
  color: #FFFFFF;
}

/* Inputs */
input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 8px 11px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(255, 23, 51, 0.72);
  box-shadow: 0 0 0 3px rgba(255, 23, 51, 0.14);
}

textarea.code-area {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  min-height: 500px;
  resize: vertical;
  tab-size: 2;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.field-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

/* Auth Screen */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 25% 15%, rgba(255, 23, 51, 0.14), transparent 45%),
    radial-gradient(circle at 80% 85%, rgba(56, 189, 248, 0.1), transparent 45%),
    var(--bg-canvas);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, rgba(19, 27, 44, 0.96) 0%, rgba(13, 19, 32, 0.98) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  animation: viewEnter 0.3s var(--ease);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, #FF1733 0%, #FF4D6D 100%);
  color: #FFFFFF;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(255, 23, 51, 0.35);
}

.brand-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.notice-banner {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.32);
  color: #FDE68A;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  margin-bottom: 16px;
}

.form-error {
  background: rgba(239, 68, 68, 0.13);
  border: 1px solid rgba(239, 68, 68, 0.38);
  color: #FCA5A5;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

/* App Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(15, 22, 36, 0.96) 0%, rgba(10, 15, 26, 0.98) 100%);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 16px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-host {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.nav-list {
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s var(--ease);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-primary);
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(255, 23, 51, 0.18) 0%, rgba(255, 23, 51, 0.05) 100%);
  border-color: rgba(255, 23, 51, 0.3);
  color: #FFFFFF;
}

.nav-item.active svg {
  color: var(--accent-2);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(8, 12, 20, 0.45);
}

.sidebar-user {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-user-label {
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-user strong {
  font-size: 13px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 60px;
  padding: 0 24px;
  background: rgba(12, 18, 30, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.view-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-only {
  display: none;
}

/* Full-width productive canvas — eliminates wasted dark margins */
.view-container {
  padding: 20px 24px 28px;
  width: 100%;
  max-width: 100%;
}

/* Panels */
.panel {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.92) 0%, rgba(13, 19, 32, 0.96) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
}

.panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
}

.panel-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.panel-body {
  padding: 18px;
}

.section-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* KPI Strip with refined top highlight */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(22, 31, 49, 0.95) 0%, rgba(13, 19, 32, 0.98) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 17px 18px;
  transition: transform 0.18s var(--ease), border-color 0.18s ease, box-shadow 0.18s ease;
}

.kpi-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, rgba(255, 77, 109, 0.3) 65%, transparent 100%);
  opacity: 0.7;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
}

.kpi-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.kpi-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
}

/* Player Avatars */
.player-cell {
  display: flex;
  align-items: center;
  gap: 11px;
}

.player-avatar {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  image-rendering: pixelated;
  background: #1E293B;
  border: 1px solid rgba(255, 255, 255, 0.14);
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.player-avatar.lg {
  width: 44px;
  height: 44px;
  border-radius: 7px;
}

.player-avatar.xs {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  border: none;
}

.avatar-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.avatar-status {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}

.avatar-status.online { background: var(--success); }
.avatar-status.offline { background: var(--text-muted); }

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table th.sortable {
  cursor: pointer;
}

.data-table th.sortable:hover {
  color: var(--text-primary);
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background-color 0.12s ease;
}

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

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: middle;
}

.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--text-muted); }

/* Split Editor Layout */
.split-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.file-list {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

.file-list-search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, padding-left 0.12s ease;
}

.file-item:last-child {
  border-bottom: none;
}

.file-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.file-item.active {
  background: linear-gradient(90deg, rgba(255, 23, 51, 0.2) 0%, rgba(255, 23, 51, 0.05) 100%);
  color: #FFFFFF;
  padding-left: 17px;
}

/* Tabs */
.tab-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 16px;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  padding: 12px 14px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.14s ease, border-color 0.14s ease;
}

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

.tab-btn.active {
  color: #FFFFFF;
  border-bottom-color: var(--accent);
}

.segmented {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.segmented button {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.segmented button.active {
  background: var(--bg-elevated);
  color: #FFFFFF;
}

/* Grid helpers */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.spacer {
  flex: 1;
}

/* Console command bar */
.console-bar {
  display: flex;
  gap: 10px;
}

.console-bar input {
  font-family: var(--font-mono);
}

/* Interactive Variable Chips */
.var-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.var-chip {
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: #CBD5E1;
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 4px 9px;
  border-radius: 5px;
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
}

.var-chip:hover {
  border-color: var(--accent);
  background: rgba(255, 23, 51, 0.12);
  color: #FFFFFF;
}

.var-chip.active {
  border-color: var(--accent);
  background: rgba(255, 23, 51, 0.22);
  color: #FFFFFF;
}

/* =========================================================================
   AUTHENTIC MINECRAFT CHEST INVENTORY UI
   ========================================================================= */
.chest-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 20px;
  align-items: start;
}

.mc-chest-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 23, 51, 0.08), transparent 65%),
    rgba(6, 9, 16, 0.72);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

/* Classic Minecraft #C6C6C6 Beveled Chest Container */
.mc-chest-frame {
  width: 100%;
  max-width: 530px;
  background: #C6C6C6;
  border: 2px solid #000000;
  border-radius: 4px;
  box-shadow:
    inset 3px 3px 0 #FFFFFF,
    inset -3px -3px 0 #555555,
    0 18px 42px rgba(0, 0, 0, 0.6);
  padding: 12px 14px 14px;
  user-select: none;
}

.mc-chest-header {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  color: #FFFFFF;
  margin-bottom: 8px;
  padding: 0 2px;
  line-height: 1.3;
  text-shadow: 1.5px 1.5px 0 #000000;
}

.mc-chest-slots {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 0;
  border-top: 1px solid #373737;
  border-left: 1px solid #373737;
}

.mc-chest-slots.is-dispenser {
  grid-template-columns: repeat(3, 1fr);
  max-width: 192px;
  margin: 0 auto;
}

.mc-chest-slots.is-hopper {
  grid-template-columns: repeat(5, 1fr);
  max-width: 320px;
  margin: 0 auto;
}

/* Classic Recessed 3D Minecraft Inventory Slot */
.mc-inv-slot {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #8B8B8B;
  border: none;
  box-shadow:
    inset 2px 2px 0 #373737,
    inset -2px -2px 0 #FFFFFF;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: filter 0.08s ease;
}

.mc-inv-slot:hover::after {
  content: '';
  position: absolute;
  inset: 2px;
  background: rgba(255, 255, 255, 0.38);
  pointer-events: none;
  z-index: 4;
}

.mc-inv-slot.selected {
  box-shadow:
    inset 2px 2px 0 #FF1733,
    inset -2px -2px 0 #FF1733,
    inset 0 0 0 3px rgba(255, 23, 51, 0.45);
  z-index: 2;
}

.mc-inv-slot.dynamic-slot {
  background: #7A828F;
}

.mc-inv-slot-idx {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.62);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.85);
  pointer-events: none;
  z-index: 3;
}

.mc-inv-slot.is-filler .mc-inv-slot-idx {
  opacity: 0.4;
}

.mc-item-tex {
  width: 72%;
  height: 72%;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(1px 2px 0 rgba(0, 0, 0, 0.35));
}

.mc-item-tex.filler-tex {
  opacity: 0.55;
  width: 68%;
  height: 68%;
}

.mc-item-tex.dynamic-tex {
  opacity: 0.85;
}

.mc-item-glint {
  position: absolute;
  inset: 3px;
  background: linear-gradient(125deg, transparent 25%, rgba(192, 108, 255, 0.42) 50%, transparent 75%);
  background-size: 240% 240%;
  animation: mcGlint 2.6s linear infinite;
  pointer-events: none;
  z-index: 3;
  mix-blend-mode: screen;
}

.mc-item-fallback {
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  color: #FFFFFF;
  text-shadow: 1px 1px 0 #000000;
  text-align: center;
  line-height: 1.05;
  padding: 2px;
  max-width: 92%;
  overflow: hidden;
  z-index: 2;
}

/* Floating Cursor-Following Minecraft Hover Tooltip */
.mc-floating-tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 120;
  max-width: 340px;
}

/* Authentic Minecraft Dark Purple Tooltip */
.mc-tooltip {
  background: rgba(16, 0, 16, 0.95);
  border: 2px solid #2A0859;
  box-shadow: inset 0 0 0 1px #5000FF, 0 10px 28px rgba(0, 0, 0, 0.65);
  border-radius: 4px;
  padding: 9px 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.48;
  color: #FFFFFF;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.85);
  word-break: break-word;
}

.mc-tooltip-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.mc-tooltip-icon {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  object-fit: contain;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 2px;
}

.mc-tooltip-name {
  margin-bottom: 4px;
}

.mc-tooltip-line {
  min-height: 1.2em;
}

/* Authentic Minecraft Scoreboard Preview */
.mc-scoreboard {
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 6px;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  width: 100%;
  max-width: 340px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.88);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.mc-scoreboard-title {
  text-align: center;
  margin-bottom: 6px;
}

/* Authentic Minecraft Tablist Preview */
.mc-tablist {
  background: rgba(0, 0, 0, 0.68);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  text-align: center;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.88);
}

.mc-tablist-players {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 12px auto;
  max-width: 410px;
}

.mc-tablist-row {
  background: rgba(255, 255, 255, 0.09);
  padding: 5px 8px;
  text-align: left;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mc-tablist-row-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

/* Chat / Actionbar / Title Preview */
.mc-chat-preview {
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 9px 13px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.48;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.88);
}

/* Item Template Split */
.item-editor-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

/* Message Row */
.msg-row {
  padding: 13px 0;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.msg-row:last-child {
  border-bottom: none;
}

.msg-key {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* Player Detail Header */
.player-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.player-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.player-identity h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
}

.player-uuid {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 13, 0.78);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
}

.modal-dialog {
  width: 100%;
  max-width: 450px;
  background: linear-gradient(180deg, #161F31 0%, #0F1624 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  animation: toastIn 0.18s var(--ease);
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
}

.modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Toast notifications */
.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 140;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.toast {
  background: linear-gradient(180deg, #1A2438 0%, #131B2C 100%);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 11px 15px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.2s var(--ease);
}

.toast.success {
  border-color: rgba(34, 197, 94, 0.55);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.65);
  color: #FECACA;
}

.empty-state {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* =========================================================================
   HOLOGRAMS & NPCS STUDIO STAGE & LIST ITEMS
   ========================================================================= */
.display-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.display-stage {
  position: relative;
  min-height: 290px;
  padding: 24px 18px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background:
    radial-gradient(circle at 50% 24%, rgba(92, 225, 230, 0.12), transparent 62%),
    radial-gradient(circle at 50% 82%, rgba(255, 23, 51, 0.09), transparent 58%),
    linear-gradient(180deg, #090E18 0%, #0D1424 65%, #111A2E 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.display-stage::after {
  content: '';
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.55) 0%, transparent 72%);
  pointer-events: none;
}

.holo-preview-box {
  position: relative;
  z-index: 2;
  max-width: 100%;
  padding: 8px 14px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.42;
  text-align: center;
  word-break: break-word;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.16s ease, transform 0.16s ease;
}

.holo-preview-box.has-shadow {
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.88);
}

.holo-preview-box.align-left {
  text-align: left;
}

.holo-preview-box.align-right {
  text-align: right;
}

.display-visual-holder {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 84px;
}

.display-floating-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.55));
}

.display-floating-icon.spinning {
  animation: displayFloatSpin 3.4s ease-in-out infinite;
}

.npc-skin-body {
  height: 126px;
  width: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.65));
}

.npc-mob-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-primary);
}

@keyframes displayFloatSpin {
  0%, 100% {
    transform: translateY(0px) scale(1);
  }
  50% {
    transform: translateY(-7px) scale(1.04);
  }
}

.display-list-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.display-list-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.display-list-item.active {
  background: linear-gradient(90deg, rgba(255, 23, 51, 0.18), rgba(255, 23, 51, 0.05));
  border-color: rgba(255, 23, 51, 0.42);
  color: #FFFFFF;
}

.display-list-item.is-disabled {
  opacity: 0.52;
}

.display-thumb {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(10, 15, 26, 0.85);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.display-thumb img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
}

.display-thumb-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.display-thumb-title {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.display-thumb-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.display-type-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(92, 225, 230, 0.12);
  border: 1px solid rgba(92, 225, 230, 0.28);
  color: #93EBF0;
  flex-shrink: 0;
}

.display-type-tag.npc-player {
  background: rgba(168, 85, 247, 0.14);
  border-color: rgba(168, 85, 247, 0.34);
  color: #D8B4FE;
}

.display-type-tag.npc-mob {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.32);
  color: #FDE68A;
}

.coord-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(11, 16, 27, 0.72);
  border: 1px solid var(--border-subtle);
}

.form-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.stage-meta-strip {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  z-index: 2;
}

/* Regions & Warps + Interactive Entities Helpers */
.category-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.category-chip {
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.category-chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.category-chip.active {
  background: rgba(255, 23, 51, 0.18);
  border-color: rgba(255, 23, 51, 0.5);
  color: #FFFFFF;
}

.placeholder-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.placeholder-chip {
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid rgba(92, 225, 230, 0.28);
  background: rgba(92, 225, 230, 0.09);
  color: #93EBF0;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.placeholder-chip:hover {
  background: rgba(92, 225, 230, 0.22);
  border-color: rgba(92, 225, 230, 0.55);
}

.color-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-input-row input[type="color"] {
  width: 38px;
  height: 36px;
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: rgba(11, 16, 27, 0.8);
  cursor: pointer;
  flex-shrink: 0;
}

.color-swatch-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.color-swatch-btn {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s ease, border-color 0.1s ease;
}

.color-swatch-btn:hover {
  transform: scale(1.14);
  border-color: #FFFFFF;
}

.warp-preview-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 18px;
  background:
    radial-gradient(circle at 28% 50%, rgba(92, 225, 230, 0.12), transparent 55%),
    linear-gradient(180deg, #090E18 0%, #0E1525 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
}

.warp-icon-showcase {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.warp-icon-showcase img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
}

.extra-template-card {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(11, 16, 27, 0.65);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Responsive */
@media (max-width: 1160px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chest-editor-grid,
  .item-editor-split,
  .display-editor-grid {
    grid-template-columns: 1fr;
  }
  .split-layout {
    grid-template-columns: 1fr;
  }
  .file-list {
    max-height: 220px;
  }
}

@media (max-width: 820px) {
  .sidebar {
    position: fixed;
    left: -260px;
    z-index: 50;
    transition: left 0.2s var(--ease);
  }
  .sidebar.open {
    left: 0;
  }
  .mobile-only {
    display: inline-flex;
  }
  .form-grid-2,
  .form-grid-3,
  .form-grid-4,
  .form-grid-5 {
    grid-template-columns: 1fr;
  }
  .view-container {
    padding: 16px;
  }
}

:focus-visible {
  outline: 2px solid rgba(255, 23, 51, 0.85);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
