/* ═══════════════════════════════════════════════
   MineScope — Design System v2
   IBM Plex Sans + IBM Plex Mono
   Industrial dark · animated
═══════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────── */
:root {
  --bg:             #060a0f;
  --surface:        #0b1018;
  --panel:          #0f1520;
  --panel-alt:      #141d2e;
  --input-bg:       #080d15;
  --border:         #1a2336;
  --border-hi:      #243048;
  --text:           #dce4f0;
  --muted:          #6e80a0;
  --faint:          #35455c;
  --accent:         #3b82f6;
  --accent-bright:  #60a5fa;
  --accent-dim:     rgba(59,130,246,0.1);
  --accent-glow:    rgba(59,130,246,0.25);
  --accent-border:  rgba(59,130,246,0.3);
  --green:          #34d399;
  --green-dim:      rgba(52,211,153,0.08);
  --red:            #f87171;
  --red-dim:        rgba(248,113,113,0.08);
  --mono:           'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans:           'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;
  --radius:         3px;
}

/* ── Reset ─────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

h1, h2, h3, h4, p { margin-top: 0; }

/* ── Keyframe library ──────────────────────── */

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

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes brandPulse {
  0%, 100% { text-shadow: 0 0 8px rgba(59,130,246,0.5), 0 0 20px rgba(59,130,246,0.2); }
  50%       { text-shadow: 0 0 14px rgba(59,130,246,0.9), 0 0 32px rgba(59,130,246,0.35); }
}

@keyframes scanlineMove {
  from { left: -100%; }
  to   { left: 200%; }
}

@keyframes statusPing {
  0%   { transform: scale(1);   opacity: 0.9; }
  70%  { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

@keyframes topbarReveal {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes sidebarSlide {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

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

@keyframes glow-rotate {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes statusBlink {
  0%, 80%, 100% { opacity: 1; }
  40%           { opacity: 0.3; }
}

@keyframes nbtNodeIn {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

/* ── Background layers ─────────────────────── */

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle, rgba(59,130,246,0.055) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: 0 0;
  opacity: 0.7;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 0%, transparent 100%);
}

.bg-glow {
  position: fixed;
  top: -200px;
  left: 50%;
  width: 900px;
  height: 500px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(59,130,246,0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  animation: fadeIn 1.2s ease forwards;
}

/* ── Wrap ──────────────────────────────────── */
.wrap {
  width: min(1640px, calc(100% - 2.5rem));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ── Topbar ────────────────────────────────── */

.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(11, 16, 24, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: hidden;
  animation: topbarReveal 0.5s ease forwards;
}

/* Accent line at top of topbar */
.topbar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 40%, var(--accent-bright) 50%, var(--accent) 60%, transparent 100%);
  opacity: 0.6;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
}

/* Moving scan line across topbar */
.topbar-scanline {
  position: absolute;
  top: 0; bottom: 0;
  width: 60px;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,0.12), transparent);
  animation: scanlineMove 3.5s ease-in-out 0.8s 1 forwards;
  pointer-events: none;
}

/* ── Brand ─────────────────────────────────── */

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
}

.brand-mark {
  color: var(--accent-bright);
  font-size: 1rem;
  line-height: 1;
  animation: brandPulse 3s ease-in-out infinite;
  display: inline-block;
}

.brand-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
  letter-spacing: 0.03em;
}

.brand-sep { color: var(--faint); font-size: 0.85rem; }

.brand-sub {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
}

/* Topbar right */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.topbar-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  position: relative;
  flex-shrink: 0;
}

.topbar-status-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--green);
  animation: statusPing 2.5s ease-out infinite;
}

.topbar-status-text {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--green);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.build-tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--faint);
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 200ms ease, color 200ms ease;
}

.build-tag:hover { border-color: var(--border-hi); color: var(--muted); }

/* ── Main grid ─────────────────────────────── */

.main-grid {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 0;
  padding-bottom: 3rem;
  min-height: calc(100vh - 48px);
}

/* ── Sidebar ───────────────────────────────── */

.sidebar {
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  align-self: start;
  position: sticky;
  top: 48px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: rgba(9,13,21,0.5);
  animation: sidebarSlide 0.45s ease 0.15s both;
}

.sidebar-section-label {
  font-family: var(--mono);
  font-size: 0.67rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 0 1.25rem 0.65rem;
}

