/* Fangsi Kids — светлый «яблочный» стиль: много воздуха, мягкие тени, системный шрифт */
:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --hair: rgba(0, 0, 0, 0.08);
  --accent: #0071e3;
  --accent-ink: #ffffff;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --warm: #f5a623;
  --error: #e3342f;
  --radius: 18px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, b { letter-spacing: -0.02em; }
h2 { font-size: 21px; font-weight: 600; margin: 36px 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; margin: -2px 0 12px; }
.center { text-align: center; }
.eyebrow { margin: 4px 0 4px; font-size: 14px; color: var(--muted); font-weight: 500; }
.hero { font-size: 32px; line-height: 1.12; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.03em; }

/* шапка — матовое стекло */
.top {
  position: sticky; top: 0; z-index: 10;
  padding: 10px 20px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(245, 245, 247, 0.72);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--hair);
}
.brand { display: flex; align-items: center; gap: 10px; max-width: 1280px; margin: 0 auto; }
.brand b { font-weight: 600; font-size: 17px; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.logo {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 17px;
}

.layout { display: grid; gap: 0; grid-template-columns: minmax(0, 1fr); padding-top: 12px; }
#scene canvas { display: block; width: 100%; height: 100%; }
.viewer { position: relative; }
#scene {
  height: 56vh; min-height: 320px; margin: 0 16px; border-radius: 22px;
  background: #f3efe9; overflow: hidden; touch-action: none; box-shadow: var(--shadow);
}
.hint { text-align: center; color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.panel { padding: 8px 20px 48px; }

/* выбор модели */
.beds { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.bed-btn {
  text-align: left; border: 0; background: var(--card); border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line);
  padding: 14px 16px; font: inherit; color: inherit; cursor: pointer; transition: box-shadow .2s, transform .2s;
}
.bed-btn b { display: block; font-size: 16px; font-weight: 600; line-height: 1.25; }
.bed-btn small { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.bed-btn:active { transform: scale(0.98); }
.bed-btn.on { box-shadow: inset 0 0 0 2px var(--accent); }

/* цвета — кружки */
.colors { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  display: flex; align-items: center; gap: 8px; border: 0; background: var(--card); box-shadow: inset 0 0 0 1px var(--line);
  border-radius: 999px; padding: 5px 14px 5px 5px; font: inherit; font-size: 14px; color: inherit; cursor: pointer;
}
.swatch i { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.swatch.on { box-shadow: inset 0 0 0 2px var(--accent); }

/* сегменты как в iOS */
.seg { display: inline-flex; flex-wrap: wrap; background: #e8e8ed; border-radius: 10px; padding: 2px; margin-bottom: 12px; }
.seg button { border: 0; background: none; font: inherit; font-size: 14px; font-weight: 500; padding: 7px 16px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.seg button.on { background: var(--card); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 1px 1px rgba(0,0,0,.04); }

/* переключатели вместо галочек */
.check-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-direction: row-reverse; margin: 0; padding: 13px 16px; background: var(--card); cursor: pointer; font-size: 16px; }
.check-row + .check-row { border-top: 0.5px solid var(--hair); }
#tsargaRow { border-radius: 14px; margin-top: 4px; box-shadow: var(--shadow); }
.check-row span { flex: 1; }
.check-row b.muted { font-weight: 400; font-size: 14px; display: block; letter-spacing: -0.01em; }
.check-row input {
  appearance: none; -webkit-appearance: none; flex: none; width: 51px; height: 31px; border-radius: 999px; margin: 0;
  background: #e9e9eb; position: relative; cursor: pointer; transition: background .25s;
}
.check-row input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform .25s;
}
.check-row input:checked { background: #34c759; }
.check-row input:checked::after { transform: translateX(20px); }
.group { border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.group:empty { display: none; }

/* доп. позиция */
.addon { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.addon img { width: 96px; height: 72px; border-radius: 12px; background: #f3efe9; object-fit: cover; flex: none; }
.addon-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.addon-body b { font-weight: 600; }
.addon-body .muted { font-size: 13px; line-height: 1.3; }
.addon-price { font-size: 15px; font-weight: 600; margin-top: 2px; }
.pill-btn { border: 0; border-radius: 999px; padding: 8px 16px; font: inherit; font-size: 14px; font-weight: 600; background: var(--accent-soft); color: var(--accent); cursor: pointer; flex: none; }
.pill-btn[aria-pressed="true"] { background: var(--accent); color: #fff; }
.addon-opts { margin-top: 10px; }
.addon-opts .seg { margin-bottom: 10px; }
.promo { border-radius: 14px; box-shadow: var(--shadow); font-size: 14px; line-height: 1.35; }

/* поля */
.field { display: block; margin-bottom: 12px; position: relative; }
.field span { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px 4px; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 0; box-shadow: inset 0 0 0 1px var(--line); border-radius: 12px; padding: 14px 16px; outline: none; appearance: none;
  transition: box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.field .invalid, .field input.invalid { box-shadow: inset 0 0 0 2px var(--error); }
.ac-list {
  position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin: 6px 0 0; padding: 6px;
  list-style: none; background: rgba(255,255,255,.9); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.14), 0 0 0 0.5px var(--hair); max-height: 260px; overflow: auto;
}
.ac-list li { padding: 10px 12px; border-radius: 9px; cursor: pointer; }
.ac-list li:hover, .ac-list li.hl { background: var(--accent-soft); }

/* итог, как корзина в Apple Store */
.price { background: var(--card); border-radius: var(--radius); padding: 18px 20px; margin-top: 12px; box-shadow: var(--shadow); }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
.row b { text-align: right; font-weight: 500; }
.row.total { border-top: 0.5px solid var(--line); margin-top: 8px; padding-top: 14px; font-size: 21px; }
.row.total b { font-weight: 700; }
.note { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.note:empty { display: none; }
.loading b { opacity: .45; }

.cta {
  width: 100%; border: 0; border-radius: 999px; padding: 16px; font: inherit; font-weight: 600; font-size: 17px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; margin-top: 8px; transition: background .2s, transform .1s;
}
.cta:hover { background: #0077ed; }
.cta:active { transform: scale(0.99); }
.cta:disabled { opacity: .5; }
.cta.ghost { background: var(--accent-soft); color: var(--accent); }
.error { color: var(--error); font-size: 14px; }

.pay { background: #fff8eb; border-radius: 14px; padding: 14px 16px; margin-top: 12px; font-size: 14px; color: #5c4210; }
.pay:empty { display: none; }

.done { text-align: center; padding: 48px 8px; }
.done .pay { text-align: left; }
.check { width: 72px; height: 72px; margin: 0 auto; border-radius: 50%; background: #34c759; color: #fff; font-size: 38px; display: grid; place-items: center; }

.scene-btn {
  position: absolute; right: 30px; top: 14px; border: 0; border-radius: 999px; padding: 9px 16px;
  background: rgba(255,255,255,.75); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.1); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}

@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr) 460px; align-items: start; max-width: 1320px; margin: 0 auto; padding-top: 20px; }
  .viewer { position: sticky; top: 76px; }
  #scene { height: calc(100vh - 130px); margin: 0 12px 0 20px; }
  .panel { padding-top: 0; }
  .hero { font-size: 40px; }
}
