:root {
  color-scheme: light;
  --bg: #eef3f6;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #66727c;
  --line: #d7e0e6;
  --water: #bfe8f0;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  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: 360px minmax(0, 1fr);
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.controls,
.visual-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgb(23 32 42 / 0.08);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  overflow: auto;
}

.title-block h1,
.canvas-toolbar h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.title-block p,
.canvas-toolbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 5px;
  color: #34414c;
  font-size: 12px;
  font-weight: 650;
}

input[type="number"],
select {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  background: #fbfdfe;
  font: inherit;
}

input[type="number"]:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgb(15 118 110 / 0.15);
}

.run-button,
#reset-view {
  height: 38px;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.run-button {
  grid-column: 1 / -1;
  background: var(--accent);
  color: white;
}

.run-button:hover {
  background: var(--accent-strong);
}

#reset-view {
  padding: 0 14px;
  background: #e8eef2;
  color: #26323d;
}

.readout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.readout div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #f7fafb;
}

.readout span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.readout strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
}

.visual-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px;
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0.55), rgb(255 255 255 / 0)),
    var(--water);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .controls {
    overflow: visible;
  }

  .canvas-wrap {
    min-height: 360px;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 10px;
  }

  .control-grid,
  .readout {
    grid-template-columns: 1fr;
  }

  .canvas-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
