:root {
  --bg: #16110d;
  --bg-2: #211812;
  --panel: #241a14;
  --ink: #f6ead8;
  --muted: #b9a48c;
  --line: #3d2c22;
  --amber: #e6a043;
  --amber-deep: #c4842e;
  --cream: #f0e4d0;
  --green: #6bcf8e;
  --danger: #de7656;
  --radius: 2px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Source Sans 3", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse 70% 50% at 10% -10%, #3a2818 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 100%, #1c1611 0%, transparent 50%),
    var(--bg);
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.topbar, .shell, .foot { position: relative; z-index: 1; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgba(22, 17, 13, 0.72);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  text-decoration: none;
  color: var(--cream);
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.brand-mark {
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.7rem;
  letter-spacing: 0.06em;
  line-height: 1;
}
.brand-ticker {
  color: var(--amber);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.links a {
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.links a:hover {
  color: var(--amber);
  border-color: var(--amber);
}

.shell {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.hero h1 {
  margin: 0;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(2.8rem, 7vw, 4.4rem);
  letter-spacing: 0.04em;
  line-height: 0.95;
  color: var(--cream);
}
.lede {
  margin: 10px 0 0;
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.5;
}

.layout {
  margin-top: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.panel {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line);
  padding: 14px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 140px);
  overflow: auto;
  padding-right: 8px;
}

.slot-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.slot-head h2 {
  margin: 0;
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  color: var(--amber);
  font-weight: 400;
}
.req, .opt {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.req { color: var(--green); }

.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}

.thumb {
  border: 1px solid var(--line);
  background: #140f0c;
  padding: 4px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  width: 100%;
}
.thumb:hover { border-color: #6a5542; }
.thumb.selected {
  border-color: var(--amber);
  box-shadow: inset 0 0 0 1px var(--amber);
}
.thumb.none-selected {
  border-style: dashed;
}
.thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background:
    linear-gradient(45deg, #1a1410 25%, transparent 25%),
    linear-gradient(-45deg, #1a1410 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1a1410 75%),
    linear-gradient(-45deg, transparent 75%, #1a1410 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0;
  background-color: #0d0a08;
}
.thumb .none-art {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #0d0a08;
}
.thumb .label {
  margin-top: 5px;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.25;
  word-break: break-word;
}

.stage-wrap {
  position: sticky;
  top: 78px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stage {
  width: min(100%, 560px);
  margin: 0 auto;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  background: #0d0a08;
}
.stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.status {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  min-height: 1.2em;
}
.status.err { color: var(--danger); }

.actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
button {
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--cream);
  padding: 11px 18px;
  cursor: pointer;
}
button:hover { border-color: var(--amber); color: var(--amber); }
button.primary {
  background: var(--amber);
  border-color: var(--amber-deep);
  color: #1a120c;
}
button.primary:hover { filter: brightness(1.05); color: #1a120c; }
button:disabled { opacity: 0.45; cursor: wait; }

.meta {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.foot {
  border-top: 1px solid var(--line);
  padding: 22px clamp(16px, 4vw, 40px) 36px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}
.foot a { color: var(--amber); }
.disclaimer {
  max-width: 46rem;
  margin: 10px auto 0;
  font-size: 0.75rem;
  line-height: 1.45;
  opacity: 0.85;
}

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .controls { max-height: none; }
  .stage-wrap { position: static; order: -1; }
}
