:root {
  --bg: #07111d;
  --bg-soft: #0c1827;
  --panel: rgba(18, 29, 45, 0.92);
  --panel-2: rgba(22, 35, 54, 0.95);
  --line: rgba(124, 156, 194, 0.16);
  --line-strong: rgba(124, 156, 194, 0.28);
  --text: #e8f0fb;
  --muted: #9bb0c9;
  --soft: #c8d8ec;
  --accent: #4eb8ff;
  --accent-green: #65d59a;
  --warn: #f2bf61;
  --shadow: 0 16px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top center, rgba(31, 103, 166, 0.14), transparent 34%),
    linear-gradient(180deg, #06101a 0%, #07111d 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  padding: 20px;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.pm-shell {
  width: min(1680px, 100%);
  margin: 0 auto;
}

.topbar {
  display: grid;
  grid-template-columns: 290px 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 18px 20px;
  background: rgba(8, 20, 35, 0.9);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.brand-block {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(84, 120, 176, 0.35), rgba(32, 50, 80, 0.95));
  border: 1px solid var(--line-strong);
  color: #f4f8ff;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.brand-copy h1 {
  margin: 0 0 6px;
  font-size: 20px;
  line-height: 1.05;
}

.brand-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
}

.topnav a {
  text-decoration: none;
  color: var(--soft);
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid transparent;
  transition: 0.18s ease;
}

.topnav a:hover {
  background: rgba(78, 184, 255, 0.08);
  border-color: var(--line);
  color: #fff;
}

.topnav a.active {
  background: rgba(78, 184, 255, 0.12);
  border-color: rgba(78, 184, 255, 0.32);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(78, 184, 255, 0.1);
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chip {
  background: rgba(19, 33, 49, 0.88);
  color: var(--soft);
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 12px;
}

.chip.active {
  color: #fff;
  border-color: rgba(78, 184, 255, 0.34);
  background: rgba(78, 184, 255, 0.12);
}

.surface-contract {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--soft);
  padding: 8px 2px;
}

.surface-contract__toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.caret {
  opacity: 0.9;
  padding-top: 2px;
}

.surface-contract__status {
  color: var(--muted);
  font-size: 14px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  color: #81a3ca;
  margin-bottom: 4px;
}

.game-layout {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 320px minmax(760px, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.rail,
.center-surface {
  background: linear-gradient(180deg, rgba(15, 26, 41, 0.94), rgba(10, 19, 31, 0.96));
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.rail,
.center-surface {
  padding: 18px;
}

.rail-head,
.surface-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.rail-head h2,
.surface-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.12;
}

.surface-head p {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 840px;
  line-height: 1.5;
}

.badge {
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.badge.good {
  color: #dff8ea;
  background: rgba(101, 213, 154, 0.12);
  border-color: rgba(101, 213, 154, 0.26);
}

.badge.warn {
  color: #ffedc3;
  background: rgba(242, 191, 97, 0.11);
  border-color: rgba(242, 191, 97, 0.28);
}

.stack,
.workspace {
  display: grid;
  gap: 14px;
}

.panel {
  background: linear-gradient(180deg, rgba(26, 38, 57, 0.96), rgba(20, 31, 47, 0.98));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}

.panel-label {
  margin-bottom: 12px;
  color: #89a7ca;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.field-grid {
  display: grid;
  gap: 12px;
}

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

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

.field {
  display: grid;
  gap: 8px;
}

.field > span {
  color: var(--soft);
  font-size: 13px;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(8, 16, 28, 0.85);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 13px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 84px;
  line-height: 1.45;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(78, 184, 255, 0.42);
  box-shadow: 0 0 0 3px rgba(78, 184, 255, 0.08);
}

.context-card {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  margin-bottom: 10px;
}

.context-card:last-child {
  margin-bottom: 0;
}

.context-card strong {
  display: block;
  margin-bottom: 6px;
}

.context-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.list.dense {
  display: grid;
  gap: 10px;
}

.list-item {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  color: var(--text);
}

.list-item.active {
  border-color: rgba(78, 184, 255, 0.34);
  background: rgba(78, 184, 255, 0.08);
}

.list-item.static {
  cursor: default;
}

.item-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.item-meta {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  background: rgba(255, 255, 255, 0.03);
  color: var(--soft);
  border: 1px solid var(--line);
  padding: 9px 11px;
  border-radius: 999px;
  font-size: 12px;
}

.active-pill {
  background: rgba(78, 184, 255, 0.12);
  border-color: rgba(78, 184, 255, 0.34);
  color: #fff;
}

.static-pill {
  cursor: default;
}

.segment-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segment {
  padding: 10px 12px;
  border-radius: 999px;
  color: var(--soft);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.segment.active {
  background: rgba(78, 184, 255, 0.12);
  border-color: rgba(78, 184, 255, 0.34);
  color: #fff;
}

.surface-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.btn {
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 600;
}

.btn.primary {
  background: linear-gradient(180deg, #2a95dd, #1f74af);
  color: #fff;
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.03);
  color: var(--soft);
  border: 1px solid var(--line);
}

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

.action-tile {
  min-height: 54px;
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border: 1px solid var(--line);
  text-align: left;
  font-weight: 600;
}

.action-tile.primary {
  background: rgba(78, 184, 255, 0.12);
  border-color: rgba(78, 184, 255, 0.34);
}

.status-card {
  padding: 12px;
  border-radius: 14px;
  background: rgba(8, 16, 28, 0.7);
  border: 1px solid var(--line);
}

.status-card strong {
  display: block;
  margin-bottom: 6px;
}

.status-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.summary-box {
  display: grid;
  gap: 10px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.summary-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.summary-row span {
  color: var(--muted);
  font-size: 13px;
}

.summary-row strong {
  text-align: right;
  font-size: 13px;
}

.receipt {
  min-height: 118px;
  border-radius: 14px;
  padding: 12px;
  background: rgba(8, 16, 28, 0.7);
  border: 1px dashed var(--line-strong);
}

.receipt-state {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.receipt-state.success {
  color: #def7e8;
}

.receipt-state.saved {
  color: #dcecff;
}

@media (max-width: 1480px) {
  .game-layout {
    grid-template-columns: 280px minmax(660px, 1fr) 280px;
  }
}

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

  .topnav {
    justify-content: flex-start;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .field-grid.two,
  .field-grid.three,
  .action-grid {
    grid-template-columns: 1fr;
  }
}
