@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
    --fondo-gradiente:
        radial-gradient(circle at top left, rgba(124, 217, 255, 0.44), transparent 30%),
        radial-gradient(circle at top right, rgba(255, 186, 210, 0.46), transparent 32%),
        radial-gradient(circle at bottom center, rgba(255, 216, 152, 0.34), transparent 26%),
        linear-gradient(180deg, #fff9f2 0%, #fff4ea 42%, #fefdf8 100%) !important;
    --bg-pattern:
        radial-gradient(circle at 18px 18px, rgba(255, 183, 77, 0.14) 0 4px, transparent 4.5px),
        radial-gradient(circle at 62px 54px, rgba(124, 217, 255, 0.16) 0 5px, transparent 5.5px),
        radial-gradient(circle at 102px 28px, rgba(255, 123, 172, 0.14) 0 4px, transparent 4.5px) !important;
    --texto-principal: #4c3d52 !important;
    --text-main: #4c3d52 !important;
    --text-muted: #6f6077 !important;
    --tarjeta-bg: rgba(255, 255, 255, 0.9) !important;
    --card-bg: rgba(255, 255, 255, 0.9) !important;
    --tarjeta-hover: rgba(255, 250, 245, 0.98) !important;
    --card-hover-bg: rgba(255, 250, 245, 0.98) !important;
    --border-color: rgba(255, 186, 165, 0.58) !important;
    --header-bg:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 243, 233, 0.96) 46%, rgba(236, 251, 255, 0.95)) !important;
    --btn-bg: linear-gradient(135deg, #ff7bac 0%, #ff9f6e 100%) !important;
    --btn-text: #ffffff !important;
    --topic-color: #5cc8ef !important;
    --ui-radius: 30px !important;
    --ui-radius-sm: 20px !important;
    --ui-shadow: 0 18px 40px rgba(232, 141, 124, 0.16) !important;
    --ui-shadow-strong: 0 18px 34px rgba(205, 92, 123, 0.2) !important;
    --ui-title: clamp(2rem, 3.4vw, 3.3rem) !important;
    --ui-subtitle: clamp(1.05rem, 1.5vw, 1.25rem) !important;
    --ui-section: clamp(1.35rem, 2vw, 2rem) !important;
    --ui-card-title: clamp(1.05rem, 1.4vw, 1.35rem) !important;
    --ui-body: clamp(0.98rem, 1vw, 1.04rem) !important;
    --ui-small: 0.94rem !important;
    --ui-space-section: clamp(1.2rem, 1.8vw, 2rem) !important;
}

