/* ============ Tokens ============ */
:root{
  --bg: #0b0a10;
  --bg-soft: #121019;
  --panel: #171420;
  --panel-2: #1e1a2a;
  --line: rgba(255,255,255,.08);
  --ink: #f4efe4;
  --ink-dim: #b7aecb;
  --ink-faint: #8078998f;

  --gold: #e6ba6e;
  --gold-2: #a97a3a;
  --gold-ink: #241a08;

  --money: #35c48a;
  --money-soft: #12352a;
  --rel: #ff6f92;
  --rel-soft: #3a1220;
  --health: #4fb4ec;
  --health-soft: #0f2c3d;
  --family: #dba25a;
  --family-soft: #3a2a12;

  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;

  --shadow-lg: 0 20px 50px rgba(0,0,0,.45);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  --tabbar-h: 64px;

  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  text-rendering: optimizeLegibility;
}
img{ max-width: 100%; display: block; }
button{ font: inherit; color: inherit; }
[hidden]{ display: none !important; }

button, .door, .option, .tabbar__item{
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* ============ App shell ============ */
.app{
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
}

.screen{
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  transform: translateY(10px) scale(.99);
  pointer-events: none;
  transition: opacity .32s ease, transform .32s ease;
  padding-top: var(--safe-t);
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px);
}
.screen.is-active{
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.screen--start,
.screen--register{
  padding-bottom: var(--safe-b);
}

.screen__body{
  flex: 1;
  padding: 8px 20px 24px;
  display: flex;
  flex-direction: column;
}
.screen__body--center{
  align-items: center;
  text-align: center;
  justify-content: center;
  gap: 4px;
}
.screen__footer{
  padding: 12px 20px 6px;
}

/* ============ Scene illustrations ============ */
.scene{
  position: relative;
  width: 100%;
  height: clamp(170px, 30vh, 230px);
  overflow: hidden;
  flex: 0 0 auto;
  background: var(--bg-soft);
}
.scene img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scene__fade{
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11,10,16,0) 45%, var(--bg) 96%);
}
.scene--banner{
  height: clamp(120px, 20vh, 170px);
}

