:root {
  --ink: #211d1a;
  --muted: #726963;
  --line: #e9e1d8;
  --cream: #fbf7f0;
  --paper: #fffdf9;
  --orange: #ff6734;
  --orange-dark: #e84e1b;
  --lilac: #d9c7ff;
  --purple: #6d4bc3;
  --green: #39a879;
  --red: #d64e4e;
  --shadow: 0 18px 50px rgba(61, 45, 29, 0.1);
  --radius: 26px;
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", system-ui,
    sans-serif;
  line-height: 1.6;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button,
a {
  touch-action: manipulation;
}
a {
  color: inherit;
  text-decoration: none;
}
.site-header {
  height: 76px;
  display: flex;
  align-items: center;
  padding: 0 max(22px, calc((100vw - 1160px) / 2));
  gap: 36px;
  border-bottom: 1px solid rgba(233, 225, 216, 0.8);
  background: rgba(255, 253, 249, 0.93);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.05em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px 11px 11px 3px;
  color: #fff;
  background: var(--orange);
  font: 900 20px/1 Georgia;
}
.desktop-nav {
  display: flex;
  gap: 28px;
  font-weight: 700;
  font-size: 14px;
}
.desktop-nav a:hover,
.login-link:hover {
  color: var(--orange);
}
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
}
.login-link {
  font-size: 14px;
  font-weight: 700;
}
.keeai-account {
  font-size: 13px;
  max-width: 100%;
}
.mobile-nav .keeai-account {
  padding: 12px 4px;
}
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--orange);
  color: #fff;
  padding: 14px 22px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 7px 18px rgba(255, 103, 52, 0.22);
  transition: 0.2s;
}
.button:hover {
  background: var(--orange-dark);
  transform: translateY(-1px);
}
.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.button.small {
  padding: 10px 18px;
  font-size: 14px;
}
.button.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}
.button.ghost {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}
.button.danger {
  background: #fff;
  color: var(--red);
  border: 1px solid #f1caca;
  box-shadow: none;
}
.menu-button {
  display: none;
  border: 0;
  background: transparent;
  font-size: 24px;
}
.mobile-nav {
  display: none;
}
.shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 62px 0 90px;
}
.narrow {
  width: min(760px, calc(100% - 40px));
}
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 58px;
  align-items: center;
  padding-top: 64px;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--orange);
  font-weight: 900;
  font-size: 12px;
}
.hero h1,
.page-title {
  font-size: clamp(40px, 6vw, 76px);
  line-height: 1.04;
  letter-spacing: -0.065em;
  margin: 13px 0 22px;
}
.page-title {
  font-size: clamp(36px, 5vw, 58px);
}
.hero h1 em {
  font-style: normal;
  color: var(--orange);
}
.lead {
  font-size: 18px;
  color: var(--muted);
  max-width: 600px;
}
.hero-art {
  min-height: 440px;
  position: relative;
  display: grid;
  place-items: center;
}
.blob {
  position: absolute;
  width: 380px;
  height: 380px;
  border-radius: 46% 54% 58% 42%;
  background: var(--lilac);
  transform: rotate(-8deg);
}
.quiz-card-demo {
  position: relative;
  width: min(360px, 90%);
  padding: 30px;
  background: #fff;
  border-radius: 28px;
  box-shadow: var(--shadow);
  transform: rotate(3deg);
}
.quiz-card-demo .number {
  color: var(--purple);
  font-weight: 900;
}
.demo-answer {
  margin-top: 13px;
  padding: 12px 15px;
  border-radius: 14px;
  background: var(--cream);
  font-weight: 700;
}
.demo-answer.active {
  background: #e6dcff;
  color: var(--purple);
}
.creator {
  margin-top: 54px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 32px;
  padding: 30px;
  box-shadow: var(--shadow);
}
.source-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.source-tab,
.pill-button {
  border: 0;
  background: var(--cream);
  border-radius: 999px;
  padding: 10px 17px;
  font-weight: 800;
  cursor: pointer;
}
.source-tab.active,
.pill-button.active {
  background: var(--ink);
  color: #fff;
}
.field {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}
.field label,
.label {
  font-size: 13px;
  font-weight: 900;
}
.input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 15px;
  padding: 14px 16px;
  outline: none;
}
.input:focus,
textarea:focus,
select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 103, 52, 0.12);
}
textarea {
  min-height: 150px;
  resize: vertical;
}
.file-drop {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 160px;
  border: 2px dashed #d8ccc0;
  background: var(--cream);
  border-radius: 18px;
  cursor: pointer;
}
.file-drop input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.segmented {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.segmented button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 11px;
  padding: 9px 12px;
  font-weight: 800;
  cursor: pointer;
}
.segmented button.active {
  border-color: var(--orange);
  color: var(--orange);
  background: #fff5f1;
}
.creator-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 26px;
}
.notice {
  padding: 14px 16px;
  border-radius: 14px;
  background: #fff5df;
  color: #77551a;
  font-size: 14px;
}
.notice.error {
  background: #fff0ee;
  color: #a83730;
}
.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 80px;
}
.feature {
  padding: 24px;
  background: var(--cream);
  border-radius: 22px;
}
.feature-icon {
  font-size: 30px;
}
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.section-head h1,
.section-head h2 {
  margin: 0;
  letter-spacing: -0.045em;
}
.searchbar {
  display: flex;
  gap: 10px;
  margin: 25px 0;
}
.searchbar .input {
  flex: 1;
}
.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.quiz-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.quiz-tile {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  transition: 0.2s;
}
.quiz-tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
.tile-cover {
  height: 150px;
  display: grid;
  place-items: center;
  font-size: 52px;
  background: linear-gradient(145deg, #ede4ff, #ffdccc);
}
.tile-body {
  padding: 20px;
}
.tile-body h3 {
  margin: 4px 0 6px;
  line-height: 1.4;
}
.meta,
.muted {
  color: var(--muted);
  font-size: 13px;
}
.tags {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.tag {
  padding: 4px 9px;
  background: var(--cream);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}
.empty {
  text-align: center;
  padding: 60px 20px;
  border: 1px dashed var(--line);
  border-radius: 22px;
  color: var(--muted);
}
.editor-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
}
.editor-settings {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
}
.question-list {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}
.question-editor {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
}
.question-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.question-actions {
  display: flex;
  gap: 6px;
}
.icon-button {
  border: 0;
  background: var(--cream);
  border-radius: 10px;
  padding: 8px 11px;
  cursor: pointer;
}
.option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
}
.option-row input[type="text"] {
  flex: 1;
}
.option-row.correct input[type="text"] {
  border-color: var(--green);
  background: #f2fbf7;
}
.savebar {
  position: sticky;
  bottom: 14px;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px;
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 249, 0.94);
  backdrop-filter: blur(12px);
}
.quiz-intro {
  text-align: center;
}
.quiz-cover {
  font-size: 70px;
  margin: 12px;
}
.quiz-intro h1 {
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.1;
  letter-spacing: -0.055em;
}
.question-stage {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.progress {
  height: 8px;
  background: var(--cream);
  border-radius: 10px;
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  background: var(--orange);
  transition: 0.3s;
}
.question-title {
  font-size: clamp(28px, 4.5vw, 48px);
  line-height: 1.25;
  letter-spacing: -0.04em;
}
.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.answer {
  border: 2px solid var(--line);
  background: #fff;
  text-align: left;
  padding: 20px;
  border-radius: 18px;
  font-weight: 800;
  cursor: pointer;
  transition: 0.15s;
}
.answer:hover {
  border-color: var(--orange);
  transform: translateY(-2px);
}
.text-answer {
  display: flex;
  gap: 12px;
}
.feedback {
  margin-top: 22px;
  padding: 20px;
  border-radius: 18px;
  background: #ecfaf4;
  color: #206d50;
}
.feedback.wrong {
  background: #fff0ee;
  color: #9d3834;
}
.result-hero {
  text-align: center;
}
.score-ring {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 25px auto;
  background: conic-gradient(var(--orange) var(--score), var(--cream) 0);
  position: relative;
}
.score-ring:after {
  content: "";
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  background: var(--paper);
}
.score-ring strong {
  position: relative;
  z-index: 1;
  font-size: 42px;
}
.review {
  margin-top: 42px;
}
.review-item {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  margin: 12px 0;
}
.review-item p {
  margin: 5px 0;
}
.dashboard-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  margin: 10px 0;
}
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  max-width: 340px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(15px);
  pointer-events: none;
  transition: 0.2s;
}
.toast.show {
  opacity: 1;
  transform: none;
}
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
footer {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  padding: 40px max(22px, calc((100vw - 1120px) / 2));
  background: var(--cream);
  border-top: 1px solid var(--line);
}
.muted-brand {
  opacity: 0.7;
}
.fine {
  font-size: 12px;
  color: var(--muted);
}
@media (max-width: 800px) {
  .site-header {
    height: 66px;
    padding: 0 18px;
  }
  .desktop-nav,
  .header-actions {
    display: none;
  }
  .menu-button {
    display: block;
    margin-left: auto;
  }
  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    top: 66px;
    z-index: 29;
    display: none;
    padding: 14px 20px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    gap: 20px;
    font-weight: 800;
  }
  .mobile-nav.open {
    display: flex;
  }
  .shell {
    padding-top: 38px;
  }
  .hero {
    grid-template-columns: 1fr;
    padding-top: 30px;
  }
  .hero-art {
    min-height: 300px;
  }
  .blob {
    width: 270px;
    height: 270px;
  }
  .quiz-card-demo {
    width: 270px;
    padding: 22px;
  }
  .creator {
    padding: 20px;
    margin-top: 30px;
  }
  .controls,
  .feature-strip,
  .quiz-grid,
  .editor-settings {
    grid-template-columns: 1fr;
  }
  .feature-strip {
    margin-top: 40px;
  }
  .editor-head {
    display: block;
  }
  .answer-grid {
    grid-template-columns: 1fr;
  }
  .text-answer {
    display: grid;
  }
  .creator-footer,
  .dashboard-row {
    align-items: stretch;
    flex-direction: column;
  }
  .creator-footer .button,
  .dashboard-row .button {
    width: 100%;
  }
  footer {
    align-items: start;
    flex-direction: column;
  }
  .section-head {
    align-items: start;
    flex-direction: column;
  }
  .searchbar {
    display: grid;
  }
  .question-editor {
    padding: 16px;
  }
  .savebar {
    bottom: 8px;
  }
}
/* CSP-safe utility classes */
.loading-spinner {
  border-color: #ddd;
  border-top-color: var(--orange);
  display: inline-block;
}
.error-icon {
  font-size: 48px;
}
.hero-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}
.grid-empty {
  grid-column: 1/-1;
}
.thumbnail-field {
  min-width: 130px;
}
.question-textarea {
  min-height: 80px;
}
.explanation-textarea {
  min-height: 70px;
}
.center-tags {
  justify-content: center;
}
.quiz-lead {
  margin: 0 auto 25px;
}
.share-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.score-ring {
  background: var(--cream);
}
.score-ring strong {
  display: grid;
  text-align: center;
}
.score-ring small {
  font-size: 14px;
  color: var(--muted);
}
.progress-native {
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  accent-color: var(--orange);
}
.progress-native::-webkit-progress-bar {
  background: var(--cream);
}
.progress-native::-webkit-progress-value {
  background: var(--orange);
}
.progress-native::-moz-progress-bar {
  background: var(--orange);
}
.hero {
  padding-top: 34px;
  padding-bottom: 24px;
}
.hero-art {
  min-height: 330px;
}
.creator {
  margin-top: 12px;
}
.review-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 14px;
}
.review-form {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.review-local-feedback:empty {
  display: none;
}
.review-local-feedback {
  margin-top: 12px;
}
.review-answer {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.qa-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px max(22px, calc((100vw - 1160px) / 2));
  background: #2d2150;
  color: #fff;
  font-size: 13px;
}
.qa-banner > div,
.qa-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.qa-banner strong {
  color: #f2eaff;
}
@media (max-width: 800px) {
  .hero-art {
    min-height: 245px;
  }
  .review-choices {
    grid-template-columns: 1fr;
  }
  .review-form {
    display: grid;
  }
  .qa-banner,
  .qa-banner > div,
  .qa-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Keep the generator available before decorative content on small screens. */
#creator.shell {
  padding-top: 0;
}
#creator .creator {
  margin-top: 0;
}
.hero {
  padding-bottom: 32px;
}
.hero-art {
  min-height: 280px;
}
.quiz-card-demo {
  padding: 22px;
}
.hero h1 {
  font-size: clamp(40px, 5vw, 64px);
}
@media (max-width: 700px) {
  .hero-art {
    display: none;
  }
  .hero {
    padding-top: 26px;
    padding-bottom: 26px;
  }
  .hero .lead {
    font-size: 16px;
  }
  .hero h1 {
    margin-top: 8px;
    margin-bottom: 12px;
  }
  .hero .hero-actions {
    margin-top: 14px;
  }
  .creator {
    padding: 18px;
  }
}