body.dark-mode,
.dark-mode {
    --fondo-gradiente:
        radial-gradient(circle at top left, rgba(92, 200, 239, 0.12), transparent 28%),
        radial-gradient(circle at top right, rgba(255, 123, 172, 0.12), transparent 30%),
        linear-gradient(180deg, #151d39 0%, #182447 52%, #10182f 100%) !important;
    --bg-pattern:
        radial-gradient(circle at 18px 18px, rgba(92, 200, 239, 0.16) 0 3px, transparent 3.5px),
        radial-gradient(circle at 62px 54px, rgba(255, 123, 172, 0.12) 0 3px, transparent 3.5px),
        radial-gradient(circle at 102px 28px, rgba(255, 200, 122, 0.1) 0 2px, transparent 2.5px) !important;
    --texto-principal: #f8f3ef !important;
    --text-main: #f8f3ef !important;
    --text-muted: #d7d9ea !important;
    --tarjeta-bg: rgba(19, 28, 58, 0.9) !important;
    --card-bg: rgba(19, 28, 58, 0.9) !important;
    --tarjeta-hover: rgba(24, 35, 72, 0.96) !important;
    --card-hover-bg: rgba(24, 35, 72, 0.96) !important;
    --border-color: rgba(151, 175, 255, 0.2) !important;
    --header-bg:
        linear-gradient(180deg, rgba(255, 251, 248, 0.98), rgba(255, 244, 236, 0.98)) !important;
    --btn-bg: linear-gradient(135deg, #ff4ea0 0%, #ff7f73 100%) !important;
    --btn-text: #ffffff !important;
    --topic-color: #8edfff !important;
    --ui-shadow: 0 24px 48px rgba(7, 11, 27, 0.34) !important;
    --ui-shadow-strong: 0 18px 34px rgba(0, 0, 0, 0.34) !important;
}

html,
body {
    background-color: #fff9f2 !important;
    background-image: var(--bg-pattern), var(--fondo-gradiente) !important;
    background-size: 140px 140px, cover !important;
    background-attachment: fixed !important;
    color: var(--texto-principal, var(--text-main)) !important;
    font-family: 'Nunito', sans-serif !important;
    line-height: 1.5 !important;
}

body {
    min-height: 100vh !important;
}

h1,
h2,
h3,
h4,
h5,
h6,
.header-text h1,
.menu-title,
.grado-banner__title {
    font-family: 'Fredoka', sans-serif !important;
    color: var(--texto-principal, var(--text-main)) !important;
}

p,
li,
label,
input,
textarea,
select,
button,
a,
span,
div {
    font-family: 'Nunito', sans-serif !important;
}

body:not(.dark-mode),
body:not(.dark-mode) p,
body:not(.dark-mode) li,
body:not(.dark-mode) label,
body:not(.dark-mode) h1,
body:not(.dark-mode) h2,
body:not(.dark-mode) h3,
body:not(.dark-mode) h4,
body:not(.dark-mode) h5,
body:not(.dark-mode) h6,
body:not(.dark-mode) span:not(.grado-banner__title),
body:not(.dark-mode) .text-white,
body:not(.dark-mode) .text-sky-100,
body:not(.dark-mode) .text-sky-200,
body:not(.dark-mode) .text-blue-200,
body:not(.dark-mode) .text-cyan-100,
body:not(.dark-mode) .text-emerald-100,
body:not(.dark-mode) .text-lime-100,
body:not(.dark-mode) .text-pink-100,
body:not(.dark-mode) .text-pink-200 {
    color: var(--texto-principal) !important;
}

body.dark-mode p,
body.dark-mode li,
body.dark-mode label,
body.dark-mode span:not(.grado-banner__title),
body.dark-mode .text-white,
body.dark-mode .text-sky-100,
body.dark-mode .text-sky-200,
body.dark-mode .text-blue-200,
body.dark-mode .text-cyan-100,
body.dark-mode .text-emerald-100,
body.dark-mode .text-lime-100,
body.dark-mode .text-pink-100,
body.dark-mode .text-pink-200 {
    color: var(--text-main) !important;
}

body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select,
body.dark-mode option {
    color: #43384e !important;
}

body.dark-mode header.glass-panel,
body.dark-mode header.glass-card,
body.dark-mode header[class*="glass"] {
    color: #55425f !important;
}

body.dark-mode header.glass-panel h1,
body.dark-mode header.glass-panel h2,
body.dark-mode header.glass-panel h3,
body.dark-mode header.glass-panel h4,
body.dark-mode header.glass-panel h5,
body.dark-mode header.glass-panel h6,
body.dark-mode header.glass-panel p,
body.dark-mode header.glass-panel li,
body.dark-mode header.glass-panel span,
body.dark-mode header.glass-panel label,
body.dark-mode header.glass-card h1,
body.dark-mode header.glass-card h2,
body.dark-mode header.glass-card h3,
body.dark-mode header.glass-card h4,
body.dark-mode header.glass-card h5,
body.dark-mode header.glass-card h6,
body.dark-mode header.glass-card p,
body.dark-mode header.glass-card li,
body.dark-mode header.glass-card span,
body.dark-mode header.glass-card label,
body.dark-mode header[class*="glass"] h1,
body.dark-mode header[class*="glass"] h2,
body.dark-mode header[class*="glass"] h3,
body.dark-mode header[class*="glass"] h4,
body.dark-mode header[class*="glass"] h5,
body.dark-mode header[class*="glass"] h6,
body.dark-mode header[class*="glass"] p,
body.dark-mode header[class*="glass"] li,
body.dark-mode header[class*="glass"] span,
body.dark-mode header[class*="glass"] label {
    color: #55425f !important;
}

body:not(.dark-mode) .opacity-80,
body:not(.dark-mode) .opacity-90 {
    opacity: 1 !important;
}

.glass-panel,
.tema-card,
.menu-item,
.section-card,
.card-hover,
.glass-card,
.paper-box {
    background: var(--tarjeta-bg, var(--card-bg)) !important;
    border: 2px solid var(--border-color) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    box-shadow: var(--ui-shadow) !important;
    border-radius: var(--ui-radius) !important;
}

.tema-card:hover,
.menu-item:hover,
.section-card:hover,
.card-hover:hover,
.glass-panel:hover.card-hover {
    background: var(--tarjeta-hover, var(--card-hover-bg)) !important;
    transform: translateY(-4px) !important;
}

header.glass-panel,
header.glass-card,
header[class*="glass"] {
    background: var(--header-bg) !important;
    border-radius: calc(var(--ui-radius) + 2px) !important;
    padding: clamp(1.5rem, 2vw, 2.25rem) !important;
}

h1,
.header-text h1 {
    font-size: var(--ui-title) !important;
    line-height: 1.02 !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em !important;
}

h2,
.header-subtitle {
    font-size: var(--ui-section) !important;
    line-height: 1.12 !important;
    font-weight: 700 !important;
}

h3,
.menu-title,
.text-3xl.font-black,
.text-3xl.font-bold {
    font-size: var(--ui-card-title) !important;
    line-height: 1.16 !important;
    font-weight: 700 !important;
}

h4,
h5,
h6 {
    line-height: 1.2 !important;
}

p,
li,
label,
input,
textarea,
select,
.menu-desc,
.header-text p,
.header-text h3 {
    font-size: var(--ui-body) !important;
}

.header-text p,
.menu-desc,
.opacity-80,
.opacity-90 {
    font-weight: 700 !important;
}

.glass-panel + .glass-panel,
section + section,
header + section,
section + footer {
    margin-top: var(--ui-space-section) !important;
}

#contenido-clase,
[id^="contenido-"] {
    width: 100% !important;
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.grado-banner {
    position: relative !important;
    overflow: hidden !important;
    padding: 1.3rem 1.5rem !important;
    margin-bottom: 1.25rem !important;
    border-radius: 30px !important;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.6), transparent 30%),
        linear-gradient(135deg, rgba(124, 217, 255, 0.2), rgba(255, 198, 124, 0.16), rgba(255, 123, 172, 0.18)) !important;
    border: 2px solid rgba(255, 190, 171, 0.58) !important;
    box-shadow: var(--ui-shadow) !important;
}

.grado-banner::before {
    content: "" !important;
    position: absolute !important;
    inset: auto -32px -44px auto !important;
    width: 150px !important;
    height: 150px !important;
    border-radius: 999px !important;
    background: radial-gradient(circle, rgba(124, 217, 255, 0.28), transparent 70%) !important;
    pointer-events: none !important;
}

.grado-banner__title {
    margin: 0 !important;
    display: inline-block !important;
    position: relative !important;
    z-index: 1 !important;
    font-size: clamp(2.2rem, 7vw, 5rem) !important;
    font-weight: 700 !important;
    line-height: 0.95 !important;
    letter-spacing: -0.03em !important;
    text-transform: none !important;
    color: #ff6f9f !important;
    text-shadow: 0 6px 18px rgba(255, 164, 118, 0.2) !important;
}

body.dark-mode .grado-banner,
.dark-mode .grado-banner {
    background:
        radial-gradient(circle at top left, rgba(92, 200, 239, 0.18), transparent 30%),
        linear-gradient(135deg, rgba(20, 29, 57, 0.96), rgba(26, 37, 72, 0.94), rgba(18, 28, 58, 0.96)) !important;
    border-color: rgba(142, 223, 255, 0.2) !important;
}

body.dark-mode .grado-banner__title,
.dark-mode .grado-banner__title {
    color: #fff4ef !important;
    text-shadow: 0 8px 20px rgba(0, 0, 0, 0.28) !important;
}

.cartel-bienvenida {
    width: min(84vw, 520px) !important;
    border-radius: 30px !important;
    padding: clamp(1.8rem, 3vw, 2.5rem) !important;
}

.cartel-bienvenida h1 {
    margin-bottom: 0.5rem !important;
}

.tema-card {
    border-radius: 28px !important;
}

.tema-card h4,
.tema-card h3 {
    margin-top: 0.25rem !important;
    margin-bottom: 0 !important;
}

.tema-card p {
    margin-top: 0.45rem !important;
}

.grid .tema-card {
    min-height: 160px !important;
}

.grid.sm\:grid-cols-3 .tema-card,
.grid[class*="sm:grid-cols-3"] .tema-card,
.grid[class*="lg:grid-cols-3"] .tema-card {
    min-height: 180px !important;
}

.borde-t1,
.borde-t2,
.borde-t3 {
    padding-bottom: 0.5rem !important;
    margin-bottom: 1.25rem !important;
}

footer {
    opacity: 0.85 !important;
    text-align: center !important;
}

button,
.btn-interactivo,
.btn-volver,
a[class*="bg-white"],
a[class*="rounded"],
a[class*="px-"],
.menu-item,
.tema-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease !important;
}