/* topbar floats over the scene image, but only on screens that actually have one */
.screen--quiz .scene + .topbar,
.screen--directions .scene + .topbar{
  position: absolute;
  top: var(--safe-t);
  left: 0;
  right: 0;
  z-index: 2;
}
.screen--quiz .scene + .topbar ~ .screen__body{
  padding-top: 4px;
}
.iconbtn{
  background: rgba(23,20,32,.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.screen--quiz .scene + .topbar .topbar__title,
.screen--directions .scene + .topbar .topbar__title{
  text-shadow: 0 2px 10px rgba(0,0,0,.7);
}

/* ============ Topbar ============ */
.topbar{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 6px;
}
.topbar--plain{
  padding: 20px 20px 10px;
}
.topbar__title{
  flex: 1;
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.topbar--plain .topbar__title{
  text-align: left;
  font-size: 28px;
}
.iconbtn{
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.iconbtn svg{ width: 20px; height: 20px; }
.iconbtn--ghost{
  border-color: transparent;
  background: transparent;
}

/* ============ Buttons ============ */
.btn{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 16px 20px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .02em;
  cursor: pointer;
  transition: transform .15s ease, opacity .2s ease, box-shadow .2s ease;
}
.btn:active{ transform: scale(.97); }
.btn:disabled{ opacity: .35; pointer-events: none; }

.btn--lg{ padding: 17px 22px; font-size: 17px; }

.btn--gold{
  background: linear-gradient(135deg, #f2d29b, var(--gold) 45%, var(--gold-2));
  color: var(--gold-ink);
  box-shadow: 0 14px 30px rgba(230,186,110,.28);
}
.btn--primary{
  background: linear-gradient(135deg, var(--accent-1, var(--gold)), var(--accent-2, var(--gold-2)));
  color: #08110d;
  box-shadow: 0 14px 30px var(--accent-shadow, rgba(230,186,110,.25));
}
.btn--outline{
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-dim);
}

/* ============ Start screen ============ */
.screen--start{
  position: relative;
  justify-content: flex-end;
  align-items: center;
  background: radial-gradient(120% 90% at 50% 0%, #1a1526 0%, #0b0a10 62%);
}
.start-bg{
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.start-bg__img{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.start-bg__fade{
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11,10,16,0) 42%, rgba(11,10,16,.55) 66%, var(--bg) 92%);
}

.start-content{
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 0 26px calc(46px + var(--safe-b));
  text-align: center;
}
.eyebrow{
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold);
}
.start-title{
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 42px;
  line-height: 1.05;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.start-title span{
  display: inline-block;
  margin-top: 4px;
  font-size: 22px;
  letter-spacing: .28em;
  color: var(--gold);
}
.start-tag{
  margin: 0 0 6px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-dim);
}
.start-tag--dim{
  font-size: 12.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 26px;
}
.start-hint{
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--ink-faint);
  letter-spacing: .02em;
}

/* ============ Directions grid ============ */
.doors{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 8px;
}
.door{
  --accent: var(--gold);
  --accent-soft: rgba(230,186,110,.12);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 20px 16px;
  min-height: 168px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 100% at 20% 0%, var(--accent-soft), transparent 60%),
    var(--panel);
  text-align: left;
  overflow: hidden;
}
.door::after{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px transparent;
  pointer-events: none;
}
.door:active{ transform: scale(.97); }
.door__icon{
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.door__icon svg{ width: 22px; height: 22px; }
.door__title{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--ink);
}
.door__sub{
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--ink-dim);
}
.door--money{ --accent: var(--money); --accent-soft: rgba(53,196,138,.14); }
.door--rel{ --accent: var(--rel); --accent-soft: rgba(255,111,146,.14); }
.door--health{ --accent: var(--health); --accent-soft: rgba(79,180,236,.14); }
.door--family{ --accent: var(--family); --accent-soft: rgba(219,162,90,.14); }

/* ============ Quiz theming ============ */
.theme-money{ --accent-1: #57dba0; --accent-2: var(--money); --accent-shadow: rgba(53,196,138,.3); }
.theme-rel{ --accent-1: #ff9bb4; --accent-2: var(--rel); --accent-shadow: rgba(255,111,146,.3); }
.theme-health{ --accent-1: #86cdf3; --accent-2: var(--health); --accent-shadow: rgba(79,180,236,.3); }
.theme-family{ --accent-1: #ecc084; --accent-2: var(--family); --accent-shadow: rgba(219,162,90,.3); }

.theme-money .question, .theme-money .topbar__title{ color: var(--money); }
.theme-rel .question, .theme-rel .topbar__title{ color: var(--rel); }
.theme-health .question, .theme-health .topbar__title{ color: var(--health); }
.theme-family .question, .theme-family .topbar__title{ color: var(--family); }

.question{
  margin: 18px 0 4px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  line-height: 1.25;
}
.question-hint{
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--ink-faint);
}

/* ============ Textarea ============ */
.textarea{
  width: 100%;
  min-height: 150px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
}
.textarea:focus{ outline: 2px solid var(--accent-2, var(--gold)); outline-offset: 1px; }
.textarea::placeholder{ color: var(--ink-faint); }

/* ============ Compact chip options ============ */
.options.options--compact{
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}
.options--compact .option{
  flex: 0 0 auto;
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 999px;
}

.case-step{
  margin: 4px 0 2px;
  font-size: 11.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--rel);
  opacity: .85;
}

/* ============ Relationships: approved reference screenshots ============ */
.screen--relshot{
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b));
}
.rel-shot{
  position: relative;
  width: 100%;
  line-height: 0;
}
.rel-shot img{
  display: block;
  width: 100%;
  height: auto;
}
.rel-hit{
  position: absolute;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.rel-hit:active{ filter: brightness(1.15); }
.rel-hit:focus-visible{
  outline: 2px solid rgba(255,255,255,.65);
  outline-offset: 2px;
}

.rel-hit--s1-start{
  left: 20.9%; top: 70.2%;
  width: 57.4%; height: 8.46%;
  border-radius: 999px;
}

.rel-hit--s2-back{
  left: .98%; top: .33%;
  width: 10.25%; height: 6.18%;
  border-radius: 14px;
}
.rel-hit--s2-next{
  left: 5.27%; top: 76.3%;
  width: 89.45%; height: 8.01%;
  border-radius: 999px;
}
.rel-hit--s2-skip{
  left: 34.18%; top: 84.96%;
  width: 32.23%; height: 3.58%;
}

.rel-q-box{
  position: absolute;
  left: 5.86%; top: 44.14%;
  width: 88.18%; height: 14.26%;
}
.rel-q-box textarea{
  display: block;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background: rgb(18,17,24);
  border: 1px solid rgba(165,155,185,.35);
  border-radius: 14px;
  color: #f2eef7;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  padding: 3.5% 4% 8% 4%;
  resize: none;
}
.rel-q-box textarea::placeholder{ color: rgba(200,195,215,.55); }
.rel-q-box textarea:focus{ outline: 2px solid var(--rel); outline-offset: 1px; }
.rel-q-counter{
  position: absolute;
  right: 4%;
  bottom: 3.2%;
  font-size: 12.5px;
  color: rgba(200,195,215,.75);
  pointer-events: none;
}

/* ============ Relationships: screen 3 — profile form over reference image ============ */
.rel-hit--s3-back{
  left: 1.46%; top: .65%;
  width: 9.77%; height: 5.86%;
  border-radius: 14px;
}
.rel-hit--s3-next{
  left: 5.86%; top: 85.29%;
  width: 88.28%; height: 6.51%;
  border-radius: 999px;
}
.rel-hit--s3-next:disabled{ cursor: default; }

.rel-p-field{
  position: absolute;
  box-sizing: border-box;
  background: rgb(19,17,23);
  border: 1px solid rgba(165,155,185,.3);
  border-radius: 10px;
  color: #f2eef7;
  font-family: var(--font-body);
  font-size: 14px;
  padding: 0 3.5%;
}
.rel-p-field::placeholder{ color: rgba(190,185,205,.5); }
.rel-p-field:focus{ outline: 2px solid var(--rel); outline-offset: 1px; }
.rel-p-field{ color-scheme: dark; }
.rel-p-field::-webkit-calendar-picker-indicator{ filter: invert(1) brightness(1.4); cursor: pointer; }

.rel-p-firstname{ left: 14.45%; top: 35.81%; width: 54.98%; height: 2.73%; }
.rel-p-lastname{ left: 14.45%; top: 42.06%; width: 54.98%; height: 2.80%; }
.rel-p-patronymic{ left: 14.45%; top: 48.31%; width: 54.98%; height: 2.80%; }
.rel-p-birthdate{ left: 14.55%; top: 54.56%; width: 54.88%; height: 2.80%; }

.rel-p-occupation{
  left: 14.55%; top: 73.89%;
  width: 79.39%; height: 3.06%;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 9l6 6 6-6' fill='none' stroke='%23e6ba6e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 3.5% center;
  background-size: 16px;
}
.rel-p-occupation option{ background: #171420; color: #f2eef7; }

.options.rel-p-chips{ display: contents; }
.option.rel-p-chip{
  position: absolute;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  background: rgb(14,14,19);
  border: 1px solid rgba(165,155,185,.28);
  border-radius: 10px;
  color: #ece8f2;
  font-family: var(--font-body);
  font-size: 8.2px;
  font-weight: 700;
  line-height: 1.05;
  padding: 0 0.5%;
  letter-spacing: -.15px;
  word-break: break-word;
}
.option.rel-p-chip[aria-checked="true"]{
  background: rgb(23,13,19);
  border-color: var(--rel);
  box-shadow: 0 0 0 1px var(--rel) inset, 0 0 14px rgba(255,111,146,.35);
  color: #ffd7e2;
}

.rel-p-marital-0{ left: 14.36%; top: 61.07%; width: 18.36%; height: 2.99%; }
.rel-p-marital-1{ left: 34.08%; top: 61.07%; width: 13.87%; height: 2.99%; }
.rel-p-marital-2{ left: 49.32%; top: 61.07%; width: 16.02%; height: 2.99%; }
.rel-p-marital-3{ left: 66.70%; top: 61.07%; width: 13.96%; height: 2.99%; }
.rel-p-marital-4{ left: 82.03%; top: 61.07%; width: 12.70%; height: 2.99%; }

.rel-p-kids-0{ left: 14.36%; top: 67.58%; width: 13.48%; height: 2.99%; }
.rel-p-kids-1{ left: 29.20%; top: 67.58%; width: 13.38%; height: 2.99%; }
.rel-p-kids-2{ left: 43.85%; top: 67.58%; width: 15.04%; height: 2.99%; }

.rel-p-income-0{ left: 14.36%; top: 80.86%; width: 13.09%; height: 2.93%; }
.rel-p-income-1{ left: 28.71%; top: 80.86%; width: 12.21%; height: 2.93%; }
.rel-p-income-2{ left: 42.29%; top: 80.86%; width: 15.92%; height: 2.93%; }
.rel-p-income-3{ left: 59.57%; top: 80.86%; width: 17.38%; height: 2.93%; }
.rel-p-income-4{ left: 78.22%; top: 80.86%; width: 15.92%; height: 2.93%; }

/* ============ Relationships: screen 4 — current situation rows over reference image ============ */
.rel-hit--s4-back{
  left: 1.46%; top: .65%;
  width: 9.77%; height: 5.86%;
  border-radius: 14px;
}
.rel-row{ border-radius: 14px; }
.rel-row--0{ left: 6.05%; top: 23.37%; width: 87.70%; height: 5.08%; }
.rel-row--1{ left: 6.05%; top: 28.97%; width: 87.70%; height: 5.08%; }
.rel-row--2{ left: 6.05%; top: 34.64%; width: 87.70%; height: 5.08%; }
.rel-row--3{ left: 6.05%; top: 40.23%; width: 87.70%; height: 5.08%; }
.rel-row--4{ left: 6.05%; top: 45.90%; width: 87.70%; height: 5.08%; }
.rel-row--5{ left: 6.05%; top: 51.56%; width: 87.70%; height: 5.08%; }
.rel-row--6{ left: 6.05%; top: 57.16%; width: 87.70%; height: 5.14%; }
.rel-row--7{ left: 6.05%; top: 62.89%; width: 87.70%; height: 5.14%; }
.rel-row--8{ left: 6.05%; top: 68.62%; width: 87.70%; height: 5.14%; }
.rel-row--9{ left: 6.05%; top: 74.35%; width: 87.70%; height: 5.34%; }
.rel-row[aria-checked="true"]{
  box-shadow: 0 0 0 2px var(--rel) inset, 0 0 16px rgba(255,111,146,.45);
  border-radius: 14px;
}

.rel-radio{
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  box-sizing: border-box;
}
.rel-radio--0{ left: 8.89%; top: 24.87%; width: 2.93%; height: 1.95%; }
.rel-radio--1{ left: 8.89%; top: 30.47%; width: 2.93%; height: 1.95%; }
.rel-radio--2{ left: 8.89%; top: 36.13%; width: 2.93%; height: 1.95%; }
.rel-radio--3{ left: 8.89%; top: 41.73%; width: 2.93%; height: 1.95%; }
.rel-radio--4{ left: 8.89%; top: 47.40%; width: 2.93%; height: 1.95%; }
.rel-radio--5{ left: 8.89%; top: 53.06%; width: 2.93%; height: 1.95%; }
.rel-radio--6{ left: 8.89%; top: 58.66%; width: 2.93%; height: 1.95%; }
.rel-radio--7{ left: 8.89%; top: 64.39%; width: 2.93%; height: 1.95%; }
.rel-radio--8{ left: 8.89%; top: 70.12%; width: 2.93%; height: 1.95%; }
.rel-radio--9{ left: 8.89%; top: 75.85%; width: 2.93%; height: 1.95%; }
.rel-radio.is-checked{
  box-shadow: 0 0 10px rgba(255,111,146,.7);
}
.rel-radio.is-checked::after{
  content: "";
  position: absolute;
  inset: 24%;
  border-radius: 50%;
  background: var(--rel);
}

.rel-hit--s4-next{
  left: 5.86%; top: 81.38%;
  width: 88.18%; height: 5.86%;
}

/* ============ Relationships: screen 5 — goal direction rows over reference image ============ */
.rel-hit--s5-back{
  left: 1.46%; top: .65%;
  width: 9.77%; height: 5.86%;
  border-radius: 14px;
}
.rel-row5{ border-radius: 14px; left: 5.96%; width: 88.09%; }
.rel-row5--0{ top: 23.24%; height: 4.82%; }
.rel-row5--1{ top: 28.58%; height: 4.82%; }
.rel-row5--2{ top: 33.85%; height: 4.88%; }
.rel-row5--3{ top: 39.19%; height: 4.88%; }
.rel-row5--4{ top: 44.53%; height: 4.88%; }
.rel-row5--5{ top: 49.93%; height: 4.88%; }
.rel-row5--6{ top: 55.34%; height: 4.95%; }
.rel-row5--7{ top: 60.74%; height: 4.95%; }
.rel-row5--8{ top: 66.15%; height: 4.95%; }
.rel-row5--9{ top: 71.55%; height: 4.95%; }
.rel-row5--10{ top: 77.02%; height: 4.95%; }
.rel-row5[aria-checked="true"]{
  box-shadow: 0 0 0 2px var(--rel) inset, 0 0 16px rgba(255,111,146,.45);
  border-radius: 14px;
}

.rel-radio5{
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  box-sizing: border-box;
  left: 8.98%; width: 2.93%; height: 1.89%;
}
.rel-radio5--0{ top: 24.74%; }
.rel-radio5--1{ top: 30.08%; }
.rel-radio5--2{ top: 35.35%; }
.rel-radio5--3{ top: 40.69%; }
.rel-radio5--4{ top: 46.03%; }
.rel-radio5--5{ top: 51.43%; }
.rel-radio5--6{ top: 56.84%; }
.rel-radio5--7{ top: 62.24%; }
.rel-radio5--8{ top: 67.64%; }
.rel-radio5--9{ top: 73.05%; }
.rel-radio5--10{ top: 78.52%; }
.rel-radio5.is-checked{
  box-shadow: 0 0 10px rgba(255,111,146,.7);
}
.rel-radio5.is-checked::after{
  content: "";
  position: absolute;
  inset: 24%;
  border-radius: 50%;
  background: var(--rel);
}

.rel-hit--s5-next{
  left: 5.66%; top: 83.53%;
  width: 88.67%; height: 6.12%;
}

.rel-other-wrap{
  padding: 16px 20px calc(var(--tabbar-h) + var(--safe-b) + 16px);
}
.rel-other-wrap .field__label{
  display: block;
  margin-bottom: 8px;
}
.rel-other-wrap textarea{
  width: 100%;
  min-height: 90px;
  box-sizing: border-box;
  background: rgb(19,17,23);
  border: 1px solid rgba(165,155,185,.3);
  border-radius: 12px;
  color: #f2eef7;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  padding: 12px 14px;
  resize: vertical;
}
.rel-other-wrap textarea::placeholder{ color: rgba(190,185,205,.5); }
.rel-other-wrap textarea:focus{ outline: 2px solid var(--rel); outline-offset: 1px; }

/* ============ Relationships: case file cover ============ */
.screen--case{
  background: var(--bg);
}
.scene--case{
  height: clamp(260px, 46vh, 380px);
}
.scene--case img{
  object-position: center top;
}
.case-back{
  position: absolute;
  top: var(--safe-t);
  left: 14px;
  z-index: 3;
}
.case-body{
  padding-top: 10px;
  text-align: center;
}
.case-title{
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 32px;
  line-height: 1.05;
  text-transform: uppercase;
  color: var(--ink);
}
.case-title__gold{
  display: inline-block;
  margin-top: 4px;
  font-size: 21px;
  letter-spacing: .16em;
  color: var(--gold);
}
.case-category{
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 2px;
}
.case-category__line{
  flex: 1 1 auto;
  height: 1px;
}
.case-category__line--l{ background: linear-gradient(90deg, transparent, rgba(255,111,146,.55)); }
.case-category__line--r{ background: linear-gradient(90deg, rgba(255,111,146,.55), transparent); }
.case-category__text{
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 32px;
  letter-spacing: .03em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #ffb0c4, var(--rel) 55%, #a5123a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.case-subtitle{
  margin: 2px 0 18px;
  font-size: 12.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.case-lists{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  text-align: left;
  margin-bottom: 20px;
}
.case-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--ink-dim);
}
.case-list--alt{ color: var(--rel); text-align: right; }

.case-tagline{
  margin: 4px 0 22px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-dim);
}

.case-cta{
  display: inline-flex;
  gap: 10px;
  width: 100%;
}
.case-hint{
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--ink-faint);
}

