:root {
  color-scheme: dark;
  --bg-1: #110d0a;
  --bg-2: #241810;
  --bg-3: #3b291b;
  --panel: rgba(25, 19, 14, 0.84);
  --panel-strong: rgba(24, 18, 14, 0.96);
  --line: rgba(255, 192, 109, 0.18);
  --line-strong: rgba(255, 192, 109, 0.42);
  --text: #fff5e7;
  --muted: #c7b39c;
  --accent: #ffb054;
  --accent-2: #8ff0bd;
  --accent-3: #7fdfff;
  --danger: #ff5d73;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.46);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Avenir Next Condensed", "Arial Narrow Bold", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 176, 84, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(143, 240, 189, 0.08), transparent 24%),
    radial-gradient(circle at bottom right, rgba(127, 223, 255, 0.08), transparent 26%),
    linear-gradient(155deg, var(--bg-1), var(--bg-2) 42%, var(--bg-3));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.016) 0 14px,
      transparent 14px 32px
    ),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.016) 1px, transparent 1px);
  background-size: auto, 56px 56px, 56px 56px;
  mask-image: radial-gradient(circle at center, black 60%, transparent 100%);
}

.page-shell {
  width: min(1560px, calc(100vw - 28px));
  margin: 24px auto 40px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 26px;
  margin-bottom: 20px;
  padding: 30px 32px 34px;
  border: 1px solid var(--line);
  border-radius: 34px 20px 34px 20px;
  background:
    linear-gradient(135deg, rgba(40, 28, 18, 0.98), rgba(18, 14, 11, 0.94)),
    linear-gradient(120deg, rgba(255, 176, 84, 0.08), rgba(143, 240, 189, 0.05));
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  clip-path: polygon(0 0, calc(100% - 28px) 0, 100% 28px, 100% 100%, 28px 100%, 0 calc(100% - 28px));
}

.hero::before {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 0;
  height: 12px;
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(255, 176, 84, 0.9) 0 14px,
      rgba(31, 23, 16, 0.96) 14px 28px
    );
  opacity: 0.72;
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -50px -46px auto;
  width: 290px;
  height: 290px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(127, 223, 255, 0.18) 0, rgba(127, 223, 255, 0.05) 42%, transparent 72%);
  pointer-events: none;
}

.eyebrow,
.kicker {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.74rem;
  color: var(--accent-2);
}

.hero h1,
.section-heading h2,
.toolbar-copy h2 {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  letter-spacing: 0.04em;
}

.hero h1 {
  font-size: clamp(2.6rem, 5vw, 4.4rem);
  text-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.subtitle {
  width: min(780px, 100%);
  margin: 12px 0 0;
  line-height: 1.45;
  color: var(--muted);
  font-size: 1.04rem;
}

.hero-copy {
  min-width: 0;
}

.hero-banner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 192, 109, 0.2);
  background: rgba(9, 7, 5, 0.44);
  color: #ffd8a3;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-console {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.console-chip {
  min-width: 156px;
  padding: 11px 13px;
  border-radius: 18px 12px 18px 12px;
  border: 1px solid rgba(255, 192, 109, 0.16);
  background:
    linear-gradient(135deg, rgba(255, 176, 84, 0.08), rgba(127, 223, 255, 0.05)),
    rgba(15, 11, 8, 0.76);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.console-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.console-chip strong {
  font-size: 0.96rem;
  letter-spacing: 0.05em;
}

.hero-sidecar {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-signal-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.signal-pip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(10, 8, 6, 0.58);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.signal-pip::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.03);
}

.signal-pip-live::before {
  background: #91f2bd;
}

.signal-pip-save::before {
  background: #7fdfff;
}

.signal-pip-reactive::before {
  background: #ffb054;
}

.hero-stats {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.stat-pill,
.hud-card,
.details-card,
.legend-card {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(12px);
}

.stat-pill {
  min-width: 130px;
  padding: 14px 14px 13px;
  border-radius: 20px 14px 20px 14px;
  background:
    linear-gradient(180deg, rgba(44, 31, 20, 0.92), rgba(17, 13, 10, 0.9));
}

.stat-pill.wide {
  min-width: 260px;
}

.stat-label,
.hud-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.lab-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 280px;
  gap: 18px;
}

