/* Slipstream — form controls + creator/profile layout (F1 language). */

/* ---- Range sliders ---- */
.range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 3px;
  background: var(--bg-elev-2); outline: none; margin: 9px 0 2px; cursor: pointer;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 3px;
  background: #fff; border: 2px solid var(--accent); cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}
.range::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 3px;
  background: #fff; border: 2px solid var(--accent); cursor: pointer;
}
.range::-moz-range-track { height: 6px; border-radius: 3px; background: transparent; }

.slider-row { margin-bottom: 13px; }
.slider-head { display: flex; justify-content: space-between; align-items: baseline; }
.slider-label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.slider-val { font-size: 14px; font-weight: 800; color: var(--text); }

/* ---- Budget counter ---- */
.budget {
  display: flex; align-items: baseline; gap: 5px; justify-content: flex-end;
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 8px;
}
.budget-num { color: var(--accent-soft); font-size: 16px; font-weight: 900; }
.budget.is-empty .budget-num { color: var(--danger); }
.budget-total { color: var(--text-mute); }

/* ---- Skill subgroup heading ---- */
.skill-group-head {
  font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-mute); margin: 14px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--line-soft);
}
.skill-group-head:first-child { margin-top: 0; }

/* ---- Segmented control ---- */
.segmented { display: flex; background: var(--bg-elev-2); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.segmented button {
  flex: 1; padding: 10px 6px; background: transparent; border: 0; cursor: pointer;
  color: var(--text-dim); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  transition: background 0.12s, color 0.12s;
}
.segmented button.is-active { background: var(--accent); color: #fff; }

/* ---- Select ---- */
.select {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--line); color: var(--text); font-size: 15px; font-family: inherit;
}
.select:focus { outline: none; border-color: var(--accent); }

/* ---- Chips (multi-select) ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 13px; border-radius: 3px; border: 1px solid var(--line); background: var(--bg-elev-2);
  color: var(--text-dim); font-size: 11px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
  cursor: pointer; transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.chip.is-selected { background: var(--accent-tint); border-color: var(--accent); color: #fff; }
.chip.is-disabled { opacity: 0.38; pointer-events: none; }

/* ---- Stat bars (profile) ---- */
.statbar { margin-bottom: 11px; }
.statbar-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.statbar-label { font-size: 12.5px; font-weight: 600; color: var(--text-dim); }
.statbar-val { font-size: 13px; font-weight: 800; color: var(--text); }
.statbar-track { height: 6px; border-radius: 3px; background: var(--bg-elev-2); overflow: hidden; }
.statbar-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width 0.3s ease; }

/* ---- Creator / sections ---- */
.creator { padding-bottom: 92px; }
.form-section { margin-bottom: 24px; }
.form-section-titlebar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.form-section-title {
  position: relative; padding-left: 13px; margin: 0 0 12px;
  font-size: 13px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text);
}
.form-section-titlebar .form-section-title { margin-bottom: 0; }
.form-section-title::before {
  content: ""; position: absolute; left: 0; top: 1px; bottom: 1px; width: 4px;
  background: var(--accent); clip-path: polygon(40% 0, 100% 0, 60% 100%, 0 100%);
}
.form-section-sub {
  font-size: 10.5px; color: var(--text-mute); letter-spacing: 0.05em; text-transform: uppercase;
  font-weight: 600; margin: 4px 0 0; padding-left: 13px;
}
.mini-btn {
  flex: 0 0 auto; padding: 6px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--text-dim);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer;
}
.mini-btn:active { transform: scale(0.95); border-color: var(--accent); }

/* ---- Back link ---- */
.back-link {
  display: inline-flex; align-items: center; gap: 4px; margin-bottom: 12px; padding: 0;
  background: none; border: 0; cursor: pointer;
  color: var(--text-dim); font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
}
.back-link:active { color: var(--accent-soft); }

/* ---- Sticky save bar ---- */
.creator-save {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-bot)); z-index: 90;
  display: flex; align-items: center; gap: 14px; padding: 11px 16px;
  max-width: 760px; margin: 0 auto;
  background: rgba(13, 14, 18, 0.96); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.ovr-preview { display: flex; flex-direction: column; align-items: center; line-height: 1; min-width: 44px; }
.ovr-preview b { font-size: 23px; font-weight: 900; color: var(--text); font-variant-numeric: tabular-nums; }
.ovr-preview span { font-size: 9px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 2px; }
.creator-save .btn { flex: 1; padding: 14px; }

