/* ============================================================
   EE Topic Wizard — modern, clean UI
   Inter for UI, Newsreader italic for display accents,
   indigo accent, white surfaces, soft shadows, rounded corners.
   ============================================================ */

:root {
  /* surfaces */
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  /* ink */
  --ink: #171923;
  --ink-2: #5A6472;
  --ink-3: #8B93A1;
  /* lines */
  --line: #E7E9EE;
  --line-2: #DBDEE5;
  /* accent */
  --brand: #4F46E5;
  --brand-deep: #4338CA;
  --brand-lt: #818CF8;
  --brand-bg: #EEF2FE;
  --brand-ink: #3730A3;
  /* semantic */
  --good: #067647;
  --good-bg: #E7F5EE;
  --good-line: #BFE3CE;
  --warn: #9A5B0A;
  --warn-bg: #FCF3E3;
  --warn-line: #EEDBB2;
  --issue: #B42318;
  --issue-bg: #FDECEA;
  --issue-line: #F2C6C0;
  /* type */
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'Roboto Mono', Menlo, Consolas, monospace;
  /* effects */
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 8px -4px rgba(16, 24, 40, .08);
  --shadow-md: 0 2px 4px rgba(16, 24, 40, .04), 0 12px 28px -12px rgba(16, 24, 40, .16);
  --shadow-lg: 0 4px 8px rgba(16, 24, 40, .06), 0 24px 56px -16px rgba(16, 24, 40, .24);
  --ring: 0 0 0 3px rgba(79, 70, 229, .18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1100px 460px at 82% -140px, rgba(79, 70, 229, .075), transparent 64%),
    radial-gradient(900px 420px at -12% -80px, rgba(14, 147, 132, .055), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(79, 70, 229, .22); }

::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #CDD2DB; border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #B4BBC7; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

.hidden { display: none !important; }

/* ------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1020px;
  margin: 0 auto;
  padding: 11px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.brand { display: flex; gap: 12px; align-items: center; }
.brand .logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand) 0%, #6D5CE7 100%);
  color: #fff;
  box-shadow: 0 4px 10px -3px rgba(79, 70, 229, .5), inset 0 1px 0 rgba(255, 255, 255, .25);
  flex: none;
}
.brand .logo svg { width: 21px; height: 21px; }
.brand h1 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -.015em;
  color: var(--ink);
}
.subtitle {
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--ink-3);
}

.auth { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.auth .user {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 6px 4px 5px;
}
.auth .user img { display: block; border-radius: 50%; width: 28px; height: 28px; }
.auth .user > span {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-2);
}

/* ------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.005em;
  line-height: 1;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  padding: 11px 18px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s ease, color .16s ease, border-color .16s ease,
    box-shadow .16s ease, transform .16s ease, opacity .16s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn.primary {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-xs), 0 2px 6px -2px rgba(79, 70, 229, .45), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.btn.primary:hover:not(:disabled) {
  background: var(--brand-deep);
  box-shadow: var(--shadow-sm), 0 6px 16px -6px rgba(79, 70, 229, .55);
}

.btn.ghost {
  color: var(--ink-2);
  border-color: transparent;
}
.btn.ghost:hover:not(:disabled) {
  background: rgba(23, 25, 35, .055);
  color: var(--ink);
  box-shadow: none;
}

.btn.plain {
  background: var(--surface);
  border-color: var(--line-2);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}
.btn.plain:hover:not(:disabled) { border-color: #C4CAD4; background: var(--surface); box-shadow: var(--shadow-sm); }

.btn.fast {
  background: var(--surface);
  border-color: var(--line-2);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}
.btn.fast:hover:not(:disabled) { border-color: var(--brand-lt); color: var(--brand-ink); box-shadow: var(--shadow-sm); }

.btn.small { padding: 9px 14px; font-size: 13px; border-radius: 9px; }
.btn.tiny { padding: 6px 11px; font-size: 12px; border-radius: 8px; }

.btn.auth-btn {
  background: var(--surface);
  border-color: var(--line-2);
  box-shadow: var(--shadow-xs);
}
.btn.auth-btn:hover:not(:disabled) { border-color: #C4CAD4; }

/* inline spinner while a wizard call is in flight */
.btn.busy { pointer-events: none; }
.btn.busy::before {
  content: "";
  width: 14px;
  height: 14px;
  flex: none;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
}
.btn.plain.busy::before, .btn.fast.busy::before, .btn.ghost.busy::before {
  border-color: rgba(79, 70, 229, .25);
  border-top-color: var(--brand);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- layout */

.layout {
  max-width: 920px;
  margin: 0 auto;
  padding: 30px 18px 64px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 34px 36px;
  box-shadow: var(--shadow-sm);
  animation: panelIn .35s cubic-bezier(.21, .7, .3, 1);
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------- stepper */

.stepper {
  list-style: none;
  display: flex;
  gap: 5px;
  margin: 0 0 22px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-xs);
}
.stepper li {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.005em;
  color: var(--ink-3);
  transition: background .2s ease, color .2s ease;
}
.stepper li .dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  background: var(--surface);
  font-size: 11px;
  font-weight: 700;
  flex: none;
  transition: all .2s ease;
}
.stepper li.current { background: var(--brand-bg); color: var(--brand-ink); }
.stepper li.current .dot {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 2px 6px -1px rgba(79, 70, 229, .5);
}
.stepper li.done { color: var(--good); }
.stepper li.done .dot {
  background: var(--good-bg);
  border-color: var(--good-line);
  color: var(--good);
  font-size: 0;
}
.stepper li.done .dot::after { content: "✓"; font-size: 12px; font-weight: 800; }
.stepper li.todo { opacity: .75; }

/* ------------------------------------------------------------- step headings */

.stepnum {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brand-ink);
  background: var(--brand-bg);
  border: 1px solid rgba(79, 70, 229, .18);
  border-radius: 999px;
  padding: 4px 11px;
  margin-bottom: 14px;
}

