@font-face {
  font-family: "Lusitana";
  src: url("/assets/Lusitana-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Ovo";
  src: url("/assets/Ovo-Regular.ttf") format("truetype");
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #0d0e0f;
  --panel: #242629;
  --field: #17191c;
  --ivory: #f3f0e9;
  --muted: #d8d2c7;
  --bronze: #b18b52;
  --bronze-light: #c4a16c;
  --line: rgba(243, 240, 233, 0.16);
  --font-head: "Ovo", Georgia, serif;
  --font-body: "Lusitana", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  color: var(--ivory);
}

body {
  font-family: var(--font-body);
  font-weight: 700;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.app-shell {
  position: fixed;
  inset: var(--viewport-offset-top, 0px) 0 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: var(--viewport-height, 100dvh);
  min-height: 0;
  overflow: hidden;
  padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background:
    radial-gradient(ellipse at 50% 43%, rgba(177, 139, 82, 0.07), transparent 54%),
    var(--ink);
}

.topbar {
  flex: 0 0 48px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  width: min(100%, 1120px);
  margin: 0 auto;
}

.wordmark {
  width: fit-content;
  color: var(--ivory);
  font: 700 22px/1 var(--font-head);
  letter-spacing: 0.16em;
  text-decoration: none;
}

.desk-name {
  color: var(--muted);
  font: 700 12px/1.2 var(--font-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.return-link {
  justify-self: end;
  color: var(--muted);
  font: 700 13px/1.2 var(--font-body);
  text-decoration: none;
  transition: color 160ms ease;
}

.return-link:hover, .return-link:focus-visible { color: var(--bronze-light); }

.progress-wrap {
  flex: 0 0 52px;
  width: min(100%, 1120px);
  margin: 7px auto 0;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

#question-count { color: var(--ivory); }
.progress-caption { color: rgba(216, 210, 199, 0.7); }

.progress-track {
  width: 100%;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(243, 240, 233, 0.13);
}

.progress-fill {
  display: block;
  width: 8.333%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #80612f, var(--bronze-light));
  transition: width 300ms ease;
}

.screen-wrap {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  padding: 0 10px;
}

.question-panel, .success-panel {
  width: min(100%, 760px);
  max-height: 100%;
  margin: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(12px, 2.2vh, 24px);
  padding: clamp(12px, 2.4vh, 28px) clamp(10px, 2.5vw, 24px);
  border: 1px solid rgba(243, 240, 233, 0.12);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(36, 38, 41, 0.95), rgba(24, 26, 29, 0.96));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2), inset 0 1px rgba(255, 255, 255, 0.025);
  transition: opacity 190ms ease, transform 230ms cubic-bezier(.2,.75,.25,1);
}

.question-panel.leaving { opacity: 0; transform: translateX(-24px); }
.question-panel.entering { opacity: 0; transform: translateX(24px); }

.question-heading { display: flex; flex-direction: column; gap: 9px; }

.question-eyebrow {
  color: var(--bronze-light);
  font: 700 11px/1.2 var(--font-body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.question-title, .success-title {
  margin: 0;
  color: var(--ivory);
  font: 700 clamp(2.1rem, 5.5vw, 3.6rem)/1.08 var(--font-head);
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.question-title.is-medium { font-size: clamp(1.5rem, 3.5vh, 2.45rem); line-height: 1.14; }
.question-title.is-long { font-size: clamp(1.08rem, 2.45vh, 1.55rem); line-height: 1.2; letter-spacing: -0.015em; }

#answer-form { display: flex; flex-direction: column; gap: clamp(11px, 1.8vh, 18px); min-height: 0; }

.answer-area { display: grid; gap: 9px; min-width: 0; }

.text-input {
  display: block;
  width: 100%;
  height: 58px;
  padding: 0 17px;
  border: 1px solid rgba(177, 139, 82, 0.42);
  border-radius: 9px;
  outline: none;
  background: var(--field);
  color: var(--ivory);
  font: 700 17px/1.3 var(--font-body);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.text-input::placeholder { color: rgba(216, 210, 199, 0.55); opacity: 1; }
.text-input:focus { border-color: var(--bronze-light); box-shadow: 0 0 0 3px rgba(177, 139, 82, 0.16); background: #1c1e21; }

.choice-list { display: grid; gap: 8px; }

.choice-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(13, 14, 15, 0.38);
  color: var(--ivory);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.choice-option:hover { border-color: rgba(177, 139, 82, 0.65); background: rgba(177, 139, 82, 0.08); }
.choice-option:active { transform: scale(0.995); }
.choice-option.selected { border-color: var(--bronze); background: rgba(177, 139, 82, 0.13); }

.choice-option input {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--bronze-light);
}

.choice-copy { font: 700 clamp(13px, 1.8vh, 15px)/1.28 var(--font-body); }
.choice-option input:focus-visible { outline: 2px solid var(--bronze-light); outline-offset: 3px; }

.other-field-wrap { display: grid; gap: 6px; margin-top: 2px; }
.other-field-label { color: var(--muted); font: 700 12px/1.2 var(--font-body); }
.other-field-wrap .text-input { height: 48px; font-size: 15px; }

.description {
  margin: 0;
  max-width: 700px;
  color: rgba(216, 210, 199, 0.82);
  font: 700 clamp(12px, 1.65vh, 14px)/1.38 var(--font-body);
}

.form-error {
  margin: -5px 0 0;
  color: #f0a69d;
  font: 700 12px/1.3 var(--font-body);
}

.button-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin-top: 1px;
}

.keyboard-hint { flex: 1; color: rgba(216, 210, 199, 0.56); font: 700 11px/1.2 var(--font-body); }

.back-button, .next-button {
  min-height: 48px;
  border-radius: 9px;
  cursor: pointer;
  font: 700 15px/1.15 var(--font-body);
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease, opacity 150ms ease, transform 150ms ease;
}

.back-button {
  min-width: 92px;
  padding: 0 18px;
  border: 1px solid rgba(243, 240, 233, 0.2);
  background: transparent;
  color: var(--muted);
}

.back-button:hover { border-color: rgba(196, 161, 108, 0.7); color: var(--ivory); }

.next-button {
  min-width: 132px;
  max-width: 100%;
  padding: 0 22px;
  border: 1px solid var(--bronze);
  background: var(--bronze);
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  box-shadow: 0 8px 28px rgba(177, 139, 82, 0.13);
}

.next-button:hover:not(:disabled) { background: var(--bronze-light); border-color: var(--bronze-light); transform: translateY(-1px); }
.next-button:disabled { cursor: not-allowed; opacity: 0.42; box-shadow: none; }
.next-button.submit-button { min-width: 0; font-size: 12px; white-space: nowrap; }
.back-button:focus-visible, .next-button:focus-visible, .return-link:focus-visible, .wordmark:focus-visible { outline: 2px solid var(--bronze-light); outline-offset: 4px; }

.success-panel { align-items: flex-start; gap: 14px; padding: clamp(26px, 5vw, 48px); }
.success-mark { display: grid; place-items: center; width: 43px; height: 43px; border: 1px solid var(--bronze); border-radius: 50%; color: var(--bronze-light); font: 700 23px/1 var(--font-head); }
.success-title { font-size: clamp(2rem, 5vw, 3rem); }
.success-panel p { max-width: 520px; margin: 0; color: var(--muted); font: 700 16px/1.45 var(--font-body); }
.return-button { display: inline-flex; align-items: center; justify-content: center; margin-top: 8px; }

.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.screen-wrap.compact .question-panel { gap: 10px; padding-top: 8px; padding-bottom: 8px; }
.screen-wrap.compact .question-title.is-long { font-size: clamp(1rem, 2.15vh, 1.35rem); line-height: 1.16; }
.screen-wrap.compact .description { font-size: clamp(11px, 1.5vh, 12px); line-height: 1.28; }
.screen-wrap.compact .choice-list { gap: 6px; }
.screen-wrap.compact .choice-option { min-height: 39px; padding: 7px 10px; }
.screen-wrap.compact .choice-copy { font-size: 12px; line-height: 1.22; }
.screen-wrap.compact .text-input { height: 50px; }
.screen-wrap.compact #answer-form { gap: 9px; }
.screen-wrap.compact .button-row { min-height: 46px; }
.screen-wrap.compact .back-button, .screen-wrap.compact .next-button { min-height: 44px; }

.screen-wrap.ultra-compact .question-panel { gap: 7px; padding-top: 4px; padding-bottom: 4px; }
.screen-wrap.ultra-compact .question-heading { gap: 5px; }
.screen-wrap.ultra-compact .question-eyebrow { font-size: 9px; }
.screen-wrap.ultra-compact .question-title.is-long { font-size: 15px; line-height: 1.12; }
.screen-wrap.ultra-compact .question-title.is-medium { font-size: 18px; }
.screen-wrap.ultra-compact .description { font-size: 11px; line-height: 1.22; }
.screen-wrap.ultra-compact .choice-list { gap: 4px; }
.screen-wrap.ultra-compact .choice-option { min-height: 34px; padding: 5px 8px; gap: 9px; }
.screen-wrap.ultra-compact .choice-copy { font-size: 11px; line-height: 1.15; }
.screen-wrap.ultra-compact .text-input { height: 42px; font-size: 14px; }
.screen-wrap.ultra-compact #answer-form { gap: 6px; }
.screen-wrap.ultra-compact .button-row { min-height: 40px; }
.screen-wrap.ultra-compact .back-button, .screen-wrap.ultra-compact .next-button { min-height: 40px; font-size: 13px; }
.screen-wrap.ultra-compact .next-button.submit-button { font-size: 10px; padding: 0 10px; }

@media (max-width: 560px) {
  .app-shell { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .topbar { flex-basis: 42px; grid-template-columns: 1fr auto; gap: 8px; }
  .wordmark { font-size: 19px; }
  .desk-name { grid-column: 2; grid-row: 1; justify-self: end; font-size: 9px; }
  .return-link { grid-column: 1 / -1; grid-row: 2; justify-self: end; margin-top: -3px; font-size: 10px; }
  .progress-wrap { flex-basis: 43px; margin-top: 6px; }
  .progress-labels { margin-bottom: 7px; font-size: 10px; }
  .screen-wrap { padding: 0; }
  .question-panel { width: 100%; border-radius: 13px; padding: 14px 12px; gap: 12px; }
  .question-heading { gap: 7px; }
  .question-eyebrow { font-size: 9px; }
  .question-title { font-size: clamp(2rem, 8vw, 2.65rem); }
  .question-title.is-medium { font-size: clamp(1.4rem, 5.5vw, 1.8rem); }
  .question-title.is-long { font-size: clamp(1.04rem, 4.8vw, 1.28rem); line-height: 1.17; }
  #answer-form { gap: 10px; }
  .answer-area { gap: 7px; }
  .text-input { height: 52px; padding: 0 13px; font-size: 15px; }
  .choice-option { min-height: 42px; padding: 8px 10px; gap: 10px; }
  .choice-copy { font-size: 13px; }
  .description { font-size: clamp(11.5px, 1.8vh, 13px); line-height: 1.3; }
  .button-row { min-height: 46px; gap: 8px; }
  .keyboard-hint { font-size: 9px; }
  .back-button, .next-button { min-height: 44px; font-size: 13px; }
  .back-button { min-width: 74px; padding: 0 12px; }
  .next-button { min-width: 110px; padding: 0 14px; }
  .next-button.submit-button { font-size: 10px; padding: 0 10px; }
  .success-panel { padding: 25px 20px; }
  .success-panel p { font-size: 14px; }
}

@media (max-height: 720px) {
  .topbar { flex-basis: 38px; }
  .progress-wrap { flex-basis: 38px; margin-top: 4px; }
  .question-panel { gap: 9px; }
  .question-title.is-long { font-size: clamp(1rem, 2.4vh, 1.35rem); }
  .choice-list { gap: 6px; }
  .choice-option { min-height: 39px; padding-top: 6px; padding-bottom: 6px; }
  .description { font-size: clamp(11px, 1.6vh, 13px); }
  #answer-form { gap: 8px; }
}

@media (max-height: 570px) {
  .topbar { flex-basis: 32px; }
  .progress-wrap { flex-basis: 32px; margin-top: 2px; }
  .question-panel { gap: 6px; padding-top: 3px; padding-bottom: 3px; }
  .question-eyebrow { font-size: 8px; }
  .question-title.is-long { font-size: 14px; }
  .question-title.is-medium { font-size: 17px; }
  .description { font-size: 10.5px; line-height: 1.18; }
  .choice-list { gap: 3px; }
  .choice-option { min-height: 31px; padding: 4px 7px; }
  .choice-copy { font-size: 10px; }
  .text-input { height: 38px; }
  .button-row { min-height: 36px; }
  .back-button, .next-button { min-height: 36px; }
}

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