:root {
  --bg: #08111f;
  --panel: rgba(9, 20, 37, 0.9);
  --panel-border: #5ae0c7;
  --panel-shadow: #02050c;
  --text: #eff7d7;
  --muted: #8cb0a5;
  --danger: #ff7878;
  --warn: #ffd166;
  --good: #73f0a8;
  --accent: #6ecbff;
  --ticket: #d8c58f;
  --ticket-text: #2d2413;
  --ticket-accent: #c6a75a;
  --ide-accent: #6ecbff;
  --debrief-accent: #ff9f6e;
  --font-display: "Courier New", monospace;
  --font-body: "Lucida Console", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(29, 74, 146, 0.35), transparent 38%),
    linear-gradient(180deg, #05101e 0%, #08111f 52%, #03070d 100%);
  font-family: var(--font-body);
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.02),
    rgba(255, 255, 255, 0.02) 1px,
    transparent 1px,
    transparent 4px
  );
  opacity: 0.45;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1320px, calc(100% - 24px));
  margin: 0 auto;
  padding: 20px 0 180px;
}

.panel,
.hud-panel,
.chuck-bar__inner {
  border: 3px solid var(--panel-border);
  background: var(--panel);
  box-shadow: 8px 8px 0 var(--panel-shadow);
}

.hud-panel {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 20px;
  margin-bottom: 20px;
}

.eyebrow,
.tagline,
.theme,
.system-line,
#summary-text {
  color: var(--muted);
}

h1,
h2,
h3,
.panel-heading,
button,
.ticket-label {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 4vw, 2.8rem);
}

h2,
h3,
p,
ul,
ol {
  margin-top: 0;
}

.meters {
  display: grid;
  gap: 12px;
  min-width: min(100%, 360px);
}

.meter {
  display: grid;
  gap: 6px;
}

.meter-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.86rem;
}

.meter-track {
  height: 16px;
  border: 2px solid var(--text);
  background: #040912;
}

.meter-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--good));
}

.panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  color: var(--warn);
  font-size: 0.8rem;
}

.panel-heading--bar {
  margin-bottom: 8px;
}

.screen {
  display: none;
}

.screen--active {
  display: block;
}

.start-grid,
.ticket-grid,
.ide-grid,
.debrief-grid {
  display: grid;
  gap: 18px;
}

.start-grid {
  grid-template-columns: 1.2fr 1fr;
}

.start-actions,
.ticket-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
  gap: 12px;
}

.start-select {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.start-select label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.start-select select {
  border: 2px solid var(--text);
  background: #112945;
  color: var(--text);
  padding: 10px 12px;
  font: 0.95rem/1.3 var(--font-body);
}

.ticket-screen {
  background:
    linear-gradient(135deg, rgba(216, 197, 143, 0.18), transparent 45%),
    linear-gradient(180deg, rgba(93, 76, 36, 0.16), rgba(9, 20, 37, 0.94)),
    var(--panel);
  border-color: var(--ticket-accent);
}

.ticket-banner {
  padding: 18px;
  border: 3px dashed #9d8650;
  background: rgba(18, 29, 46, 0.8);
  margin-bottom: 18px;
  box-shadow: inset 0 0 0 2px rgba(198, 167, 90, 0.15);
}

.ticket-label {
  color: var(--warn);
  margin-bottom: 10px;
}

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

.ticket-card {
  padding: 16px;
  border: 3px solid #7b6740;
  background: linear-gradient(180deg, rgba(216, 197, 143, 0.94), rgba(191, 171, 118, 0.92));
  color: var(--ticket-text);
  box-shadow: 6px 6px 0 rgba(11, 17, 31, 0.55);
}

.ticket-card h3 {
  color: #5e4717;
}

.ticket-screen .panel-heading {
  color: #f0ca6d;
}

.ticket-screen .ticket-actions button {
  background: #4a3a18;
  border-color: #e7d7a2;
}

.ticket-screen .ticket-actions button:hover:not(:disabled),
.ticket-screen .ticket-actions button:focus-visible:not(:disabled) {
  background: #634a1c;
}

.ide-screen {
  background:
    radial-gradient(circle at top right, rgba(44, 108, 168, 0.16), transparent 30%),
    linear-gradient(180deg, rgba(8, 18, 31, 0.98), rgba(5, 13, 23, 0.98));
  border-color: var(--ide-accent);
}

.ide-screen .panel-heading {
  color: #86d9ff;
}

.ide-grid {
  grid-template-columns: 320px minmax(0, 1fr);
}

.debrief-grid {
  grid-template-columns: 1.2fr 1fr;
}

.debrief-screen {
  background:
    linear-gradient(135deg, rgba(255, 159, 110, 0.12), transparent 40%),
    linear-gradient(180deg, rgba(43, 17, 10, 0.4), rgba(10, 16, 28, 0.96));
  border-color: var(--debrief-accent);
}

.debrief-screen .panel-heading {
  color: #ffb48c;
}

.debrief-card {
  padding: 18px;
  border: 3px solid #80523b;
  background:
    linear-gradient(180deg, rgba(52, 24, 15, 0.52), rgba(12, 20, 33, 0.92));
  box-shadow: inset 0 0 0 2px rgba(255, 159, 110, 0.08);
}

.debrief-card h3,
.debrief-card h2 {
  margin-bottom: 12px;
}

.ticket-brief {
  padding: 16px;
  border: 3px solid #20496f;
  background:
    linear-gradient(180deg, rgba(20, 39, 65, 0.62), rgba(11, 23, 39, 0.96));
  box-shadow: inset 0 0 0 2px rgba(110, 203, 255, 0.08);
}

.editor-pane {
  display: grid;
  gap: 12px;
  position: relative;
  padding: 8px 0 0;
}

.editor-chrome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 8px 10px 0;
}