.stephead h2 {
  margin: 2px 0 10px;
  font-size: clamp(23px, 3vw, 30px);
  font-weight: 750;
  letter-spacing: -.025em;
  line-height: 1.16;
}
.stephead p { margin: 0 0 24px; color: var(--ink-2); font-size: 15.5px; max-width: 64ch; }

.subhead {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 26px 0 12px;
}

/* ------------------------------------------------------------- hero (welcome) */

.hero { position: relative; }

.hero .eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 18px 0 12px;
}

.hero h2 {
  font-size: clamp(30px, 4.6vw, 44px);
  font-weight: 780;
  letter-spacing: -.035em;
  line-height: 1.07;
  margin: 0 0 16px;
}

.hero-lede {
  color: var(--ink-2);
  font-size: 16.5px;
  line-height: 1.68;
  max-width: 58ch;
  margin: 0 0 6px;
}
.hero-lede em, .stephead p em { font-family: var(--serif); font-style: italic; font-size: 1.04em; }

.hand-note {
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  color: var(--brand);
  margin: 10px 0 16px;
}

/* hand-drawn underline (hero) */
.uw { position: relative; font-family: var(--serif); font-style: italic; font-weight: 500; white-space: nowrap; }
.uw svg { position: absolute; left: -2%; bottom: -.18em; width: 104%; height: .22em; overflow: visible; }
.uw path {
  fill: none;
  stroke: var(--brand-lt);
  stroke-width: 2.5;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: drawStroke .8s cubic-bezier(.4, 0, .2, 1) forwards;
}
.uw path:nth-child(2) { animation-delay: .9s; }
@keyframes drawStroke { to { stroke-dashoffset: 0; } }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin: 26px 0;
}

