:root {
  color-scheme: light;
  --page: #f3f4f0;
  --surface: #ffffff;
  --surface-soft: #e9eee8;
  --ink: #142432;
  --muted: #5d696f;
  --line: #ccd4cf;
  --brand: #176951;
  --brand-dark: #0c4838;
  --focus: #1276a4;
  --equities: #16799b;
  --gold: #c79528;
  --bonds: #7558a2;
  --bitcoin: #d25d36;
  --cash: #4f8b64;
  --shadow: 0 18px 50px rgb(20 36 50 / 9%);
  font-family: Inter, Aptos, "Segoe UI", Helvetica, Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
select,
input[type="radio"],
input[type="checkbox"],
input[type="range"] {
  cursor: pointer;
}

button {
  min-height: 50px;
  padding: 0.78rem 1.3rem;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font-weight: 750;
  text-transform: uppercase;
}

button:hover:not(:disabled) {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

button.secondary {
  background: transparent;
  color: var(--brand-dark);
}

button.secondary:hover:not(:disabled) {
  background: var(--surface-soft);
  color: var(--brand-dark);
}

button.text-button {
  min-height: 44px;
  padding-inline: 0.5rem;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

button.text-button:hover:not(:disabled) {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
}

a {
  color: var(--brand-dark);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  text-wrap: balance;
}

h1 {
  margin-bottom: 1rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 500;
  line-height: 1.04;
}

.hidden {
  display: none !important;
}

.visually-hidden,
.bot-field {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.site-header {
  background: rgb(255 255 255 / 88%);
  border-bottom: 1px solid rgb(204 212 207 / 76%);
  backdrop-filter: blur(12px);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 2.5rem));
  min-height: 64px;
  margin: 0 auto;
}

.brand {
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-decoration: none;
}

.privacy-link {
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
}

.privacy-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

.research-disclosure {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  background: #e1e8e3;
  color: #384942;
  font-size: 0.82rem;
  text-align: center;
}

.study {
  width: 100%;
}

.study-screen {
  display: grid;
  place-items: center;
  width: min(1180px, calc(100% - 2.5rem));
  min-height: calc(100svh - 106px);
  margin: 0 auto;
  padding: 2.2rem 0 3rem;
}

.opening-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  align-items: stretch;
  gap: clamp(1.5rem, 4vw, 4.5rem);
  width: 100%;
}

.future-visual {
  position: relative;
  align-self: center;
  margin: 0;
  padding: 8px;
  overflow: hidden;
  border: 1px solid #b6c1ba;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.future-visual::after {
  position: absolute;
  inset: 8px;
  border: 1px solid rgb(255 255 255 / 48%);
  border-radius: 4px;
  pointer-events: none;
  content: "";
}

.future-visual img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  border-radius: 4px;
  object-fit: cover;
}

.opening-question {
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 430px;
  padding-block: 1rem;
}

.opening-question h1 {
  font-size: clamp(2.6rem, 4.6vw, 4.4rem);
}

.screen-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
  color: var(--brand-dark);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.binary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.4rem;
}

.binary-actions button {
  min-height: 64px;
  font-size: 1.05rem;
}

.screen-panel,
.quiet-panel,
.completion-panel {
  width: min(100%, 920px);
  padding: clamp(1.25rem, 4vw, 3.5rem);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.quiet-panel,
.completion-panel {
  max-width: 680px;
}

.quiet-panel textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  margin-top: 0.5rem;
  padding: 1rem;
  border: 1px solid #9daaa3;
  border-radius: 6px;
  background: #fbfcfa;
}

.textarea-meta {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: right;
}

.eyebrow {
  margin-bottom: 0.75rem;
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.completion-panel {
  text-align: center;
}

.completion-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 1.4rem;
  border: 1px solid #9ab6a5;
  border-radius: 50%;
  background: #e4eee7;
  color: var(--brand-dark);
  font-size: 1.55rem;
}

.completion-panel h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.horizon-fieldset {
  margin: 2.2rem 0 3.2rem;
}

.horizon-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.horizon-track::before {
  position: absolute;
  top: 23px;
  right: 14%;
  left: 14%;
  z-index: 0;
  height: 2px;
  background: #b9c6bf;
  content: "";
}

.horizon-choice {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  min-height: 108px;
  text-align: center;
  cursor: pointer;
}

