/* =========================================================
   TEMA OSCURO / CLARO — TOGGLE
   Se activa con <html data-theme="dark"> (theme-toggle.js).
   Sin el atributo (o data-theme="light") se ve el diseño
   original de la aplicación.
========================================================= */

html[data-theme="dark"] {
    color-scheme: dark;
    --primary: #3f70b2;
    --primary-hover: #5687ca;
    --text: #edf3ff;
    --muted: #aebbd0;
    --border: #4a6489;
    --bg: #070c14;
    --card: #101a2b;
    --danger-bg: #2d1118;
    --danger-text: #ffabb8;
    --success-bg: #10271d;
    --success-text: #8de2ad;
    --note-bg: #251e11;
    --note-title: #ffd078;
    --shadow-card: 0 12px 34px rgba(0, 0, 0, 0.5);
    --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.4);
    --dark-surface: #101a2b;
    --dark-surface-raised: #162238;
    --dark-surface-soft: #0c1524;
    --dark-border: #4a6489;
    --dark-border-strong: #6484b0;
    --dark-text: #edf3ff;
    --dark-muted: #aebbd0;
}

/* ---------- Fondo ---------- */
html[data-theme="dark"] body {
    background: var(--bg);
    color: var(--dark-text);
}

html[data-theme="dark"] body::before {
    background-image:
        linear-gradient(rgba(3, 7, 14, 0.52), rgba(3, 7, 14, 0.72)),
        url("/assets/img/fondo_oscuro.png");
    filter: blur(1px) saturate(.8);
}

html[data-theme="dark"] .login-container {
    background: rgba(2, 6, 12, 0.24);
}

html[data-theme="dark"] .page-shell {
    background: rgba(2, 6, 12, 0.58);
}

/* ---------- Formularios genéricos ---------- */
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background: var(--dark-surface-soft);
    border: 1.5px solid var(--dark-border);
    color: var(--dark-text);
    caret-color: #9ec5ff;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #8291a9;
}

html[data-theme="dark"] input:hover,
html[data-theme="dark"] select:hover,
html[data-theme="dark"] textarea:hover {
    border-color: var(--dark-border-strong);
}

html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] button:focus-visible,
html[data-theme="dark"] a:focus-visible {
    outline: 2px solid #91bfff;
    outline-offset: 2px;
    border-color: #91bfff;
    box-shadow: 0 0 0 4px rgba(82, 139, 215, 0.22);
}

html[data-theme="dark"] input:disabled,
html[data-theme="dark"] select:disabled,
html[data-theme="dark"] textarea:disabled,
html[data-theme="dark"] button:disabled {
    background: #101827;
    border-color: #354861;
    color: #7f8da3;
    opacity: 1;
}

html[data-theme="dark"] select option {
    background: #0c1524;
    color: var(--dark-text);
}

html[data-theme="dark"] label,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] p,
html[data-theme="dark"] td {
    color: var(--dark-text);
}

html[data-theme="dark"] a:not(.btn-link):not(.btn-tabla):not(.topbar a) {
    color: #9ec5ff;
}

/* Los inputs "glass" dentro de login-card/recovery-stage ya están
   pensados para fondos oscuros: se dejan tal cual. */
html[data-theme="dark"] .login-container .login-card input,
html[data-theme="dark"] .login-container .login-card select {
    background: rgba(7, 15, 27, 0.58);
    border-color: rgba(143, 187, 245, 0.72);
    color: #ffffff;
    backdrop-filter: blur(6px) saturate(.82);
    -webkit-backdrop-filter: blur(6px) saturate(.82);
}

html[data-theme="dark"] .recovery-stage input,
html[data-theme="dark"] .recovery-stage select {
    background: rgba(6, 13, 24, 0.82);
    border-color: var(--dark-border-strong);
    color: #ffffff;
}

html[data-theme="dark"] .login-container .login-card {
    background: rgba(6, 12, 22, 0.08);
    border: 1.5px solid rgba(143, 187, 245, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(16px) saturate(.78);
    box-shadow: 0 16px 46px rgba(0, 0, 0, .52), inset 0 1px 0 rgba(255,255,255,.09);
}

html[data-theme="dark"] .recovery-stage .login-card {
    background: rgba(7, 13, 23, 0.88);
    border: 1.5px solid var(--dark-border-strong);
    box-shadow: 0 14px 42px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255,255,255,.05);
}

