/* ============================================================
   ШТОРКА-КВИЗ — как окно выбора региона на musafir-78.ru:
   мрамор слоновой кости, матовые графитовые варианты ответа,
   круглая кнопка закрытия. Эталон: reference/screens/sheet-*.jpg
   ============================================================ */

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s4);
  background: rgba(10, 11, 13, .62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity var(--base) var(--ease);
}
.sheet-overlay[hidden] { display: none; }
.sheet-overlay.is-open { opacity: 1; }

.sheet {
  position: relative;
  width: min(620px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--s7) 40px 40px;
  border-radius: var(--radius-big);
  background:
    linear-gradient(180deg, rgba(248, 245, 239, .9), rgba(240, 235, 226, .93)),
    url("../img/ivory.jpg") center / cover,
    var(--ivory);
  border: 1px solid rgba(255, 255, 255, .75);
  box-shadow: inset 0 1px 0 #ffffff, 0 40px 90px rgba(0, 0, 0, .5);
  transform: translateY(12px) scale(.98);
  transition: transform var(--slow) var(--ease);
}
.sheet-overlay.is-open .sheet { transform: none; }

.sheet-body { display: flex; flex-direction: column; gap: var(--s5); }

.sheet-grab { display: none; }

.sheet-x {
  position: absolute;
  top: var(--s4);
  right: var(--s4);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--ink-on-light);
  background: rgba(255, 255, 255, .6);
  border: 1px solid rgba(22, 24, 27, .14);
  transition: background-color var(--base) var(--ease), transform var(--base) var(--ease);
}
.sheet-x:hover { background: #ffffff; transform: rotate(90deg); }

/* «ШАГ 2 · 5» с тонкими линиями слева и справа */
.sheet-step { justify-content: center; align-self: center; gap: var(--s4); }
.sheet-step::before,
.sheet-step::after { content: ''; display: block; width: 72px; height: 1px; background: rgba(22, 24, 27, .18); }

.sheet-title {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.15;
  letter-spacing: -.015em;
  outline: none;
}
.sheet-hint { margin: -8px 0 0; text-align: center; color: var(--muted); font-size: 15px; }

.sheet-progress { height: 3px; border-radius: 2px; background: rgba(22, 24, 27, .12); }
.sheet-progress > div { height: 100%; border-radius: 2px; background: #16181b; transition: width var(--slow) var(--ease); }

/* Варианты ответа — матовые графитовые кнопки */
.sheet-options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  width: 100%;
  min-height: 60px;
  padding: 0 22px;
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius-small);
  border: 1px solid rgba(0, 0, 0, .5);
  color: #eef0f2;
  background: linear-gradient(180deg, #272a2f, #14161a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 10px 24px rgba(18, 21, 26, .22);
  font-family: var(--font-text);
  font-size: 17px;
  line-height: 1.3;
  transition: transform var(--base) var(--ease), box-shadow var(--base) var(--ease), background-color var(--base) var(--ease);
}
.opt svg { transition: transform var(--base) var(--ease); }
.opt:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 16px 32px rgba(18, 21, 26, .3); background: linear-gradient(180deg, #33373d, #1a1c20); }
.opt:hover svg { transform: translateX(4px); }
.opt.on { box-shadow: inset 0 0 0 1px var(--silver), 0 10px 24px rgba(18, 21, 26, .22); }

/* Поля */
.sheet-form { display: flex; flex-direction: column; gap: var(--s4); }
.sheet-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.sheet-field > label, .sheet-field > span { color: var(--ink); font-weight: 500; }
.sheet-input {
  width: 100%;
  min-height: 54px;
  padding: 0 18px;
  border-radius: var(--radius-small);
  border: 1px solid rgba(22, 24, 27, .16);
  background: rgba(255, 255, 255, .62);
  color: var(--ink-on-light);
  font-family: var(--font-text);
  font-size: 16px;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.sheet-input::placeholder { color: var(--muted-on-light); }
.sheet-input:focus { outline: none; border-color: #16181b; box-shadow: 0 0 0 3px rgba(22, 24, 27, .1); }
.sheet-input[aria-invalid="true"] { border-color: #8a1f1f; }
.sheet-error { margin: 0; color: #8a1f1f; font-size: 14px; }

.sheet-seg { display: flex; gap: 4px; padding: 4px; border-radius: var(--radius-small); background: rgba(22, 24, 27, .08); }
.sheet-seg-b {
  flex: 1 1 0; min-height: 44px; padding: 0 10px; border: 0; border-radius: 9px; cursor: pointer;
  background: transparent; color: var(--muted); font-family: var(--font-text); font-size: 15px;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.sheet-seg-b:hover { color: var(--ink); background: rgba(255, 255, 255, .5); }
.sheet-seg-b.on { background: #f8f9fb; color: var(--ink); box-shadow: 0 1px 2px rgba(18, 21, 26, .14); }

.sheet-consent { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.5; color: var(--muted); cursor: pointer; }
.sheet-consent input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: #16181b; }
.sheet-consent a { color: var(--ink); }

.sheet-legal { margin: -4px 0 0; text-align: center; font-size: 12px; line-height: 1.5; color: var(--muted); }
.sheet-legal a { color: var(--ink); }

.sheet-format { margin: 0; font-size: 13px; color: var(--muted); }

.sheet-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.sheet-back {
  align-self: center; min-height: 44px; padding: 0 var(--s4); border: 0; background: transparent; cursor: pointer;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  transition: color var(--fast) var(--ease);
}
.sheet-back:hover { color: var(--ink); }

.sheet-done { display: flex; flex-direction: column; gap: var(--s4); align-items: stretch; }
.sheet-done-mark {
  align-self: center; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  color: #eef0f2; background: linear-gradient(180deg, #272a2f, #131417); box-shadow: 0 14px 30px rgba(18, 21, 26, .28);
}
.sheet-demo { margin: 0; padding: var(--s3) var(--s4); border: 1px dashed rgba(22, 24, 27, .25); border-radius: var(--radius-small); font-size: 13px; color: var(--muted); text-align: center; }

.sheet .btn:focus-visible, .opt:focus-visible, .sheet-x:focus-visible, .sheet-seg-b:focus-visible, .sheet-back:focus-visible {
  outline: 2px solid #16181b; outline-offset: 3px;
}

/* Страница под шторкой не прокручивается */
body.sheet-open { position: fixed; left: 0; right: 0; overflow: hidden; }

/* Телефон: шторка выезжает снизу */
@media (max-width: 760px) {
  .sheet-overlay { align-items: flex-end; padding: 0; }
  .sheet {
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: var(--radius-big) var(--radius-big) 0 0;
    padding: var(--s6) 20px calc(var(--s5) + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
  }
  .sheet-grab {
    display: block; position: absolute; top: 0; left: 50%; width: 120px; height: 28px; margin-left: -60px; touch-action: none; cursor: grab;
  }
  .sheet-grab::before { content: ''; position: absolute; top: 10px; left: 38px; width: 44px; height: 4px; border-radius: 2px; background: rgba(22, 24, 27, .22); }
  .sheet-step::before, .sheet-step::after { width: 40px; }
  .opt { min-height: 56px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet-overlay, .sheet, .opt, .opt svg, .sheet-x, .sheet-progress > div { transition: none !important; }
  .opt:hover, .sheet-x:hover { transform: none; }
}
