:root {
  --bg: #0a0a0f;
  --panel: rgba(10, 5, 15, 0.96);
  --ink: #f0f0f0;
  --muted: #b8b8b8;
  --line: rgba(255, 140, 0, 0.4);
  --accent: #ff8c00;
  --accent-hot: #ffd700;
  --ok: #8de4b6;
  --font-display: "Orbitron", monospace;
  --font-body: "Roboto", sans-serif;
  --font-mono: "Cascadia Code", "Consolas", monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: #0a0a0f;
  background-image: linear-gradient(180deg, #0a0a0f 0%, #140a18 100%);
  color: var(--ink);
  font-family: var(--font-body);
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
body:has(.nav-container) .shell {
  height: calc(100dvh - 72px);
}

.panel {
  background: var(--panel);
  border-right: 2px solid var(--line);
  padding: 1.1rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-height: 100%;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--accent);
  text-shadow: 0 0 16px rgba(255, 140, 0, 0.4);
}
.brand .sub {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.block h2 {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffd08a;
}

.field, .channel-row {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.field input,
.field select,
.channel-row input,
.channel-row select,
textarea {
  background: #120814;
  border: 1px solid rgba(255, 140, 0, 0.35);
  color: var(--ink);
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
  font: inherit;
}
textarea {
  min-height: 180px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  resize: vertical;
}

.row {
  display: flex;
  align-items: center;
}
.row.gap { gap: 0.45rem; flex-wrap: wrap; }

button {
  border: 1px solid rgba(255, 140, 0, 0.45);
  background: rgba(255, 140, 0, 0.12);
  color: #ffd08a;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
}
button.primary {
  background: linear-gradient(180deg, #ffb347, #ff8c00);
  color: #1a1208;
  border-color: #ffd700;
}
button.ghost { background: transparent; }
button.mini { padding: 0.2rem 0.45rem; font-size: 0.62rem; }
button:hover { border-color: var(--accent-hot); }

.hint { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.75rem; }
.check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.block,
.channel,
.field,
.field input,
.field select,
.channel-row input,
.channel-row select,
textarea,
.tex-pick,
.tex-pick > div {
  min-width: 0;
  max-width: 100%;
}
.field input,
.channel-row input,
.channel-row select,
.tex-pick select {
  width: 100%;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  min-width: 0;
}
.asset-slot {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  overflow: hidden;
  font-size: 0.72rem;
  color: var(--muted);
}
.asset-slot.wide { margin-top: 0.55rem; }
.asset-slot img,
.tex-preview {
  width: 100%;
  height: 72px;
  object-fit: cover;
  background: #08060c;
  border: 1px solid rgba(255, 140, 0, 0.28);
  border-radius: 6px;
}
.asset-slot.wide img { height: 96px; object-fit: contain; background: #111; }

.channel {
  border: 1px solid rgba(255, 140, 0, 0.25);
  border-radius: 10px;
  padding: 0.7rem;
  margin-bottom: 0.6rem;
  background: rgba(255, 140, 0, 0.04);
}
.channel h3 {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.channel.red h3 { color: #ff8a8a; }
.channel.green h3 { color: #8de4b6; }
.channel.blue h3 { color: #8ec8ff; }
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}
.tex-pick {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.45rem;
}
.tex-pick img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(255, 140, 0, 0.3);
  background: #08060c;
}

.stage-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.stage-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.7rem;
}
.stage-fit {
  position: relative;
  width: min(100%, 426px);
  aspect-ratio: 426 / 568;
  border: 2px solid rgba(255, 140, 0, 0.45);
  box-shadow: 0 0 24px rgba(255, 140, 0, 0.18), 0 24px 60px rgba(0, 0, 0, 0.55);
  background: #000;
  overflow: hidden;
  border-radius: 18px;
}
#stage {
  width: 100%;
  height: 100%;
  display: block;
}

.catalog {
  position: absolute;
  inset: 3.2rem 1rem 1rem;
  background: rgba(8, 6, 12, 0.96);
  border: 1px solid rgba(255, 140, 0, 0.4);
  border-radius: 12px;
  overflow: auto;
  padding: 0.8rem;
  z-index: 4;
}
.catalog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}
.catalog-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.45rem;
}
.catalog-item {
  text-align: left;
  width: 100%;
  background: rgba(255, 140, 0, 0.08);
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; height: auto; }
  .panel { max-height: none; border-right: 0; border-bottom: 2px solid var(--line); }
  .stage-wrap { min-height: 70vh; }
}