.case-divider{
  height: 1px;
  margin: 26px 0 20px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

.case-badges{
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.case-badge{
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--gold);
}
.case-badge svg{ width: 22px; height: 22px; }
.case-badge span{
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-align: center;
  line-height: 1.3;
}

/* ============ Money slider ============ */
.money-value{
  margin-top: 22px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 44px;
  color: var(--ink);
}
.money-caption{
  margin: 0 0 30px;
  font-size: 13px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: .1em;
}
.slider-wrap{ margin-top: auto; padding-bottom: 8px; }
.slider{
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--money) 0%, var(--money) var(--fill,50%), var(--panel-2) var(--fill,50%), var(--panel-2) 100%);
  outline: none;
}
.slider::-webkit-slider-thumb{
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink);
  border: 4px solid var(--money);
  box-shadow: 0 6px 14px rgba(0,0,0,.35);
}
.slider::-moz-range-thumb{
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink);
  border: 4px solid var(--money);
  box-shadow: 0 6px 14px rgba(0,0,0,.35);
}
.slider-labels{
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--ink-faint);
}

/* ============ Options ============ */
.options{
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}
.option{
  text-align: left;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
}
.option[aria-checked="true"], .option[aria-pressed="true"]{
  border-color: var(--accent-2);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-2) 22%, var(--panel)), var(--panel));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-2) 55%, transparent) inset;
}