.panel {
  min-height: 0;
  padding: 22px 18px 18px;
  border-radius: 30px 20px 30px 20px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 24px, 100% 100%, 24px 100%, 0 calc(100% - 24px));
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(255, 176, 84, 0.07), transparent 22%),
    linear-gradient(320deg, rgba(127, 223, 255, 0.06), transparent 24%);
  pointer-events: none;
}

.panel::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 72px;
  height: 72px;
  border-top: 1px solid rgba(255, 192, 109, 0.24);
  border-right: 1px solid rgba(255, 192, 109, 0.24);
  border-radius: 0 18px 0 0;
  opacity: 0.65;
  pointer-events: none;
}

.hero > *,
.panel > * {
  position: relative;
  z-index: 1;
}

.control-panel,
.info-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.control-panel {
  background:
    linear-gradient(180deg, rgba(35, 25, 17, 0.98), rgba(18, 13, 9, 0.96));
}

.stage-panel {
  background:
    linear-gradient(180deg, rgba(28, 21, 15, 0.98), rgba(12, 9, 7, 0.96));
}

.info-panel {
  background:
    linear-gradient(180deg, rgba(24, 21, 17, 0.98), rgba(11, 10, 8, 0.96));
}

.control-panel,
.info-panel,
.stage-panel {
  padding-top: 58px;
}

.panel-ribbon {
  position: absolute;
  top: 16px;
  left: 18px;
  z-index: 2;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 192, 109, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 176, 84, 0.12), rgba(255, 176, 84, 0.04)),
    rgba(12, 9, 7, 0.74);
  color: #ffd7a1;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.panel-ribbon-stage {
  border-color: rgba(127, 223, 255, 0.18);
  color: #d4f5ff;
  background:
    linear-gradient(135deg, rgba(127, 223, 255, 0.12), rgba(127, 223, 255, 0.04)),
    rgba(12, 9, 7, 0.74);
}

.panel-ribbon-info {
  border-color: rgba(143, 240, 189, 0.18);
  color: #d8ffe7;
  background:
    linear-gradient(135deg, rgba(143, 240, 189, 0.12), rgba(143, 240, 189, 0.04)),
    rgba(12, 9, 7, 0.74);
}

.section-heading {
  margin-bottom: 14px;
}

.section-heading-split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.map-list,
.item-grid {
  display: grid;
  gap: 10px;
}

.map-button,
.item-button,
.ghost-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(13, 10, 8, 0.86);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease,
    box-shadow 160ms ease;
}

.map-button,
.item-button {
  width: 100%;
  text-align: left;
  padding: 13px 15px;
  border-radius: 18px 12px 18px 12px;
  cursor: pointer;
}

.map-button:hover,
.item-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
}

.map-button.active,
.item-button.active {
  background:
    linear-gradient(135deg, rgba(255, 176, 84, 0.18), rgba(127, 223, 255, 0.12)),
    rgba(28, 20, 14, 0.95);
  border-color: rgba(255, 176, 84, 0.42);
}

.button-title {
  display: block;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.button-copy {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.3;
}

.details-card {
  margin-top: 12px;
  border-radius: 20px;
  padding: 14px 15px;
}

.hidden {
  display: none;
}

.details-card h3 {
  margin: 0 0 8px;
  font-size: 1.12rem;
}

.details-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.detail-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.detail-actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.delete-confirm-card {
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 93, 115, 0.22);
  background:
    linear-gradient(135deg, rgba(255, 93, 115, 0.12), rgba(255, 93, 115, 0.04)),
    rgba(14, 20, 30, 0.92);
}

.delete-confirm-card strong {
  display: block;
  margin-bottom: 6px;
  color: #ffe5e9;
  letter-spacing: 0.02em;
}

.delete-confirm-card p {
  margin: 0;
  color: #f0bac3;
}

.detail-edit-button,
.detail-delete-button {
  width: 100%;
}

