:root {
  color-scheme: light;
  --ink: #17233b;
  --muted: #637083;
  --paper: #ffffff;
  --canvas: #f4f6f9;
  --line: #dce2ea;
  --line-strong: #bdc7d5;
  --accent: #2754c7;
  --accent-dark: #1c3e98;
  --accent-soft: #eef3ff;
  --success: #16734a;
  --success-soft: #e9f8f0;
  --danger: #ba2b3b;
  --danger-soft: #fff0f1;
  --shadow: 0 18px 45px rgb(26 39 70 / 8%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgb(39 84 199 / 8%), transparent 27rem),
    var(--canvas);
  min-width: 320px;
}

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

.site-header {
  height: 68px;
  background: rgb(255 255 255 / 88%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 9px;
  font-size: 0.78rem;
  letter-spacing: -0.04em;
}

.prototype-badge {
  padding: 5px 10px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border: 1px solid #cedaff;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

main {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 60px;
}

.hero { max-width: 820px; padding: 68px 6px 38px; }

.eyebrow, .step-label {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2 { margin: 0; letter-spacing: -0.035em; }
h1 { max-width: 760px; font-size: clamp(2.3rem, 5vw, 4.25rem); line-height: 1.02; }
h2 { font-size: clamp(1.25rem, 2vw, 1.65rem); }

.hero-copy {
  max-width: 700px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.65;
}

.card {
  margin-bottom: 22px;
  padding: 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.import-card {
  display: block;
}

.start-heading { max-width: 760px; }
.start-heading .muted { margin-bottom: 0; }

.start-options {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.start-option {
  min-height: 230px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.start-option h3 { margin: 0; font-size: 1.12rem; }
.start-option > p:not(.choice-label) { margin: 9px 0 18px; color: var(--muted); }

.manual-start {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--accent-soft);
  border-color: #c8d5f8;
}

.manual-start .button { margin-top: auto; }
.file-start { background: #fafbfc; }

.choice-label {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.start-extras {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.ai-guide {
  margin-top: 18px;
  background: #f8f7ff;
  border: 1px solid #d8d4f4;
  border-radius: 14px;
}

.ai-guide > summary {
  padding: 17px 20px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  color: var(--muted);
  cursor: pointer;
}

.ai-summary-title { color: var(--ink); font-weight: 800; }
.ai-guide-body {
  padding: 4px 20px 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.ai-workflow-card {
  padding: 20px;
  background: white;
  border: 1px solid #d8d4f4;
  border-radius: 11px;
}

.ai-guide-copy > h3 { margin: 0; }
.ai-guide-copy > p:not(.choice-label) { color: var(--muted); line-height: 1.55; }
.ai-resource-buttons { align-items: stretch; }
.ai-resource-buttons a { display: inline-flex; align-items: center; text-decoration: none; }
.resource-note { font-size: 0.85rem; }
.resource-note a { color: var(--accent); }

.format-preview {
  grid-column: 1 / -1;
  border: 1px solid #d8d4f4;
  border-radius: 10px;
}

.agent-access-note {
  grid-column: 1 / -1;
  margin: -2px 2px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.agent-access-note a { color: var(--accent); }

.format-preview summary { padding: 13px 16px; color: var(--accent-dark); font-weight: 700; cursor: pointer; }
.format-preview pre {
  max-height: 360px;
  margin: 0 14px 14px;
  padding: 14px;
  overflow: auto;
  color: #25314a;
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 0.78rem;
  line-height: 1.55;
}

.ai-paste-panel {
  display: flex;
  flex-direction: column;
}

.ai-paste-panel h3 { margin: 0; }
.workflow-description { margin: 9px 0 14px; color: var(--muted); }

.ai-paste-panel textarea {
  width: 100%;
  min-height: 210px;
  margin: 0;
  padding: 11px;
  color: var(--ink);
  background: #fbfcff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font: 0.8rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.ai-paste-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.ai-paste-actions .inline-status { flex: 1; margin: 0; }
.ai-paste-actions .button { flex: 0 0 auto; }

.inline-status { min-height: 1.4em; margin: 10px 0 0; color: var(--success); font-size: 0.84rem; }
.inline-status.error { color: var(--danger); }
.clipboard-helper { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }

.muted { color: var(--muted); }
.card p { line-height: 1.5; }

.drop-zone {
  min-height: 92px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: var(--accent-soft);
  border: 1.5px dashed #9ab0e9;
  border-radius: 14px;
  text-align: center;
  transition: 150ms ease;
  cursor: pointer;
}

.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--accent); background: #e7eeff; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-icon { color: var(--accent); font-size: 1.5rem; line-height: 1; }

.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.button-row.compact { justify-content: flex-end; }

.button {
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 700;
  transition: 120ms ease;
}

.button:hover { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid rgb(39 84 199 / 22%);
  outline-offset: 1px;
}

.button.primary { color: white; background: var(--accent); }
.button.primary:hover { background: var(--accent-dark); }
.button.primary:disabled { opacity: 0.48; cursor: not-allowed; transform: none; }
.button.secondary { color: var(--accent-dark); background: var(--accent-soft); border-color: #c8d5f8; }
.button.ghost { color: var(--ink); background: white; border-color: var(--line-strong); }

.section-heading, .grid-toolbar, .export-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.section-intro {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.summary {
  padding: 8px 12px;
  background: var(--canvas);
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.quiz-fields {
  margin: 26px 0 18px;
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(320px, 1.3fr);
  gap: 18px;
}

label > span, .settings-grid label:not(.check-label) > span {
  display: block;
  margin-bottom: 7px;
  color: #3c485b;
  font-size: 0.82rem;
  font-weight: 750;
}

label small { color: var(--muted); font-weight: 500; }

.quiz-fields input, .quiz-fields textarea, .settings-grid input {
  width: 100%;
  padding: 10px 11px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

textarea { resize: vertical; }

.settings-panel {
  margin-bottom: 20px;
  padding: 0 14px;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.settings-panel summary { padding: 12px 2px; font-weight: 700; cursor: pointer; }
.settings-grid { padding: 5px 0 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 22px; }
.check-label { display: inline-flex; align-items: center; gap: 7px; }
.settings-grid label:last-child { width: 155px; }

.grid-toolbar { margin: 18px 0 12px; }
.paste-hint { margin: 0; color: var(--muted); font-size: 0.88rem; }

.table-shell {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
}

table { width: 100%; min-width: 1260px; border-collapse: separate; border-spacing: 0; }
th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 8px;
  color: #596578;
  background: #eef1f5;
  border-bottom: 1px solid var(--line-strong);
  border-right: 1px solid var(--line);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  text-align: left;
  text-transform: uppercase;
}

td { padding: 0; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: stretch; }
tr:last-child td { border-bottom: 0; }
th:last-child, td:last-child { border-right: 0; }
.row-number { width: 42px; text-align: center; }
td.row-number { padding: 12px 4px; color: var(--muted); background: #fafbfc; font-size: 0.78rem; }
.question-column { min-width: 300px; }
.points-column { width: 78px; }
.actions-column { width: 76px; }

td input, td select, td textarea {
  width: 100%;
  min-width: 132px;
  height: 48px;
  padding: 8px;
  color: var(--ink);
  background: white;
  border: 0;
  border-radius: 0;
}

td textarea { min-width: 290px; min-height: 48px; resize: vertical; }
td input[type="number"] { min-width: 70px; }
td input:hover, td select:hover, td textarea:hover { background: #fbfcff; }
td input:focus, td select:focus, td textarea:focus { position: relative; z-index: 2; outline: 2px solid var(--accent); outline-offset: -2px; }
td.has-error input, td.has-error select, td.has-error textarea { background: var(--danger-soft); box-shadow: inset 0 0 0 1px var(--danger); }

.row-actions { height: 48px; padding: 5px; display: flex; align-items: center; justify-content: center; gap: 3px; }
.icon-button { width: 30px; height: 30px; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 6px; }
.icon-button:hover { color: var(--ink); background: var(--canvas); }
.icon-button.delete:hover { color: var(--danger); background: var(--danger-soft); }

.validation-panel { margin-top: 14px; }
.validation-success, .validation-errors { margin: 0; padding: 11px 13px; border-radius: 9px; font-size: 0.88rem; }
.validation-success { color: var(--success); background: var(--success-soft); }
.validation-errors { color: #8f2431; background: var(--danger-soft); }
.validation-errors ul { margin: 7px 0 0; padding-left: 20px; }
.validation-errors a { color: inherit; }

.export-card { margin-bottom: 0; }
.export-buttons { justify-content: flex-end; }
.action-status { min-height: 1.4em; margin: 0; color: var(--success); font-size: 0.85rem; }
.action-status.error { color: var(--danger); }

footer { padding: 26px 20px 48px; color: var(--muted); text-align: center; font-size: 0.82rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  main { width: min(100% - 24px, 1440px); }
  .hero { padding-top: 46px; }
  .start-options { grid-template-columns: 1fr; }
  .start-extras { align-items: flex-start; flex-direction: column; }
  .ai-guide > summary { align-items: flex-start; flex-direction: column; }
  .ai-guide-body { grid-template-columns: 1fr; }
  .format-preview { grid-column: auto; }
  .agent-access-note { grid-column: auto; }
  .import-card .button-row { justify-content: flex-start; }
  .quiz-fields { grid-template-columns: 1fr; }
  .section-heading, .grid-toolbar, .export-card { align-items: flex-start; flex-direction: column; }
  .export-buttons { justify-content: flex-start; }
}

@media (max-width: 560px) {
  .header-inner { padding: 0 16px; }
  .card { padding: 20px 16px; border-radius: 14px; }
  .button-row { width: 100%; }
  .export-buttons .button { width: 100%; }
  .ai-guide-body { padding: 4px 12px 12px; }
  .ai-workflow-card { padding: 16px; }
  .ai-paste-actions { align-items: stretch; flex-direction: column; }
  .ai-paste-actions .button { width: 100%; }
}