/* ============ Family archive ============ */
.family-copy{
  max-width: 320px;
  margin: 6px 0 26px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-dim);
}
.family-loading{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  font-size: 13.5px;
  color: var(--ink-dim);
}
.spinner{
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(219,162,90,.25);
  border-top-color: var(--family);
  animation: spin .8s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }

/* ============ Result cards (Результаты) ============ */
.result-card{
  --accent: var(--gold);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 18px;
  margin-bottom: 14px;
}
.result-card--money{ --accent: var(--money); }
.result-card--rel{ --accent: var(--rel); }
.result-card--health{ --accent: var(--health); }
.result-card--family{ --accent: var(--family); }

.result-card__head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.result-card__title{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: .02em;
  color: var(--accent);
}
.result-card__badge{
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}
.result-card__text{
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-dim);
  margin: 0 0 14px;
}
.result-card__locked{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.result-card__locked p{
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-faint);
}
.chip-btn{
  flex: 0 0 auto;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

.results-summary{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--panel-2);
  margin-bottom: 18px;
  font-size: 14px;
  color: var(--ink-dim);
}
.results-summary strong{ color: var(--gold); font-size: 20px; }

/* ============ History ============ */
.history-item{
  display: flex;
  gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
}
.history-item:last-child{ border-bottom: none; }
.history-dot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 6px;
  flex: 0 0 auto;
  background: var(--accent, var(--gold));
}
.history-item--money .history-dot{ background: var(--money); }
.history-item--rel .history-dot{ background: var(--rel); }
.history-item--health .history-dot{ background: var(--health); }
.history-item--family .history-dot{ background: var(--family); }
.history-item__title{
  font-weight: 700;
  font-size: 14.5px;
  margin: 0 0 2px;
}
.history-item__text{
  margin: 0 0 4px;
  font-size: 13.5px;
  color: var(--ink-dim);
  line-height: 1.45;
}
.history-item__time{
  font-size: 11.5px;
  color: var(--ink-faint);
}
.empty-state{
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-faint);
  font-size: 14px;
}
.link-btn{
  display: block;
  margin: 18px auto 0;
  background: none;
  border: none;
  color: var(--ink-faint);
  font-size: 13px;
  text-decoration: underline;
}