/* ---- Wizard (stepped creator) ---- */
.wiz-progress { margin-bottom: 18px; }
.wiz-bar { display: flex; gap: 5px; margin-bottom: 9px; }
.wiz-seg {
  flex: 1; height: 4px; border-radius: 2px; background: var(--bg-elev-2); cursor: pointer;
  transition: background 0.3s ease;
}
.wiz-seg.is-done { background: var(--accent); }
.wiz-caption { font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-dim); }
.wiz-caption b { color: #fff; }

.wizard-viewport { position: relative; overflow: hidden; transition: height 0.34s cubic-bezier(0.4, 0, 0.2, 1); }
.wiz-panel { width: 100%; }
.wiz-anim { transition: transform 0.34s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.26s ease; will-change: transform, opacity; }
@media (prefers-reduced-motion: reduce) {
  .wizard-viewport, .wiz-anim { transition: none; }
}

.wizard-footer {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-bot)); z-index: 90;
  display: flex; gap: 12px; padding: 11px 16px; max-width: 760px; margin: 0 auto;
  background: rgba(13, 14, 18, 0.96); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.wizard-footer .btn { padding: 14px; }
.wizard-footer .btn-ghost { flex: 0 0 36%; }
.wizard-footer .btn-primary { flex: 1; }

/* Review step */
.review-hero {
  display: flex; gap: 14px; align-items: center; margin: 4px 0 14px; padding: 14px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
}
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.review-stat { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 10px; text-align: center; }
.review-stat b { font-size: 24px; font-weight: 900; }
.review-stat span { display: block; font-size: 10px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }

/* ---- Color picker rows (livery editor) ---- */
.color-row { display: flex; align-items: center; gap: 12px; margin-bottom: 11px; }
.color-label { flex: 1; font-size: 13px; font-weight: 600; color: var(--text); }
.color-hex { font-size: 12px; color: var(--text-dim); width: 74px; text-align: right; text-transform: uppercase; }
.color-input {
  width: 46px; height: 32px; padding: 0; flex: 0 0 auto; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-elev-2);
}
.color-input::-webkit-color-swatch-wrapper { padding: 3px; }
.color-input::-webkit-color-swatch { border: none; border-radius: 3px; }
.color-input::-moz-color-swatch { border: none; border-radius: 3px; }

.theme-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.theme-chip {
  display: flex; padding: 0; height: 26px; overflow: hidden; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: none;
  transition: transform 0.1s, border-color 0.15s;
}
.theme-chip:active { transform: scale(0.95); }
.theme-chip:hover { border-color: var(--text-mute); }
.theme-sw { width: 20px; height: 100%; display: block; }

/* Sticky editor save bar */
.editor-save {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-bot)); z-index: 90;
  display: flex; gap: 12px; padding: 11px 16px; max-width: 760px; margin: 0 auto;
  background: rgba(13, 14, 18, 0.96); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.editor-save .btn { padding: 14px; }
.editor-save .btn-ghost { flex: 0 0 36%; }
.editor-save .btn-primary { flex: 1; }

/* ---- Emblem editor ---- */
.emblem-editor { padding-bottom: 88px; }
.em-stage-wrap {
  position: sticky; top: calc(var(--header-h) + var(--safe-top)); z-index: 50;
  display: flex; justify-content: center; padding: 6px 0 14px; margin-bottom: 4px; background: var(--bg);
}
.em-stage {
  position: relative; width: 264px; height: 264px; max-width: 78vw; max-height: 78vw;
  touch-action: none; overflow: hidden; border: 1px solid var(--line);
  background: var(--bg-elev); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}
