:root {
  --bg: #ffffff;
  --rail: #fafafa;
  --ink: #272727;
  --dim: #64646c;
  --line: #e6e6ea;
  --line-strong: #cfcfd6;
  --accent: #d6004a;
  --wash: #fff1f5;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--sans); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#app { height: 100%; }

.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}
.shell[data-embed="true"] {
  grid-template-columns: minmax(0, 1fr);
}
.shell[data-embed="true"] .menu {
  display: none !important;
}
.shell[data-embed="true"] .dock-composer {
  display: none;
}
.shell[data-build="true"] {
  grid-template-columns: 260px minmax(300px, 400px) minmax(0, 1fr);
}
.side, .rail, .stage {
  min-height: 0;
  min-width: 0;
}
.side {
  background: var(--rail);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
}
.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand b { color: var(--accent); }
.new {
  margin: 0 6px 10px;
  border: 1px solid #f3b3c6;
  background: #fff;
  color: var(--accent);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 650;
  text-align: left;
}
.cats {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 6px 8px;
  scrollbar-width: none;
}
.cats button, .chip, .btn, .tone, .tile, .stylebtn, .stop, .rule {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
}
.cats button.on, .tone.on, .tile.on, .stylebtn.on, .stop.on, .rule.on, .chip.on {
  background: var(--ink);
  color: #fff;
  border-color: transparent;
}
.list { overflow: auto; flex: 1; padding: 0 4px 12px; }
.list button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 8px 10px;
  display: grid;
  gap: 2px;
}
.list button.on, .list button:hover { background: #fff; }
.list strong { font-size: 14px; }
.list span { color: var(--dim); font-size: 12px; }
.count {
  padding: 8px 10px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.rail {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}
.stage { display: flex; flex-direction: column; background: #fff; }
.empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px 20px 12px;
  text-align: center;
}
.empty h1 {
  font-size: clamp(32px, 4vw, 44px);
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  font-weight: 650;
}
.empty p { margin: 0; color: var(--dim); max-width: 46ch; }
.picks { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 640px; margin: 16px 0 4px; }
.empty .composer, .dock-composer .composer { width: min(720px, 100%); }
.rail { overflow: auto; }
.rail .dock-composer { margin-top: auto; }
.rail .dock { flex-direction: column; align-items: stretch; }
.rail .dock .row { justify-content: flex-end; }
.catpick { display: grid; gap: 4px; margin: 0 6px 8px; font-size: 12px; color: var(--dim); }
.catpick select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; }
.composer-wrap { width: min(720px, 100%); margin: 18px auto 0; }
.composer {
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(52, 52, 52, 0.06);
  padding: 10px 12px 8px 14px;
}
.composer textarea {
  width: 100%;
  border: 0;
  resize: none;
  outline: none;
  min-height: 28px;
  max-height: 120px;
  padding: 4px 0;
  background: transparent;
}
.composer-row { display: flex; align-items: center; gap: 8px; }
.modes { display: inline-flex; padding: 2px; border-radius: 999px; background: #f4f4f5; border: 1px solid #e4e4e7; }
.modes button { border: 0; background: transparent; border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 650; color: #52525b; }
.modes button.on { background: #fff; color: #18181b; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.modes button.on.build { background: var(--accent); color: #fff; }
.send {
  margin-left: auto;
  width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: #ececf1; color: #888;
}
.send.on { background: var(--ink); color: #fff; }
.dock-composer { padding: 8px 12px 12px; }

.phead { padding: 16px 18px 0; }
.kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.phead h1 { margin: 4px 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: -0.03em; font-weight: 600; }
.phead p { margin: 0; color: var(--dim); }
.stage-body { padding: 14px 18px 18px; overflow: auto; flex: 1; }
.hint { color: var(--dim); margin: 0 0 12px; }
.note { color: var(--dim); font-size: 13px; margin-top: 10px; }

.dials { display: grid; gap: 14px; }
.dial label { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.dial input { width: 100%; accent-color: var(--accent); }
.verdict, .cardface, .previewbox {
  margin-top: 14px;
  padding: 16px;
  border-radius: 16px;
  background: var(--wash);
  border: 1px solid #f3b3c6;
}
.verdict h3, .cardface strong, .previewbox {
  font-size: 28px;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
}
.cardface strong { display: block; font-size: 34px; }
.row, .tiles, .tones, .styles, .people, .stops { display: flex; flex-wrap: wrap; gap: 8px; }
.btn.solid { background: var(--accent); color: #fff; border-color: transparent; }
.clocknum { font-size: clamp(64px, 12vw, 120px); letter-spacing: -0.04em; line-height: .9; margin: 0; }
.person { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.person .money { margin-left: auto; font-family: var(--mono); }
.duel { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.duel button, .rankrow {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 14px;
}
.duel button strong { display: block; font-size: 26px; letter-spacing: -0.03em; }
.rankrow { display: flex; gap: 8px; align-items: center; border-radius: 12px; margin-bottom: 8px; }
.rankrow .t { flex: 1; }
.sprint { position: relative; height: 280px; border: 1px solid var(--line); border-radius: 16px; background: #fafafa; overflow: hidden; }
.bug { position: absolute; border: 0; border-radius: 999px; padding: 8px 12px; background: var(--accent); color: #fff; font-weight: 700; }
.bug.decoy { background: #fff; color: var(--dim); border: 1px dashed var(--line-strong); }
canvas.poster, canvas.wheel { width: min(100%, 420px); height: auto; }
.swatches { display: flex; height: 84px; border-radius: 14px; overflow: hidden; }
.swatches span { flex: 1; }
.fake { margin-top: 10px; border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.beatrow { display: flex; gap: 5px; margin: 10px 0; }
.beat { width: 16px; height: 32px; border-radius: 5px; background: #eee; }
.beat.on { background: var(--accent); }
.beat.hit { background: #1f9d55; }
.beat.miss { background: #e7b4c2; }
.fields { display: grid; gap: 8px; }
.field { display: grid; gap: 4px; }
.field span { font-size: 13px; color: var(--dim); }
.field input, .field textarea, .linebox {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  width: 100%;
  background: #fff;
}
.dock {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  justify-content: space-between;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line);
}
.dock pre { margin: 0; white-space: pre-wrap; color: var(--dim); font-family: var(--sans); max-width: 70ch; }
.saved { color: #1f9d55; font-size: 13px; }

@media (max-width: 800px) {
  .shell, .shell[data-build="true"] { grid-template-columns: 1fr; }
  .side { display: none; }
  .shell[data-nav="open"] .side {
    display: flex;
    position: absolute;
    inset: 0 auto 0 0;
    width: min(320px, 88vw);
    z-index: 5;
    box-shadow: 8px 0 30px rgba(0,0,0,.12);
  }
  .duel { grid-template-columns: 1fr; }
  .menu { display: inline-flex !important; }
}
.menu { display: none; border: 0; background: transparent; font-size: 18px; padding: 8px; }
.main, .rail, .stage { position: relative; }
.empty .menu, .phead .menu { position: absolute; top: 8px; left: 8px; }