/* ============ Profile ============ */
.profile-card{
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}
.avatar{
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  color: var(--gold-ink);
  background: linear-gradient(135deg, #f2d29b, var(--gold));
  flex: 0 0 auto;
}
.field{ flex: 1; display: flex; flex-direction: column; gap: 6px; }
.field__label{
  font-size: 12px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.field__input{
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--ink);
  font-size: 15px;
}
.field__input:focus{ outline: 2px solid var(--gold); outline-offset: 1px; }
.field__input.has-error{ border-color: var(--rel); }
.field__label em{ font-style: normal; color: var(--ink-faint); font-weight: 400; text-transform: none; letter-spacing: 0; }
.field__error{
  min-height: 14px;
  font-size: 12px;
  color: var(--rel);
}

/* ============ Registration ============ */
.register-title{
  margin: 4px 0 4px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
}
.register-sub{
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-dim);
}
.register-form{
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.register-note{
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.4;
  background: rgba(230,186,110,.12);
  color: var(--gold);
  border: 1px solid rgba(230,186,110,.35);
}
.register-note.is-error{
  background: rgba(255,111,146,.12);
  color: #ffb3c4;
  border-color: rgba(255,111,146,.4);
}
.register-privacy{
  margin: 2px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-faint);
  text-align: center;
}

