:root {
  color-scheme: dark;
  --ink: #f4efe4;
  --muted: #d5cbb8;
  --bg: #10233a;
  --bg-2: #17324d;
  --line: #2d5274;
  --amber: #ffb703;
  --coral: #e85d4c;
  --ok: #8fd18a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -10%, rgba(255, 183, 3, 0.18), transparent 32%),
    linear-gradient(180deg, #16324d 0%, var(--bg) 38%, #0c1b2e 100%);
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

main {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto 64px;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: "Arial Black", "Segoe UI", sans-serif;
  letter-spacing: 0.04em;
  font-size: 22px;
}

.ring {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 4px solid var(--amber);
  box-shadow: inset 0 0 0 4px var(--coral);
}

nav { display: flex; gap: 14px; flex-wrap: wrap; }
nav a { color: var(--amber); }
nav .nav-form { display: inline; margin: 0; }
nav .nav-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--amber);
  text-decoration: underline;
  cursor: pointer;
}

h1, h2, legend {
  font-family: "Arial Black", "Segoe UI", sans-serif;
  letter-spacing: 0.02em;
  font-weight: 800;
}

h1 { font-size: 40px; margin: 0 0 8px; }
h2 { margin: 0 0 8px; font-size: 22px; }

.lede { font-size: 18px; color: var(--muted); max-width: 62ch; }

.hero { padding: 12px 0 28px; }
.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(240px, 0.85fr);
  gap: 28px;
  align-items: center;
}
.sample-scene {
  position: relative;
  aspect-ratio: 1120 / 900;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #41a6f6;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}
.hero-layout:not(:has(.sample-scene)) { display: block; }
.sample-scene iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}
.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--amber);
  font-size: 13px;
}

.hero-points {
  list-style: none;
  padding: 0;
  margin: 16px 0 18px;
  display: grid;
  gap: 10px;
}
.hero-points li {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(16, 35, 58, 0.55);
  color: var(--muted);
}
.hero-points strong {
  display: block;
  margin-bottom: 2px;
  color: var(--amber);
  font-family: "Arial Black", "Segoe UI", sans-serif;
  letter-spacing: 0.02em;
}

.hero-actions, .url-row, .row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.button, button {
  background: var(--amber);
  color: #1b1403;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.button.ghost, button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.card, fieldset.card, fieldset {
  background: rgba(16, 35, 58, 0.78);
  border: 1px solid var(--line);
  border-left: 6px solid var(--amber);
  border-radius: 16px;
  padding: 16px 18px 18px;
  margin: 0 0 16px;
}

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.stack label, form label { display: block; margin: 10px 0; }
.hint { color: var(--muted); font-size: 14px; }
label.check { display: flex; gap: 8px; align-items: center; }

input, select, textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0d1c2e;
  color: var(--ink);
  font: inherit;
}

input[type="checkbox"], input[type="radio"] { width: auto; margin-top: 0; }

input[type="range"] {
  display: block;
  width: min(280px, 100%);
  height: 28px;
  margin: 8px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
}
textarea { resize: vertical; }

.choice-grid { display: flex; flex-wrap: wrap; gap: 4px; }
.pad-choices { gap: 2px; }
.pad-choices .choice { margin: 0; }
.choice {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0d1c2e;
}
.choice input { accent-color: var(--amber); }

.preview {
  margin: 12px 0;
  background: #0d1c2e;
  border-radius: 12px;
  min-height: 120px;
}
.preview svg, .preview img, .preview canvas {
  width: 100%;
  height: auto;
  max-height: 180px;
  display: block;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#pad-preview {
  overflow: hidden;
  min-height: 180px;
}

#pad-preview .pad-stage {
  position: relative;
  height: 180px;
}

#pad-preview .pad-mover {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(calc(180px * 192 / 112), calc(100% * 680 / 1920));
  transform: translate(-50%, -50%);
}

#pad-preview .pad-mover svg,
#pad-preview .pad-mover img,
#pad-preview .pad-mover canvas {
  width: 100%;
  height: auto;
  max-height: none;
}
.character-preview { width: auto; min-width: 96px; min-height: 140px; color: #e85d4c; }
.character-preview svg { width: 96px; height: auto; }
.random-chip { display: inline-block; width: 48px; vertical-align: bottom; }
.random-chip img, .random-chip canvas { width: 48px; height: auto; image-rendering: pixelated; }
#pad-preview.pad-random {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  gap: 8px;
  padding: 10px;
}
.pad-chip { width: 64px; }
.pad-chip img { width: 100%; height: auto; display: block; }

.url-row input { flex: 1; }

table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.row-actions form { display: inline; }
.row-actions button { padding: 6px 10px; }

.flash, .errors {
  background: #24381f;
  border: 1px solid var(--ok);
  border-radius: 12px;
  padding: 12px 14px;
}
.errors { background: #3c1d22; border-color: var(--coral); }

.checks { list-style: none; padding: 0; }
.checks li { padding: 6px 0; }
.checks .ok::before { content: "● "; color: var(--ok); }
.checks .bad::before { content: "● "; color: var(--coral); }

code { color: var(--amber); }

.site-foot {
  position: fixed;
  z-index: 15;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 12px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background: #0c1b2e;
  border-top: 1px solid var(--line);
}
.site-foot a { color: var(--amber); }
body:has(.site-foot) { padding-bottom: 52px; }
body:has(.site-foot) main { margin-bottom: 28px; }

@media (max-width: 720px) {
  .split, .top, .hero-layout { display: block; }
  .sample-scene { margin-top: 22px; }
  nav { margin-top: 10px; }
  h1 { font-size: 32px; }
}