html[data-theme="dark"] .login-container .custom-select-btn {
    background: rgba(7, 15, 27, 0.58);
    border-color: rgba(143, 187, 245, 0.72);
    color: #ffffff;
    backdrop-filter: blur(6px) saturate(.82);
    -webkit-backdrop-filter: blur(6px) saturate(.82);
}

html[data-theme="dark"] .login-container .custom-select-btn:hover,
html[data-theme="dark"] .login-container .custom-select-btn.open {
    background: rgba(13, 26, 45, 0.72);
    border-color: #a9cdff;
}

html[data-theme="dark"] .login-container .custom-select-dropdown {
    background: rgba(5, 11, 20, 0.94);
    border-color: var(--dark-border);
}

/* ---------- Tarjetas de contenido (.card, dashboard, etc.) ---------- */
html[data-theme="dark"] .card,
html[data-theme="dark"] .card-perfil,
html[data-theme="dark"] .modal-panel {
    background: var(--dark-surface);
    color: var(--dark-text);
    border: 1.5px solid var(--dark-border);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .categoria-btn {
    background: #16233d;
    border-color: #2a4a7f;
    color: #cfe0ff;
}

html[data-theme="dark"] .categoria-btn:hover {
    background: #1b2c4d;
    border-color: #3a5a90;
}

/* ---------- Modal de selección ---------- */
html[data-theme="dark"] .modal-header {
    border-bottom-color: #23375c;
}

html[data-theme="dark"] .modal-header h4 {
    color: #e7ecf6;
}

html[data-theme="dark"] .modal-eyebrow {
    color: #9fb0cc;
}

html[data-theme="dark"] .modal-cerrar {
    background: #1b2c4d;
    color: #cfe0ff;
}

html[data-theme="dark"] .modal-cerrar:hover {
    background: #23375c;
    color: #ffffff;
}

html[data-theme="dark"] .opcion {
    background: #16233d;
    border-color: #2a4a7f;
}

html[data-theme="dark"] .opcion:hover {
    background: #1b2c4d;
    border-color: #3a5a90;
}

html[data-theme="dark"] .opcion.seleccionada {
    background: #1c3157;
    box-shadow: 0 0 0 4px rgba(120, 160, 230, 0.16), 0 10px 26px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .opcion-etiqueta {
    color: #9fb0cc;
    background: #1b2c4d;
    border-bottom-color: #2a4a7f;
}

html[data-theme="dark"] .opcion-titulo {
    color: #e7ecf6;
}

html[data-theme="dark"] .opcion-desc {
    color: #9fb0cc;
}

html[data-theme="dark"] .opcion.seleccionada::after {
    background: #16233d;
}

/* ---------- Notas / avisos ---------- */
html[data-theme="dark"] .subtle-note,
html[data-theme="dark"] .busqueda-usuarios,
html[data-theme="dark"] .crear-usuario-box {
    background: #16233d;
    border-color: #2a4a7f;
}

html[data-theme="dark"] .subtle-note p,
html[data-theme="dark"] .ayuda-creacion-usuario,
html[data-theme="dark"] .field-help {
    color: #9fb0cc;
}

html[data-theme="dark"] .busqueda-usuarios label,
html[data-theme="dark"] .crear-usuario-box h3,
html[data-theme="dark"] .campo-form label {
    color: #e7ecf6;
}

html[data-theme="dark"] .btn-limpiar-busqueda {
    background: #23375c;
    color: #e7ecf6;
}

html[data-theme="dark"] .btn-limpiar-busqueda:hover {
    background: #2c4470;
}

html[data-theme="dark"] .warning-inline {
    background: #2a2210;
}

html[data-theme="dark"] .warning-inline p {
    color: #cbd5e1;
}

/* ---------- Tablas ---------- */
html[data-theme="dark"] .tabla-usuarios {
    background: #132242;
}

html[data-theme="dark"] .tabla-usuarios th,
html[data-theme="dark"] .tabla-usuarios td {
    border-color: #2a4a7f;
}

html[data-theme="dark"] .tabla-usuarios th {
    background: #1b2c4d;
    color: #e7ecf6;
}

html[data-theme="dark"] .tabs-roles {
    background: #16233d;
}

html[data-theme="dark"] .tab-rol-btn {
    color: #9fb0cc;
}

html[data-theme="dark"] .tab-rol-btn:hover {
    background: #23375c;
    border-color: #3a5a90;
    color: #e7ecf6;
}

html[data-theme="dark"] .lista-hijos li {
    background: #1b2c4d;
    color: #cfe0ff;
}

html[data-theme="dark"] .input-mini-select {
    background: #16233d;
    border-color: #3a5a90;
    color: #cfe0ff;
}

html[data-theme="dark"] .texto-accion-bloqueada {
    color: #9fb0cc;
}

/* ---------- Custom select variante "tarjeta clara" ---------- */
html[data-theme="dark"] .card .custom-select-btn {
    background: #16233d;
    border-color: #2a4a7f;
    color: #e7ecf6;
}

html[data-theme="dark"] .card .custom-select-btn svg {
    stroke: #9fb0cc;
}

html[data-theme="dark"] .card .custom-select-dropdown {
    background: #16233d;
    border-color: #2a4a7f;
}

html[data-theme="dark"] .card .custom-select-option {
    color: #e7ecf6;
}

html[data-theme="dark"] .card .custom-select-option:hover {
    background: #1b2c4d;
}

html[data-theme="dark"] .card .custom-select-placeholder {
    color: #7f90ac;
}

/* ---------- Tarjeta de perfil ---------- */
html[data-theme="dark"] .perfil-header,
html[data-theme="dark"] .perfil-dato {
    border-color: #23375c;
}

html[data-theme="dark"] .perfil-nombre h2,
html[data-theme="dark"] .dato-valor {
    color: #e7ecf6;
}

/* =========================================================
   Estilos propios de páginas concretas (bloques <style> inline)
========================================================= */

/* --- calendario.php --- */
html[data-theme="dark"] .cal-header h2,
html[data-theme="dark"] .cal-table th,
html[data-theme="dark"] .cal-day-number,
html[data-theme="dark"] .detail-text strong {
    color: #cfe0ff;
}

html[data-theme="dark"] .cal-today-btn {
    background: #1b2c4d;
    color: #cfe0ff;
    border-color: #3a5a90;
}

html[data-theme="dark"] .cal-summary-eventos {
    background: #1b2c4d;
    color: #cfe0ff;
}

html[data-theme="dark"] .cal-summary-comunicados {
    background: #2a2210;
    color: #f0c869;
}

html[data-theme="dark"] .cal-table td {
    background: #16233d;
}

html[data-theme="dark"] .cal-table td:hover {
    background: #1b2c4d;
    border-color: #4a72b8;
}

html[data-theme="dark"] .cal-table td.today {
    background: #1c3157;
    border-color: #4a72b8;
    box-shadow: 0 0 0 2px rgba(74, 114, 184, 0.3);
}

html[data-theme="dark"] .cal-table td.selected {
    background: #23375c;
    border-color: #4a86ff;
}

html[data-theme="dark"] .cal-detail {
    background: #16233d;
    border-color: #2a4a7f;
}

html[data-theme="dark"] .no-events,
html[data-theme="dark"] .leyenda,
html[data-theme="dark"] .detail-author {
    color: #9fb0cc;
}

html[data-theme="dark"] .detail-event {
    border-bottom-color: #23375c;
}

html[data-theme="dark"] .detail-text span {
    color: #b7c4dc;
}

html[data-theme="dark"] .detail-description {
    color: #cfd9ea !important;
}

html[data-theme="dark"] .detail-type {
    background: #1b2c4d;
    color: #cfe0ff !important;
}

html[data-theme="dark"] .detail-type.comunicado {
    background: #2a2210;
    color: #f0c869 !important;
}

html[data-theme="dark"] .cal-alert.error {
    background: #33131a;
    color: #f6a5b1;
}

html[data-theme="dark"] .cal-alert.success {
    background: #123321;
    color: #7fe0a8;
}

/* --- evento_form.php --- */
html[data-theme="dark"] .form-evento label {
    color: #cfe0ff;
}

html[data-theme="dark"] .form-evento input[type="text"],
html[data-theme="dark"] .form-evento input[type="date"],
html[data-theme="dark"] .form-evento input[type="time"],
html[data-theme="dark"] .form-evento select,
html[data-theme="dark"] .form-evento textarea {
    background: #16233d;
    border-color: #2a4a7f;
    color: #e7ecf6;
}

html[data-theme="dark"] .btn-cancelar-evento {
    background: #1b2c4d;
    color: #cfe0ff;
    border-color: #3a5a90;
}

/* --- publicar_comunicado.php --- */
html[data-theme="dark"] .badge-alcance {
    background: #1b2c4d;
    color: #cfe0ff;
}

html[data-theme="dark"] .comunicado-item {
    border-bottom-color: #23375c;
}

html[data-theme="dark"] .comunicado-item strong {
    color: #cfe0ff;
}

html[data-theme="dark"] .comunicado-meta {
    color: #9fb0cc;
}

html[data-theme="dark"] .comunicado-cuerpo {
    color: #cfd9ea;
}

/* --- comunicados.php --- */
html[data-theme="dark"] .comunicado-card {
    background: #16233d;
    border-left-color: #4a72b8;
}

html[data-theme="dark"] .comunicado-titulo {
    color: #cfe0ff;
}

html[data-theme="dark"] .filtro-btn {
    background: #16233d;
    color: #cfe0ff;
    border-color: #2a4a7f;
}

html[data-theme="dark"] .filtro-btn.activo,
html[data-theme="dark"] .filtro-btn:hover {
    background: #2f5aa3;
    border-color: #2f5aa3;
    color: #ffffff;
}

html[data-theme="dark"] .sin-comunicados {
    color: #9fb0cc;
}

html[data-theme="dark"] .comunicado-fecha {
    background: #2a2210;
    color: #f0c869;
}

@keyframes comunicadoDestacadoOscuro {
    from { transform: scale(.99); background: #1c3157; }
    to   { transform: scale(1); }
}

html[data-theme="dark"] .comunicado-destacado {
    animation-name: comunicadoDestacadoOscuro;
}

/* =========================================================
   BOTÓN FLOTANTE DE CAMBIO DE TEMA
========================================================= */
/* =========================================================
   COBERTURA OSCURA COMPLETA Y SEPARACION VISUAL
========================================================= */
html[data-theme="dark"] ::selection {
    background: #3566a8;
    color: #ffffff;
}

html[data-theme="dark"] .topbar {
    background: rgba(7, 13, 23, .9);
    border-bottom: 1px solid var(--dark-border);
    box-shadow: 0 8px 28px rgba(0, 0, 0, .42);
}

html[data-theme="dark"] .topbar a {
    background: var(--dark-surface-raised);
    border: 1px solid var(--dark-border);
}

html[data-theme="dark"] .topbar a:hover {
    background: #203352;
    border-color: var(--dark-border-strong);
}

html[data-theme="dark"] button:not(#theme-toggle-btn),
html[data-theme="dark"] .btn-link,
html[data-theme="dark"] .btn-tabla,
html[data-theme="dark"] .modal-btn {
    border: 1px solid #6687b4;
}

html[data-theme="dark"] .btn-link,
html[data-theme="dark"] .modal-btn--cancelar {
    background: var(--dark-surface-raised);
    color: var(--dark-text);
    border-color: var(--dark-border);
}

html[data-theme="dark"] .btn-link:hover,
html[data-theme="dark"] .modal-btn--cancelar:hover {
    background: #203352;
    color: #ffffff;
    border-color: var(--dark-border-strong);
}

html[data-theme="dark"] .login-card button[type="submit"],
html[data-theme="dark"] .recovery-stage button[type="submit"] {
    background: #315f9e;
    border: 1px solid #79a5df;
}

html[data-theme="dark"] .login-card button[type="submit"]:hover,
html[data-theme="dark"] .recovery-stage button[type="submit"]:hover {
    background: #4779ba;
}

html[data-theme="dark"] .alert,
html[data-theme="dark"] .cal-alert,
html[data-theme="dark"] .notice-inline,
html[data-theme="dark"] .warning-note-box {
    border: 1px solid var(--dark-border);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .26);
}

html[data-theme="dark"] .alert {
    background: #2d1118;
    color: #ffabb8;
    border-color: #7c3945;
}

html[data-theme="dark"] .alert.success {
    background: #10271d;
    color: #8de2ad;
    border-color: #356c4b;
}

html[data-theme="dark"] .warning-note-box,
html[data-theme="dark"] .warning-inline {
    background: #251e11;
    border-color: #80652c;
    border-left: 5px solid #d99b2b;
}

html[data-theme="dark"] .warning-note-box p,
html[data-theme="dark"] .warning-note-box strong,
html[data-theme="dark"] .warning-note-box .mini-note,
html[data-theme="dark"] .warning-inline p {
    color: #e8dcc2;
}

html[data-theme="dark"] .warning-note-box .warning-badge {
    background: #3a2d14;
    color: #ffd078;
    border: 1px solid #80652c;
}

html[data-theme="dark"] .authorization-status,
html[data-theme="dark"] .estado-badge,
html[data-theme="dark"] .grupo-actual-badge,
html[data-theme="dark"] .perfil-rol,
html[data-theme="dark"] .badge-alcance,
html[data-theme="dark"] .comunicado-fecha,
html[data-theme="dark"] .cal-summary-item,
html[data-theme="dark"] .detail-type {
    border: 1px solid currentColor;
}

html[data-theme="dark"] .authorization-status.active,
html[data-theme="dark"] .estado-activo {
    background: #102b20;
    color: #83dfaa;
}

html[data-theme="dark"] .authorization-status.inactive,
html[data-theme="dark"] .estado-inactivo {
    background: #30151b;
    color: #ffadb8;
}

html[data-theme="dark"] .grupo-actual-badge,
html[data-theme="dark"] .perfil-rol {
    background: #162a48;
    color: #a9cdff;
}

html[data-theme="dark"] .btn-eliminar-comunicado {
    background: #30151b;
    color: #ffadb8;
    border-color: #83404b;
}

html[data-theme="dark"] .btn-eliminar-comunicado:hover {
    background: #482029;
}

html[data-theme="dark"] .modal-overlay {
    background: rgba(1, 5, 11, .82);
}

html[data-theme="dark"] .modal-header {
    border-bottom: 1px solid #314866;
    padding-bottom: 16px;
}

html[data-theme="dark"] .opcion.seleccionada .opcion-etiqueta {
    background: #315f9e;
    color: #ffffff;
    border-color: #79a5df;
}

html[data-theme="dark"] .opcion.seleccionada::after {
    box-shadow: 0 0 0 2px #8fbbf5;
}

html[data-theme="dark"] .opcion.seleccionada::before {
    border-color: #8fbbf5;
}

html[data-theme="dark"] .modal-btn--continuar:disabled {
    background: #182235;
    color: #7f8da3;
    border-color: #354861;
}

html[data-theme="dark"] .tabla-responsive {
    border: 1px solid var(--dark-border);
    border-radius: 12px;
    background: #0b1422;
}

html[data-theme="dark"] .tabla-usuarios {
    background: var(--dark-surface);
    color: var(--dark-text);
}

html[data-theme="dark"] .tabla-usuarios tbody tr:nth-child(even) td {
    background: #121f33;
}

html[data-theme="dark"] .tabla-usuarios tbody tr:hover td {
    background: #1a2b45;
}

html[data-theme="dark"] .tabla-usuarios th,
html[data-theme="dark"] .tabla-usuarios td {
    border-color: var(--dark-border);
}

html[data-theme="dark"] .tab-rol-btn.activo,
html[data-theme="dark"] .tab-rol-btn.activo:hover {
    background: #315f9e;
    color: #ffffff;
    border-color: #79a5df;
}

html[data-theme="dark"] .lista-hijos li,
html[data-theme="dark"] .grupo-actual-badge {
    border: 1px solid #4e719f;
}

html[data-theme="dark"] .card .custom-select-btn:hover,
html[data-theme="dark"] .card .custom-select-btn.open {
    background: #162238;
    border-color: #91bfff;
}

html[data-theme="dark"] .card .custom-select-option.selected,
html[data-theme="dark"] .custom-select-option.selected,
html[data-theme="dark"] .custom-select-option.is-selected {
    background: #315f9e;
    color: #ffffff;
}

html[data-theme="dark"] .perfil-avatar {
    background: #315f9e;
    border: 1px solid #8fbbf5;
}

html[data-theme="dark"] .perfil-header {
    background: #121f33;
}

html[data-theme="dark"] .perfil-dato {
    background: #0c1524;
    border-color: var(--dark-border);
}

html[data-theme="dark"] .dato-label {
    color: var(--dark-muted);
}

html[data-theme="dark"] .cal-table {
    background: #0b1422;
    border: 1px solid var(--dark-border);
    border-radius: 14px;
    padding: 6px;
}

html[data-theme="dark"] .cal-table td {
    background: #101b2d;
    border-color: #3c5578;
}

html[data-theme="dark"] .cal-table td.empty {
    background: transparent !important;
    border: none !important;
}

html[data-theme="dark"] .cal-event-chip {
    border: 1px solid currentColor;
    border-left-width: 3px;
    background: #182944 !important;
}

html[data-theme="dark"] .cal-event-chip.comunicado {
    background: #302712 !important;
    color: #ffd078 !important;
}

html[data-theme="dark"] .cal-detail h3,
html[data-theme="dark"] .cal-header h2 {
    color: #cfe2ff;
}

html[data-theme="dark"] .comunicado-card {
    border: 1px solid var(--dark-border);
    border-left: 5px solid #6f9edb;
    box-shadow: 0 7px 20px rgba(0, 0, 0, .25);
}

html[data-theme="dark"] .filtro-btn.activo,
html[data-theme="dark"] .filtro-btn:hover {
    background: #315f9e;
    border-color: #79a5df;
}

html[data-theme="dark"] .comunicado-fecha,
html[data-theme="dark"] .cal-summary-comunicados,
html[data-theme="dark"] .detail-type.comunicado {
    background: #302712;
    color: #ffd078 !important;
    border-color: #80652c;
}

html[data-theme="dark"] .cal-alert.error {
    border-color: #7c3945;
}

html[data-theme="dark"] .cal-alert.success {
    border-color: #356c4b;
}

html[data-theme="dark"] .password-toggle {
    color: #bcd6fa;
}

/* ---------- Ola diagonal al cambiar de tema ---------- */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

html.theme-wave-transition::view-transition-old(root) {
    z-index: 1;
}

html.theme-wave-transition::view-transition-new(root) {
    z-index: 2;
    animation: theme-wave-reveal .72s cubic-bezier(.72, 0, .2, 1) both;
}

@keyframes theme-wave-reveal {
    from {
        clip-path: polygon(112% -15%, 112% -15%, 98% 115%, 98% 115%);
    }
    to {
        clip-path: polygon(-20% -15%, 112% -15%, 112% 115%, -34% 115%);
    }
}

/* Respaldo para navegadores sin View Transitions. */
.theme-transition-wave {
    position: fixed;
    top: -25vh;
    right: -175vw;
    z-index: 9998;
    width: 175vw;
    height: 150vh;
    pointer-events: none;
    transform: translateX(0) skewX(-9deg);
    transform-origin: center;
    will-change: transform;
    border-radius: 52% 0 0 52% / 16% 0 0 16%;
    box-shadow: -24px 0 46px rgba(90, 142, 211, .38);
}

.theme-transition-wave.to-dark {
    background: linear-gradient(115deg, #294c78 0%, #12243c 28%, #070c14 76%);
}

.theme-transition-wave.to-light {
    background: linear-gradient(115deg, #bcd7f7 0%, #e6f0fb 30%, #ffffff 76%);
}

.theme-transition-wave.is-moving {
    transform: translateX(-285vw) skewX(-9deg);
    transition: transform 1.05s cubic-bezier(.65, 0, .35, 1);
}

#theme-toggle-btn {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 2000;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.68);
    background: rgba(20, 30, 50, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    transition: transform .15s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
    padding: 0;
}

#theme-toggle-btn:hover {
    transform: translateY(-2px) scale(1.05);
    border-color: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .48), 0 0 0 4px rgba(255, 255, 255, .12);
}

#theme-toggle-btn:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 3px;
}

html[data-theme="dark"] #theme-toggle-btn {
    background: #16243a;
    border-color: #8fbbf5;
    color: #ffe39a;
    box-shadow: 0 9px 28px rgba(0, 0, 0, .55), 0 0 0 1px rgba(143, 187, 245, .2);
}

#theme-toggle-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#theme-toggle-btn .icon-sun {
    display: none;
}

html[data-theme="dark"] #theme-toggle-btn .icon-moon {
    display: none;
}

html[data-theme="dark"] #theme-toggle-btn .icon-sun {
    display: block;
}

@media (max-width: 640px) {
    #theme-toggle-btn {
        right: 14px;
        bottom: 14px;
        width: 46px;
        height: 46px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html.theme-wave-transition::view-transition-new(root),
    #theme-toggle-btn {
        transition: none;
        animation: none;
    }
}