.horizon-choice input {
  position: absolute;
  opacity: 0;
}

.horizon-marker {
  display: block;
  width: 46px;
  height: 46px;
  margin-bottom: 0.65rem;
  border: 7px solid var(--surface);
  border-radius: 50%;
  background: #aab8b0;
  box-shadow: 0 0 0 1px #899891;
}

.horizon-choice:hover .horizon-marker,
.horizon-choice input:checked + .horizon-marker {
  background: var(--brand);
  box-shadow: 0 0 0 3px #7ea998;
}

.horizon-choice input:focus-visible + .horizon-marker {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.horizon-choice strong {
  font-size: 1.02rem;
}

.horizon-choice small {
  color: var(--muted);
}

.amount-fieldset {
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.amount-fieldset legend {
  padding: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 3vw, 2rem);
  line-height: 1.15;
}

.amount-fieldset > p,
.style-fieldset > p,
.screen-intro,
.allocation-heading p {
  max-width: 720px;
  margin-top: 0.7rem;
  color: var(--muted);
}

.amount-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin-top: 1.4rem;
}

.amount-options label {
  position: relative;
}

.amount-options input {
  position: absolute;
  opacity: 0;
}

.amount-options span {
  display: grid;
  place-items: center;
  min-height: 58px;
  padding: 0.65rem;
  border: 1px solid #a9b5ae;
  border-radius: 6px;
  background: #fbfcfa;
  font-weight: 750;
  text-align: center;
}

.amount-options label:hover span,
.amount-options input:checked + span {
  border-color: var(--brand);
  background: #deebe4;
  color: var(--brand-dark);
}

.amount-options input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.step-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2rem;
}

.split-actions {
  justify-content: space-between;
}

.state-note {
  margin: 1rem 0 0;
  padding: 0.75rem 0.9rem;
  border-left: 3px solid var(--gold);
  background: #f7f2df;
  color: #5f501f;
  font-size: 0.9rem;
}

.allocation-panel {
  width: min(100%, 1000px);
}

.allocation-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}

.allocation-heading h1 {
  margin-bottom: 0.4rem;
}

.allocation-total {
  min-width: 110px;
  color: var(--brand-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.8rem;
  line-height: 1;
  text-align: right;
}

.allocation-total.invalid {
  color: #a33a2c;
}

.style-fieldset {
  margin: 1.7rem 0;
}

.style-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
}

.style-choice {
  min-height: 50px;
  padding-inline: 0.5rem;
  border-color: #9eaaa4;
  background: transparent;
  color: var(--ink);
  font-size: 0.82rem;
}

.style-choice:hover:not(:disabled),
.style-choice.selected {
  border-color: var(--brand);
  background: #deebe4;
  color: var(--brand-dark);
}

.large-allocation-bar {
  display: flex;
  width: 100%;
  height: 30px;
  overflow: hidden;
  border: 4px solid #edf0ed;
  border-radius: 6px;
  background: #e2e6e3;
}

.allocation-segment {
  min-width: 0;
  transition: width 130ms ease;
}

.allocation-segment[data-asset="globalEquities"] {
  background: var(--equities);
}

.allocation-segment[data-asset="physicalGold"] {
  background: var(--gold);
}

.allocation-segment[data-asset="higherYieldGovernmentBonds"] {
  background: var(--bonds);
}

.allocation-segment[data-asset="bitcoin"] {
  background: var(--bitcoin);
}

.allocation-segment[data-asset="eurCashShortGovernmentBonds"] {
  background: var(--cash);
}

.slider-rows {
  margin-top: 1rem;
}

.slider-row {
  --asset-color: var(--brand);
  padding: 1rem 0;
  border-top: 1px solid #e0e5e1;
}

.slider-row[data-asset="globalEquities"] {
  --asset-color: var(--equities);
}

.slider-row[data-asset="physicalGold"] {
  --asset-color: var(--gold);
}

.slider-row[data-asset="higherYieldGovernmentBonds"] {
  --asset-color: var(--bonds);
}

.slider-row[data-asset="bitcoin"] {
  --asset-color: var(--bitcoin);
}

.slider-row[data-asset="eurCashShortGovernmentBonds"] {
  --asset-color: var(--cash);
}

