:root {
  color-scheme: dark;
  --bg: #12110f;
  --panel: #1b1815;
  --card: #241f1b;
  --frame: #2c2723;
  --text: #f4efe6;
  --muted: #b2a89c;
  --line: #3d342c;
  --accent: #e7a15a;
  --accent-ink: #1c140c;
  --green: #d7efe0;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.app {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 28px 22px 36px;
  overflow: auto;
  max-height: 100vh;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand h1 {
  margin: 0 0 10px;
  font-family: Palatino, "Iowan Old Style", Georgia, serif;
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 0.98;
}

.lede {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.muted, .hint, .keys {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.hint { min-height: 0; margin: 10px 0 0; }

.open {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--text);
  cursor: pointer;
}

.open:hover { border-color: var(--accent); }

.open input { display: none; }

#file-label { margin: 10px 0 0; }

section { margin-top: 26px; }

h2 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.modes { display: grid; gap: 8px; }

.mode {
  position: relative;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 2px 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
}

.mode:hover { border-color: var(--line); }

.mode:has(input:checked) {
  background: #2c241c;
  border-color: var(--accent);
}

.mode:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.mode input {
  position: absolute;
  opacity: 0;
}

.mode svg {
  grid-row: 1 / span 2;
  width: 32px;
  height: 32px;
  color: var(--accent);
}

.mode-title {
  font-size: 15px;
  font-weight: 650;
}

.mode-line {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  align-items: center;
  margin: 14px 0 6px;
  font-size: 13px;
  color: var(--muted);
}

.field select,
.field input[type="range"] { grid-column: 1 / -1; }

.field-name { color: var(--text); }

select, button {
  background: var(--frame);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
}

select { width: 100%; }

button { cursor: pointer; }

button:hover { border-color: #6a5b4c; }

button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  white-space: nowrap;
}

button.primary:hover { filter: brightness(1.05); }

button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  filter: none;
}

.check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 12px 0;
  font-size: 14px;
  line-height: 1.35;
}

.row { display: flex; gap: 8px; }
.row button { flex: 1; }

#handles {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

#handles li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

#handles button { padding: 4px 10px; border-radius: 999px; }

#bake { width: 100%; margin-top: 8px; }

details {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

summary::-webkit-details-marker { display: none; }

summary::after {
  content: "Show";
  float: right;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

details[open] summary::after { content: "Hide"; }

details .muted:first-of-type { margin-top: 8px; }

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 100vh;
  padding: 28px 32px;
  background:
    radial-gradient(ellipse at 50% 42%, #3a2c22 0%, rgba(58, 44, 34, 0) 46%),
    var(--bg);
}

.stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(860px, 100%);
}

.status {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
}

.frame {
  position: relative;
  width: min(860px, calc(100vh - 150px), 100%);
  aspect-ratio: 1;
  background: #070706;
  border-radius: 22px;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(244, 239, 230, 0.08);
  overflow: hidden;
}

canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#overlay { cursor: crosshair; touch-action: none; }

.coach {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: max-content;
  max-width: calc(100% - 36px);
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(18, 17, 15, 0.82);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  text-align: center;
}

.coach strong { font-size: 15px; }

.coach span {
  color: var(--muted);
  font-size: 13px;
}

.keys { margin: 0; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .stage { order: -1; min-height: auto; padding: 16px; }
  .sidebar { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand h1 { font-size: 32px; }
  .frame { width: min(100%, 78vw); }
  .stage-bar { align-items: flex-start; }
}
