:root {
  --bg: #0e1218;
  --panel: #161c24;
  --line: #2a3340;
  --text: #e6e0d4;
  --muted: #8b93a0;
  --accent: #c4a35a;
  --held: #d9b36a;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

.app {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  height: 100%;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem 1.35rem 1.25rem;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.7rem;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

h1 {
  margin: 0 0 0.6rem;
  font-size: 1.85rem;
  font-weight: 600;
}

.lede,
.hint {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.lede {
  margin: 0;
}

h2 {
  margin: 0 0 0.7rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-weight: 600;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 0.2rem;
}

.control-block {
  padding-top: 0.2rem;
  border-top: 1px solid var(--line);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
  font-size: 0.92rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
}

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

output {
  min-width: 5.6rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 0.82rem;
}

.length-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.length-list li {
  display: grid;
  grid-template-columns: 0.7rem 1fr auto;
  gap: 0.55rem;
  align-items: center;
  font-size: 0.82rem;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

.swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
}

.length-list .meta {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  font-size: 0.92rem;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}

button {
  appearance: none;
  border: 1px solid var(--line);
  background: #1d2530;
  color: var(--text);
  padding: 0.65rem 0.4rem;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}

button:disabled {
  opacity: 0.4;
  cursor: default;
}

button.primary {
  background: var(--accent);
  color: #1a1408;
  border-color: var(--accent);
  font-weight: 600;
}

button:hover:not(:disabled) {
  filter: brightness(1.08);
}

.status {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 0.78rem;
}

.status span {
  display: block;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.status strong {
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
}

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

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .panel {
    max-height: 46vh;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .stage {
    min-height: 54vh;
  }
}