.tool-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* Stagger sidebar links on load */
.tool-link:nth-child(1) { animation: fadeIn 0.3s ease 0.25s both; }
.tool-link:nth-child(2) { animation: fadeIn 0.3s ease 0.32s both; }
.tool-link:nth-child(3) { animation: fadeIn 0.3s ease 0.39s both; }
.tool-link:nth-child(4) { animation: fadeIn 0.3s ease 0.46s both; }
.tool-link:nth-child(5) { animation: fadeIn 0.3s ease 0.53s both; }

.tool-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  padding: 0.65rem 1.25rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 400;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
  position: relative;
  overflow: hidden;
}

/* Hover shimmer */
.tool-link::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,0.06), transparent);
  transform: translateX(-100%);
  transition: none;
}

.tool-link:hover::after {
  animation: shimmerSweep 0.5s ease forwards;
}

.tool-link:hover {
  color: var(--text);
  background: rgba(59,130,246,0.04);
  border-color: var(--border-hi);
  transform: none;
}

.tool-link.active {
  color: var(--text);
  background: rgba(59,130,246,0.07);
  border-left-color: var(--accent);
  font-weight: 500;
  box-shadow: inset 0 0 20px rgba(59,130,246,0.06);
}

.tool-link-icon {
  font-size: 0.78rem;
  color: var(--faint);
  min-width: 1rem;
  text-align: center;
  line-height: 1;
  transition: color 140ms ease, text-shadow 140ms ease;
}

.tool-link.active .tool-link-icon {
  color: var(--accent-bright);
  text-shadow: 0 0 8px rgba(96,165,250,0.5);
}

.tool-link:hover .tool-link-icon { color: var(--muted); }

/* ── Content stack ─────────────────────────── */

.content-stack {
  padding: 2rem 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  animation: fadeUp 0.5s ease 0.2s both;
}

.tool-panel { display: none; }

.tool-panel.active {
  display: block;
  animation: panelIn 0.3s ease forwards;
}

/* ── Panel structure ───────────────────────── */

.panel-header {
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  position: relative;
}

/* Decorative left accent on panel header */
.panel-header::before {
  content: '';
  position: absolute;
  left: -2.25rem;
  top: 0.15rem;
  bottom: 1.25rem;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), transparent);
  opacity: 0.5;
}

.panel-title-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.panel-title-row h2 {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
  margin: 0;
}

.panel-desc {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0;
  line-height: 1.55;
}

.panel-desc code,
code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--panel-alt);
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  color: var(--accent-bright);
}

/* ── Form elements ─────────────────────────── */

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
  min-width: 180px;
}

.field-narrow { flex: 0 0 160px; min-width: 0; }
.field-actions { flex: 0 0 auto; }

.field-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

input,
select,
textarea {
  font: inherit;
  font-size: 0.875rem;
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.6rem 0.75rem;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
  appearance: none;
  -webkit-appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%236e80a0' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  padding-right: 2rem;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(59,130,246,0.5);
  background: var(--panel);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1), 0 0 12px rgba(59,130,246,0.05);
}

input[type="file"] {
  padding: 0.5rem 0.6rem;
  color: var(--muted);
  cursor: pointer;
}

input[type="file"]::-webkit-file-upload-button {
  font: inherit;
  font-size: 0.78rem;
  font-family: var(--mono);
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  margin-right: 0.6rem;
  transition: border-color 140ms ease;
}

input[type="file"]:hover::-webkit-file-upload-button {
  border-color: var(--accent-border);
}

input[type="search"] { font-size: 0.82rem; }
textarea { resize: vertical; }

/* ── Buttons ───────────────────────────────── */

button { font: inherit; cursor: pointer; transition: all 150ms ease; }

.btn-primary,
.btn-secondary,
.btn-ghost {
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.03em;
  white-space: nowrap;
  padding: 0.6rem 1rem;
  border: 1px solid;
  position: relative;
  overflow: hidden;
  transform: translateZ(0); /* GPU layer for animation perf */
}

/* shimmer sweep on hover for all buttons */
.btn-primary::after,
.btn-secondary::after,
.btn-ghost::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  transform: translateX(-200%);
  transition: none;
}

.btn-primary:hover::after,
.btn-secondary:hover::after,
.btn-ghost:hover::after {
  animation: shimmerSweep 0.45s ease forwards;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 rgba(59,130,246,0);
}