.progress-card{
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--line);
  margin-bottom: 22px;
}
.progress-card__head{
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--ink-dim);
  margin-bottom: 10px;
}
.progress-bar{
  height: 8px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}
.progress-bar__fill{
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-2), var(--gold));
  transition: width .4s ease;
}

/* ============ Tabbar ============ */
.tabbar{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: space-around;
  padding: 8px 6px calc(8px + var(--safe-b));
  background: rgba(15,13,20,.86);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  transform: translateY(100%);
  transition: transform .3s ease;
  pointer-events: none;
}
body.app-started .tabbar{
  transform: translateY(0);
  pointer-events: auto;
}
.tabbar__item{
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  border: none;
  background: none;
  color: var(--ink-faint);
  max-width: 96px;
}
.tabbar__item svg{ width: 22px; height: 22px; }
.tabbar__item span{ font-size: 10.5px; letter-spacing: .01em; }
.tabbar__item.is-active{ color: var(--gold); }

/* ============ Responsive ============ */
@media (min-width: 480px){
  .app{ max-width: 480px; left: 50%; transform: translateX(-50%); box-shadow: var(--shadow-lg); }
  .tabbar{ max-width: 480px; left: 50%; transform: translateX(-50%); }
  body.app-started .tabbar{ transform: translateX(-50%) translateY(0); }
  body{ background: #050409; }
}

@media (max-width: 360px){
  .start-title{ font-size: 36px; }
  .doors{ gap: 10px; }
  .door{ min-height: 152px; padding: 16px 13px; }
}
