/* ── Settings Overlay ── */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-overlay.hidden {
    display: none;
}

.settings-card {
    background: var(--surface);
    border: 1px solid var(--gold);
    border-radius: var(--radius-lg);
    padding: var(--space-7);
    max-width: 380px;
    width: 90%;
    position: relative;
    padding-top: 52px;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) 0;
}

.settings-divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-2) 0;
}

.settings-item .label {
    font-weight: 600;
    font-size: var(--text-lg);
    color: var(--text);
}

.settings-item .desc {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.toggle-switch {
    width: 44px;
    height: 26px;
    border-radius: var(--radius-sm);
    background: #3a3a4a;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.toggle-switch.on {
    background: var(--gold);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: var(--transition);
}

.toggle-switch.on::after {
    left: 21px;
}

/* ── Input Groups ── */
.input-group {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: var(--space-1);
}

.input-group label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    min-width: 55px;
}

.input-group input,
.input-group select,
.input-group textarea {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: var(--space-2) var(--space-2);
    border-radius: var(--radius-xs);
    font-family: var(--font);
    font-size: var(--text-base);
    outline: none;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    border-color: var(--gold);
}

.input-group textarea {
    resize: vertical;
    min-height: 50px;
    width: 100%;
}

.save-btn,
.cancel-btn {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    font-size: var(--text-lg);
    transition: var(--transition);
}

.save-btn:hover {
    background: var(--gold);
    color: #1a1a1a;
    border-color: var(--gold);
}

.difficulty-selector {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: 100%;
}

.difficulty-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
    width: 100%;
    text-align: left;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
}

.difficulty-option:hover {
    border-color: var(--gold);
}

.difficulty-option-title {
    font-weight: 700;
    font-size: var(--text-lg);
    color: var(--text-bright);
}

.difficulty-option-desc {
    font-size: var(--text-sm);
    color: var(--text-muted);
    line-height: 1.4;
}

.difficulty-option.active {
    border-color: var(--gold);
    background: rgba(226, 176, 74, 0.08);
    box-shadow: 0 0 12px rgba(226, 176, 74, 0.12);
}

.difficulty-option.active .difficulty-option-title {
    color: var(--gold);
}

.cancel-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ── Modal Close Button ── */
.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    z-index: var(--z-base);
}

.modal-close-btn:hover {
    background: rgba(224, 85, 106, 0.12);
    border-color: var(--danger);
    color: var(--danger);
}

/* ── Shared Modal Info Boxes (Phase 1, Day 2) ──
   Consolidates the Reflection modal's and Reflection detail view's stats
   grids, which previously hand-coded slightly different gap/font-size
   values for the same component (audit M-3), plus other inline-styled
   info blocks (recovery preview, detail text fields) into shared classes
   so index.html no longer needs inline style="padding:…" attributes. */
.stats-summary-box {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    margin-bottom: var(--space-3);
}

.stats-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
}

.info-box {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    margin-bottom: var(--space-4);
    font-size: var(--text-base);
    color: var(--text);
}

.detail-field-box {
    font-size: var(--text-base);
    color: var(--text);
    background: var(--surface2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-xs);
}

/* ── Modal Inline Error ── */
.modal-error {
    color: var(--danger);
    font-size: var(--text-base);
    font-weight: 600;
    min-height: 18px;
    margin-bottom: var(--space-1);
}

/* ── Modal Action Row (Phase 1, Day 2 follow-up) ──
   Consolidates the Cancel/Save (and Start Fresh/Restore, Skip/Save)
   button row used at the bottom of every modal — previously each modal
   in index.html hand-coded its own inline style="display:flex; gap:8px;
   justify-content:flex-end; margin-top:…" with a slightly different
   margin-top per modal (6px / 12px / 14px / none). Standardized here on
   the spacing scale so index.html no longer needs inline styles for it. */
.modal-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
    margin-top: var(--space-3);
}

/* ── Mood Buttons (Weekly Reflection) ── */
.mood-btn {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text-muted);
    font-size: var(--text-base);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
}

.mood-btn:hover {
    border-color: var(--gold);
    color: var(--text);
}

.mood-btn.selected {
    background: rgba(226, 176, 74, 0.12);
    border-color: var(--gold);
    color: var(--gold);
}

/* ── Signup Overlay ── */
.signup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(12px);
    z-index: var(--z-signup);
    display: flex;
    align-items: center;
    justify-content: center;
}

.signup-overlay.hidden {
    display: none;
}

.signup-input {
    width: 100%;
    padding: var(--space-3);
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    font-size: var(--text-xl);
    text-align: center;
    margin-bottom: var(--space-4);
    outline: none;
    font-family: var(--font);
}

.signup-input:focus {
    border-color: var(--gold);
}

