:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #5d687c;
  --line: #d9e0ea;
  --blue: #2f6fbd;
  --shadow: 0 12px 32px rgba(23, 32, 51, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(330px, 0.88fr) minmax(0, 1.12fr);
  grid-template-rows: minmax(500px, 52vh) minmax(390px, 1fr);
  gap: 12px;
  min-height: 100vh;
  padding: 12px;
}

.controls,
.plot-cell {
  min-width: 0;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}

.brand,
.status {
  width: 100%;
}

.brand {
  padding-bottom: 2px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
}

.field span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

output {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

select,
button {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

select {
  padding: 0 12px;
}

button {
  cursor: pointer;
  background: var(--blue);
  color: white;
  border-color: var(--blue);
  font-weight: 750;
}

button:hover {
  filter: brightness(0.96);
}

.hidden {
  display: none;
}

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

input[type="range"]:disabled {
  opacity: 0.48;
}

.segmented {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.segmented button {
  min-height: 30px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.segmented button.is-active {
  background: var(--blue);
  color: #fff;
}

.note {
  margin: -2px 0 0;
  padding: 10px 12px;
  border: 1px solid #cfd8e6;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.status {
  min-height: 38px;
  margin: auto 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.plot-cell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.tile-header {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 14px 18px 8px;
  border-bottom: 1px solid var(--line);
}

.tile-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.plot {
  width: 100%;
  height: 100%;
  min-height: 0;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto repeat(3, minmax(420px, 64vh));
    min-height: auto;
  }

  .controls {
    display: flex;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 8px;
    gap: 8px;
    grid-template-rows: auto repeat(3, minmax(380px, 62vh));
  }

  .controls {
    padding: 16px;
  }

  h1 {
    font-size: 1.2rem;
  }

  .tile-header h2 {
    font-size: 1.16rem;
  }
}