.editor-tabs,
.editor-meta,
.editor-statusbar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.editor-tab,
#editor-mode,
#editor-scenario-chip,
.editor-statusbar span {
  border: 2px solid #2d5f8f;
  background: rgba(10, 25, 42, 0.9);
  color: #9ddfff;
  padding: 6px 8px;
  font: 0.75rem/1 var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.editor-tab--active {
  background: #17385b;
  color: var(--text);
  border-color: #9ddfff;
}

.editor-label {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0 10px;
}

textarea,
pre {
  width: 100%;
  border: 2px solid #264f78;
  background:
    linear-gradient(180deg, rgba(12, 23, 39, 0.96), rgba(5, 14, 24, 0.98));
  color: var(--text);
  font: 0.95rem/1.5 var(--font-body);
}

textarea {
  min-height: 340px;
  resize: vertical;
  padding: 14px 14px 14px 10px;
  border-left: 0;
  flex: 1;
  margin: 0;
}

pre {
  margin: 0;
  min-height: 150px;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
}

.editor-surface {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: stretch;
  border: 2px solid #264f78;
  background:
    linear-gradient(180deg, rgba(12, 23, 39, 0.96), rgba(5, 14, 24, 0.98));
}

.editor-surface textarea {
  border: 0;
  background: transparent;
}

.editor-gutter {
  min-height: 340px;
  padding: 14px 8px 14px 12px;
  border: 0;
  border-right: 1px solid rgba(109, 170, 220, 0.24);
  background: rgba(7, 18, 32, 0.85);
  color: rgba(140, 176, 165, 0.75);
  text-align: right;
  user-select: none;
}

.editor-actions,
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.choices.hidden {
  display: none;
}

button {
  border: 2px solid var(--text);
  padding: 10px 14px;
  background: #112945;
  color: var(--text);
  cursor: pointer;
}

button:hover:not(:disabled),
button:focus-visible:not(:disabled) {
  outline: none;
  background: #1a4069;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.choice-button {
  flex: 1 1 calc(50% - 10px);
  text-align: left;
}

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

.editor-statusbar {
  justify-content: space-between;
  padding: 0 10px 2px;
}

.editor-statusbar span {
  padding: 5px 8px;
}

.ide-screen .editor-actions button {
  background: #14365a;
  border-color: #9ddfff;
}

.ide-screen .editor-actions button:hover:not(:disabled),
.ide-screen .editor-actions button:focus-visible:not(:disabled) {
  background: #1a4878;
}

.portrait-wrap {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 14px;
  align-items: start;
}

.portrait-wrap--bar {
  align-items: stretch;
}

.portrait {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 3px solid var(--text);
  background: linear-gradient(180deg, #d9d3c5, #767a74);
  color: #111823;
  font-size: 1.75rem;
  font-weight: 700;
}

.chuck-line {
  margin-bottom: 6px;
  font-size: 1.05rem;
}

.summary-screen {
  margin-top: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.summary-card {
  padding: 18px;
  border: 3px solid #576b7e;
  background:
    linear-gradient(180deg, rgba(18, 32, 50, 0.76), rgba(8, 16, 28, 0.94));
  box-shadow: inset 0 0 0 2px rgba(140, 176, 165, 0.08);
}

.summary-card h3 {
  margin-bottom: 12px;
}

#history {
  display: grid;
  gap: 8px;
  padding-left: 20px;
}

#summary-review {
  display: grid;
  gap: 12px;
}

.review-entry {
  padding: 14px;
  border: 2px solid #355675;
  background: rgba(7, 16, 28, 0.88);
}

.review-entry h4,
.review-entry p {
  margin: 0 0 8px;
}

.review-entry p:last-child {
  margin-bottom: 0;
}

.review-entry__meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.history-pass {
  color: var(--good);
}

.history-soft {
  color: var(--warn);
}

.history-hard {
  color: var(--danger);
}

.editor-blocker {
  position: fixed;
  inset: 0 0 130px 0;
  background: rgba(1, 7, 12, 0.62);
  z-index: 3;
}

.editor-blocker.hidden {
  display: none;
}

.chuck-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 4;
}

.chuck-bar__inner {
  padding: 12px 16px 14px;
  background:
    linear-gradient(180deg, rgba(244, 241, 226, 0.08), transparent 18%),
    rgba(12, 18, 31, 0.96);
}

ul,
ol {
  padding-left: 20px;
}

@media (max-width: 1100px) {
  .start-grid,
  .ticket-grid,
  .ide-grid,
  .summary-grid,
  .test-panel {
    grid-template-columns: 1fr;
  }

  .hud-panel {
    flex-direction: column;
  }

  .app-shell {
    padding-bottom: 220px;
  }
}