.em-stage.em-bg-none { background: repeating-conic-gradient(#1b1d23 0% 25%, #15171c 0% 50%) 0 / 26px 26px; }
.em-stage.em-bg-circle { border-radius: 50%; background: var(--em-bg); }
.em-stage.em-bg-rounded { border-radius: 18%; background: var(--em-bg); }
.em-stage.em-bg-shield { background: var(--em-bg); clip-path: polygon(8% 6%, 92% 6%, 92% 52%, 50% 96%, 8% 52%); }
.em-layer { position: absolute; }
.em-layer svg { width: 100%; height: 100%; display: block; }
.em-layer.is-selected { outline: 2px dashed var(--accent-soft); outline-offset: 1px; }

.layer-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.layer-chip {
  width: 52px; height: 52px; flex: 0 0 auto; padding: 7px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-elev-2);
  display: flex; align-items: center; justify-content: center;
}
.layer-chip.is-selected { border-color: var(--accent); }
.layer-chip img { width: 100%; height: 100%; object-fit: contain; }
.layer-chip.add { font-size: 22px; font-weight: 700; color: var(--text-mute); }

.em-controls .em-btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.color-pick-row { display: flex; align-items: center; gap: 12px; }
.swatch-row { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-swatch { width: 24px; height: 24px; padding: 0; border-radius: 4px; border: 1px solid var(--line); cursor: pointer; }
.mini-swatch:active { transform: scale(0.9); }
.mini-btn.danger { color: var(--danger); border-color: rgba(255, 77, 87, 0.4); }

/* Emblem preview chip (livery editor) */
.emblem-row { display: flex; align-items: center; gap: 14px; }
.emblem-preview {
  width: 64px; height: 64px; flex: 0 0 auto; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-elev-2);
  display: flex; align-items: center; justify-content: center;
}
.emblem-preview-img { width: 100%; height: 100%; object-fit: contain; }
.emblem-preview-empty { color: var(--text-mute); font-size: 22px; }
.emblem-row .btn { flex: 1; }

/* Icon picker overlay */
.picker-overlay {
  position: fixed; inset: 0; z-index: 800; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(4, 5, 8, 0.7); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.picker-panel {
  width: 100%; max-width: 600px; height: 82vh; display: flex; flex-direction: column;
  padding: 16px calc(16px) calc(16px + var(--safe-bot));
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.picker-title { font-size: 17px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; }
.picker-panel .field-input { margin-bottom: 12px; }
.picker-grid {
  flex: 1; overflow-y: auto; display: grid; gap: 8px; align-content: start;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
}
.picker-item {
  aspect-ratio: 1; padding: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-elev-2);
}
.picker-item:active { border-color: var(--accent); }
.picker-item img { width: 100%; height: 100%; object-fit: contain; }

/* ---- Portrait picker (creator) ---- */
.portrait-picker { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.portrait-preview { display: flex; justify-content: center; }
.portrait-xl { width: 120px; height: 120px; border-radius: var(--radius); border: 2px solid var(--accent); }
.portrait-strip {
  display: flex; gap: 8px; overflow-x: auto; width: 100%; padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}
.portrait-thumb {
  width: 54px; height: 54px; flex: 0 0 auto; border-radius: var(--radius-sm); object-fit: cover; cursor: pointer;
  border: 2px solid transparent; opacity: 0.7; background: var(--bg-elev-2);
  transition: opacity 0.12s, border-color 0.12s;
}
.portrait-thumb:hover { opacity: 1; }
.portrait-thumb.is-selected { border-color: var(--accent); opacity: 1; }

/* Nationality flag preview (creator) */
.nat-row { display: flex; align-items: center; gap: 12px; }
.nat-row .select { flex: 1; }
.nat-flag { display: flex; align-items: center; flex: 0 0 auto; }
.nat-flag .flag-icon { height: 28px; }

/* Faded full-flag backdrop behind hero cards (profile + review) */
.profile-hero, .review-hero { position: relative; overflow: hidden; }
.hero-flag-bg {
  position: absolute; top: 0; right: 0; height: 100%; width: 62%; object-fit: cover;
  opacity: 0.16; z-index: 0; pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 72%);
  mask-image: linear-gradient(90deg, transparent, #000 72%);
}
.profile-hero > *:not(.hero-flag-bg), .review-hero > *:not(.hero-flag-bg) { position: relative; z-index: 1; }

/* ---- Driver profile ---- */
.profile-hero { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.profile-id { flex: 1; min-width: 0; }
.portrait-lg { width: 76px; height: 76px; border-radius: var(--radius); flex: 0 0 auto; }
.profile-ovr {
  position: relative; width: 66px; height: 66px; flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg-elev-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.profile-ovr b { font-size: 27px; font-weight: 900; font-variant-numeric: tabular-nums; }
.profile-ovr span { font-size: 8px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.12em; }
.profile-ovr::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent); }
.profile-name { font-size: 25px; font-weight: 900; text-transform: uppercase; line-height: 1; }
.profile-meta { font-size: 11.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 6px; font-weight: 600; }