.detail-delete-button {
  border-color: rgba(255, 93, 115, 0.26);
  color: #ffd8de;
  background:
    linear-gradient(135deg, rgba(255, 93, 115, 0.12), rgba(255, 93, 115, 0.04)),
    rgba(8, 18, 32, 0.9);
}

.detail-edit-button {
  border-color: rgba(109, 226, 255, 0.24);
  color: #dff8ff;
  background:
    linear-gradient(135deg, rgba(109, 226, 255, 0.12), rgba(109, 226, 255, 0.04)),
    rgba(8, 18, 32, 0.9);
}

.detail-chip {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.item-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.item-picker-shell {
  position: relative;
  margin-top: 4px;
  padding: 18px;
  border-radius: 28px 16px 28px 16px;
  border: 1px solid rgba(255, 192, 109, 0.2);
  background:
    radial-gradient(circle at top left, rgba(255, 176, 84, 0.14), transparent 30%),
    radial-gradient(circle at bottom right, rgba(127, 223, 255, 0.12), transparent 30%),
    linear-gradient(160deg, rgba(24, 18, 14, 0.96), rgba(12, 9, 7, 0.98));
  overflow: hidden;
}

.item-picker-ornament {
  position: absolute;
  top: 14px;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  border: 1px solid rgba(109, 226, 255, 0.15);
  background:
    linear-gradient(135deg, rgba(109, 226, 255, 0.16), rgba(255, 158, 77, 0.05));
  opacity: 0.75;
  pointer-events: none;
  transform: rotate(12deg);
}

.item-picker-ornament-left {
  left: -26px;
}

.item-picker-ornament-right {
  right: -24px;
  top: auto;
  bottom: 48px;
  transform: rotate(-18deg);
}

.item-slider-frame {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.item-nav-button {
  width: 44px;
  height: 132px;
  border: 1px solid rgba(255, 192, 109, 0.22);
  border-radius: 18px 12px 18px 12px;
  background:
    linear-gradient(180deg, rgba(31, 22, 16, 0.98), rgba(11, 8, 6, 0.98));
  color: var(--text);
  font: inherit;
  font-size: 1.55rem;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.item-nav-button:hover {
  transform: translateY(-1px);
  border-color: rgba(143, 240, 189, 0.42);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
}

.item-showcase-card {
  position: relative;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(140deg, rgba(14, 31, 51, 0.96), rgba(7, 15, 28, 0.96));
  overflow: hidden;
}

.item-showcase-halo {
  position: absolute;
  right: -40px;
  top: -30px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(109, 226, 255, 0.2), transparent 68%);
  pointer-events: none;
}

.item-showcase-header,
.item-showcase-footer,
.item-slider-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item-showcase-header {
  margin-bottom: 14px;
}

.item-showcase-index,
.item-showcase-category,
.slider-label,
.item-peek {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
}

.item-showcase-index,
.slider-label {
  color: var(--accent-2);
}

.item-showcase-category,
.item-peek {
  color: var(--muted);
}

.item-showcase-main {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.item-showcase-art-shell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 138px;
  border-radius: 18px;
  border: 1px solid rgba(109, 226, 255, 0.14);
  background:
    radial-gradient(circle at center, rgba(109, 226, 255, 0.12), transparent 62%),
    linear-gradient(180deg, rgba(8, 18, 32, 0.98), rgba(3, 9, 17, 0.98));
  overflow: hidden;
}

.item-showcase-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 18px 18px;
  mask-image: radial-gradient(circle at center, black 50%, transparent 92%);
}

.item-showcase-art {
  position: relative;
  width: 108px;
  height: 108px;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.35));
}

.item-showcase-copy h3 {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: 0.04em;
}

.item-showcase-copy p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.42;
}

.item-stat-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.item-stat-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.item-stat-row span {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.item-stat-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.item-stat-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(109, 226, 255, 0.92), rgba(255, 158, 77, 0.92));
  box-shadow: 0 0 18px rgba(109, 226, 255, 0.2);
}