.btn-primary:hover {
  background: #4f92f8;
  border-color: #4f92f8;
  box-shadow: 0 0 16px rgba(59,130,246,0.25), 0 2px 8px rgba(0,0,0,0.3);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 0 6px rgba(59,130,246,0.2);
}

.btn-secondary {
  background: transparent;
  border-color: var(--border-hi);
  color: var(--muted);
}

.btn-secondary:hover {
  border-color: var(--accent-border);
  color: var(--text);
  box-shadow: 0 0 8px rgba(59,130,246,0.1);
  transform: translateY(-1px);
}

.btn-secondary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-hi);
  transform: none;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button:disabled::after { display: none; }

.btn-group { display: flex; gap: 0.5rem; }

/* ── Chips ─────────────────────────────────── */

.chip-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.chip-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chip {
  font-size: 0.76rem;
  font-family: var(--mono);
  padding: 0.25rem 0.65rem;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--muted);
  position: relative;
  overflow: hidden;
  transition: color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.chip:hover {
  border-color: var(--accent-border);
  color: var(--accent-bright);
  box-shadow: 0 0 8px rgba(59,130,246,0.12);
  transform: none;
}

/* ── Status line ───────────────────────────── */

.status-line {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  min-height: 1.2rem;
  margin-bottom: 0.75rem;
  transition: color 200ms ease;
}

/* Blinking cursor when status has text */
.status-line:not(:empty)::after {
  content: '▌';
  animation: statusBlink 1.2s ease infinite;
  margin-left: 2px;
  color: var(--accent);
  font-size: 0.7em;
}

.info-bar {
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-left: 2px solid var(--faint);
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.75rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ── Server status results ─────────────────── */

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-top: 0.5rem;
}

/* Staggered result cards */
.result-card {
  background: var(--panel);
  padding: 0.85rem 1rem;
  transition: background 160ms ease;
  animation: resultIn 0.3s ease both;
}

.result-card:nth-child(1) { animation-delay: 0.00s; }
.result-card:nth-child(2) { animation-delay: 0.04s; }
.result-card:nth-child(3) { animation-delay: 0.08s; }
.result-card:nth-child(4) { animation-delay: 0.12s; }
.result-card:nth-child(5) { animation-delay: 0.16s; }
.result-card:nth-child(6) { animation-delay: 0.20s; }
.result-card:nth-child(7) { animation-delay: 0.24s; }
.result-card:nth-child(8) { animation-delay: 0.28s; }
.result-card:nth-child(9) { animation-delay: 0.32s; }

.result-card:hover { background: var(--panel-alt); }

.result-card h3 {
  font-family: var(--mono);
  font-size: 0.67rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.result-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
  word-break: break-all;
}

.icon-card img {
  image-rendering: pixelated;
  display: block;
  border: 1px solid var(--border);
}

/* Status pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.status-pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green), 0 0 12px rgba(52,211,153,0.3);
  animation: statusPing 2.5s ease-out infinite;
  position: relative;
  flex-shrink: 0;
}

.status-pill.offline::before {
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
  animation: none;
}

/* ── RAM result ────────────────────────────── */

.result-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  padding: 1.25rem 1.5rem;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  animation: panelIn 0.3s ease forwards;
  box-shadow: 0 0 20px rgba(59,130,246,0.05);
}

.result-box h3 {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.65rem;
}

.result-box p { margin: 0 0 0.5rem; }
.result-box p:last-child { margin: 0; }

.result-box strong {
  font-family: var(--mono);
  color: var(--accent-bright);
  font-size: 1.1em;
  text-shadow: 0 0 12px rgba(96,165,250,0.3);
}

.tiny-note {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.65rem;
  line-height: 1.5;
}

/* ── server.properties form ────────────────── */

.prop-group {
  margin-bottom: 1.5rem;
  animation: propGroupIn 0.3s ease both;
}

.prop-group:nth-child(1) { animation-delay: 0.05s; }
.prop-group:nth-child(2) { animation-delay: 0.10s; }
.prop-group:nth-child(3) { animation-delay: 0.15s; }
.prop-group:nth-child(4) { animation-delay: 0.20s; }

.prop-group:last-of-type { margin-bottom: 1rem; }

.prop-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem;
}

.form-footer {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

/* ── Code output ───────────────────────────── */

.code-output {
  display: block;
  width: 100%;
  min-height: 240px;
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.7;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent-bright);
  padding: 1rem;
  white-space: pre;
  resize: vertical;
  animation: fadeIn 0.25s ease forwards;
}