.fg {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13.5px;
  color: var(--ink-2);
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.fg:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-2); }
.fgicon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  margin-bottom: 4px;
  background: var(--fgbg, var(--brand-bg));
  color: var(--fgc, var(--brand));
}
.fgicon svg { width: 19px; height: 19px; }
.fg.spark { --fgbg: #EEF2FE; --fgc: #4F46E5; }
.fg.frame { --fgbg: #E4F5F2; --fgc: #0E9384; }
.fg.narrow { --fgbg: #FCF3E3; --fgc: #B7791F; }
.fg.commit { --fgbg: #FDEDEC; --fgc: #D63E2F; }
.fg strong { color: var(--ink); font-size: 14px; font-weight: 650; letter-spacing: -.01em; }

.startrow { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.notebox {
  display: flex;
  gap: 10px;
  align-items: baseline;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: #6E4508;
  border-radius: var(--radius);
  padding: 13px 16px;
  font-size: 13.5px;
  line-height: 1.6;
  margin-top: 20px;
}
.notebox::before {
  content: "ⓘ";
  flex: none;
  font-weight: 800;
  font-size: 14px;
  color: var(--warn);
}

/* ------------------------------------------------- how it works (landing) */

.how {
  margin-top: 34px;
  padding-top: 26px;
  border-top: 1px dashed var(--line-2);
}
.how-title {
  font-size: 19px;
  margin: 0 0 8px;
  letter-spacing: -.015em;
}
.how-lede {
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.65;
  margin: 0 0 20px;
  max-width: 68ch;
}
.how-lede em { font-family: var(--serif); font-style: italic; font-size: 1.05em; }

.flow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
  margin: 0 0 10px;
}
.fnode {
  flex: 1 1 148px;
  min-width: 138px;
  max-width: 210px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--fnc, var(--brand));
  border-radius: var(--radius);
  padding: 11px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-xs);
}
.fnode-tag {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--fnc, var(--brand));
}
.fnode strong { font-size: 13.5px; color: var(--ink); letter-spacing: -.01em; }
.fnode span:not(.fnode-tag) { font-size: 12px; line-height: 1.45; color: var(--ink-2); }
.fnode.you { --fnc: #0E9384; }
.fnode.ai  { --fnc: var(--brand); }
.fnode.out { --fnc: #B7791F; }
.farrow {
  align-self: center;
  flex: none;
  color: var(--ink-3);
  font-size: 16px;
  font-weight: 700;
  padding: 0 1px;
}
.flow-legend {
  font-size: 12.5px;
  color: var(--ink-3);
  margin: 0 0 24px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
}
.lg {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  margin-right: 3px;
  vertical-align: baseline;
}
.lg-you { background: #0E9384; }
.lg-ai  { background: var(--brand); }
.lg-out { background: #B7791F; }

.how-steps { display: flex; flex-direction: column; gap: 0; }
.howstep {
  display: flex;
  gap: 16px;
  position: relative;
  padding: 0 0 22px 0;
}
.howstep:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 30px;
  bottom: 2px;
  width: 2px;
  background: var(--line);
}
.hs-dot {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: var(--brand);
  box-shadow: 0 0 0 4px var(--surface);
  position: relative;
  z-index: 1;
}
.hs-dot.hs-you { background: #0E9384; }
.hs-dot.hs-ai  { background: var(--brand); }
.hs-dot.hs-out { background: #B7791F; }
.hs-body { min-width: 0; }
.hs-body h4 {
  margin: 3px 0 7px;
  font-size: 14.5px;
  color: var(--ink);
  letter-spacing: -.01em;
}
.hs-body h4 small { color: var(--ink-3); font-weight: 500; font-size: 12px; margin-left: 6px; }
.hs-body p {
  margin: 0 0 7px;
  font-size: 13.5px;
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 74ch;
}
.hs-body p strong { color: var(--ink); }
.hs-out {
  font-size: 13px !important;
  color: var(--brand-ink) !important;
  background: var(--brand-bg);
  border: 1px solid #DDE4FD;
  border-radius: 8px;
  padding: 7px 11px !important;
  display: inline-block;
}
.how-note { margin-top: 4px; }

@media (max-width: 640px) {
  .flow { flex-direction: column; align-items: stretch; }
  .fnode { max-width: none; }
  .farrow { transform: rotate(90deg); align-self: flex-start; padding: 0 0 0 12px; }
  .howstep { gap: 12px; }
}

/* ------------------------------------------------------------- edition badge */

.edition-badge {
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
  background: var(--brand-bg);
  border: 1px solid rgba(79, 70, 229, .16);
  border-radius: var(--radius);
  padding: 11px 15px;
  font-size: 13.5px;
}
.edition-badge .eb-pill {
  background: var(--brand);
  color: #fff;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
  flex: none;
}
.edition-badge .eb-text { color: var(--ink-2); line-height: 1.55; }

/* ------------------------------------------------------------- chips */

.chips { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 22px; }
.chip {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 550;
  border: 1.5px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  user-select: none;
  box-shadow: var(--shadow-xs);
  transition: all .15s ease;
}
.chip:hover {
  border-color: var(--brand-lt);
  color: var(--brand-ink);
  background: var(--brand-bg);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.chip.active {
  background: var(--brand);
  border-color: var(--brand-deep);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 3px 10px -3px rgba(79, 70, 229, .55);
}
.chip.active::before { content: "✓  "; font-weight: 700; }

/* ------------------------------------------------------------- fields */

.field { display: block; margin-bottom: 20px; }
.field span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 8px;
}
.field input, .field textarea, .field select {
  width: 100%;
  border: 1.5px solid var(--line-2);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14.5px;
  font-family: var(--sans);
  background: var(--surface);
  color: var(--ink);
  caret-color: var(--brand);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field input:hover, .field textarea:hover, .field select:hover { border-color: #C4CAD4; }
.field textarea { resize: vertical; line-height: 1.6; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
}
.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235A6472' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
}
.field select option { font-size: 14px; }

.hint { color: var(--ink-3); font-size: 13.5px; }

.navrow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

/* ------------------------------------------------------------- cards */

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.card {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 19px;
  cursor: pointer;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.card:hover { border-color: var(--brand-lt); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card.selected {
  border: 2px solid var(--brand);
  box-shadow: var(--ring), var(--shadow-sm);
  background: linear-gradient(180deg, rgba(79, 70, 229, .035), transparent 46%), var(--surface);
}
.card h3 { margin: 0 0 7px; font-size: 16.5px; font-weight: 650; letter-spacing: -.015em; }
.card p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.6; }

.summary {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 16px;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.7;
  margin-bottom: 18px;
}
.summary strong { color: var(--ink); font-weight: 650; }

.placeholder, .loading {
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1.5px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 26px 22px;
  font-size: 14.5px;
  text-align: center;
}
.loading {
  border-style: solid;
  border-color: rgba(79, 70, 229, .28);
  background: var(--brand-bg);
  color: var(--brand-ink);
  font-weight: 550;
}
.loading::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 10px;
  vertical-align: -2px;
  border: 2px solid rgba(79, 70, 229, .25);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.results { display: flex; flex-direction: column; gap: 13px; margin-top: 10px; }

/* skeletons */
.skel-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--surface);
}
.skel-line {
  height: 12px;
  border-radius: 6px;
  margin: 10px 0;
  background: linear-gradient(90deg, #EEF0F3 25%, #E4E7EC 42%, #EEF0F3 58%);
  background-size: 220% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.skel-line.w60 { width: 60%; }
.skel-line.w85 { width: 85%; }
.skel-line.w40 { width: 40%; }
.skel-line.h18 { height: 17px; border-radius: 6px; }
.skel-row { display: flex; gap: 8px; margin-top: 12px; }
@keyframes shimmer { to { background-position: -220% 0; } }

/* ------------------------------------------------------------- ideas */

.ideaboard { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
@media (max-width: 720px) { .ideaboard { grid-template-columns: 1fr; } }

.idea {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
  opacity: 0;
  animation: rise .35s ease forwards;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.idea:hover { border-color: var(--brand-lt); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.idea.selected {
  border: 2px solid var(--brand);
  box-shadow: var(--ring), var(--shadow-sm);
}
.idea h3 { margin: 0 0 5px; font-size: 16px; font-weight: 650; letter-spacing: -.015em; line-height: 1.35; }

.idea-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.idea-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  background: var(--brand-bg);
  color: var(--brand-ink);
  font-size: 12.5px;
  font-weight: 700;
  flex: none;
}
.idea .area { margin: 0; }
.idea .area small { color: var(--ink-3); font-size: 12.5px; font-weight: 550; }
.idea p { margin: 7px 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.6; }
.idea p strong { color: var(--ink); font-weight: 600; }
.idea .sources { margin-top: 9px; }
.idea .sources span {
  background: var(--good-bg);
  color: var(--good);
  border: 1px solid var(--good-line);
  border-radius: 999px;
  padding: 2.5px 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 550;
  display: inline-block;
  margin: 2px 4px 2px 0;
}
.idea .idea-pick {
  margin-top: auto;
  padding-top: 13px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--brand);
  opacity: .85;
  transition: opacity .15s ease;
}
.idea:hover .idea-pick, .idea.selected .idea-pick { opacity: 1; }

/* generic + engagement badges */
.meta {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  padding: 3px 10px;
  border-radius: 999px;
}
.badge {
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0;
  padding: 3.5px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.badge.high { background: var(--good-bg); color: var(--good); border-color: var(--good-line); }
.badge.medium { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.badge.low { background: var(--surface-2); color: var(--ink-2); border-color: var(--line-2); }

/* ------------------------------------------------------------- guiding questions / funnel */

.gq {
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 9px;
  font-size: 14.5px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.gq strong { display: block; margin-bottom: 4px; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.gq small { color: var(--ink-3); font-size: 13px; }

.funnel { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.funnel-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--brand);
  color: #fff;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 6px 13px;
  border-radius: 999px;
  box-shadow: 0 3px 8px -3px rgba(79, 70, 229, .5);
}
.funnel-stage { display: flex; flex-direction: column; }
.funnel-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  border-radius: 8px;
  border: 1.5px solid rgba(79, 70, 229, .35);
  background: var(--brand-bg);
  color: var(--brand-ink);
  font-size: 12px;
  font-weight: 700;
  margin-right: 9px;
  flex: none;
}
.funnel-arrow { text-align: center; color: var(--brand-lt); font-size: 12px; margin: 2px 0 2px 4px; }

/* ------------------------------------------------------------- research questions */

.rq {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 19px 20px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.rq.selected { border: 2px solid var(--brand); box-shadow: var(--ring), var(--shadow-sm); }
.rq h3 { margin: 0 0 7px; font-size: 16.5px; font-weight: 650; letter-spacing: -.015em; line-height: 1.4; }
.rq p { margin: 7px 0; color: var(--ink-2); font-size: 14px; line-height: 1.6; }
.rq ul { margin: 10px 0 0; padding-left: 4px; list-style: none; font-size: 13.5px; }
.rq li { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; }
.rq li.ok { color: var(--good); }
.rq li.no { color: var(--issue); }
.rq .pick { margin-top: 12px; }
.rq-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }

.band {
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 650;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.band.band-high { background: var(--good-bg); color: var(--good); border-color: var(--good-line); }
.band.band-mid { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.band.band-low { background: var(--issue-bg); color: var(--issue); border-color: var(--issue-line); }

.bandnote {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 13.5px;
  line-height: 1.6;
  margin: 9px 0;
  color: var(--ink-2);
}
.bandnote strong { color: var(--ink); }
.improve {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 13.5px;
  line-height: 1.6;
  margin: 9px 0;
  color: #6E4508;
}

/* ------------------------------------------------------------- health check */

.healthcard {
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-2);
  border-radius: var(--radius);
  padding: 15px 18px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.healthcard h3 { margin: 0 0 4px; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.healthcard .note { color: var(--ink-2); font-size: 13.5px; margin: 0; line-height: 1.6; }
.healthcard.good { border-left-color: var(--good); background: linear-gradient(90deg, var(--good-bg), var(--surface) 38%); }
.healthcard.warning { border-left-color: #D89B3D; background: linear-gradient(90deg, var(--warn-bg), var(--surface) 38%); }
.healthcard.issue { border-left-color: var(--issue); background: linear-gradient(90deg, var(--issue-bg), var(--surface) 38%); }

.tag {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 2.5px 8px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: 1px;
}
.tag.good { color: var(--good); background: var(--good-bg); }
.tag.warning { color: var(--warn); background: var(--warn-bg); }
.tag.issue { color: var(--issue); background: var(--issue-bg); }

.verdict {
  display: flex;
  gap: 10px;
  align-items: baseline;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 14px 17px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.55;
  margin-top: 10px;
}
.verdict::before { font-size: 17px; flex: none; }
.verdict.ready { background: var(--good-bg); color: var(--good); border-color: var(--good-line); }
.verdict.ready::before { content: "✓"; }
.verdict.refine { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.verdict.refine::before { content: "△"; }
.verdict.rethink { background: var(--issue-bg); color: var(--issue); border-color: var(--issue-line); }
.verdict.rethink::before { content: "✕"; }

.nextsteps { margin: 10px 0 0; padding-left: 20px; }
.nextsteps li { margin-bottom: 8px; line-height: 1.6; font-size: 14.5px; color: var(--ink-2); }

/* ------------------------------------------------------------- feasibility */

.feaslist { list-style: none; margin: 10px 0 0; padding: 0; }
.feaslist li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-left-color: var(--line-2);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 7px;
  font-size: 14px;
  background: var(--surface);
  line-height: 1.55;
}
.feaslist li.ok { border-left-color: var(--good); }
.feaslist li.warn { border-left-color: #D89B3D; }
.feaslist li.no { border-left-color: var(--issue); }
.feaslist .feas-icon { font-weight: 800; flex: none; }
.feaslist li.ok .feas-icon { color: var(--good); }
.feaslist li.warn .feas-icon { color: var(--warn); }
.feaslist li.no .feas-icon { color: var(--issue); }
.feaslist li strong { flex: none; font-weight: 650; color: var(--ink); }
.feaslist li small { color: var(--ink-3); }

/* ------------------------------------------------------------- pathways & frameworks */

.pw-head { display: flex; align-items: center; gap: 13px; }
.pw-head h3 { margin: 0; }
.pw-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  color: #fff;
  flex: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 4px 10px -4px rgba(16, 24, 40, .35);
}
.pw-icon svg { width: 20px; height: 20px; }
.pw-icon.subject { background: linear-gradient(135deg, #4F46E5, #6D5CE7); }
.pw-icon.inter { background: linear-gradient(135deg, #0E9384, #14B8A6); }

.card.fw { display: flex; gap: 14px; align-items: stretch; padding: 16px; }
.card.fw .fw-bar { width: 5px; border-radius: 4px; flex: none; }
.card.fw h3 { margin: 0 0 4px; font-size: 15.5px; }
.card.fw ul.fw-topics { margin: 7px 0 0; padding-left: 16px; font-size: 12.5px; color: var(--ink-3); }
.card.fw ul.fw-topics li { margin: 2px 0; }

.sourcerule {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-left: 3px solid #D89B3D;
  color: #6E4508;
  border-radius: var(--radius);
  padding: 12px 15px;
  font-size: 13.5px;
  line-height: 1.6;
  margin: 4px 0 16px;
}
.sourcerule + .sourcerule { margin-top: -10px; }
.sourcerule.strict {
  background: var(--issue-bg);
  border-color: var(--issue-line);
  border-left-color: var(--issue);
  color: #8C2118;
}

/* ------------------------------------------------------------- modal ("My plans") */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 16px;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  max-width: 640px;
  width: 100%;
  max-height: 82vh;
  overflow: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  animation: modalIn .22s cubic-bezier(.21, .7, .3, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.modal-head h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.02em; }

.plan-card { cursor: default; }
.plan-card .plan-meta { color: var(--ink-3); font-size: 13px; margin: 4px 0 0; }
.plan-actions { margin-top: 12px; display: flex; gap: 8px; }

/* ------------------------------------------------------------- auth modal (sign in / sign up) */

.auth-modal { max-width: 420px; }
.auth-lede { color: var(--ink-2); font-size: 14px; line-height: 1.6; margin: 0 0 16px; }

.google-btn {
  width: 100%;
  background: var(--surface);
  border-color: var(--line-2);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
  padding: 12px 16px;
  font-size: 14.5px;
}
.google-btn:hover:not(:disabled) { border-color: #C4CAD4; box-shadow: var(--shadow-sm); }
.google-btn svg { flex: none; }

.auth-div {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.auth-div::before, .auth-div::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.btn.wide { width: 100%; padding: 12px 16px; font-size: 14.5px; }

.code-input {
  font-family: var(--mono);
  font-size: 24px !important;
  letter-spacing: .45em;
  text-align: center;
  padding: 12px 0 12px .45em !important;
}

.auth-alt {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--ink-3);
  font-size: 13px;
}
.btn-link {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
}
.btn-link:hover { color: var(--brand-deep); text-decoration: underline; text-underline-offset: 3px; }

.auth-step .hint { margin: 12px 0 0; text-align: center; }

/* letter-avatar for email-only accounts (no Google photo) */
.user-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-bg);
  color: var(--brand-ink);
  font-size: 13px;
  font-weight: 700;
}

/* hero sign-up row under the start buttons */
.signuprow { margin-top: 12px; display: flex; justify-content: center; }
.btn.secondary {
  background: var(--surface);
  border-color: var(--brand-lt);
  color: var(--brand-ink);
  box-shadow: var(--shadow-xs);
  text-decoration: none;
}
.btn.secondary:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------- footer & toast */

.footer {
  text-align: center;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.8;
  padding: 14px 24px 48px;
}
.footer a { color: var(--brand); text-decoration: none; font-weight: 550; }
.footer a:hover { color: var(--brand-deep); text-decoration: underline; text-underline-offset: 3px; }

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: #1D2330;
  color: #F3F5F9;
  border-radius: 12px;
  padding: 13px 19px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  max-width: min(92vw, 520px);
  animation: toastIn .25s cubic-bezier(.21, .7, .3, 1);
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.toast::before { content: "●"; font-size: 9px; margin-right: 9px; vertical-align: 1px; color: var(--brand-lt); }
.toast.error::before { color: #F97066; }
.toast.success::before { color: #32D583; }

/* ------------------------------------------------------------- responsive */

@media (max-width: 640px) {
  .cards { grid-template-columns: 1fr; }
  .panel { padding: 24px 18px; }
  .navrow { justify-content: stretch; }
  .navrow .btn { flex: 1; }
  .navrow .btn.ghost { flex: 0 0 auto; }
  .stepper li .lbl { display: none; }
  .stepper li { padding: 9px 6px; }
  .topbar-inner { padding: 10px 14px; }
  .subtitle { display: none; }
  .hero h2 { white-space: normal; }
  .uw { white-space: normal; }
}

/* ------------------------------------------------------------- motion preferences */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    transition-duration: .001s !important;
  }
  .uw path { stroke-dashoffset: 0; }
  .skel-line { animation: none; }
}

/* ---- context recap bar (steps 2+) ---- */
.ctxbar { margin: 0 0 16px; font-size: 13px; }

/* ---- first-steps / next-steps lists on idea & refined cards ---- */
.firststeps { margin: 10px 0 4px; font-size: 13px; }
.firststeps ol { margin: 6px 0 0; padding-left: 20px; }
.firststeps li { margin: 3px 0; }

/* ---- model answer under a guiding question ---- */
.gq-example { display: block; margin-top: 6px; opacity: .85; }

/* ---- print-only Topic Brief (Save as PDF) ---- */
#printArea { display: none; }
@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea {
    display: block;
    font-family: Georgia, 'Times New Roman', serif;
    color: #111;
    max-width: 720px;
    margin: 0 auto;
    padding: 24px;
    font-size: 12pt;
    line-height: 1.5;
  }
  #printArea h1 { font-size: 20pt; margin: 0 0 4px; }
  #printArea h2 { font-size: 14pt; margin: 18px 0 6px; border-bottom: 1px solid #999; padding-bottom: 3px; }
  #printArea blockquote {
    margin: 8px 0; padding: 8px 14px; border-left: 3px solid #555;
    font-style: italic; background: #f4f4f4;
  }
  #printArea ul { padding-left: 22px; }
  #printArea li { margin: 4px 0; }
  #printArea .pb-meta { font-size: 9.5pt; color: #555; }
  #printArea hr { border: none; border-top: 1px solid #bbb; margin: 18px 0 8px; }
}