.slider-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.slider-heading label {
  font-weight: 800;
}

.slider-heading p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.slider-heading output {
  min-width: 66px;
  color: var(--asset-color);
  font-size: 1.45rem;
  font-weight: 850;
  line-height: 1.1;
  text-align: right;
}

.slider-row input[type="range"] {
  appearance: none;
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
}

.slider-row input[type="range"]::-webkit-slider-runnable-track {
  height: 7px;
  border: 1px solid #aeb9b2;
  border-radius: 4px;
  background: linear-gradient(
    to right,
    var(--asset-color) 0 var(--range-progress),
    #e5e9e6 var(--range-progress) 100%
  );
}

.slider-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -9px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--asset-color);
  box-shadow: 0 0 0 1px var(--asset-color);
}

.slider-row input[type="range"]::-moz-range-track {
  height: 7px;
  border: 1px solid #aeb9b2;
  border-radius: 4px;
  background: #e5e9e6;
}

.slider-row input[type="range"]::-moz-range-progress {
  height: 7px;
  border-radius: 4px;
  background: var(--asset-color);
}

.slider-row input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--asset-color);
  box-shadow: 0 0 0 1px var(--asset-color);
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem 1.5rem;
  margin-top: 2rem;
}

.profile-grid > label {
  display: grid;
  gap: 0.45rem;
  font-size: 0.88rem;
  font-weight: 750;
}

select,
.admin-controls input,
.contact-admin input {
  width: 100%;
  min-height: 50px;
  padding: 0.65rem 0.8rem;
  border: 1px solid #9ca9a2;
  border-radius: 5px;
  background: #fbfcfa;
}

.holdings-fieldset {
  grid-column: 1 / -1;
}

.holdings-fieldset legend {
  margin-bottom: 0.65rem;
  font-size: 0.88rem;
  font-weight: 750;
}

.holding-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

.holding-options label {
  display: flex;
  align-items: center;
  min-height: 46px;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fbfcfa;
  font-size: 0.86rem;
}

.holding-options input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand);
}

.profile-actions {
  justify-content: flex-end;
}

.profile-actions .text-button {
  margin-right: auto;
}

.error-message {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 10;
  max-width: min(420px, calc(100% - 2rem));
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid #b74535;
  border-radius: 6px;
  background: #fff3f0;
  color: #7c241a;
  box-shadow: var(--shadow);
}

