:root {
  --ink: #0b1830;
  --ink-2: #152849;
  --blue: #155eef;
  --blue-dark: #0b45bd;
  --cyan: #12b8c4;
  --orange: #f79009;
  --paper: #f5f8fc;
  --white: #ffffff;
  --line: #d9e2ef;
  --muted: #5e6c84;
  --success: #138a5b;
  --danger: #b42318;
  --shadow: 0 20px 55px rgba(11, 24, 48, .12);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-height: 100vh; margin: 0; background: var(--paper); line-height: 1.55; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 3px solid rgba(21, 94, 239, .28); outline-offset: 3px; }

.site-header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px clamp(20px, 4vw, 64px); border-bottom: 1px solid rgba(217, 226, 239, .85); background: rgba(255, 255, 255, .92); position: relative; z-index: 10; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.15; }
.brand b { font-size: 1rem; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: .78rem; margin-top: 4px; }
.brand-mark { width: 40px; height: 40px; border-radius: 11px; background: var(--ink); display: flex; justify-content: center; align-items: center; gap: 3px; overflow: hidden; }
.brand-mark i { width: 4px; height: 24px; background: var(--cyan); border-radius: 5px; transform: rotate(23deg); }
.brand-mark i:nth-child(2) { background: var(--blue); height: 31px; }
.brand-mark i:nth-child(3) { background: var(--orange); height: 20px; }
.account { display: flex; align-items: center; gap: 18px; }
.account form { margin: 0; }
.account-name { color: var(--muted); font-size: .9rem; }
.text-button { border: 0; background: transparent; color: var(--blue); font-weight: 700; padding: 8px; cursor: pointer; }
.page-shell { width: min(1280px, calc(100% - 40px)); margin: 0 auto; padding: clamp(32px, 5vw, 72px) 0; min-height: calc(100vh - 138px); }
.site-footer { color: #738198; text-align: center; font-size: .8rem; padding: 0 20px 26px; }

.auth-page { background-color: var(--paper); background-image: linear-gradient(rgba(21, 94, 239, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(21, 94, 239, .035) 1px, transparent 1px); background-size: 32px 32px; }
.auth-layout { min-height: calc(100vh - 235px); display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, .65fr); align-items: center; gap: clamp(48px, 8vw, 120px); }
.auth-intro { max-width: 720px; }
.eyebrow, .card-kicker { color: var(--blue); font-size: .78rem; line-height: 1; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.auth-intro h1 { font-size: clamp(2.7rem, 5.6vw, 5.4rem); line-height: .98; letter-spacing: -.06em; margin: 18px 0 28px; max-width: 820px; }
.auth-intro h1 span { color: var(--blue); }
.lede { font-size: 1.12rem; color: var(--muted); max-width: 650px; }
.trust-list { list-style: none; padding: 0; margin: 36px 0 0; display: grid; gap: 13px; }
.trust-list li { display: flex; gap: 14px; align-items: center; color: var(--ink-2); font-weight: 600; }
.trust-list span { color: var(--cyan); font: 800 .78rem/1 ui-monospace, monospace; border: 1px solid rgba(18, 184, 196, .4); padding: 7px; border-radius: 7px; }
.auth-card, .narrow-card, .panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-card { padding: clamp(28px, 4vw, 46px); position: relative; overflow: hidden; }
.auth-card::before { content: ""; display: block; position: absolute; height: 5px; inset: 0 0 auto; background: linear-gradient(90deg, var(--blue), var(--cyan), var(--orange)); }
.auth-card h2, .narrow-card h1 { font-size: clamp(1.7rem, 3vw, 2.25rem); line-height: 1.12; letter-spacing: -.035em; margin: 13px 0 10px; }
.auth-card > p, .narrow-card > p { color: var(--muted); }
.stack-form { display: grid; gap: 19px; margin-top: 30px; }
.stack-form label { display: grid; gap: 7px; color: var(--ink-2); font-size: .9rem; font-weight: 700; }
.stack-form input, .stack-form textarea { width: 100%; border: 1px solid #c8d3e2; border-radius: 10px; background: #fbfcfe; color: var(--ink); min-height: 48px; padding: 11px 13px; }
.stack-form input:focus, .stack-form textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21, 94, 239, .1); outline: 0; }
.primary-button, .secondary-button { min-height: 48px; border-radius: 10px; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 12px; padding: 11px 18px; font-weight: 800; text-decoration: none; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.primary-button { color: #fff; background: var(--blue); box-shadow: 0 9px 20px rgba(21, 94, 239, .22); }
.primary-button:hover { background: var(--blue-dark); transform: translateY(-1px); }
.primary-button:disabled { cursor: not-allowed; opacity: .55; transform: none; box-shadow: none; }
.secondary-button { color: var(--ink); background: #fff; border-color: var(--line); }
.secondary-button:hover { background: #f7f9fc; border-color: #b9c8da; }
.fine-print { color: #77849a !important; font-size: .8rem; margin-top: 22px; }
.narrow-card { max-width: 620px; margin: 3vh auto; padding: clamp(28px, 5vw, 52px); }
.step-badge { display: inline-flex; color: var(--blue); background: #eef4ff; border-radius: 999px; padding: 6px 10px; font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.otp-form input { font: 700 1.75rem/1 ui-monospace, monospace; letter-spacing: .28em; text-align: center; }
.stack-form small { color: var(--muted); margin-top: -12px; }
.secret-box, .invite-result { background: #0e1d36; color: #fff; border-radius: 12px; padding: 18px; margin: 25px 0; display: grid; gap: 10px; }
.secret-box > span, .invite-result > span { color: #9fb1cb; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.secret-box code, .invite-result code { font: 700 .96rem/1.5 ui-monospace, monospace; word-break: break-all; color: #c9f9fc; }
.copy-button { width: fit-content; border: 1px solid rgba(255, 255, 255, .22); color: #fff; background: rgba(255, 255, 255, .09); border-radius: 8px; font-weight: 700; padding: 7px 11px; cursor: pointer; }
.notice { background: #fff7e8; border-left: 4px solid var(--orange); color: #754b00 !important; padding: 12px 14px; font-size: .88rem; }
.break-all { word-break: break-all; font-size: .82rem; }
.status-card { text-align: center; }
.status-icon, .status-code { width: 58px; height: 58px; margin: 0 auto 20px; display: grid; place-items: center; border-radius: 50%; background: #fff1f0; color: var(--danger); font-size: 1.6rem; font-weight: 900; }

.survey-page .page-shell { width: min(1440px, calc(100% - 40px)); padding-top: 30px; }
.survey-layout { min-height: calc(100vh - 185px); display: grid; grid-template-columns: minmax(300px, .72fr) minmax(0, 1.5fr); background: #fff; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); }
.survey-rail { color: #fff; background: var(--ink); padding: clamp(28px, 4vw, 52px); position: relative; overflow: hidden; }
.survey-rail::after { content: ""; position: absolute; width: 230px; height: 230px; border: 32px solid rgba(18, 184, 196, .13); border-radius: 50%; right: -130px; bottom: -100px; }
.survey-rail .eyebrow { color: #55d6de; }
.survey-rail h1 { font-size: clamp(1.7rem, 2.7vw, 2.55rem); line-height: 1.08; letter-spacing: -.04em; margin: 16px 0 36px; }
.progress-copy { display: flex; justify-content: space-between; font-size: .84rem; color: #b8c5d7; }
.progress-copy b { color: #fff; }
.progress-track { height: 8px; background: rgba(255,255,255,.12); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--cyan); border-radius: inherit; transition: width .25s ease; }
.section-nav { display: grid; margin-top: 38px; position: relative; z-index: 1; }
.section-nav button { display: flex; gap: 12px; align-items: center; color: #9eb0c8; background: transparent; border: 0; border-left: 2px solid rgba(255,255,255,.12); text-align: left; padding: 10px 0 10px 16px; font-weight: 650; cursor: default; }
.section-nav button::before { content: ""; width: 7px; height: 7px; border: 1px solid currentColor; border-radius: 50%; }
.section-nav button.active { color: #fff; border-left-color: var(--cyan); }
.section-nav button.complete { color: #77dde3; }
.section-nav button.complete::before { background: currentColor; }
.save-state { position: absolute; left: clamp(28px, 4vw, 52px); bottom: 28px; display: flex; align-items: center; gap: 8px; color: #9eb0c8; font-size: .78rem; z-index: 1; }
.save-state span { width: 7px; height: 7px; border-radius: 50%; background: #37ce8e; box-shadow: 0 0 0 4px rgba(55, 206, 142, .12); }
.save-state.saving span { background: var(--orange); }
.save-state.error span { background: #f97066; }
.question-stage { display: flex; align-items: center; justify-content: center; padding: clamp(28px, 6vw, 78px); min-width: 0; }
#question-panel, #review-panel, .loading-panel, .error-panel { width: min(760px, 100%); }
.question-meta { display: flex; justify-content: space-between; gap: 20px; color: var(--blue); text-transform: uppercase; letter-spacing: .09em; font-size: .76rem; font-weight: 800; }
.question-stage h2 { font-size: clamp(2rem, 4vw, 3.45rem); letter-spacing: -.05em; line-height: 1.04; margin: 18px 0 16px; }
.question-help { color: var(--muted); max-width: 680px; font-size: 1rem; margin: 0 0 30px; }
.answer-area { display: grid; gap: 11px; }
.option-card { display: flex; align-items: flex-start; gap: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 15px 16px; cursor: pointer; color: var(--ink-2); background: #fff; transition: border .15s ease, background .15s ease, transform .15s ease; }
.option-card:hover { border-color: #9cb8ec; transform: translateX(2px); }
.option-card.selected { border-color: var(--blue); background: #f1f6ff; box-shadow: inset 3px 0 0 var(--blue); }
.option-card input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--blue); flex: 0 0 auto; }
.option-card span { font-weight: 700; }
.answer-area textarea, .answer-area input[type="text"] { width: 100%; border: 1px solid #c8d3e2; border-radius: 12px; padding: 14px; background: #fbfcfe; color: var(--ink); min-height: 52px; }
.answer-area textarea { min-height: 160px; resize: vertical; }
.char-counter { color: var(--muted); font-size: .78rem; text-align: right; }
.field-error { min-height: 23px; color: var(--danger); font-weight: 700; font-size: .86rem; }
.question-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 30px; }
.question-actions .primary-button { margin-left: auto; }
.review-mark { width: 56px; height: 56px; display: grid; place-items: center; background: #e9f9f2; color: var(--success); border-radius: 16px; font-weight: 900; font-size: 1.5rem; }
.review-summary { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-top: 28px; }
.review-summary div { display: flex; justify-content: space-between; gap: 20px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.review-summary div:last-child { border: 0; }
.review-summary span { color: var(--muted); }
.loading-panel { color: var(--muted); text-align: center; }
.error-panel { text-align: center; }

.result-hero { padding: clamp(30px, 5vw, 58px); border-radius: 22px; background: var(--ink); color: #fff; display: flex; align-items: center; gap: 28px; box-shadow: var(--shadow); }
.result-hero h1 { font-size: clamp(2rem, 4vw, 3.6rem); line-height: 1.04; letter-spacing: -.05em; margin: 8px 0 12px; }
.result-hero p { color: #b9c7d9; margin: 0; }
.result-hero .eyebrow { color: #55d6de; }
.success-seal { min-width: 72px; height: 72px; display: grid; place-items: center; border-radius: 18px; background: var(--cyan); color: var(--ink); font-size: 2rem; font-weight: 900; }
.recommendation-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 22px; margin-top: 22px; }
.recommendation-main, .recommendation-side { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(26px, 4vw, 42px); }
.recommendation-main h2 { font-size: 2rem; letter-spacing: -.035em; margin: 10px 0; }
.recommendation-main h3, .recommendation-side h3 { margin-top: 26px; }
.platform-line { color: var(--blue); font-weight: 800; }
.check-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check-list li::before { content: "✓"; color: var(--success); font-weight: 900; margin-right: 8px; }
.recommendation-side { background: #fff8ea; border-color: #f5d9a3; }

.dashboard-head, .detail-head { display: flex; justify-content: space-between; gap: 35px; align-items: flex-end; margin-bottom: 32px; }
.dashboard-head h1, .detail-head h1 { font-size: clamp(2.4rem, 5vw, 4.5rem); letter-spacing: -.06em; line-height: .98; margin: 12px 0; }
.dashboard-head p, .detail-head p { color: var(--muted); margin: 0; }
.stats-row { display: flex; background: var(--ink); border-radius: 16px; color: #fff; overflow: hidden; box-shadow: var(--shadow); }
.stats-row div { min-width: 112px; padding: 19px 24px; border-left: 1px solid rgba(255,255,255,.1); display: grid; }
.stats-row div:first-child { border-left: 0; }
.stats-row b { font-size: 1.6rem; }
.stats-row span { color: #9fb1c9; font-size: .76rem; }
.admin-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 22px; }
.panel { padding: clamp(24px, 3vw, 34px); box-shadow: 0 12px 38px rgba(11,24,48,.07); }
.panel h2 { margin: 8px 0 0; font-size: 1.45rem; letter-spacing: -.025em; }
.compact-form { grid-template-columns: 1fr 1fr auto; align-items: end; gap: 12px; }
.compact-form .primary-button { white-space: nowrap; }
.invite-result { margin-bottom: 0; }
.invite-list { list-style: none; margin: 22px 0 0; padding: 0; }
.invite-list li { display: flex; justify-content: space-between; gap: 15px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.invite-list li:last-child { border: 0; }
.invite-list li div { display: grid; min-width: 0; }
.invite-list li div span, table td span { color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-flex; white-space: nowrap; border-radius: 999px; padding: 6px 10px; font-size: .75rem; font-weight: 800; }
.pill.complete { background: #e8f8f0; color: #067647; }
.pill.active { background: #edf3ff; color: #1849a9; }
.pill.muted { background: #f1f3f6; color: #667085; }
.survey-table-panel { margin-top: 22px; }
.table-wrap { overflow-x: auto; margin-top: 20px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; padding: 12px 14px; border-bottom: 1px solid var(--line); }
td { padding: 16px 14px; border-bottom: 1px solid var(--line); }
td:first-child { display: grid; }
.row-link, .back-link { color: var(--blue); font-weight: 800; text-decoration: none; }
.empty-state { text-align: center; padding: 55px 20px 35px; color: var(--muted); }
.empty-state > span { font-size: 2rem; color: var(--cyan); }
.empty-state h3 { color: var(--ink); }
.empty-copy { color: var(--muted); }
.back-link { display: inline-block; margin-bottom: 25px; }
.detail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.recommendation-strip { background: var(--ink); color: #fff; padding: clamp(26px, 4vw, 42px); border-radius: 20px; display: grid; grid-template-columns: .9fr 1.5fr; gap: 30px; margin-bottom: 24px; }
.recommendation-strip .card-kicker { color: #55d6de; }
.recommendation-strip h2 { margin: 12px 0 5px; font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.08; }
.recommendation-strip p { color: #b8c5d7; }
.recommendation-strip h3 { margin-top: 0; }
.tag-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tag-list li { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12); border-radius: 8px; padding: 7px 10px; font-size: .82rem; }
.caution-box { grid-column: 1 / -1; background: rgba(247,144,9,.12); border-left: 4px solid var(--orange); padding: 13px 16px; }
.caution-box p { margin: 5px 0; color: #ffe2ad; }
.answers-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.answer-section { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(22px, 3vw, 34px); }
.answer-section h2 { margin: 0 0 20px; font-size: 1.35rem; }
.answer-section dl { margin: 0; display: grid; gap: 17px; }
.answer-section dl div { border-bottom: 1px solid var(--line); padding-bottom: 15px; }
.answer-section dl div:last-child { border: 0; padding-bottom: 0; }
.answer-section dt { color: var(--muted); font-size: .82rem; margin-bottom: 5px; }
.answer-section dd { margin: 0; font-weight: 700; white-space: pre-wrap; }
.flash-stack { position: fixed; top: 88px; right: 24px; z-index: 50; display: grid; gap: 8px; width: min(420px, calc(100vw - 48px)); }
.flash { border-radius: 10px; padding: 13px 16px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 650; }
.flash.error { border-left: 4px solid var(--danger); }
.flash.success { border-left: 4px solid var(--success); }

@media (max-width: 960px) {
  .auth-layout, .survey-layout, .recommendation-grid, .admin-grid { grid-template-columns: 1fr; }
  .auth-intro h1 { font-size: clamp(2.7rem, 10vw, 4.8rem); }
  .survey-rail { padding-bottom: 30px; }
  .survey-rail h1 { max-width: 650px; }
  .section-nav { grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .section-nav button { border-left: 0; border-bottom: 2px solid rgba(255,255,255,.12); padding: 8px 4px; font-size: .75rem; }
  .section-nav button::before { display: none; }
  .save-state { position: static; margin-top: 22px; }
  .dashboard-head, .detail-head { align-items: flex-start; flex-direction: column; }
  .compact-form { grid-template-columns: 1fr 1fr; }
  .compact-form .primary-button { grid-column: 1 / -1; }
  .recommendation-strip { grid-template-columns: 1fr; }
  .caution-box { grid-column: auto; }
}

@media (max-width: 680px) {
  .site-header { padding: 12px 18px; }
  .account-name { display: none; }
  .page-shell, .survey-page .page-shell { width: min(100% - 24px, 1280px); padding: 24px 0; }
  .auth-layout { gap: 36px; }
  .auth-intro h1 { font-size: 2.7rem; }
  .trust-list { display: none; }
  .survey-layout { border-radius: 15px; }
  .survey-rail { padding: 24px; }
  .survey-rail h1 { font-size: 1.65rem; margin-bottom: 24px; }
  .section-nav { display: none; }
  .question-stage { padding: 28px 21px 32px; min-height: 540px; align-items: flex-start; }
  .question-stage h2 { font-size: 2rem; }
  .option-card { padding: 13px; }
  .question-actions { position: sticky; bottom: 0; background: rgba(255,255,255,.96); padding-top: 12px; }
  .question-actions .primary-button, .question-actions .secondary-button { flex: 1; }
  .result-hero { align-items: flex-start; flex-direction: column; }
  .recommendation-grid { grid-template-columns: 1fr; }
  .check-list { grid-template-columns: 1fr; }
  .stats-row { width: 100%; }
  .stats-row div { min-width: 0; flex: 1; padding: 15px; }
  .compact-form, .answers-layout { grid-template-columns: 1fr; }
  .compact-form .primary-button { grid-column: auto; }
  .detail-actions { align-items: stretch; width: 100%; }
  .detail-actions .secondary-button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
