:root {
  --ink: #122e57;
  --blue: #203e6b;
  --blue-soft: #6b89b2;
  --mist: #c7d2e9;
  --paper: #f8f9fc;
  --white: #ffffff;
  --green: #2e725f;
  --red: #a84e4e;
  --line: rgba(32, 62, 107, .18);
  --shadow: 0 18px 55px rgba(18, 46, 87, .12);
}

@font-face {
  font-family: 'TildaSans';
  font-style: normal;
  font-weight: 250 1000;
  font-display: swap;
  src: url('https://static.tildacdn.com/fonts/tildasans/TildaSans-VF.woff2') format('woff2-variations');
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #ffffff;
  font-family: TildaSans, Arial, sans-serif;
}

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

.site-header {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand { color: var(--blue); text-decoration: none; display: grid; gap: 2px; }
.brand span { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.brand strong { font: 400 24px/1.1 TildaSans, Arial, sans-serif; }

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: calc(100vh - 180px);
  margin: 0 auto;
  padding: 56px 0 72px;
}

.hero { max-width: 760px; padding: 44px 0 24px; }
.eyebrow { margin: 0 0 14px; color: var(--blue-soft); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; color: var(--blue); font-family: TildaSans, Arial, sans-serif; font-weight: 400; }
h1 { font-size: clamp(44px, 8vw, 84px); line-height: .98; letter-spacing: -.04em; }
h2 { font-size: clamp(30px, 4vw, 46px); line-height: 1.08; }
.lead { max-width: 660px; margin: 26px 0 0; font-size: clamp(18px, 2.2vw, 22px); line-height: 1.55; }

.intro-card, .results-panel, .share-panel {
  background: rgba(255,255,255,.86);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.intro-card { max-width: 760px; padding: 28px; }
.intro-card ol { margin: 0 0 26px; padding-left: 22px; line-height: 1.65; }
.intro-card li + li { margin-top: 8px; }

.primary, .secondary, .ghost {
  min-height: 50px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform .16s ease, background .16s ease;
}
.primary { background: var(--blue); color: var(--white); }
.secondary { background: var(--mist); color: var(--ink); }
.ghost { background: transparent; border-color: var(--line); color: var(--blue); }
.primary:hover, .secondary:hover, .ghost:hover { transform: translateY(-1px); }
.primary:focus-visible, .secondary:focus-visible, .ghost:focus-visible, .portrait:focus-visible { outline: 3px solid rgba(107,137,178,.55); outline-offset: 3px; }

.test-layout { display: grid; grid-template-columns: minmax(270px, .72fr) minmax(0, 1.65fr); gap: clamp(28px, 4vw, 58px); align-items: start; }
.test-head { min-width: 0; position: sticky; top: 28px; display: flex; min-height: 100%; flex-direction: column; align-items: stretch; }
.test-copy { max-width: 390px; }
.test-head h2 { font-size: 36px; }
.instruction { margin: 12px 0 0; font-size: 18px; line-height: 1.5; }
.progress-copy { width: min(280px, 100%); margin-top: auto; padding-top: 34px; text-align: left; color: var(--blue-soft); font-size: 14px; }
.progress-track { height: 5px; margin-top: 10px; overflow: hidden; border-radius: 99px; background: var(--mist); }
.progress-bar { height: 100%; border-radius: inherit; background: var(--blue); transition: width .25s ease; }

.phase-banner {
  width: fit-content;
  margin: 0 0 18px;
  padding: 11px 15px 10px;
  border: 2px solid currentColor;
  border-radius: 12px;
  line-height: 1.1;
}
.phase-banner span { display: block; margin-bottom: 4px; font-size: 12px; letter-spacing: .11em; text-transform: uppercase; opacity: .72; }
.phase-banner strong { font-size: 15px; letter-spacing: .04em; }
.phase-positive { color: var(--green); background: #edf7f3; }
.phase-negative { color: var(--red); background: #fff0f0; }
.test-head.is-positive .progress-bar { background: var(--green); }
.test-head.is-negative .progress-bar { background: var(--red); }

.portrait-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.portrait {
  position: relative;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  border: 2px solid transparent;
  border-radius: 16px;
  background: #e7ebf3;
  box-shadow: 0 8px 30px rgba(18,46,87,.1);
}
.portrait:hover { border-color: var(--blue-soft); }
.portrait[disabled] { cursor: default; opacity: .18; filter: grayscale(1); }
.portrait img { width: 100%; height: 100%; display: block; object-fit: contain; background: #ffffff; }
.portrait-placeholder {
  width: 100%; height: 100%; position: relative;
  background: linear-gradient(145deg, hsl(var(--tone) 18% 93%), hsl(var(--tone) 18% 75%));
}
.portrait-placeholder::before {
  content: ""; position: absolute; left: 50%; top: 18%; transform: translateX(-50%);
  width: 41%; aspect-ratio: .78; border-radius: 48% 48% 43% 43%;
  background: hsl(var(--tone) 12% 51%);
  box-shadow: inset calc(var(--shift) * 1px) -8px 0 rgba(0,0,0,.08);
}
.portrait-placeholder::after {
  content: ""; position: absolute; left: 13%; right: 13%; bottom: -12%; height: 51%;
  border-radius: 50% 50% 0 0; background: hsl(var(--tone) 12% 45%);
}
.placeholder-label { position: absolute; z-index: 2; left: 10px; bottom: 9px; color: rgba(255,255,255,.82); font-size: 11px; letter-spacing: .06em; }

.results-top { display: flex; justify-content: space-between; gap: 24px; align-items: start; margin-bottom: 26px; }
.results-top p { max-width: 670px; margin: 12px 0 0; line-height: 1.55; }
.results-panel { padding: 28px; }
.result-summary { margin: 16px 0 0; padding: 16px 20px; border-radius: 12px; background: var(--blue); color: white; text-align: center; font-size: 18px; font-weight: 600; }
.profiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.profile-table-wrap { min-width: 0; }
.szondi-table, .shadow-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  color: #28313c;
  background: white;
  font-size: 12px;
}
.szondi-table th, .szondi-table td, .shadow-table th, .shadow-table td {
  height: 28px;
  padding: 3px 2px;
  border: 1px solid #d7dde7;
  text-align: center;
  white-space: nowrap;
}
.szondi-table .profile-title, .shadow-table th { height: 36px; font-size: 13px; }
.szondi-table .vector-row th { height: 34px; }
.szondi-table .factor-row th { height: 32px; font-size: 12px; }
.szondi-table .scale-cell { height: 27px; }
.szondi-table .scale-cell.positive.is-active { background: #d2e5f7; }
.szondi-table .scale-cell.negative.is-active { background: #ffd0d0; }
.szondi-table .centre-line td { border-bottom: 2px solid #4f5965; }
.szondi-table .reaction-row td { height: 38px; font-weight: 700; }
.shadow-table { margin-top: 18px; }
.shadow-table td { height: 38px; font-weight: 700; }

.share-panel { margin-top: 18px; padding: 28px; }
.share-panel h3 { margin: 0 0 8px; font: 400 24px/1.2 TildaSans, Arial, sans-serif; }
.share-panel p { margin: 0 0 18px; line-height: 1.5; }
.share-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.privacy-note { margin-top: 18px !important; color: var(--blue-soft); font-size: 13px; }
button:disabled { cursor: default; opacity: .68; transform: none !important; }

.toast { position: fixed; z-index: 10; right: 22px; bottom: 22px; max-width: 360px; padding: 14px 18px; border-radius: 12px; background: var(--ink); color: white; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

footer { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 22px 0 32px; border-top: 1px solid var(--line); color: var(--blue-soft); font-size: 12px; }

@media (max-width: 820px) {
  .app-shell { padding-top: 34px; }
  .test-layout { grid-template-columns: 1fr; gap: 0; }
  .test-head { position: static; display: grid; grid-template-columns: 1fr; min-height: 0; margin-bottom: 18px; }
  .test-copy { max-width: 780px; }
  .progress-copy { width: 100%; margin-top: 0; padding-top: 0; }
  .portrait-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .profiles { grid-template-columns: 1fr; }
  .results-top { grid-template-columns: 1fr; display: grid; }
  .progress-copy { text-align: left; }
}

@media (max-width: 520px) {
  .site-header { min-height: 62px; }
  .brand strong { font-size: 20px; }
  .app-shell { width: min(100% - 16px, 1180px); padding: 14px 0 40px; }
  .intro-card, .results-panel, .share-panel { padding: 20px; border-radius: 18px; }
  .test-head { gap: 7px; margin-bottom: 12px; }
  .test-head .eyebrow { margin-bottom: 6px; font-size: 10px; }
  .test-head h2 { font-size: clamp(20px, 6vw, 26px); }
  .phase-banner { margin-bottom: 8px; padding: 6px 9px; border-radius: 8px; }
  .phase-banner span { display: inline; margin: 0 5px 0 0; font-size: 9px; }
  .phase-banner strong { font-size: 11px; }
  .instruction { margin-top: 6px; font-size: 14px; }
  .progress-copy { font-size: 11px; }
  .progress-track { margin-top: 4px; }
  .portrait-grid { gap: 5px; }
  .portrait { border-width: 1px; border-radius: 7px; box-shadow: 0 4px 12px rgba(18,46,87,.09); }
  .results-panel { padding: 10px; }
  .profiles { gap: 12px; }
  .szondi-table, .shadow-table { font-size: 10px; }
  .szondi-table th, .szondi-table td, .shadow-table th, .shadow-table td { padding: 2px 1px; }
  .szondi-table .profile-title, .shadow-table th { height: 31px; font-size: 11px; }
  .szondi-table .vector-row th { height: 26px; }
  .szondi-table .factor-row th { height: 25px; font-size: 10px; }
  .szondi-table .scale-cell { height: 20px; }
  .szondi-table .reaction-row td, .shadow-table td { height: 31px; font-size: 10px; }
  .shadow-table { margin-top: 12px; }
  .result-summary { margin-top: 12px; padding: 12px 8px; font-size: 14px; }
  .share-actions { display: grid; }
  .share-actions button { width: 100%; }
}
