:root {
  color-scheme: light;
  --bg: #d5c2a1;
  --bg-2: #c4ab82;
  --paper: #f4e7c8;
  --paper-2: #e8d6b2;
  --panel: #e0cc9d;
  --panel-2: #d0b683;
  --text: #2a1d0f;
  --muted: #6d563b;
  --accent: #7d4f24;
  --accent-2: #9e6a34;
  --accent-3: #5c7a34;
  --border: #9b7b53;
  --danger: #8b3a2b;
  --success: #365b24;
  --shadow: rgba(56, 34, 12, 0.18);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Verdana, Arial, sans-serif;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0) 220px),
    radial-gradient(circle at top left, rgba(255,255,255,0.22), rgba(255,255,255,0) 32%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
}
.page {
  max-width: 1460px;
  margin: 0 auto;
  padding: 18px 16px 36px;
}
.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 14px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.3), rgba(255,255,255,0.08)), linear-gradient(180deg, #dbc08e, #ccb07b);
  box-shadow: 0 18px 34px var(--shadow);
}
.hero h1 { margin: 0 0 8px; font-size: 42px; line-height: 1.05; }
.hero p { margin: 0; font-size: 15px; max-width: 980px; color: var(--muted); line-height: 1.5; }
.hero-compact { padding-top: 14px; padding-bottom: 14px; }
.ghost-link {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 15px;
  background: rgba(255,255,255,0.22);
  font-weight: 700;
  white-space: nowrap;
}
.card {
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 12px 28px var(--shadow);
}
h1, h2, h3, h4 { margin-top: 0; color: #2d1c0d; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.compact-grid .card { min-height: 170px; }
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.card-head h2, .card-head h3, .card-head h4 { margin-bottom: 0; }
.editor, .mini-editor, input, textarea {
  width: 100%;
  background: #fcf5e4;
  color: var(--text);
  border: 1px solid #b39161;
  border-radius: 10px;
  padding: 11px 12px;
  font: 13px/1.45 Consolas, Monaco, monospace;
  box-shadow: inset 0 1px 2px rgba(55,33,10,0.08);
}
.editor { min-height: 420px; resize: vertical; }
.mini-editor { min-height: 118px; resize: vertical; }
.actions-card { margin-bottom: 16px; }
.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
button {
  background: linear-gradient(180deg, var(--accent-2) 0%, var(--accent) 100%);
  color: #fff8eb;
  border: 1px solid #5f3818;
  border-radius: 9px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(80,49,23,0.35);
}
button:hover { filter: brightness(1.04); }
button:active { transform: translateY(1px); }
.small-btn {
  background: linear-gradient(180deg, #f4e1b8 0%, #e7cc94 100%);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 11px;
  box-shadow: none;
}
.project-meta-row {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
  margin-top: 12px;
}
label span { display:block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
.wide-field { min-width: 0; }
pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #fcf5e4;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  color: var(--text);
  font: 13px/1.45 Consolas, Monaco, monospace;
}
.result-card pre { min-height: 340px; }
.endpoint-list { padding-left: 18px; margin: 0; }
.endpoint-list li { margin-bottom: 8px; }
.muted { color: var(--muted); }
.success { color: var(--success); }
.error { color: var(--danger); }
code {
  background: rgba(255,255,255,0.32);
  padding: 2px 6px;
  border-radius: 7px;
}

.wizard-card {
  margin-bottom: 16px;
  padding: 14px;
  background: linear-gradient(180deg, #caa975 0%, #b48c5a 100%);
  border-color: #8c673d;
}
.wizard-head { align-items: flex-start; margin-bottom: 8px; }
.pill-row { display:flex; flex-wrap:wrap; gap:8px; }
.tab-btn.is-active { background: linear-gradient(180deg, var(--accent-3) 0%, #476725 100%); color: #fff; border-color: #335014; }
.tab-panel { display:none; margin-top: 12px; }
.tab-panel.is-active { display:block; }
.small-editor { min-height: 260px; }
.inline-actions { display:flex; flex-wrap:wrap; gap:10px; align-items:end; }
.persistence-row { align-items:end; }
.wide-first-row { grid-template-columns: 280px 1fr; }
.tall-mini { min-height: 220px; }
.narrow-top-gap { margin-bottom: 0; }

.builder-grid { display:grid; grid-template-columns: 1fr 1fr; gap:16px; margin-top:12px; }
.builder-card { min-width: 0; background: linear-gradient(180deg, #ecd9b5 0%, #ddc391 100%); }
.form-grid { display:grid; gap:12px; }
.form-grid.two-up { grid-template-columns: 1fr 1fr; }
.stack-list { display:grid; gap:12px; }
.builder-item {
  background: linear-gradient(180deg, #f8eaca 0%, #eed7a8 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.builder-item-head { display:flex; justify-content:space-between; gap:12px; align-items:center; margin-bottom:10px; }
.compact-form { grid-template-columns: 1fr 1fr; }
.compact-editor { min-height: 92px; }
.medium-editor { min-height: 120px; }
.check-row { display:flex; align-items:center; gap:10px; }
.check-row input[type='checkbox'] { width:auto; margin:0; }
.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #f7ebcf 0%, #ecd7ab 100%);
  cursor: pointer;
  user-select: none;
}
.toggle-row input[type='checkbox'] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}
.toggle-ui {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 42px;
  border-radius: 999px;
  border: 1px solid #8f6c43;
  background: linear-gradient(180deg, #c9b28a 0%, #b99d71 100%);
  box-shadow: inset 0 1px 2px rgba(55,33,10,0.12);
  transition: background .18s ease, border-color .18s ease;
}
.toggle-ui::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff8eb 0%, #f0e0bf 100%);
  border: 1px solid rgba(97, 67, 31, 0.35);
  box-shadow: 0 1px 2px rgba(55,33,10,0.16);
  transition: transform .18s ease;
}
.toggle-row input[type='checkbox']:checked + .toggle-ui {
  background: linear-gradient(180deg, #7ca34e 0%, #5c7a34 100%);
  border-color: #496124;
}
.toggle-row input[type='checkbox']:checked + .toggle-ui::after {
  transform: translateX(18px);
}
.toggle-row input[type='checkbox']:focus-visible + .toggle-ui {
  outline: 2px solid rgba(93, 122, 52, 0.35);
  outline-offset: 2px;
}
.toggle-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.danger-btn { color:#6e2319; border-color:#8f5a4f; }
.quick-world-card { margin-top: 12px; margin-bottom: 14px; }
.three-up { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.overlay-shell {
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #b38b59 0%, #9d7346 100%);
  border: 1px solid #76522f;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 16px 30px rgba(72,44,16,0.24);
}
.overlay-header-like {
  display:grid;
  grid-template-columns: 1.25fr 1fr auto;
  gap: 14px;
  align-items:center;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid #7d5a33;
  border-radius: 14px;
  background: linear-gradient(180deg, #f2e2bb 0%, #e3c98f 100%);
}
.overlay-kicker {
  color: #775327;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 700;
  margin-bottom: 4px;
}
.overlay-title { font-size: 24px; font-weight: 700; line-height: 1.1; }
.overlay-sub { margin-top: 4px; color: var(--muted); font-size: 13px; }
.overlay-world-meta { display:flex; flex-wrap:wrap; gap:10px; color: var(--muted); font-size: 12px; }
.overlay-world-meta b { color: var(--text); }
.overlay-header-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end;}
.status-strip {
  display:grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap:10px;
  margin-bottom: 14px;
}
.status-item {
  background: linear-gradient(180deg, #f7ebcf 0%, #eddab2 100%);
  border:1px solid var(--border);
  border-radius:12px;
  padding:9px 11px;
  display:flex;
  flex-direction:column;
  gap:3px;
}
.status-item span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.status-item strong { font-size: 15px; }
#ui-ready-status[data-ui-ready-state="ready"] { color: var(--success); }
#ui-ready-status[data-ui-ready-state="pending"] { color: #9b6d18; }
#ui-ready-status[data-ui-ready-state="error"] { color: var(--danger); }
.stepper-layout { display:grid; grid-template-columns: 290px 1fr; gap:14px; }
.wizard-sidebar { display:grid; gap:12px; align-content:start; }
.sidebar-card {
  background: linear-gradient(180deg, #f2e3c0 0%, #e2c895 100%);
  border:1px solid var(--border);
  border-radius:12px;
  padding:13px;
}
.sidebar-card h4 { margin: 0 0 8px; }
.sidebar-actions { display:grid; gap:8px; }
.vertical-step-nav { display:grid; grid-template-columns: 1fr; gap: 8px; }
.step-btn {
  background: linear-gradient(180deg, #f7e6c2 0%, #ead09a 100%);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  text-align:left;
  display:flex;
  align-items:center;
  min-height: 44px;
}
.step-btn.is-active {
  background: linear-gradient(180deg, #7d5e2e 0%, #5d4524 100%);
  color: #fff6e6;
  border-color: #533717;
}
.step-btn-stats, .step-btn-diagnostics { background: linear-gradient(180deg, #e5d7b8 0%, #d5c09a 100%); }
.wizard-stage {
  min-width: 0;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, #b98f5c 0%, #a97e4c 100%);
  border: 1px solid #7d5a33;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}
.step-panel {
  display:none;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ecd9b5 0%, #dfc28f 100%);
  border: 1px solid #8f6c43;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}
.step-panel.is-active { display:block; }
.step-panel > * + * { margin-top: 16px; }
.step-panel .card-head { margin-bottom: 14px; }
.step-panel h3, .step-panel h4, .step-panel p, .step-panel label, .step-panel .muted { max-width: 100%; }
.step-panel .summary-grid,
.step-panel .result-overview-grid,
.step-panel .stats-chip-grid,
.step-panel .grid.result-block-grid,
.step-panel .form-grid,
.step-panel .stack-list,
.step-panel .table-shell {
  margin-left: 0;
  margin-right: 0;
}
.subhead-spacer { margin-top: .8rem; }
.summary-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin:12px 0 16px; }
.summary-card {
  padding:12px 14px;
  border:1px solid var(--border);
  border-radius:12px;
  background: linear-gradient(180deg, #f7ebcf 0%, #ecd7ab 100%);
  display:flex;
  flex-direction:column;
  gap:4px;
}
.summary-card span{font-size:.8rem;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;}
.summary-card strong{font-size:1.18rem;color:var(--text);}
.result-overview-grid, .stats-chip-grid {
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:14px;
  margin: 12px 0 16px;
}
.overview-card, .result-table-card {
  background: linear-gradient(180deg, #f4e6c6 0%, #e7d1a1 100%);
  border:1px solid var(--border);
  border-radius:14px;
  padding:16px;
}
.overview-list ul { margin:0; padding-left:18px; display:grid; gap:8px; }
.overview-list li { line-height:1.45; }
.result-block-grid { grid-template-columns:1fr 1fr; gap:14px; }
.table-shell {
  background:#fbf4e4;
  border:1px solid var(--border);
  border-radius:10px;
  padding:10px;
  min-height:180px;
}
.table-scroll { overflow:auto; }
.result-table { width:100%; border-collapse: collapse; font-size:12px; }
.result-table th, .result-table td { border-bottom:1px solid #c8ad83; padding:8px 10px; text-align:left; white-space:nowrap; }
.result-table th {
  color: var(--muted);
  font-weight:700;
  background: rgba(232,216,186,0.95);
  position: sticky;
  top: 0;
}
.stepper-foot {
  justify-content: space-between;
  margin: 18px 12px 0;
  padding: 14px 16px;
  border: 1px solid #7e5c37;
  border-radius: 12px;
  background: linear-gradient(180deg, #f2dfb7 0%, #e2c78f 100%);
}
.utility-card {
  background: linear-gradient(180deg, #d2ba8e 0%, #c4a56e 100%);
  border-color: #8d683f;
}
.stat-card { min-height: 160px; }
.tab-result-overview { margin-bottom: 14px; }

@media (max-width: 1100px) {
  .overlay-header-like, .stepper-layout, .workspace-grid, .builder-grid, .form-grid.two-up, .compact-form, .three-up, .result-overview-grid, .stats-chip-grid, .result-block-grid, .project-meta-row, .wide-first-row { grid-template-columns: 1fr; }
  .status-strip, .summary-grid { grid-template-columns: 1fr 1fr; }
  .overlay-header-actions { justify-content: flex-start; }
}
@media (max-width: 840px) {
  .hero { display: grid; }
  .hero h1 { font-size: 34px; }
  .status-strip, .summary-grid { grid-template-columns: 1fr; }
  .page { padding-left: 10px; padding-right: 10px; }
}


.route-preview {
  display: block;
  width: 168px;
  height: 54px;
  overflow: visible;
}
.route-line {
  stroke: #5c7a34;
  stroke-width: 2.4;
  stroke-linecap: round;
}
.route-line.is-risky {
  stroke: #8b3a2b;
  stroke-dasharray: 7 5;
}
.route-point {
  stroke: rgba(42, 29, 15, 0.45);
  stroke-width: 1.1;
}
.route-point.from { fill: #5c7a34; }
.route-point.to { fill: #7d4f24; }
.route-tower {
  fill: rgba(139, 58, 43, 0.2);
  stroke: #8b3a2b;
  stroke-width: 1.2;
}
.route-tower-label {
  font-size: 8px;
  fill: #6e2319;
  font-weight: 700;
}
.table-shell .route-preview { margin: 0 auto; }
