/* kp.tudasuda.su — mobile-first, single-page со спойлерами */
:root {
  --bg: #0a0a0a;
  --bg-elev: #161616;
  --bg-elev-2: #1f1f1f;
  --line: #2a2a2a;
  --text: #f4f4f5;
  --text-dim: #9ca3af;
  --text-muted: #6b7280;
  --accent: #facc15;          /* geely-style yellow */
  --accent-ink: #0a0a0a;
  --danger: #ef4444;
  --ok: #22c55e;
  --radius: 14px;
  --radius-sm: 10px;
  --tap: 52px;
  --shadow: 0 8px 24px rgba(0,0,0,.4);
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bot: env(safe-area-inset-bottom, 0);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; font-family: -apple-system, BlinkMacSystemFont,
  "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.4;
  overscroll-behavior-y: contain;
  -webkit-tap-highlight-color: transparent;
}
body { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(96px + var(--safe-bot)); }

/* appbar */
.appbar { position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  height: calc(52px + var(--safe-top)); padding: var(--safe-top) 12px 0;
  background: linear-gradient(180deg, rgba(10,10,10,.96), rgba(10,10,10,.86));
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
}
.appbar .title { flex: 1; font-size: 17px; font-weight: 600; letter-spacing: -.01em;
  text-align: center; padding: 0 4px; }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; border: none; background: transparent;
  color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.iconbtn:active { background: var(--bg-elev); }

/* screen */
.screen { padding: 12px 14px 8px; max-width: 720px; margin: 0 auto; }
.lead { color: var(--text-dim); font-size: 13px; margin: 4px 0 12px; }