.item-showcase-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.item-peek.active {
  color: #fff2cf;
}

.item-slider-panel {
  margin-top: 14px;
  padding: 12px 12px 10px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(4, 10, 18, 0.62);
}

.item-slider-meta {
  margin-bottom: 10px;
}

.item-slider-meta strong {
  font-size: 0.92rem;
  letter-spacing: 0.08em;
}

.item-slider {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
}

.item-slider::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(109, 226, 255, 0.22), rgba(255, 158, 77, 0.28));
}

.item-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.74);
  background: linear-gradient(180deg, #ffd193, #ff9e4d);
  box-shadow: 0 0 0 4px rgba(255, 158, 77, 0.12);
}

.item-slider::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(109, 226, 255, 0.22), rgba(255, 158, 77, 0.28));
}

.item-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.74);
  background: linear-gradient(180deg, #ffd193, #ff9e4d);
  box-shadow: 0 0 0 4px rgba(255, 158, 77, 0.12);
}

.item-slider-ticks {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.item-slider-tick {
  flex: 1 1 0;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.item-slider-tick.active {
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.builder-panel {
  margin-top: 14px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    linear-gradient(160deg, rgba(109, 226, 255, 0.08), rgba(255, 158, 77, 0.08)),
    rgba(10, 24, 39, 0.92);
}

.builder-copy,
.builder-hint {
  color: var(--muted);
  line-height: 1.4;
}

.builder-copy {
  margin: 0 0 12px;
}

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

.builder-label {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.builder-input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(6, 15, 26, 0.9);
  color: var(--text);
  font: inherit;
}

.builder-input:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(109, 226, 255, 0.16);
}

.editor-tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.editor-tool {
  padding: 10px 11px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(8, 18, 32, 0.88);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.editor-tool:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.editor-tool.active {
  border-color: rgba(255, 158, 77, 0.52);
  background:
    linear-gradient(135deg, rgba(109, 226, 255, 0.14), rgba(255, 158, 77, 0.14)),
    rgba(9, 21, 35, 0.96);
}

.editor-tool strong,
.editor-tool span {
  display: block;
}

.editor-tool span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.25;
}

.builder-hint {
  min-height: 42px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(5, 14, 26, 0.56);
}

.builder-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.stage-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stage-header-band {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: -2px;
}

.stage-header-chip {
  padding: 8px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(12, 9, 7, 0.66);
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

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

.readout-card {
  position: relative;
  padding: 14px 15px;
  border-radius: 20px 12px 20px 12px;
  border: 1px solid rgba(255, 192, 109, 0.14);
  background:
    linear-gradient(160deg, rgba(39, 28, 18, 0.92), rgba(13, 10, 7, 0.94));
  overflow: hidden;
}

.readout-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(255, 176, 84, 0.85), rgba(127, 223, 255, 0.8));
  opacity: 0.55;
}

.readout-label,
.readout-copy {
  display: block;
}

.readout-label {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.readout-card strong {
  display: block;
  font-size: 1.18rem;
  letter-spacing: 0.04em;
}

.readout-copy {
  margin-top: 6px;
  color: #cfe7f8;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stage-toolbar,
.toolbar-actions,
.hud-grid {
  display: flex;
  gap: 12px;
}

.stage-toolbar {
  align-items: center;
  justify-content: space-between;
}

.ghost-button {
  padding: 11px 14px;
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
}

.canvas-frame {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  border: 1px solid rgba(255, 192, 109, 0.22);
  background:
    linear-gradient(90deg, rgba(255, 176, 84, 0.08) 0 14px, transparent 14px calc(100% - 14px), rgba(127, 223, 255, 0.08) calc(100% - 14px)),
    radial-gradient(circle at top, rgba(255, 176, 84, 0.14), transparent 30%),
    linear-gradient(180deg, rgba(24, 18, 14, 0.9), rgba(10, 8, 6, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 20px 38px rgba(0, 0, 0, 0.28);
}

.canvas-frame::before,
.canvas-frame::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 1;
}

.canvas-frame::before {
  inset: 10px;
  border: 1px solid rgba(255, 192, 109, 0.08);
  border-radius: 20px;
}

.canvas-frame::after {
  top: 14px;
  right: 16px;
  width: 82px;
  height: 14px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(127, 223, 255, 0.85), rgba(255, 176, 84, 0.22));
  opacity: 0.55;
}

.canvas-scanline {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 100% 6px;
  opacity: 0.16;
  mix-blend-mode: screen;
}

.canvas-deco {
  position: absolute;
  z-index: 2;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(18, 13, 10, 0.72);
  backdrop-filter: blur(10px);
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.canvas-deco-left {
  left: 16px;
  bottom: 18px;
}

.canvas-deco-right {
  top: 18px;
  right: 16px;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 980 / 640;
}

.canvas-badge {
  position: absolute;
  top: 16px;
  left: 122px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(18, 13, 10, 0.68);
  backdrop-filter: blur(10px);
  z-index: 2;
}

.hud-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.hud-card {
  padding: 14px;
  border-radius: 20px 12px 20px 12px;
  background:
    linear-gradient(180deg, rgba(40, 29, 20, 0.86), rgba(14, 11, 8, 0.86));
}

.hud-card strong {
  font-size: clamp(1.25rem, 2.3vw, 1.8rem);
  letter-spacing: 0.03em;
}

.note-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.legend-card {
  padding: 14px;
  border-radius: 20px;
}

.stage-footer-rack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.footer-rack-card {
  padding: 12px 14px;
  border-radius: 18px 12px 18px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(180deg, rgba(16, 12, 9, 0.84), rgba(9, 7, 5, 0.86));
}

.footer-rack-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.footer-rack-card strong {
  font-size: 0.94rem;
  letter-spacing: 0.04em;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
}

.swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.swatch.spring {
  background: #96ff79;
}

.swatch.conveyor {
  background: #ffb84d;
}

.swatch.water {
  background: #5cc8ff;
}

.swatch.fan {
  background: #7cf4d7;
}

.swatch.hammer {
  background: #ff6e7f;
}

.arcade-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 10, 18, 0.78);
  backdrop-filter: blur(10px);
}

.arcade-overlay.hidden {
  display: none;
}

.arcade-panel {
  width: min(100%, 520px);
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(109, 226, 255, 0.2);
  background:
    radial-gradient(circle at top, rgba(109, 226, 255, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(9, 17, 31, 0.98), rgba(6, 11, 21, 0.98));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.arcade-head,
.arcade-meta {
  display: flex;
  gap: 10px;
}

.arcade-head {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.arcade-meta {
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.arcade-chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(6, 15, 26, 0.82);
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#arcade-canvas {
  width: 100%;
  aspect-ratio: 320 / 220;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #040910;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.arcade-copy {
  margin: 12px 4px 0;
  color: var(--muted);
  line-height: 1.45;
}

.piano-panel {
  width: min(100%, 760px);
}

.racer-panel {
  width: min(100%, 920px);
}

#racer-canvas {
  width: 100%;
  aspect-ratio: 420 / 240;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, #7ac9ff 0%, #7ac9ff 54%, #39462d 54%, #39462d 100%);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.challenge-panel {
  width: min(100%, 940px);
  border-color: rgba(255, 184, 77, 0.22);
  background:
    radial-gradient(circle at top, rgba(255, 184, 77, 0.16), transparent 36%),
    linear-gradient(180deg, rgba(18, 15, 10, 0.98), rgba(8, 11, 20, 0.98));
}

#challenge-canvas {
  width: 100%;
  aspect-ratio: 440 / 270;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, #11161f 0%, #0a1118 100%);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.piano-keyboard {
  position: relative;
  height: 232px;
  margin-top: 6px;
  padding: 14px 14px 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at top, rgba(251, 212, 57, 0.12), transparent 32%),
    linear-gradient(180deg, rgba(23, 18, 13, 0.98), rgba(11, 8, 7, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -16px 28px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.piano-white-row {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  height: 100%;
}

.piano-key {
  appearance: none;
  border: 0;
  cursor: pointer;
  user-select: none;
  transition:
    transform 110ms ease,
    box-shadow 110ms ease,
    background 110ms ease;
}

.piano-key:focus-visible {
  outline: 2px solid rgba(126, 232, 255, 0.9);
  outline-offset: 3px;
}

.piano-key-white {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 14px 10px 12px;
  border-radius: 0 0 18px 18px;
  background: linear-gradient(180deg, #fffef9, #ebedf1 60%, #d1d7de 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -8px 0 rgba(53, 65, 84, 0.14),
    0 12px 20px rgba(0, 0, 0, 0.18);
  color: #223048;
}

.piano-key-white.active {
  transform: translateY(4px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -5px 0 rgba(53, 65, 84, 0.16),
    0 6px 14px rgba(0, 0, 0, 0.18);
}

.piano-key-black {
  position: absolute;
  top: 14px;
  left: var(--black-left);
  transform: translateX(-50%);
  width: clamp(38px, 8.3%, 56px);
  height: 132px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 12px 6px 14px;
  border-radius: 0 0 14px 14px;
  background: linear-gradient(180deg, #3b4256 0%, #0e111a 58%, #05070d 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -8px 0 rgba(0, 0, 0, 0.46),
    0 10px 18px rgba(0, 0, 0, 0.38);
  color: #f6fbff;
  z-index: 2;
}

.piano-key-black.active {
  transform: translateX(-50%) translateY(4px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -4px 0 rgba(0, 0, 0, 0.5),
    0 4px 10px rgba(0, 0, 0, 0.3);
}

.piano-key-note {
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.piano-key-shortcut {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.72;
}

kbd {
  padding: 2px 6px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  font-family: inherit;
}

@media (max-width: 1280px) {
  .lab-grid {
    grid-template-columns: 290px minmax(0, 1fr);
  }

  .info-panel {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .page-shell {
    width: min(100vw - 18px, 100%);
    margin-top: 14px;
  }

  .hero,
  .lab-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .hero {
    gap: 18px;
  }

  .hero-stats {
    justify-content: flex-start;
  }

  .hero-sidecar {
    width: 100%;
  }

  .hero-signal-strip {
    justify-content: flex-start;
  }

  .lab-grid {
    gap: 16px;
  }

  .hud-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage-readout-grid {
    grid-template-columns: 1fr;
  }

  .stage-footer-rack {
    grid-template-columns: 1fr;
  }

  .item-slider-frame {
    grid-template-columns: 1fr;
  }

  .item-nav-button {
    width: 100%;
    height: 42px;
  }

  .piano-keyboard {
    height: 204px;
    padding: 12px 10px 16px;
  }

  #racer-canvas {
    aspect-ratio: 400 / 250;
  }

  .piano-key-white {
    padding-inline: 8px;
  }

  .piano-key-black {
    width: clamp(30px, 10%, 46px);
    height: 114px;
  }

  .info-panel {
    display: flex;
  }

  .canvas-badge {
    left: 16px;
    top: 56px;
  }
}

@media (max-width: 640px) {
  .hero,
  .panel {
    padding: 16px;
    border-radius: 20px;
  }

  .item-grid,
  .hud-grid {
    grid-template-columns: 1fr;
  }

  .item-showcase-main {
    grid-template-columns: 1fr;
  }

  .item-showcase-footer,
  .item-slider-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .editor-tool-grid,
  .builder-actions {
    grid-template-columns: 1fr;
  }

  .arcade-head,
  .arcade-meta,
  .stage-toolbar,
  .toolbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-console {
    flex-direction: column;
  }

  .hero-banner,
  .signal-pip,
  .stage-header-chip {
    font-size: 0.64rem;
  }

  .canvas-deco-right {
    top: 62px;
  }

  .canvas-deco-left {
    bottom: 14px;
  }

  .piano-keyboard {
    height: 176px;
  }

  #racer-canvas {
    aspect-ratio: 360 / 260;
  }

  .piano-key-note {
    font-size: 0.72rem;
  }

  .piano-key-shortcut {
    font-size: 0.64rem;
  }
}
