:root {
  color-scheme: light;
  --bg: #f3efe8;
  --bg-soft: rgba(255, 255, 255, 0.68);
  --card: rgba(255, 255, 255, 0.74);
  --card-strong: rgba(255, 255, 255, 0.92);
  --text: #17212c;
  --muted: #5f6b78;
  --line: rgba(23, 33, 44, 0.1);
  --shadow: 0 24px 60px rgba(23, 33, 44, 0.12);
  --accent: #6c7bff;
  --accent-2: #2f8f83;
  --danger: #c25555;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  min-width: 0;
}

html,
body {
  height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(108, 123, 255, 0.18), transparent 34%),
    radial-gradient(circle at 85% 15%, rgba(47, 143, 131, 0.14), transparent 28%),
    linear-gradient(180deg, #f8f5ef 0%, #f3efe8 45%, #f6f2eb 100%);
  color: var(--text);
  font-family: "Aptos", "Segoe UI", "Trebuchet MS", sans-serif;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

body {
  min-height: 100%;
  position: relative;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  white-space: normal;
  line-height: 1.2;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes softPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(108, 123, 255, 0.12);
  }

  50% {
    box-shadow: 0 0 0 10px rgba(108, 123, 255, 0);
  }
}

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(14px);
  opacity: 0.65;
}

.orb-a {
  width: 28rem;
  height: 28rem;
  top: -10rem;
  left: -8rem;
  background: radial-gradient(circle, rgba(108, 123, 255, 0.35) 0%, rgba(108, 123, 255, 0) 72%);
}

.orb-b {
  width: 24rem;
  height: 24rem;
  right: -10rem;
  bottom: 8rem;
  background: radial-gradient(circle, rgba(47, 143, 131, 0.28) 0%, rgba(47, 143, 131, 0) 72%);
}

.grid-noise {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(23, 33, 44, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 33, 44, 0.03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 85%);
}

.shell {
  width: min(1240px, calc(100% - 32px));
  margin: 24px auto 48px;
  position: relative;
  z-index: 1;
}

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero {
  border-radius: var(--radius-xl);
  padding: 28px 30px;
  display: grid;
  grid-template-columns: 1.8fr 0.8fr;
  gap: 24px;
  align-items: end;
}

.eyebrow {
  margin: 0 0 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-size: 0.76rem;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  font-family: "Georgia", "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

h1 {
  font-size: clamp(2.2rem, 4vw, 4.4rem);
  line-height: 0.98;
  max-width: 11ch;
}

h2 {
  font-size: 1.42rem;
}

.lede {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.65;
  max-width: 58ch;
  overflow-wrap: anywhere;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat,
.pill {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(23, 33, 44, 0.08);
}

.stat {
  padding: 16px 14px;
  display: grid;
  gap: 4px;
  align-content: start;
}

.stat span {
  font-size: 1.8rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.stat label {
  color: var(--muted);
  font-size: 0.88rem;
}

.pill {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 0 16px;
  color: var(--accent-2);
  font-weight: 700;
}

.toolbar {
  margin-top: 18px;
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
}

.toolbar-left,
.toolbar-right,
.field-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-right {
  justify-content: flex-end;
}

.toolbar-right.tight {
  margin-top: 8px;
}

.upload-zone {
  min-width: 290px;
  border-radius: 18px;
  border: 1px dashed rgba(23, 33, 44, 0.16);
  background: rgba(255, 255, 255, 0.55);
  padding: 14px 16px;
  display: grid;
  gap: 4px;
  cursor: pointer;
}

.upload-zone strong {
  font-size: 0.95rem;
}

.upload-zone span,
.microcopy,
.helper {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.ghost-btn,
.secondary-btn,
.primary-btn,
.icon-btn {
  border-radius: 999px;
  padding: 12px 16px;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.ghost-btn,
.secondary-btn {
  background: rgba(255, 255, 255, 0.64);
  color: var(--text);
  border: 1px solid rgba(23, 33, 44, 0.1);
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), #8b95ff);
  color: white;
  box-shadow: 0 16px 32px rgba(108, 123, 255, 0.24);
}

.ghost-btn:hover,
.secondary-btn:hover,
.primary-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.content-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.tab-shell {
  margin-top: 18px;
  border-radius: var(--radius-xl);
  padding: 14px;
}

.tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(23, 33, 44, 0.08);
}

.tab-btn {
  border-radius: 999px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 11px 15px;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease, border-color 140ms ease;
}

.tab-btn:hover {
  transform: translateY(-1px);
}

.tab-btn.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(23, 33, 44, 0.1);
}

.tab-page {
  display: none;
  padding-top: 14px;
}

.tab-page.active {
  display: block;
}

.inner-panel {
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.38);
}

.saved-box {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(23, 33, 44, 0.08);
}

.panel-head.compact {
  margin-bottom: 12px;
}

.saved-list {
  display: grid;
  gap: 12px;
}

.saved-empty {
  color: var(--muted);
  padding: 14px 16px;
}

.saved-item {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(23, 33, 44, 0.08);
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
}

.saved-item.current {
  border-color: rgba(108, 123, 255, 0.32);
  box-shadow: 0 10px 24px rgba(108, 123, 255, 0.08);
}

.saved-copy strong,
.template-card h3,
.overview-card strong,
.chatgpt-card h3,
.question-number,
.step-label {
  overflow-wrap: anywhere;
}

.saved-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

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

.saved-actions button {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(23, 33, 44, 0.05);
}

.builder-stepper {
  display: grid;
  gap: 14px;
}

.builder-stepper-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.step-label {
  color: var(--accent-2);
  font-weight: 700;
  text-align: center;
  flex: 1 1 auto;
}

.overview-grid,
.chatgpt-grid {
  display: grid;
  gap: 14px;
}

.overview-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.overview-card,
.chatgpt-card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(23, 33, 44, 0.08);
  border-radius: 22px;
  padding: 18px;
}