.output-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.footnote {
  font-size: 0.78rem;
  color: var(--faint);
  margin-top: 0.75rem;
  margin-bottom: 0;
  line-height: 1.5;
}

/* ── NBT Controls bar ──────────────────────── */

.nbt-controls {
  background: var(--panel);
  border: 1px solid var(--border);
  border-bottom: none;
  padding: 1rem 1.25rem;
}

.nbt-file-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
}

.nbt-stats-bar {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  flex-wrap: wrap;
  gap: 0;
}

.nbt-stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding-right: 1.25rem;
  margin-right: 1rem;
}

.nbt-stat-sep {
  width: 1px;
  height: 28px;
  background: var(--border);
  margin-right: 1.25rem;
}

.nbt-stat-label {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
}

.nbt-stat-val {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text);
  min-width: 4ch;
  word-break: break-all;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nbt-stat-search {
  margin-left: auto;
  min-width: 220px;
}

.nbt-stat-search input { width: 100%; }

/* ── NBT Workspace ─────────────────────────── */

.nbt-workspace {
  display: grid;
  grid-template-columns: minmax(380px, 1fr) minmax(420px, 1.15fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  align-items: start;
  min-width: 0;
}

.subpanel {
  background: var(--panel);
  min-width: 0;
}

.subpanel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  min-height: 40px;
  flex-wrap: wrap;
  background: var(--panel-alt);
}

.subpanel-title {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.subpanel-actions { display: flex; gap: 0.4rem; }

/* ── NBT Tree ──────────────────────────────── */

.nbt-tree {
  padding: 0.75rem;
  min-height: 640px;
  max-height: calc(100vh - 22rem);
  overflow: auto;
  overflow-x: hidden;
}

.nbt-root,
.nbt-children {
  display: grid;
  gap: 1px;
}

.nbt-node {
  display: grid;
  gap: 1px;
}

.nbt-node-row {
  display: flex;
  align-items: flex-start;
  gap: 0.3rem;
}

.nbt-toggle,
.nbt-spacer {
  width: 22px;
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--input-bg);
  color: var(--muted);
  font-size: 0.6rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.nbt-toggle {
  padding: 0;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.nbt-toggle:hover {
  border-color: rgba(59,130,246,0.5);
  color: var(--accent-bright);
  box-shadow: 0 0 6px rgba(59,130,246,0.15);
  transform: none;
}

.nbt-spacer {
  opacity: 0.2;
  cursor: default;
}

.nbt-select {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  min-width: 0;
  transform: none;
  transition: background 120ms ease, border-color 120ms ease;
}

.nbt-select:hover {
  background: var(--panel-alt);
  border-color: var(--border);
}

.nbt-select.is-selected {
  background: rgba(59,130,246,0.09);
  border-color: rgba(59,130,246,0.35);
  box-shadow: inset 2px 0 0 var(--accent);
}

.nbt-row-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  min-width: 0;
}

.nbt-key {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--text);
  word-break: break-word;
}

.nbt-type {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(59,130,246,0.18);
  border-radius: 2px;
  padding: 0.1rem 0.35rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.nbt-preview {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--muted);
  text-align: left;
  word-break: break-word;
  width: 100%;
  line-height: 1.4;
}

.nbt-children {
  margin-left: 1rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
}

/* ── Inspector ─────────────────────────────── */

.inspector-panel { min-height: 640px; }

.inspector-panel-body {
  padding: 1rem;
  display: grid;
  gap: 0.85rem;
}

.inspector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.inspector-card {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  border-radius: 2px;
  transition: border-color 160ms ease;
}

.inspector-card:hover { border-color: var(--border-hi); }

.inspector-card h4 {
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.inspector-card p {
  margin: 0 0 0.3rem;
  font-size: 0.85rem;
  word-break: break-all;
}

.inspector-card p:last-child { margin: 0; }

.path-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.69rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 0.35rem;
}

.path-code {
  display: block;
  font-family: var(--mono);
  font-size: 0.75rem;
  margin-top: 0.3rem;
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  background: var(--input-bg);
  border-radius: 2px;
  word-break: break-all;
  color: var(--accent-bright);
  line-height: 1.5;
  min-width: 0;
  text-shadow: 0 0 8px rgba(96,165,250,0.2);
}

.nbt-badge {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green);
  background: var(--green-dim);
  border: 1px solid rgba(52,211,153,0.18);
  border-radius: 2px;
  padding: 0.15rem 0.4rem;
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(52,211,153,0.3);
}

