/* Overlays: settings sheet, toasts, age gate. */

/* ── Scrim ───────────────────────────────────────────────────────────── */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(12, 14, 17, 0.6);
  z-index: 40;
  opacity: 1;
  transition: opacity 0.18s ease;
}
.scrim.closing {
  opacity: 0;
}

/* ── Settings sheet (bottom sheet mobile / centered modal desktop) ───── */

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  background: var(--surface);
  border-top: var(--hairline-w) solid var(--hairline);
  border-radius: 16px 16px 0 0;
  padding: 6px 18px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  box-shadow: var(--shadow-float);
  transform: translateY(0);
  transition: transform 0.22s ease;
  max-height: 80dvh;
  overflow-y: auto;
}
.sheet.closing {
  transform: translateY(100%);
}

@media (min-width: 900px) {
  .sheet {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    border: var(--hairline-w) solid var(--hairline);
    border-radius: 16px;
    padding: 6px 20px 18px;
    max-height: 80vh;
  }
  .sheet.closing {
    transform: translate(-50%, -46%);
    opacity: 0;
    transition: transform 0.18s ease, opacity 0.18s ease;
  }
}

.sheet-grab {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--hairline);
  margin: 6px auto 2px;
}
@media (min-width: 900px) {
  .sheet-grab {
    display: none;
  }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 4px;
}
.sheet-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
}
.sheet-close {
  width: 44px;
  height: 44px;
  margin-right: -12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
}
.sheet-close .icon {
  font-size: 18px;
}

.sheet-section-label {
  font-size: 11px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 12px 0 4px;
}

/* Radio rows */
.radio-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  text-align: left;
  padding: 6px 0;
}
.radio-row + .radio-row {
  border-top: var(--hairline-w) solid var(--hairline);
}
.radio-disc {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--text-3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.radio-row[aria-checked="true"] .radio-disc {
  border-color: var(--accent);
}
.radio-row[aria-checked="true"] .radio-disc::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}
.radio-body {
  min-width: 0;
}
.radio-label {
  font-size: 14px;
  color: var(--text-1);
}
.radio-desc {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 1px;
}

.sheet-about {
  border-top: var(--hairline-w) solid var(--hairline);
  margin-top: 14px;
  padding-top: 12px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}
.sheet-about .about-title {
  color: var(--text-1);
  font-size: 13px;
  font-weight: 500;
}

/* ── Toasts ──────────────────────────────────────────────────────────── */

#toasts {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 30;
  pointer-events: none;
  padding: 0 16px;
}

.toast {
  pointer-events: auto;
  background: var(--surface);
  border: var(--hairline-w) solid var(--hairline);
  color: var(--text-1);
  font-size: 13px;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-float);
  max-width: min(92%, 420px);
  animation: toast-in 0.18s ease;
}
.toast .icon {
  font-size: 16px;
  color: var(--text-2);
  flex-shrink: 0;
}
.toast.error .icon {
  color: var(--danger);
}
.toast .toast-action {
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
  min-height: 32px;
  display: flex;
  align-items: center;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Age gate ────────────────────────────────────────────────────────── */

#age-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(12, 14, 17, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.age-card {
  width: min(360px, 100%);
  background: var(--surface);
  border: var(--hairline-w) solid var(--hairline);
  border-radius: 16px;
  padding: 26px 22px 22px;
  text-align: center;
  box-shadow: var(--shadow-float);
}
.age-card .age-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-disc);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 500;
  margin: 0 auto 14px;
}
.age-card h1 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0 0 8px;
}
.age-card p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  margin: 0 0 20px;
}
.age-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.btn-primary {
  min-height: 44px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 600;
}
.btn-secondary {
  min-height: 44px;
  border-radius: 12px;
  border: var(--hairline-w) solid var(--hairline);
  color: var(--text-2);
  font-size: 14px;
}

/* Settings: select row + switch (same rhythm as .radio-row) */
.select-row {
  padding: 10px 16px 14px;
}
.select-row select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--text);
  background: var(--bubble-in);
  border: 0.5px solid var(--hairline);
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%),
    linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.select-row select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Quality slider (same rhythm as .select-row) */
.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 0;
}
.slider-row input[type="range"] {
  flex: 1;
  min-width: 0;
  height: 24px;
  accent-color: var(--accent);
  background: none;
}
.slider-row input[type="range"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}
.slider-value {
  min-width: 1.2em;
  text-align: right;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
}
.slider-desc {
  padding: 0 16px 14px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  background: none;
  border: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.toggle-body {
  flex: 1;
}
.toggle-track {
  flex: none;
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: var(--meter-off, #4b5563);
  transition: background 0.18s ease;
}
.toggle-row.on .toggle-track {
  background: var(--accent);
}
.toggle-knob {
  display: block;
  width: 22px;
  height: 22px;
  margin: 2px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}
.toggle-row.on .toggle-knob {
  transform: translateX(18px);
}
@media (prefers-reduced-motion: reduce) {
  .toggle-track,
  .toggle-knob {
    transition: none;
  }
}

/* Personality presets (chips) + trait sliders */
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px 4px;
}
.preset-chip {
  padding: 7px 12px;
  border-radius: 16px;
  border: 0.5px solid var(--hairline);
  background: var(--bubble-in);
  color: var(--text-1);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.preset-chip.on {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}
.preset-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.persona-actions {
  display: flex;
  gap: 8px;
  padding: 8px 16px 6px;
}
.p-row {
  padding: 8px 16px 0;
}
.p-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.p-row input[type="range"] {
  width: 100%;
  height: 24px;
  accent-color: var(--accent);
  background: none;
}
.p-row input[type="range"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}
