:root {
  color-scheme: dark;
  --ink: #12110e;
  --paper: #f3eee4;
  --paper-ink: #1c1915;
  --muted: #4e4942;
  --brass: #e2b15a;
  --line: #e0d5c4;
  --serif: "Noto Serif", Georgia, "Iowan Old Style", Palatino, serif;
  --sans: "Noto Sans", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { background: var(--ink); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 480px at 0% -10%, #2a241c 0%, transparent 55%),
    radial-gradient(700px 420px at 100% 0%, #1a2c2c 0%, transparent 50%),
    var(--ink);
  color: #ebe4d8;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
}

::selection { background: var(--brass); color: var(--paper-ink); }

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  background: #fff;
  color: #000;
  padding: 8px 12px;
  z-index: 5;
  border-radius: 8px;
}

.skip:focus { top: 12px; }

header, .notice, .shelf-wrap, footer, .noscript {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-top: 18px;
}

.mark {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.7rem;
  letter-spacing: -0.03em;
  color: #f3ecdf;
}

.mark span { color: var(--brass); }

.lede {
  margin: 0;
  color: #b7ad9e;
  font-size: 0.95rem;
}

.notice {
  margin-top: 16px;
  margin-bottom: 0;
  background: #3a2c22;
  color: #f6eadc;
  border-radius: 12px;
  padding-top: 12px;
  padding-bottom: 12px;
}

main {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.9fr);
  gap: 28px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 24px 8px;
  align-items: stretch;
}

.stage {
  position: relative;
  min-height: 480px;
  border-radius: 28px;
  overflow: hidden;
  background: #0e0d0b;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
}

.stage.swap { animation: rise 280ms ease; }

@keyframes rise {
  from { opacity: 0.45; }
  to { opacity: 1; }
}

.art, .art svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.stage-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 88px 28px 26px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.45) 52%, transparent 100%);
  color: #f6f2ea;
}

.kicker {
  margin: 0 0 8px;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.poster {
  margin: 0;
  font-family: var(--serif);
  font-weight: 560;
  font-size: clamp(2.7rem, 5vw, 4.5rem);
  line-height: 0.9;
  letter-spacing: -0.035em;
  text-wrap: balance;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.ticket {
  color-scheme: light;
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: 28px;
  padding: 18px 18px 14px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 22px 50px rgba(0, 0, 0, 0.28);
}

.job {
  margin: 0 0 4px;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: #7a7268;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 560;
  font-size: clamp(1.7rem, 2.4vw, 2.15rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-wrap: balance;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.brief { margin: 8px 0 0; font-size: 0.94rem; }

.brief p { margin: 0 0 4px; }

.axes {
  list-style: none;
  padding: 0;
  margin: 6px 0 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
}

.axes li { min-width: 0; }

.axes button {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 5px 8px;
  min-height: 44px;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.axes button:hover { background: rgba(28, 25, 21, 0.04); }

.axes button[aria-pressed="true"] {
  background: #e9e0d0;
  border-color: #d9cbb3;
}

.axis-k {
  grid-column: 1;
  grid-row: 1;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.axis-v {
  grid-column: 1;
  grid-row: 2;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
  line-height: 1.25;
}

.lock {
  grid-column: 2;
  grid-row: 1 / span 2;
  position: relative;
  width: 16px;
  height: 16px;
  border: 1.5px solid #8a8174;
  border-radius: 4px;
}

[aria-pressed="true"] .lock {
  background: var(--paper-ink);
  border-color: var(--paper-ink);
}

[aria-pressed="true"] .lock::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 3px;
  height: 7px;
  border: solid var(--paper);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.hint, .status {
  margin: 0;
  color: #5e584e;
  font-size: 0.92rem;
}

.status { min-height: 1.3em; margin-top: 6px; }

.swatches {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 8px;
}

.swatches button {
  border: 0;
  background: transparent;
  padding: 4px;
  margin: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  border-radius: 12px;
  min-height: 44px;
}

.chip {
  display: block;
  height: 32px;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16);
}

.chip-name, .chip-hex {
  display: block;
  overflow-wrap: anywhere;
}

.chip-name {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--muted);
}

.chip-hex {
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  color: #6e675c;
  font-variant-numeric: tabular-nums;
}

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

.actions button, .shelf-open, .shelf-x {
  font: inherit;
  cursor: pointer;
}

.actions button {
  flex: 1 1 30%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.95rem;
  white-space: nowrap;
  background: transparent;
  color: var(--paper-ink);
  border: 1px solid #cfc4b2;
}

.actions button.primary {
  background: var(--paper-ink);
  color: var(--paper);
  border-color: var(--paper-ink);
}

.actions button:hover { background: rgba(28, 25, 21, 0.05); }

.actions button.primary:hover { background: #322c26; }

.actions button:active { transform: translateY(1px); }

#fallback-copy {
  width: 100%;
  margin-top: 12px;
  min-height: 7rem;
  border-radius: 12px;
  border: 1px solid #cfc4b2;
  padding: 10px;
  font: inherit;
  color: var(--paper-ink);
  background: #fff;
}

.shelf-wrap { padding-top: 22px; padding-bottom: 8px; }

.shelf-wrap h2 {
  margin: 0 0 10px;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 650;
  color: #b7ad9e;
}

#shelf-empty { margin: 0 0 8px; color: #8c8376; }

.shelf-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  scroll-snap-type: x mandatory;
}

.shelf-card {
  position: relative;
  flex: 0 0 auto;
  width: 156px;
  scroll-snap-align: start;
  border-radius: 16px;
  background: #1c1a16;
  box-shadow: 0 0 0 1px #3a342c;
}

.shelf-card.is-current { box-shadow: 0 0 0 2px var(--brass); }

.shelf-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.shelf-bits { display: flex; height: 36px; border-radius: 16px 16px 0 0; overflow: hidden; }

.shelf-bits span { flex: 1; }

.shelf-name {
  display: block;
  padding: 8px 28px 10px 10px;
  font-family: var(--serif);
  font-size: 0.92rem;
  line-height: 1.2;
}

.shelf-x {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: rgba(18, 17, 14, 0.72);
  color: #f3ecdf;
  font-size: 1.1rem;
  line-height: 1;
}

footer { padding-top: 4px; padding-bottom: 36px; color: #8c8376; }

.noscript {
  margin-top: 12px;
  color: #f6eadc;
}

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.ticket :focus-visible { outline-color: var(--paper-ink); }

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

  .axes button {
    grid-template-columns: 84px minmax(0, 1fr) auto;
    grid-template-rows: auto;
    min-height: 44px;
  }

  .axis-k, .axis-v { grid-row: 1; }

  .axis-k { grid-column: 1; align-self: center; }

  .axis-v { grid-column: 2; align-self: center; }

  .lock { grid-column: 3; grid-row: 1; }
  header, .notice, .shelf-wrap, footer, .noscript {
    padding-left: 16px;
    padding-right: 16px;
  }

  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding-top: 18px;
  }

  main {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 16px;
  }

  .stage {
    min-height: 0;
    aspect-ratio: 3 / 4;
    border-radius: 20px;
  }

  .ticket { padding: 18px 16px 16px; border-radius: 20px; }

  .actions button { flex: 1 1 42%; padding: 0 12px; }

  .stage-caption { padding: 72px 18px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .stage.swap { animation: none; }
  .actions button:active { transform: none; }
}