.inspector-form {
  display: grid;
  gap: 0.75rem;
}

.inspector-form.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.inline-inputs { display: grid; gap: 0.65rem; }

.inline-inputs.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.container-list {
  margin: 0.35rem 0 0;
  padding-left: 1rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.container-list li + li { margin-top: 0.25rem; }

/* ── Shortcut chips ────────────────────────── */

.shortcut-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.shortcut-grid .chip,
.shortcut-grid .tiny-chip {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: var(--accent-bright);
  font-family: var(--mono);
  cursor: pointer;
}

.shortcut-grid .chip:hover,
.shortcut-grid .tiny-chip:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 10px rgba(59,130,246,0.25);
}

/* Standalone tiny-chip (JS-generated) */
.tiny-chip {
  font-size: 0.72rem;
  font-family: var(--mono);
  padding: 0.22rem 0.55rem;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 2px;
  color: var(--accent-bright);
  cursor: pointer;
  transition: all 130ms ease;
}

.tiny-chip:hover {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 10px rgba(59,130,246,0.25);
  transform: none;
}

/* ── Empty states ──────────────────────────── */

.empty-state-panel {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 1.5rem 1rem;
  /* subtle dashed border texture */
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 6px,
    rgba(255,255,255,0.012) 6px,
    rgba(255,255,255,0.012) 7px
  );
}

/* ── Loading button state ──────────────────── */

@keyframes loadingPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

@keyframes loadingDots {
  0%   { content: 'Checking'; }
  33%  { content: 'Checking.'; }
  66%  { content: 'Checking..'; }
  100% { content: 'Checking...'; }
}

.btn-loading {
  pointer-events: none;
  position: relative;
  color: transparent !important;
  overflow: hidden;
}

/* Animated bar that sweeps across the button */
.btn-loading::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.18) 40%,
    rgba(255,255,255,0.25) 50%,
    rgba(255,255,255,0.18) 60%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: shimmerSweep 1s ease infinite;
}

/* Spinner ring in the centre */
.btn-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spinnerRing 0.7s linear infinite;
  transform: none !important; /* override shimmer */
}

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

/* ── Featured result cards ─────────────────── */

.result-card--featured {
  background: var(--panel-alt);
  border-top: 2px solid var(--accent);
  position: relative;
}

.result-card--featured::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(59,130,246,0.05) 0%, transparent 60%);
  pointer-events: none;
}

.result-card--featured h3 {
  color: var(--accent-bright);
}

.result-card--featured p {
  font-size: 1rem;
  font-weight: 500;
}

/* ── Success flash on output panel ─────────── */

@keyframes flashSuccess {
  0%   { border-color: var(--green); box-shadow: 0 0 0 1px rgba(52,211,153,0.4), 0 0 20px rgba(52,211,153,0.1); }
  60%  { border-color: var(--green); box-shadow: 0 0 0 1px rgba(52,211,153,0.2), 0 0 10px rgba(52,211,153,0.05); }
  100% { border-color: var(--border); box-shadow: none; }
}

.flash-success {
  animation: flashSuccess 1.2s ease forwards;
}

/* ── Output editor panel ───────────────────── */

.output-panel {
  margin-top: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  animation: panelIn 0.25s ease forwards;
  transition: border-color 300ms ease, box-shadow 300ms ease;
}

.output-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.85rem;
  background: var(--panel-alt);
  border-bottom: 1px solid var(--border);
}

.output-panel-title {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* Dot decoration on output panel header */
.output-panel-header::before {
  content: '● ● ●';
  font-size: 0.4rem;
  letter-spacing: 0.25em;
  color: var(--faint);
  opacity: 0.6;
  flex-shrink: 0;
}

.output-panel-actions {
  display: flex;
  gap: 0.4rem;
}

/* Override code-output when inside an output-panel — no top margin, no border */
.output-panel .code-output {
  margin-top: 0;
  border: none;
  border-radius: 0;
  min-height: 220px;
}

/* ── Collapsible prop-groups ───────────────── */

.prop-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-family: var(--mono);
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-bright);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 0 0 0.5rem 0;
  margin-bottom: 0.85rem;
  cursor: pointer;
  text-align: left;
  text-shadow: 0 0 10px rgba(96,165,250,0.2);
  transition: color 140ms ease;
}