/* ── Onboarding Tutorial Overlay ── */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 11, 18, 0.97);
    backdrop-filter: blur(16px);
    z-index: var(--z-onboarding);
    display: flex;
    flex-direction: column;
    /* top padding is a one-off layout offset (clears the absolutely-
       positioned .onboarding-skip-btn at top:20px + its own height),
       not a spacing-rhythm value — intentionally left raw per H-3;
       side/bottom padding use the spacing scale as normal. */
    padding: 60px var(--space-5) var(--space-7);
}

.onboarding-overlay.hidden {
    display: none;
}

.onboarding-skip-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: var(--text-base);
    font-weight: 600;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.onboarding-skip-btn:hover {
    border-color: var(--text);
    color: var(--text);
}

.onboarding-progress {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
    flex-shrink: 0;
}

.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: var(--transition);
}

.onboarding-dot.active {
    background: var(--gold);
    box-shadow: 0 0 10px rgba(226, 176, 74, 0.5);
    transform: scale(1.2);
}

.onboarding-dot.done {
    background: var(--gold-glow);
    opacity: 0.5;
}

.onboarding-track {
    flex: 1;
    display: flex;
    width: 500%;
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.onboarding-slide {
    width: 20%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 var(--space-3);
    max-width: 440px;
    margin: 0 auto;
}

.onboarding-emoji {
    font-size: 3.4rem;
    margin-bottom: var(--space-4);
    filter: drop-shadow(0 0 20px rgba(226, 176, 74, 0.3));
}

.onboarding-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-bright);
    margin-bottom: var(--space-4);
}

.onboarding-text {
    font-size: var(--text-xl);
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: var(--space-2);
}

.onboarding-examples {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2);
    margin: var(--space-4) 0;
}

.onboarding-examples.onboarding-examples-col {
    flex-direction: column;
    align-items: stretch;
}

.onboarding-examples span {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text);
}

.onboarding-examples.onboarding-examples-col span {
    text-align: left;
}

.onboarding-next-btn {
    flex-shrink: 0;
    margin-top: var(--space-5);
    max-width: 440px;
    align-self: center;
    width: 100%;
}

@media (max-width: 480px) {
    .onboarding-overlay {
        /* top value scales down with the same skip-btn clearance as the
           base rule above — see comment there; intentionally raw. */
        padding: 56px var(--space-4) var(--space-6);
    }

    .onboarding-emoji {
        font-size: 2.8rem;
    }

    .onboarding-title {
        font-size: var(--text-2xl);
    }
}

/* ── Persistent Unsaved Warning ── */
.unsaved-warning {
  position: sticky;
  top: 0;
  z-index: var(--z-modal);
  background: rgba(180, 40, 40, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid #ff6b6b;
  padding: var(--space-2) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: var(--text-lg);
  font-weight: 600;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.unsaved-warning.hidden {
  display: none;
}

.unsaved-warning-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  max-width: 520px;
  width: 100%;
}

.unsaved-warning-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ── Retry / Export tints — layered on .btn-secondary for the
   Unsaved-Changes warning bar CTAs. Both override the idle
   background/border/color since .btn-secondary's default surface2
   fill doesn't stand out against the bar's red background.
   .btn-retry also overrides :hover to stay green instead of inheriting
   .btn-secondary's gold hover; .btn-export's hover is close enough to
   that gold default to reuse as-is (minimal override, per plan).
   NOTE: now that both use their own saturated border colors, the
   --border-on-alert token (originally added so a *neutral* border
   would still read against red) is no longer referenced anywhere —
   flagging as a Phase 7 dead-token cleanup candidate rather than
   removing the :root definition here. */
.btn-retry {
    border-color: var(--xp-green);
    background: rgba(92, 201, 138, 0.2);
    color: var(--text-bright);
}

.btn-retry:hover:not(:disabled) {
    background: var(--xp-green);
    border-color: var(--xp-green);
    color: var(--surface);
}

.btn-export {
    border-color: var(--gold);
    background: rgba(226, 176, 74, 0.2);
    color: var(--text-bright);
}

/* ══════════════════════════════════════════════
   STORE — placeholder page (foundation only)
   Lives as an overlay using the same .settings-overlay /
   .settings-card / .modal-close-btn chrome as every other
   header-icon-triggered secondary view in the app (Settings,
   Reflection History, Recovery, etc.) — see index.html
   #store-overlay. The "coming soon" message itself reuses
   .empty-state. Only the small category-preview grid below is
   new CSS — built from the same surface2/border/radius-sm/
   spacing tokens used throughout (e.g. achievement.css's
   .ach-pill), since no existing component matches a 4-up
   "coming soon" tile grid.
   ══════════════════════════════════════════════ */
.store-preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.store-preview-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-1);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-4) var(--space-2);
}

.store-preview-icon {
    font-size: 1.4rem;
}

.store-preview-name {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text-bright);
}

.store-preview-badge {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}