:root {
  --bg-top: #efe5cf;
  --bg-bottom: #e0d3bb;
  --paper: rgba(255, 250, 241, 0.86);
  --paper-strong: #fbf6eb;
  --ink: #1f2730;
  --muted: #4f5b63;
  --accent: #b44b2a;
  --accent-soft: #e8b48c;
  --olive: #6d7550;
  --olive-soft: #c4c8b3;
  --blue: #49657d;
  --blue-soft: #c9d7e4;
  --line: rgba(31, 39, 48, 0.12);
  --shadow: 0 18px 48px rgba(39, 31, 18, 0.16);
  --radius: 22px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(180, 75, 42, 0.13), transparent 28%),
    radial-gradient(circle at top right, rgba(73, 101, 125, 0.14), transparent 30%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.25;
  background-image:
    linear-gradient(rgba(31, 39, 48, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 39, 48, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
}

.app-shell {
  width: min(1540px, calc(100vw - 32px));
  margin: 24px auto 32px;
}

.hero {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
  padding: 22px 24px;
  border: 1px solid rgba(31, 39, 48, 0.08);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(251, 246, 235, 0.96), rgba(242, 235, 220, 0.88));
  box-shadow: var(--shadow);
}

.eyebrow,
h1,
h2,
h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

.eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.35rem;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.hero-copy {
  max-width: 860px;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid rgba(31, 39, 48, 0.08);
  border-radius: var(--radius);
  background: var(--paper);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}

.controls-panel,
.info-panel {
  padding: 20px;
}

.sim-panel {
  overflow: hidden;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(251, 246, 235, 0.94), rgba(240, 231, 212, 0.92)),
    linear-gradient(45deg, rgba(73, 101, 125, 0.06), rgba(109, 117, 80, 0.06));
}

#simCanvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
  border: 1px solid rgba(31, 39, 48, 0.08);
  background: linear-gradient(180deg, #f6efdf 0%, #eee3cd 100%);
}

.control-group {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.control-group label,
.toggle span {
  font-size: 0.95rem;
}

input[type="range"] {
  width: 100%;
  margin: 4px 0;
  accent-color: var(--accent);
}

input[type="number"],
select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(31, 39, 48, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  font: inherit;
}

select {
  appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.input-with-unit,
.triple-input {
  display: grid;
  gap: 8px;
  align-items: center;
}

.input-with-unit {
  grid-template-columns: minmax(0, 1fr) auto;
}

.triple-input {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.input-with-unit span,
.triple-input span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(31, 39, 48, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-size: 0.9rem;
}

.field-hint {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.35;
}

.sensor-parameters {
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid rgba(31, 39, 48, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.38);
}

.sensor-parameters summary {
  cursor: pointer;
  margin-bottom: 8px;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-weight: 700;
}

.compact-control {
  margin: 10px 0;
}

.sensor-parameters > button {
  width: 100%;
  margin-top: 2px;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.button-row:last-of-type {
  grid-template-columns: 1fr;
}

button {
  cursor: pointer;
  border: 1px solid rgba(31, 39, 48, 0.18);
  border-radius: 999px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  font: inherit;
  transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 39, 48, 0.35);
}

button.primary,
button.is-active {
  background: linear-gradient(180deg, var(--accent), #8d381e);
  border-color: #8d381e;
  color: #fff8f2;
}

.toggle-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 20px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.52);
}

.toggle input {
  accent-color: var(--accent);
}

.notes {
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(196, 200, 179, 0.28), rgba(201, 215, 228, 0.2));
}

.notes p {
  margin: 0 0 10px;
  line-height: 1.45;
  color: var(--muted);
}

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

.status-bar {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  min-height: 50px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--muted);
  line-height: 1.4;
}

.metric-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.metric-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.56);
}

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

.metric-value {
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 1.02rem;
}

.run-log {
  margin: 0;
  padding: 14px;
  min-height: 260px;
  max-height: 420px;
  overflow: auto;
  border-radius: 18px;
  background: rgba(24, 31, 39, 0.92);
  color: #e7edf2;
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

.pilot-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.pilot-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

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

.pilot-tag {
  justify-self: start;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(73, 101, 125, 0.14);
  color: var(--blue);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
 }

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

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 20px, 1540px);
    margin-top: 12px;
  }

  .hero,
  .controls-panel,
  .info-panel,
  .sim-panel {
    padding-left: 16px;
    padding-right: 16px;
  }
}