.prop-group-label:hover {
  color: #fff;
  transform: none;
  box-shadow: none;
}

.prop-group-label:hover .prop-group-chevron {
  color: var(--accent-bright);
}

.prop-group-chevron {
  font-size: 0.8rem;
  color: var(--faint);
  transition: transform 240ms ease, color 140ms ease;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.prop-group--collapsed .prop-group-chevron {
  transform: rotate(-90deg);
}

.prop-group-body {
  overflow: hidden;
  transition: max-height 280ms cubic-bezier(0.4, 0, 0.2, 1), opacity 200ms ease;
  opacity: 1;
}

.prop-group--collapsed .prop-group-body {
  opacity: 0;
}

/* ── Panel crossfade ───────────────────────── */

@keyframes panelExit {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-4px); }
}

.tool-panel.panel-exiting {
  display: block;
  animation: panelExit 0.15s ease forwards;
  pointer-events: none;
}

/* ── Topbar status states ──────────────────── */

.topbar-dot--busy {
  background: var(--accent-bright) !important;
}

.topbar-dot--busy::after {
  background: var(--accent-bright) !important;
  animation: statusPing 1s ease-out infinite !important;
}

.topbar-dot--ok {
  background: var(--green) !important;
}

.topbar-dot--error {
  background: var(--red) !important;
}

.topbar-dot--error::after {
  background: var(--red) !important;
  animation: none !important;
}

/* Topbar status text color follows dot state */
.topbar-status-dot.topbar-dot--busy + .topbar-status-text { color: var(--accent-bright); }
.topbar-status-dot.topbar-dot--ok  + .topbar-status-text { color: var(--green); }
.topbar-status-dot.topbar-dot--error + .topbar-status-text { color: var(--red); }

/* ── Result grid fade-out ──────────────────── */

@keyframes resultFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.result-fadeout {
  animation: resultFadeOut 0.18s ease forwards;
  pointer-events: none;
}

/* ── Copy button checkmark state ───────────── */

@keyframes copiedFlash {
  0%   { box-shadow: 0 0 0 rgba(52,211,153,0); }
  30%  { box-shadow: 0 0 12px rgba(52,211,153,0.35); }
  100% { box-shadow: 0 0 0 rgba(52,211,153,0); }
}

.btn-copied {
  border-color: var(--green) !important;
  color: var(--green) !important;
  animation: copiedFlash 1.4s ease forwards;
}

.btn-primary.btn-copied {
  background: rgba(52,211,153,0.15) !important;
}

/* ── Keyboard shortcut hint ────────────────── */

/* Faint Ctrl+↵ label on primary submit buttons in forms */
.form-footer .btn-primary::before,
.form-row .btn-primary[type="submit"]::before {
  content: attr(data-shortcut);
  display: none; /* shown via JS if needed — placeholder for future */
}

/* ── Utilities ─────────────────────────────── */

.hidden { display: none !important; }

/* ── Scrollbar ─────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--border-hi);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--faint); }

/* ── Responsive ────────────────────────────── */

@media (max-width: 1080px) {
  .nbt-workspace { grid-template-columns: 1fr; }
  .inspector-panel { min-height: 0; }
}

@media (max-width: 860px) {
  .main-grid { grid-template-columns: 1fr; }

  .sidebar {
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    max-height: none;
    animation: fadeIn 0.4s ease forwards;
  }

  .tool-nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0 0.75rem;
    gap: 0.35rem;
  }

  .tool-link:nth-child(n) { animation: none; }

  .sidebar-section-label { padding: 0 0.75rem 0.5rem; }

  .tool-link {
    border-left: none;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 2px;
    background: var(--panel-alt);
    border: 1px solid var(--border);
  }

  .tool-link.active {
    border-color: var(--accent-border);
    background: var(--accent-dim);
    color: var(--accent-bright);
    box-shadow: 0 0 10px rgba(59,130,246,0.1);
  }

  .content-stack { padding: 1.25rem 1rem; }
  .panel-header::before { display: none; }
  .prop-fields { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .wrap { width: calc(100% - 1.5rem); }
  .form-row { flex-direction: column; }
  .field, .field-narrow { flex: 1 1 auto; min-width: 0; }
  .prop-fields { grid-template-columns: 1fr; }
  .inspector-grid,
  .inspector-form.two-col,
  .inline-inputs.three-col { grid-template-columns: 1fr; }
  .nbt-tree { min-height: 300px; max-height: none; }
}

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