button:not(.theme-toggle):not(.accessibility-toggle),
.btn-interactivo,
.btn-volver,
.unified-back-button,
a.unified-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    min-height: 52px !important;
    padding: 0.9rem 1.45rem !important;
    border-radius: 999px !important;
    border: none !important;
    background: var(--btn-bg) !important;
    color: var(--btn-text) !important;
    font-size: 1rem !important;
    font-weight: 900 !important;
    text-decoration: none !important;
    box-shadow: var(--ui-shadow-strong) !important;
    width: auto !important;
}

button:not(.theme-toggle):not(.accessibility-toggle):hover,
.btn-interactivo:hover,
.btn-volver:hover,
.unified-back-button:hover,
a.unified-button:hover {
    transform: translateY(-2px) scale(1.01) !important;
    filter: saturate(1.05) !important;
}

.unified-back-button {
    min-width: 180px !important;
}

header a.unified-back-button,
header .btn-volver,
header a[href*="index"],
header a[href*="submenu"],
header a[href*="tema"] {
    align-self: center !important;
    white-space: nowrap !important;
}

.win-close {
    min-height: unset !important;
    min-width: unset !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    color: inherit !important;
    border: none !important;
}

.theme-toggle,
.accessibility-toggle {
    position: fixed !important;
    right: 20px !important;
    z-index: 4000 !important;
    cursor: pointer !important;
    min-width: 190px !important;
    min-height: 48px !important;
    padding: 12px 18px !important;
    border-radius: 999px !important;
    border: 2px solid rgba(255, 190, 171, 0.58) !important;
    background: rgba(255, 255, 255, 0.88) !important;
    color: #6c5474 !important;
    font-family: 'Fredoka', sans-serif !important;
    font-size: 0.98rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    box-shadow: var(--ui-shadow) !important;
    transition: transform 0.2s ease, background 0.2s ease !important;
}