/* === Spoiler sections (single-page) === */
details.section { background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
details.section[open] { background: var(--bg-elev); }
details.section > summary { list-style: none; cursor: pointer;
  min-height: var(--tap); padding: 14px 14px;
  display: flex; align-items: center; gap: 10px;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary:active { background: var(--bg-elev-2); }
details.section > summary .icon { width: 22px; height: 22px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-dim); transition: transform .15s ease; }
details.section[open] > summary .icon { transform: rotate(90deg); }
details.section > summary .label { flex: 1; min-width: 0; }
details.section > summary .label .t { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
details.section > summary .label .v { font-size: 12px; color: var(--text-dim); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
details.section > summary .badge { background: var(--bg-elev-2); color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px;
  font-size: 11px; font-weight: 600; flex: 0 0 auto; }
details.section.invalid > summary .badge { background: rgba(239,68,68,.15); color: var(--danger); border-color: rgba(239,68,68,.4); }
details.section.complete > summary .badge { background: rgba(34,197,94,.15); color: var(--ok); border-color: rgba(34,197,94,.4); }
details.section > .body { padding: 4px 14px 14px; border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent); }
details.section > .body > .desc { color: var(--text-dim); font-size: 13px; margin: 8px 0 12px; }

/* === chips === */
.chips { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 540px) { .chips { grid-template-columns: 1fr 1fr; } }
.chip { min-height: var(--tap); padding: 12px 14px; border-radius: var(--radius);
  background: var(--bg-elev-2); border: 1px solid var(--line); color: var(--text);
  font-size: 15px; font-weight: 500; text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  transition: transform .08s ease, background .12s ease, border-color .12s ease;
}
.chip:active { transform: scale(.985); }
.chip .meta { color: var(--text-dim); font-size: 12px; font-weight: 400; }
.chip.selected { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip.selected .meta { color: rgba(10,10,10,.7); }
.chip .check { margin-left: auto; opacity: 0; font-weight: 800; }
.chip.selected .check { opacity: 1; color: var(--accent-ink); }

/* === color tiles === */
.colors { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 540px) { .colors { grid-template-columns: 1fr 1fr 1fr; } }
.color { min-height: 56px; padding: 10px 12px; border-radius: var(--radius);
  background: var(--bg-elev-2); border: 1px solid var(--line); color: var(--text);
  font-size: 14px; font-weight: 500; text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: 8px; }
.color .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--bg);
  border: 1px solid var(--line); flex: 0 0 auto; }
.color.selected { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* === inputs === */
.field { display: block; margin-bottom: 10px; }
.field label { display: block; color: var(--text-dim); font-size: 12px; margin-bottom: 4px; }
.input, .textarea { width: 100%; min-height: var(--tap); padding: 12px 14px; font-size: 16px;
  background: var(--bg-elev-2); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); outline: none; transition: border-color .12s ease; }
.input.big { font-size: 26px; font-weight: 700; letter-spacing: -.01em; min-height: 60px; text-align: center; }
.input:focus, .textarea:focus { border-color: var(--accent); }
.textarea { min-height: 80px; resize: vertical; line-height: 1.35; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 380px) { .row2 { grid-template-columns: 1fr; } }

/* === toggles (equipment) === */
.toggles { display: grid; grid-template-columns: 1fr; gap: 6px; }
.toggle { min-height: 48px; padding: 10px 12px; border-radius: var(--radius);
  background: var(--bg-elev-2); border: 1px solid var(--line); color: var(--text);
  display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none;
  text-align: left; font: inherit; }
.toggle .name { flex: 1; font-size: 14px; font-weight: 500; }
.toggle .price { color: var(--text-dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.toggle .box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.toggle.selected { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.toggle.selected .box { border-color: var(--accent-ink); background: var(--accent-ink); color: var(--accent); }
.toggle.selected .price { color: rgba(10,10,10,.7); }

/* === group (ceramic / tires) === */
.group { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 10px 8px; margin-bottom: 8px; }
.group .gtitle { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.group .gtitle .n { font-weight: 600; font-size: 14px; }
.group .gtitle .s { color: var(--text-dim); font-size: 12px; }
.opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
@media (min-width: 540px) { .opts { grid-template-columns: repeat(6, 1fr); } }
.opt { min-height: 40px; padding: 6px 4px; border-radius: 8px; background: var(--bg-elev-2);
  border: 1px solid var(--line); color: var(--text); font-size: 13px; font-weight: 600;
  text-align: center; cursor: pointer; font-variant-numeric: tabular-nums; }
.opt.selected { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* year chips */
.yearrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.yearrow .chip { text-align: center; justify-content: center; min-height: var(--tap); }

/* === Action bar (sticky bottom, single CTA) === */
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  padding: 10px 14px calc(10px + var(--safe-bot));
  background: linear-gradient(0deg, rgba(10,10,10,.96), rgba(10,10,10,.86));
  border-top: 1px solid var(--line); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  max-width: 720px; margin: 0 auto;
}
.navbtn { width: 100%; min-height: var(--tap); border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--bg-elev); color: var(--text); font-size: 17px; font-weight: 600; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.navbtn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.navbtn:disabled { opacity: .4; cursor: not-allowed; }
.navbtn:active:not(:disabled) { transform: scale(.99); }

/* === Toast === */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(120px + var(--safe-bot));
  background: var(--bg-elev-2); color: var(--text); padding: 10px 16px; border-radius: 999px;
  font-size: 14px; box-shadow: var(--shadow); z-index: 20; max-width: 90vw; text-align: center;
  border: 1px solid var(--line);
}
.toast.danger { background: var(--danger); color: #fff; border-color: transparent; }
.toast[hidden] { display: none; }

/* === Spinner overlay === */
.spinner-overlay { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.spinner-overlay[hidden] { display: none; }   /* HTML-атрибут hidden важнее, чем display:flex */
.spinner { width: 48px; height: 48px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.15); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.muted { color: var(--text-dim); font-size: 12px; }

/* empty state for sections без опций (ещё не загрузился каталог) */
.empty { color: var(--text-muted); font-size: 13px; text-align: center; padding: 12px; }
