.generator-page {
  background: #07090e;
  font-family: "Outfit", system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.92);
}

.generator-page .generate-shell {
  position: fixed;
  inset: 0;
  z-index: 1;
}

/* —— Full-page quiz —— */
.quiz-panel {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: 28px 24px 36px;
  box-sizing: border-box;
  /* Opaque night wash — no alpha over the canvas / body */
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, #2a3148 0%, #10141e 50%, #07090e 100%),
    #07090e;
}

.generator-page.is-drawing .quiz-panel {
  display: none;
}

.quiz-topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  width: min(720px, 100%);
  margin: 0 auto;
  flex: 0 0 auto;
}

.generate-back,
.generator-page .site-nav-link {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 160ms ease;
}

.generate-back:hover,
.generator-page .site-nav-link:hover {
  color: rgba(255, 255, 255, 0.85);
}

/* Keep Gallery link reachable during the quiz (chrome is otherwise hidden) */
.generator-page.is-quiz .site-nav-link {
  display: none !important;
}

.quiz-progress {
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.quiz-progress-bar {
  height: 100%;
  width: 0%;
  background: rgba(255, 255, 255, 0.75);
  transition: width 220ms ease;
}

.quiz-step-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
}

.quiz-center {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: min(720px, 100%);
  margin: 0 auto;
  min-height: 0;
  padding: 36px 0 24px;
  box-sizing: border-box;
}

.quiz-form {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.quiz-step {
  border: none;
  margin: 0;
  padding: 0;
}

.quiz-step[hidden] {
  display: none !important;
}

.quiz-question {
  margin: 0 0 28px;
  padding: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(32px, 5vw, 46px);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.15;
  color: rgba(255, 255, 255, 0.94);
}

.quiz-disclaimer {
  margin: -8px 0 28px;
  padding: 12px 14px;
  border-left: 2px solid rgba(255, 255, 255, 0.22);
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 13px;
  font-weight: 300;
  line-height: 1.55;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.5);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 26px;
  font-size: 17px;
  font-weight: 300;
  letter-spacing: 0.01em;
  line-height: 1.5;
  text-transform: none;
  color: rgba(255, 255, 255, 0.86);
}

.field > span,
.field-label {
  display: block;
  margin: 0;
  padding: 0;
  font-size: 17px;
  font-weight: 300;
  letter-spacing: 0.01em;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.86);
}

.field-note {
  display: inline;
  font-size: 0.92em;
  font-weight: 300;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.42);
}

.field-duration {
  border: none;
  padding: 0;
}

.duration-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.duration-part {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.duration-part input {
  width: 100%;
}

.field input[type="text"],
.field input[type="number"],
.field textarea,
.duration-part input {
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.92);
  font-family: "Outfit", system-ui, sans-serif;
  font-size: 18px;
  letter-spacing: 0;
  text-transform: none;
  box-sizing: border-box;
  width: 100%;
}

.field input[type="text"],
.field input[type="number"],
.duration-part input {
  height: 52px;
  padding-top: 0;
  padding-bottom: 0;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}

.duration-part input::placeholder {
  color: rgba(255, 255, 255, 0.28);
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.07);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.quiz-nav {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  padding-top: 8px;
}

.primary-btn,
.secondary-btn {
  height: 44px;
  margin: 0;
  padding: 0 20px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.primary-btn {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.95);
}

.quiz-nav .primary-btn {
  flex: 1;
}

.secondary-btn {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
}

.primary-btn:hover,
.secondary-btn:hover {
  border-color: rgba(255, 255, 255, 0.55);
}

.form-status {
  min-height: 1.4em;
  margin: 14px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
}

.form-status.is-error {
  color: #ff8f8f;
}

.form-status.is-ok {
  color: #9bd4a8;
}

/* —— Drawing stage —— */
.generate-stage {
  position: absolute;
  inset: 0;
  background: #050608;
}

.generator-page.is-quiz .generate-stage {
  visibility: hidden;
  pointer-events: none;
}

.generator-page.is-drawing .generate-stage {
  visibility: visible;
  pointer-events: auto;
}

#preview-mount {
  position: absolute;
  inset: 0;
}

#preview-mount canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Hide main chrome during quiz; show during drawing (matches gallery chrome) */
.generator-page.is-quiz .left-chrome,
.generator-page.is-quiz .right-stack,
.generator-page.is-quiz .mode-menu,
.generator-page .nav-btn,
.generator-page .start-screen {
  display: none !important;
}

.generator-page.is-drawing .left-chrome,
.generator-page.is-drawing .right-stack {
  display: flex;
}

.generator-page.is-drawing .right-chrome,
.generator-page.is-drawing .transport-bar {
  display: flex;
}

.generator-page.is-drawing .left-chrome {
  flex-direction: column;
}

.generator-page.is-drawing .mode-menu {
  display: block;
}

.generator-story-actions {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.generator-story-actions .generate-story-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 0 12px;
  text-align: center;
  cursor: pointer;
}

.generator-page .delete-story-btn {
  border-color: rgba(255, 120, 120, 0.35);
  color: rgba(255, 200, 200, 0.92);
}

.generator-page .delete-story-btn:hover {
  border-color: rgba(255, 140, 140, 0.7);
  background: rgba(120, 40, 40, 0.35);
}

.generator-page .delete-story-btn[hidden] {
  display: none !important;
}

/* In-app confirm (not window.confirm) */
.app-modal[hidden] {
  display: none !important;
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 8, 0.72);
  backdrop-filter: blur(6px);
}

.app-modal-panel {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  padding: 22px 22px 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(18, 22, 30, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
}

.app-modal-title {
  margin: 0 0 10px;
  font-family: var(--ui-display, Georgia, serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.94);
}

.app-modal-body {
  margin: 0 0 20px;
  font-family: var(--ui-font, system-ui, sans-serif);
  font-size: 14px;
  font-weight: 300;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.62);
}

.app-modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.app-modal-btn {
  height: 40px;
  margin: 0;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  font-family: var(--ui-font, system-ui, sans-serif);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.app-modal-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
}

.app-modal-danger {
  border-color: rgba(255, 120, 120, 0.45);
  background: rgba(120, 40, 40, 0.45);
  color: rgba(255, 220, 220, 0.96);
}

.app-modal-danger:hover {
  border-color: rgba(255, 150, 150, 0.75);
  background: rgba(150, 50, 50, 0.55);
}

@media (max-width: 640px) {
  .quiz-topbar {
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .generate-back {
    grid-column: 1 / -1;
  }

  .quiz-center {
    padding-top: 24px;
  }

  .quiz-question {
    font-size: clamp(28px, 8vw, 38px);
  }

  .field,
  .field > span,
  .field-label {
    font-size: 16px;
  }

  .duration-row {
    grid-template-columns: 1fr;
  }
}