.theme-toggle {
    top: 20px !important;
}

.accessibility-toggle {
    top: 80px !important;
}

.theme-toggle:hover,
.accessibility-toggle:hover {
    transform: translateY(-2px) scale(1.02) !important;
    background: rgba(255, 251, 247, 0.96) !important;
}

body.dark-mode .theme-toggle,
body.dark-mode .accessibility-toggle {
    background: rgba(19, 28, 58, 0.94) !important;
    color: #fff4ef !important;
    border-color: rgba(142, 223, 255, 0.2) !important;
}

body.text-uppercase,
body.text-uppercase p,
body.text-uppercase h1,
body.text-uppercase h2,
body.text-uppercase h3,
body.text-uppercase h4,
body.text-uppercase h5,
body.text-uppercase h6,
body.text-uppercase a,
body.text-uppercase button,
body.text-uppercase span,
body.text-uppercase li,
body.text-uppercase label,
body.text-uppercase div {
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
}

body.text-uppercase input,
body.text-uppercase textarea {
    text-transform: none !important;
}

@media (max-width: 640px) {
    h1,
    .header-text h1 {
        padding-right: 0.5rem !important;
    }

    .theme-toggle,
    .accessibility-toggle {
        min-width: 154px !important;
        right: 12px !important;
        font-size: 0.82rem !important;
        padding: 10px 14px !important;
    }
}