.overview-card strong,
.chatgpt-card h3 {
  display: block;
  margin-bottom: 10px;
  font-size: 1rem;
}

.overview-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.chatgpt-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chatgpt-grid .chatgpt-card:last-child {
  grid-column: 1 / -1;
}

.chatgpt-card textarea {
  min-height: 180px;
}

.chatgpt-card label + label {
  margin-top: 12px;
}

#promptPreview {
  min-height: 460px;
}

#chatgptJsonInput {
  min-height: 180px;
}

.panel {
  border-radius: var(--radius-xl);
  padding: 22px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.template-card {
  background: var(--card-strong);
  border-radius: 22px;
  border: 1px solid rgba(23, 33, 44, 0.08);
  padding: 18px;
  display: grid;
  gap: 12px;
}

.template-card h3 {
  margin: 0;
  font-size: 1.1rem;
}

.template-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.94rem;
  overflow-wrap: anywhere;
}

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

.template-actions button {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(23, 33, 44, 0.05);
  color: var(--text);
}

.field-row {
  margin-bottom: 16px;
}

.field-row label {
  flex: 1 1 280px;
  min-width: 0;
}

.field-row.compact label:last-child {
  flex: 1 1 360px;
}

label span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.86rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

input,
textarea,
select {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(23, 33, 44, 0.1);
  background: rgba(255, 255, 255, 0.72);
  padding: 13px 14px;
  color: var(--text);
  outline: none;
  min-width: 0;
}

textarea {
  resize: vertical;
  min-height: 52px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(108, 123, 255, 0.42);
  box-shadow: 0 0 0 4px rgba(108, 123, 255, 0.08);
}

.question-list {
  display: grid;
  gap: 14px;
}

.question-card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(23, 33, 44, 0.08);
  border-radius: 22px;
  padding: 18px;
  display: grid;
  gap: 12px;
  overflow: hidden;
  animation: fadeUp 180ms ease both;
}

.question-card label,
.question-card input,
.question-card textarea,
.question-card select {
  min-width: 0;
}

.question-options-wrap[hidden],
.question-answer-choice[hidden],
.question-answer-input[hidden] {
  display: none;
}

.question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.question-number {
  color: var(--accent-2);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: rgba(194, 85, 85, 0.12);
  color: var(--danger);
  font-size: 1.25rem;
  display: grid;
  place-items: center;
}

.quiz-preview {
  display: grid;
  gap: 14px;
}

.preview-card {
  background: rgba(255, 255, 255, 0.84);
  border-radius: 24px;
  border: 1px solid rgba(23, 33, 44, 0.08);
  padding: 18px;
  overflow: hidden;
}

.quiz-fade-in {
  animation: fadeUp 220ms ease both;
}

.preview-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.choices {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.choice {
  text-align: left;
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(108, 123, 255, 0.06);
  border: 1px solid rgba(108, 123, 255, 0.14);
  overflow-wrap: anywhere;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.choice.selected {
  background: rgba(47, 143, 131, 0.12);
  border-color: rgba(47, 143, 131, 0.3);
  animation: softPulse 900ms ease;
}

.choice.correct {
  background: rgba(47, 143, 131, 0.18);
  border-color: rgba(47, 143, 131, 0.38);
}

.choice.wrong {
  background: rgba(194, 85, 85, 0.14);
  border-color: rgba(194, 85, 85, 0.32);
}

.preview-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.play-input-box {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.hint-box,
.feedback-box {
  margin-top: 12px;
  border-radius: 18px;
  padding: 14px 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.hint-box {
  background: rgba(108, 123, 255, 0.08);
  border: 1px solid rgba(108, 123, 255, 0.18);
  color: var(--text);
  white-space: pre-line;
}

.feedback-box.good {
  background: rgba(47, 143, 131, 0.12);
  border: 1px solid rgba(47, 143, 131, 0.24);
}

.feedback-box.bad {
  background: rgba(194, 85, 85, 0.12);
  border: 1px solid rgba(194, 85, 85, 0.24);
}

.question-type,
.question-answer-choice,
.question-answer-input {
  width: 100%;
}

.helper {
  margin: 0;
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(23, 33, 44, 0.08);
  overflow: hidden;
  margin-top: 12px;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

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

  .hero-stats,
  .template-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-right,
  .toolbar-left {
    width: 100%;
  }

  .upload-zone {
    min-width: 0;
    width: 100%;
  }

  .panel-head {
    flex-direction: column;
    align-items: start;
  }

  .overview-grid,
  .chatgpt-grid {
    grid-template-columns: 1fr;
  }

  .chatgpt-grid .chatgpt-card:last-child {
    grid-column: auto;
  }

  .saved-item {
    flex-direction: column;
    align-items: stretch;
  }

  .saved-actions {
    justify-content: flex-start;
  }

  .builder-stepper-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .step-label {
    order: -1;
  }

  .preview-footer {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1240px);
    margin-top: 10px;
  }

  .hero,
  .panel,
  .toolbar {
    padding: 18px;
  }

  h1 {
    font-size: clamp(1.9rem, 10vw, 3rem);
  }
}