.privacy-notice {
  width: min(920px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 1rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.privacy-notice details {
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.privacy-notice summary {
  cursor: pointer;
  font-weight: 750;
}

.privacy-notice details div {
  max-width: 760px;
  padding-top: 1rem;
}

/* Internal dashboard */
.admin-page {
  background: #eef1ee;
}

.admin-shell {
  width: min(1180px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.admin-shell > header {
  margin-bottom: 1.5rem;
}

.admin-shell h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(2.2rem, 5vw, 3.5rem);
}

.research-banner {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.5rem 0.7rem;
  border-left: 3px solid var(--gold);
  background: #f8f1db;
  color: #51461f;
  font-size: 0.82rem;
  font-weight: 750;
}

.admin-controls,
.contact-admin {
  display: flex;
  align-items: end;
  gap: 0.75rem;
  margin: 1.5rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.admin-controls label,
.contact-admin label {
  display: grid;
  flex: 1;
  gap: 0.35rem;
  font-size: 0.84rem;
  font-weight: 750;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.metric {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.metric > span {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.metric > strong {
  font-size: 1.65rem;
  overflow-wrap: anywhere;
}

.table-card {
  grid-column: 1 / -1;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

th,
td {
  padding: 0.7rem;
  border-bottom: 1px solid #e2e6e3;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.contact-admin {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
}

.contact-admin h2,
.contact-admin p,
.contact-admin pre {
  grid-column: 1 / -1;
}

.contact-actions {
  display: flex;
  gap: 0.5rem;
}

.contact-admin pre {
  overflow-x: auto;
}

@media (max-width: 900px) {
  .study-screen {
    width: min(100% - 2rem, 760px);
  }

  .opening-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .opening-question {
    max-width: 680px;
    padding: 0;
  }

  .future-visual img {
    height: clamp(260px, 36svh, 400px);
    aspect-ratio: auto;
  }

  .amount-options,
  .style-options {
    grid-template-columns: repeat(2, 1fr);
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .site-header-inner,
  .study-screen,
  .privacy-notice,
  .admin-shell {
    width: min(100% - 1.25rem, 100%);
  }

  .site-header-inner {
    min-height: 54px;
  }

  .research-disclosure {
    padding-block: 0.45rem;
    font-size: 0.74rem;
  }

  .study-screen {
    min-height: calc(100svh - 96px);
    padding: 0.8rem 0 1.5rem;
  }

  .opening-grid {
    gap: 1rem;
  }

  .future-visual {
    padding: 5px;
  }

  .future-visual::after {
    inset: 5px;
  }

  .future-visual img {
    height: min(28svh, 230px);
    aspect-ratio: 16 / 9;
  }

  .opening-question h1 {
    margin-bottom: 0.75rem;
    font-size: clamp(2rem, 10vw, 2.55rem);
  }

  .screen-meta {
    margin-bottom: 0.75rem;
  }

  .binary-actions {
    margin-top: 0.75rem;
  }

  .binary-actions button {
    min-height: 58px;
  }

  .screen-panel,
  .quiet-panel,
  .completion-panel {
    padding: 1.15rem;
    box-shadow: 0 8px 26px rgb(20 36 50 / 8%);
  }

  .screen-panel h1,
  .quiet-panel h1 {
    font-size: clamp(1.9rem, 9vw, 2.35rem);
  }

  .horizon-fieldset {
    margin: 1.5rem 0 2rem;
  }

  .horizon-track {
    gap: 0.35rem;
  }

  .horizon-track::before {
    right: 16%;
    left: 16%;
  }

  .horizon-choice {
    min-height: 96px;
  }

  .horizon-marker {
    width: 42px;
    height: 42px;
  }

  .horizon-choice strong {
    font-size: 0.88rem;
  }

  .horizon-choice small {
    font-size: 0.75rem;
  }

  .amount-fieldset {
    padding-top: 1.3rem;
  }

  .amount-fieldset legend {
    font-size: 1.45rem;
  }

  .amount-fieldset > p,
  .style-fieldset > p,
  .screen-intro,
  .allocation-heading p {
    font-size: 0.84rem;
  }

  .amount-options {
    margin-top: 1rem;
  }

  .amount-options span {
    min-height: 52px;
    padding-inline: 0.35rem;
    font-size: 0.88rem;
  }

  .allocation-heading {
    gap: 0.75rem;
  }

  .allocation-total {
    min-width: 76px;
    font-size: 2rem;
  }

  .style-fieldset {
    margin: 1rem 0;
  }

  .style-choice {
    min-height: 48px;
    font-size: 0.76rem;
  }

  .large-allocation-bar {
    height: 26px;
  }

  .slider-row {
    padding: 0.75rem 0;
  }

  .slider-heading {
    gap: 0.5rem;
    margin-bottom: 0.35rem;
  }

  .slider-heading label {
    font-size: 0.91rem;
  }

  .slider-heading p {
    font-size: 0.75rem;
    line-height: 1.35;
  }

  .slider-heading output {
    min-width: 54px;
    font-size: 1.25rem;
  }

  .profile-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1.25rem;
  }

  .holdings-fieldset {
    grid-column: auto;
  }

  .holding-options {
    grid-template-columns: 1fr 1fr;
  }

  .profile-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .profile-actions .text-button {
    grid-column: 1 / -1;
    grid-row: 2;
    margin: 0;
  }

  .step-actions button:not(.text-button) {
    min-width: 120px;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .admin-controls,
  .contact-admin {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .contact-admin h2,
  .contact-admin p,
  .contact-admin pre {
    grid-column: auto;
  }

  .contact-actions {
    flex-direction: column;
  }
}

@media (max-width: 340px) {
  .site-header-inner,
  .study-screen,
  .privacy-notice {
    width: min(100% - 0.8rem, 100%);
  }

  .opening-question h1 {
    font-size: 1.85rem;
  }

  .horizon-choice strong {
    font-size: 0.76rem;
  }

  .horizon-choice small {
    font-size: 0.68rem;
  }

  .amount-options,
  .style-options {
    grid-template-columns: 1fr;
  }

  .holding-options {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .allocation-segment {
    transition: none;
  }
}
