:root {
  color-scheme: dark;
  --bg: #12110e;
  --bg-2: #1b1915;
  --ink: #f3efe6;
  --muted: #a39b8e;
  --line: rgba(243, 239, 230, 0.12);
  --orange: #ff4d2e;
  --mint: #8ee0c8;
  --metal: #d5dbe4;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 80% -10%, rgba(255, 77, 46, 0.16), transparent 55%),
    radial-gradient(700px 380px at -10% 110%, rgba(142, 224, 200, 0.08), transparent 50%),
    var(--bg);
}

button, input, select { font: inherit; color: inherit; }

.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 20px 40px;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.brand { display: flex; gap: 14px; align-items: center; }

.logo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background:
    linear-gradient(145deg, #ffb199 0%, #ff4d2e 42%, #8a1d12 100%);
  box-shadow:
    8px 10px 0 #d5dbe4,
    16px 18px 0 #8ee0c8;
  transform: rotate(8deg);
}

h1 {
  margin: 0;
  font-family: Palatino, "Iowan Old Style", Georgia, serif;
  font-weight: 500;
  font-size: 34px;
  letter-spacing: -0.03em;
}

.brand p, .hint, .keys, .blurb {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  max-width: 62ch;
}

.top-actions, .presets { display: flex; flex-wrap: wrap; gap: 8px; }

button {
  background: var(--orange);
  color: #1a0d09;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 650;
  cursor: pointer;
}

button.ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

button.tiny { padding: 4px 10px; font-size: 13px; }

button:hover { filter: brightness(1.06); }
button:active { transform: translateY(1px); }

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

.stage, .desk {
  background: rgba(20, 18, 15, 0.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.stage { padding: 14px 14px 16px; user-select: none; }

.rebate {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 6px 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #050504;
  border-radius: 10px;
  cursor: grab;
  touch-action: none;
}

canvas:active { cursor: grabbing; }

.meter {
  height: 3px;
  margin-top: 8px;
  background: #2a2722;
  border-radius: 99px;
  overflow: hidden;
}

#bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--orange), #ffd0a8);
}

.stage-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

#stats {
  margin: 8px 0 0;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--ink);
}

.hint { margin: 6px 2px 0; }

.compare {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.compare-controls:not([hidden]) {
  display: flex;
  gap: 16px;
  align-items: end;
  margin-top: 8px;
}

.wipe { flex: 1; }

.legend {
  list-style: none;
  display: flex;
  gap: 14px;
  padding: 12px 4px 0;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.legend li { display: flex; align-items: center; gap: 8px; }

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.desk {
  padding: 8px 14px 16px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}

.desk section {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.desk h2 {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.choices { display: flex; flex-wrap: wrap; gap: 6px; }

.choices button {
  background: #26231e;
  color: var(--ink);
  padding: 6px 10px;
  font-weight: 550;
  font-size: 13px;
}

.choices button[aria-pressed="true"] {
  background: var(--ink);
  color: #1a1612;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

label b {
  float: right;
  color: var(--ink);
  font-weight: 550;
}

.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.check.inline { margin-top: 18px; }

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

input[type="color"] {
  width: 100%;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

select {
  width: 100%;
  background: #26231e;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
}

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

.cube {
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  background: #221f1b;
  box-shadow: inset 3px 0 0 var(--swatch, var(--orange));
}

.cube h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.keys { padding-top: 12px; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  color: var(--mint);
}

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .desk { max-height: none; }
  h1 { font-size: 28px; }
  .top { flex-direction: column; align-items: flex-start; }
}
