/* ── Personalización (prefs.js) ────────────────────────────── */
body { font-family: var(--font-ui, system-ui, -apple-system, sans-serif); }
button, input, select, textarea { font-family: inherit; }

/* Fondos */
html[data-bg="dots"] body {
  background-image: radial-gradient(color-mix(in srgb, var(--text) 14%, transparent) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
}
html[data-bg="grid"] body {
  background-image:
    linear-gradient(color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1px);
  background-size: 32px 32px;
}
html[data-bg="aurora"] body {
  background-image:
    radial-gradient(60% 50% at 15% 10%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%),
    radial-gradient(50% 45% at 90% 20%, color-mix(in srgb, var(--accent) 16%, #ec4899 14%), transparent 70%),
    radial-gradient(60% 50% at 60% 100%, color-mix(in srgb, var(--accent) 12%, #14b8a6 18%), transparent 70%);
  background-attachment: fixed;
}

/* Sin animaciones */
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* Mazo */
html[data-halfcards="off"] .card[data-value*="."] { display: none; }
html[data-alien="off"] .card[data-value="👽"] { display: none; }

/* Home */
html[data-subtitle="off"] #landing-subtitle { display: none; }
html[data-changelog="off"] #btn-changelog { display: none; }

/* Tema claro: el texto sobre acento sigue siendo blanco; ajustes finos */
html[data-theme-mode="light"] .modal-overlay { background: rgba(15, 23, 42, .35); }
html[data-theme-mode="light"] .card-panel,
html[data-theme-mode="light"] #identity-box { box-shadow: 0 1px 3px rgba(15, 23, 42, .08); }

/* Botón de la caja de identidad */
#prefs-badge {
  background: var(--surface2); color: var(--text); border-radius: 999px;
  padding: .3rem .65rem; font-size: .85rem;
}
#prefs-badge:hover { background: var(--border); }

/* Panel lateral */
.prefs-backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, .35);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.prefs-backdrop.open { opacity: 1; pointer-events: auto; }

.prefs-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 91;
  width: min(380px, 100vw);
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--text);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 32px rgba(0, 0, 0, .25);
  transform: translateX(105%); transition: transform .25s ease;
}
.prefs-panel.open { transform: none; }

.prefs-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.prefs-head h2 { font-size: 1.15rem; }
.prefs-body { flex: 1; overflow-y: auto; padding: .5rem 1.25rem 1rem; }
.prefs-body section { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.prefs-body section:last-child { border-bottom: 0; }
.prefs-body h3 {
  font-size: .75rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: .7rem;
}
.prefs-foot {
  display: flex; gap: .5rem; padding: .85rem 1.25rem; border-top: 1px solid var(--border);
}
.prefs-foot button { flex: 1; font-size: .9rem; padding: .5rem; }

.btn-secondary { background: var(--surface2); color: var(--text); }
.btn-secondary:hover { background: var(--border); }

/* Temas */
.pref-themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.pref-theme {
  background: transparent; color: var(--text); padding: .35rem; font-size: .75rem;
  border: 2px solid transparent; border-radius: 10px;
  display: flex; flex-direction: column; gap: .3rem; align-items: stretch; text-align: center;
}
.pref-theme:hover { background: var(--surface2); }
.pref-theme.active { border-color: var(--accent); background: var(--accent-soft); }
.pref-theme-preview {
  display: flex; align-items: flex-end; gap: 4px; height: 44px; padding: 6px;
  border-radius: 6px; border: 1px solid var(--border);
}
.pref-theme-preview i { flex: 1; height: 60%; border-radius: 3px; }
.pref-theme-preview i.pref-theme-accent { flex: 0 0 14px; height: 100%; background: var(--accent); }

/* Acentos */
.pref-accents { display: flex; flex-wrap: wrap; gap: .5rem; }
.pref-accent {
  width: 30px; height: 30px; padding: 0; border-radius: 50%;
  border: 2px solid transparent; outline: 2px solid transparent; outline-offset: 2px;
  cursor: pointer; position: relative; display: grid; place-items: center;
}
.pref-accent:hover { transform: scale(1.12); }
.pref-accent.active { outline-color: var(--text); }
.pref-accent-custom { background: var(--surface2); color: var(--text-muted); font-size: 1rem; overflow: hidden; }
.pref-accent-custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

/* Controles */
.pref-row { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .85rem; font-size: .9rem; }
.pref-row:last-child { margin-bottom: 0; }
.pref-row > span { color: var(--text-muted); font-size: .82rem; }
.pref-seg { display: flex; background: var(--surface2); border-radius: 8px; padding: 3px; gap: 2px; }
.pref-seg button {
  flex: 1; background: transparent; color: var(--text-muted); font-size: .8rem;
  padding: .35rem .3rem; border-radius: 6px;
}
.pref-seg button:hover { background: var(--border); color: var(--text); }
.pref-seg button.active { background: var(--accent); color: #fff; }
.prefs-panel select { width: 100%; font-size: .9rem; padding: .4rem .6rem; }

.pref-toggle { display: flex; align-items: center; gap: .7rem; padding: .35rem 0; cursor: pointer; color: var(--text); font-size: .9rem; }
.pref-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.pref-switch {
  flex: 0 0 38px; height: 22px; border-radius: 999px; background: var(--border);
  position: relative; transition: background .15s;
}
.pref-switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .15s;
}
.pref-toggle input:checked + .pref-switch { background: var(--accent); }
.pref-toggle input:checked + .pref-switch::after { transform: translateX(16px); }
.pref-toggle input:focus-visible + .pref-switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.pref-toggle-text small { display: block; color: var(--text-muted); font-size: .75rem; margin-top: .1rem; }

.pref-hint { color: var(--text-muted); font-size: .8rem; margin: .7rem 0 .5rem; }
.pref-tabs { list-style: none; display: grid; gap: .35rem; }
.pref-tabs li {
  display: flex; align-items: center; gap: .3rem; padding: .3rem .3rem .3rem .7rem;
  background: var(--surface2); border-radius: 8px; font-size: .88rem;
}
.pref-tabs li span { flex: 1; }
.pref-tabs li.is-hidden span { opacity: .45; text-decoration: line-through; }
.pref-tabs li button { background: transparent; color: var(--text); padding: .2rem .5rem; font-size: .85rem; }
.pref-tabs li button:hover { background: var(--border); }
.pref-tabs li button:disabled { opacity: .25; }
