body { margin: 0; font-family: "Comic Neue", system-ui, sans-serif; background: #100A16; color: #F4F1FF; position: relative; overflow-x: hidden; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 18%, rgba(252,219,46,.10), transparent 25%),
    radial-gradient(circle at 80% 30%, rgba(61,247,236,.08), transparent 28%),
    radial-gradient(circle at 70% 78%, rgba(244,54,160,.08), transparent 24%);
  animation: arcadeGlow 8s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: -2;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,.02) 0 1px, transparent 1px 4px);
  mix-blend-mode: soft-light;
  pointer-events: none;
  z-index: -1;
}
.wrap { max-width: 1140px; margin: 0 auto; padding: 16px; }
.top { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(6px); background: #0F0915; border-bottom: 2px solid #303B95; }
.top-inner { display: flex; align-items: center; justify-content: space-between; }
.top-actions { display: inline-flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 42px; height: 42px; border-radius: 8px; border: 2px solid #FCDB2E; object-fit: cover; image-rendering: pixelated; }
.brand h1 { margin: 0; font-family: "Press Start 2P", monospace; font-size: 1rem; color: #FCDB2E; text-shadow: 0 0 8px rgba(252,219,46,.35); }
.brand p { margin: 2px 0 0; color: #7FD6FF; font-size: .95rem; }

.app { display: grid; grid-template-columns: 1fr; gap: 16px; }

.panel {
  background: linear-gradient(180deg, #251a3c, #1a1429);
  border: 2px solid #4d4278;
  border-radius: 0;
  box-shadow: 0 0 0 2px #120d1f, 0 12px 24px rgba(0,0,0,.35);
  padding: 16px;
  min-width: 0;
}
.side { height: fit-content; transition: all .25s ease; }

.hint { color: #d1ccde; font-size: 0.95rem; }
.line { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.line.compact { margin-top: 6px; flex-wrap: nowrap; }

.btn {
  border: 2px solid #6f86ff;
  border-radius: 0;
  padding: 10px 14px;
  background: linear-gradient(180deg, #4153ab, #303b95);
  color: #eef4ff;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.25);
  transition: transform .08s ease, filter .12s ease;
}
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.secondary { border-color: #7FD6FF; background: linear-gradient(180deg, #2f3d68, #25304f); color: #d7ecff; }
.btn.danger { border-color: #f06ab5; background: linear-gradient(180deg, #5d2a4f, #46203c); color: #ffd9ef; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ai-summon-btn {
  background: rgb(252, 219, 46);
  border-color: rgb(252, 219, 46);
  color: #241a00;
}
.ai-summon-btn:hover { filter: brightness(1.03); }

input, textarea, select {
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  border: 2px solid #4e4679;
  border-radius: 0;
  padding: 10px;
  font-family: inherit;
  color: #F5F2FF;
  background: #191327;
}
input:focus, textarea:focus, select:focus { outline: 2px solid #7FD6FF; border-color: #7FD6FF; }
label { display: block; font-weight: 700; margin-top: 10px; }

.wizard-shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 16px;
  min-width: 0;
}
.wizard-rail {
  background: linear-gradient(180deg, #303B95, #2a3179);
  border: 2px solid #6f8eff;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rail-projects {
  margin-top: 8px;
  border-top: 2px dashed rgba(255,255,255,0.25);
  padding-top: 10px;
}
.rail-projects h3 {
  margin: 0;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rail-projects h3 .top-toggle { margin-left: auto; width: 30px; height: 30px; }
.rail-projects.collapsed .rail-projects-body { display: none; }
.rail-projects .line .btn {
  font-size: .82rem;
  padding: 8px 10px;
}
.rail-projects input,
.rail-projects select {
  background: rgba(10,14,35,0.65);
}
.wizard-main {
  background: #1a1429;
  border: 2px solid #4d4278;
  padding: 14px;
  min-width: 0;
  overflow-x: clip;
}
.step {
  border: 0;
  background: transparent;
  color: #d4dcff;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 4px 6px;
}
.step-bullet {
  width: 32px;
  height: 32px;
  border: 2px solid #7a90e0;
  background: #24306a;
  color: #e8eeff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.25);
}
.step-copy { display: flex; flex-direction: column; gap: 2px; }
.step-copy small { font-size: .62rem; opacity: .8; letter-spacing: .8px; }
.step-copy strong { font-size: .73rem; letter-spacing: .8px; }
.step.active { color: #ffffff; }
.step.active .step-bullet { border-color: #8af9f0; background: #3d4ca3; box-shadow: 0 0 10px rgba(61,247,236,.35); }
.step.completed .step-bullet { border-color: #3df7ec; background: #21566f; color: #d8fffb; }

.stage { display: none; }
.stage.active { display: block; animation: fade .22s ease-in; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checks label { margin-top: 0; font-weight: 700; }
.field-row { display: grid; grid-template-columns: 1fr 1fr .7fr 1fr auto; gap: 8px; margin: 8px 0; }
.field-row button { padding: 8px 10px; }
pre#output {
  background: #121827;
  color: #d9e8ff;
  border: 2px solid #34446f;
  border-radius: 0;
  padding: 12px;
  min-height: 120px;
  max-height: min(50vh, 380px);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
  margin: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  font-size: 0.78rem;
  line-height: 1.4;
  tab-size: 2;
}
.nav { justify-content: space-between; margin-top: 16px; }
.logo-preview { display: none; margin-top: 10px; max-width: 180px; border: 2px solid #4A4577; background: #0E0A16; image-rendering: pixelated; }
.logo-preview.show { display: block; }
.advanced { margin-top: 12px; border: 2px dashed #4A4577; border-radius: 0; padding: 10px; background: #1A1429; }
.advanced summary { cursor: pointer; color: #7FD6FF; font-weight: 700; }
.docs { margin-top: 14px; border-top: 2px solid #4A4577; padding-top: 10px; }
.helper {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  border-radius: 0; background: #2B355E; color: #FCDB2E; font-size: 12px; margin-left: 6px;
  cursor: help; position: relative; border: 1px solid #4F5A90;
}
.helper::after {
  content: attr(data-tip); position: absolute; left: 50%; transform: translateX(-50%); bottom: 130%;
  min-width: 180px; max-width: 240px; background: #222036; color: #F4F1FF; border: 1px solid #7FD6FF;
  padding: 8px; font-size: 12px; line-height: 1.3; opacity: 0; pointer-events: none; transition: opacity .2s;
  box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}
.helper:hover::after { opacity: 1; }

.switch-wrap { display: inline-flex; align-items: center; gap: 8px; }
.switch-wrap input { display: none; }
.switch { width: 44px; height: 24px; background: #3A355B; border: 1px solid #5A538A; position: relative; transition: all .2s; }
.switch::after { content: ""; width: 18px; height: 18px; background: #ffffff; position: absolute; left: 2px; top: 2px; transition: transform .2s; }
.switch-wrap input:checked + .switch { background: #303B95; border-color: #303B95; }
.switch-wrap input:checked + .switch::after { transform: translateX(20px); background: #3DF7EC; }

.foundation { margin-top: 14px; border-top: 2px solid #4A4577; padding-top: 10px; text-align: center; }
.foundation img { max-width: 115px; opacity: .95; filter: invert(1) hue-rotate(180deg) contrast(1.1); }
.footer { margin-top: 0px; text-align: center; color: #CDC7DE; padding: 0px; margin-top: 0px; margin-bottom: 0px; }
.footer a, a { color: #7FD6FF; }
.footer a:hover, a:hover { color: #3DF7EC; }
.material-symbols-outlined { font-size: 19px; vertical-align: middle; }
.icon-btn {
  border-radius: 0;
  border: 2px solid #6f8eff;
  background: linear-gradient(180deg, #37458f, #2c3570);
  color: #d8e4ff;
  cursor: pointer;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { filter: brightness(1.08); }
.top-toggle { border-color: #7fd6ff; }

@keyframes fade { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: translateY(0);} }
@keyframes arcadeGlow { from { transform: scale(1); } to { transform: scale(1.05) translateY(-1%); } }
@keyframes factoryMove { from { transform: translateX(0); } to { transform: translateX(40px); } }
@keyframes wandSpin { from { transform: rotate(-8deg) scale(1); } to { transform: rotate(10deg) scale(1.08); } }
@keyframes sparklePulse { 0% { opacity: .2; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.25); } 100% { opacity: .2; transform: scale(.8); } }

/* [hidden] must win: a plain `display: grid` here overrides the UA [hidden] rule. */
.spell-overlay[hidden] {
  display: none !important;
}
.spell-overlay:not([hidden]) {
  display: grid;
  place-items: center;
}
.spell-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(9, 6, 16, 0.78);
  backdrop-filter: blur(2px);
}
.spell-box {
  width: min(480px, 92vw);
  border: 2px solid #7FD6FF;
  background: linear-gradient(180deg, #22173a, #191129);
  box-shadow: 0 0 0 2px #120d1f, 0 12px 30px rgba(0,0,0,.45);
  padding: 16px;
  text-align: center;
}
.spell-glyph {
  position: relative;
  width: 86px;
  height: 86px;
  margin: 2px auto 8px;
  border: 2px solid #4d4278;
  background: rgba(48, 59, 149, 0.25);
}
.spell-glyph .wand {
  font-size: 44px;
  color: #FCDB2E;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  animation: wandSpin 700ms ease-in-out infinite alternate;
}
.spell-glyph .spark {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3DF7EC;
  box-shadow: 0 0 10px rgba(61,247,236,.8);
  animation: sparklePulse 900ms ease-in-out infinite;
}
.spell-glyph .spark.one { left: 18px; top: 18px; }
.spell-glyph .spark.two { right: 16px; top: 28px; animation-delay: 200ms; background: #F436A0; box-shadow: 0 0 10px rgba(244,54,160,.8); }
.spell-glyph .spark.three { left: 42px; bottom: 14px; animation-delay: 360ms; background: #FCDB2E; box-shadow: 0 0 10px rgba(252,219,46,.8); }

#spellOverlayText {
  margin: 6px 0 0;
  color: #EDE8FF;
  font-weight: 700;
}

@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .wizard-shell { grid-template-columns: 1fr; }
  .wizard-rail { flex-direction: column; overflow: visible; min-width: 0; }
  .wizard-main { padding: 12px; }
  pre#output {
    max-height: min(40vh, 260px);
    font-size: 0.68rem;
    padding: 10px;
  }
  .grid2 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .step { min-width: 0; }
  .step::after { display: none; }
  .rail-projects { order: -1; width: 100%; min-width: 0; margin-bottom: 8px; }
}
