:root {
    --bg: #0f172a;
    --bg-soft: #111827;
    --panel: rgba(15, 23, 42, .86);
    --panel-border: rgba(148, 163, 184, .22);
    --text: #e5e7eb;
    --muted: #94a3b8;
    --accent: #38bdf8;
    --accent-2: #22c55e;
    --danger: #ef4444;
    --shadow: 0 24px 80px rgba(0, 0, 0, .38);
    --radius: 22px;
}

body.theme-creative {
    --bg: #170021;
    --bg-soft: #2a0738;
    --panel: rgba(45, 9, 63, .82);
    --panel-border: rgba(255, 255, 255, .18);
    --text: #fff7ed;
    --muted: #f0abfc;
    --accent: #f97316;
    --accent-2: #ec4899;
    --danger: #fb7185;
    background-image: radial-gradient(circle at 10% 10%, rgba(236, 72, 153, .35), transparent 28%), radial-gradient(circle at 85% 12%, rgba(249, 115, 22, .25), transparent 30%), linear-gradient(135deg, #170021, #0f102e 60%, #1f2937);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top left, rgba(56, 189, 248, .18), transparent 35%), linear-gradient(135deg, var(--bg), var(--bg-soft));
}

button, input, select {
    font: inherit;
}

.app-header,
.app-footer,
.layout {
    width: min(1500px, calc(100% - 32px));
    margin-inline: auto;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 34px 0 20px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent);
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    font-size: .78rem;
}

h1, h2, h3, p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1;
}

h2 {
    margin-bottom: 14px;
    font-size: 1.15rem;
}

h3 {
    font-size: .95rem;
    color: var(--muted);
    margin-bottom: 10px;
}

.subtitle,
.hint,
.app-footer {
    color: var(--muted);
}

.subtitle {
    margin-bottom: 0;
}

.layout {
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.controls-panel {
    padding: 22px;
    position: sticky;
    top: 75px;
    z-index: 20;
}

.preview-panel {
    padding: 22px;
    min-height: 72vh;
    position: relative;
    z-index: 10;
}

.mode-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}

.tab,
.btn {
    border: 0;
    border-radius: 14px;
    color: #06111f;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    padding: 11px 13px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .15s ease, opacity .15s ease, filter .15s ease;
}

.tab {
    background: rgba(148, 163, 184, .15);
    color: var(--text);
    border: 1px solid var(--panel-border);
}

.tab.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #06111f;
}

.btn:hover,
.tab:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
}

.btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    transform: none;
}

.btn.secondary {
    color: var(--text);
    background: rgba(148, 163, 184, .14);
    border: 1px solid var(--panel-border);
}

.btn.danger {
    color: white;
    background: var(--danger);
}

.mode-block {
    display: none;
}

.mode-block.active {
    display: block;
}

#captureControls.active {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#captureControls .btn {
    width: 100%;
}

.field-label {
    display: block;
    margin: 0 0 8px;
    color: var(--text);
    font-weight: 700;
}

input[type="file"],
input[type="url"],
select {
    width: 100%;
    color: var(--text);
    background: rgba(2, 6, 23, .42);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 11px 12px;
    outline: none;
}

select option,
select optgroup {
    color: #111827;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.hint {
    font-size: .85rem;
    line-height: 1.45;
    margin: 9px 0 0;
}

hr {
    border: 0;
    border-top: 1px solid var(--panel-border);
    margin: 24px 0;
}

.slider-block {
    margin-top: 18px;
}

.slider-block label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: var(--muted);
    font-weight: 700;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.check-grid {
    display: grid;
    gap: 10px;
    margin-top: 18px;
    color: var(--muted);
}

.check-grid label {
    display: flex;
    gap: 10px;
    align-items: center;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.stats div {
    padding: 12px;
    border-radius: 16px;
    background: rgba(2, 6, 23, .34);
    border: 1px solid var(--panel-border);
}

.stats span {
    display: block;
    font-size: 1.25rem;
    font-weight: 900;
}

.stats small {
    color: var(--muted);
}

.preview-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
}

#statusText {
    color: var(--muted);
    margin-bottom: 16px;
}

.stage {
    display: none;
}

.stage.active {
    display: block;
}

#canvasStage,
.youtube-frame-wrapper,
.original-stage {
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--panel-border);
}

#effectCanvas {
    display: block;
    width: 100%;
    min-height: 360px;
    max-height: 78vh;
    object-fit: contain;
    background: #000;
}

.youtube-frame-wrapper {
    position: relative;
    aspect-ratio: 16 / 9;
}

.youtube-frame-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}

.original-stage {
    margin-top: 18px;
    padding: 14px;
    background: rgba(0, 0, 0, .5);
}

.original-stage.hidden {
    display: none;
}

#sourceVideo {
    width: 100%;
    max-height: 260px;
    display: block;
    border-radius: 14px;
    background: #000;
}

#sourceVideo.hidden {
    display: none;
}

.youtube-original-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 260px;
    border-radius: 14px;
    overflow: hidden;
    background: #000;
}

.youtube-original-wrapper.hidden {
    display: none;
}

.youtube-original-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}

.app-footer {
    margin-top: 36px;
    padding: 24px 20px 32px;
    border-top: 1px solid var(--panel-border);
    font-size: .88rem;
    color: var(--muted);
    background: rgba(15, 23, 42, .45);
    border-radius: var(--radius) var(--radius) 0 0;
    backdrop-filter: blur(8px);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.footer-note {
    margin: 0;
    font-size: .85rem;
    color: var(--muted);
    opacity: 0.85;
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: .88rem;
}

.footer-copy {
    color: var(--text);
}

.footer-divider {
    color: var(--panel-border);
    user-select: none;
}

.footer-dev {
    color: var(--muted);
}

.footer-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: color .2s ease, text-decoration .2s ease;
}

.footer-link:hover {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer-brand {
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0.02em;
}

@media (max-width: 640px) {
    .footer-divider {
        display: none;
    }
    .footer-bottom {
        flex-direction: column;
        gap: 6px;
    }
}

.css-normal { filter: none; }
.css-grayscale { filter: grayscale(100%); }
.css-sepia { filter: sepia(100%) contrast(110%); }
.css-negative { filter: invert(100%); }
.css-contrast { filter: contrast(160%) saturate(130%); }
.css-saturate { filter: saturate(220%); }
.css-cartoon { filter: saturate(200%) contrast(160%) brightness(105%); }
.css-comic { filter: saturate(220%) contrast(200%); }
.css-anime { filter: saturate(160%) contrast(130%) brightness(110%); }
.css-sketch { filter: grayscale(100%) contrast(260%) brightness(110%); }
.css-edges { filter: grayscale(100%) contrast(300%); }
.css-poster { filter: saturate(180%) contrast(160%); }
.css-watercolor { filter: saturate(150%) contrast(95%) brightness(105%) blur(0.5px); }
.css-pixel { image-rendering: pixelated; filter: contrast(135%) saturate(140%); }
.css-vhs { filter: contrast(135%) saturate(130%) hue-rotate(-12deg); }
.css-glitch { filter: contrast(150%) saturate(200%) hue-rotate(15deg); }
.css-heatmap { filter: saturate(300%) hue-rotate(130deg) contrast(160%); }
.css-wave { filter: contrast(130%) saturate(150%); }
.css-fisheye { filter: contrast(120%) saturate(125%); }

@media (max-width: 980px) {
    .app-header,
    .layout {
        width: min(100% - 20px, 900px);
    }

    .app-header {
        flex-direction: column;
        align-items: stretch;
    }

    .layout {
        grid-template-columns: 1fr;
    }

    .controls-panel {
        position: static;
    }
}

/* --- Estilos UI Avanzados (Puntos 2, 3, 4) --- */

#canvasStage {
    position: relative;
}

#effectCanvas.interactive-mode {
    cursor: crosshair;
}

.dynamic-params {
    margin-top: 14px;
    padding: 12px;
    background: rgba(2, 6, 23, .3);
    border: 1px dashed var(--panel-border);
    border-radius: 14px;
}

.dynamic-params:empty {
    display: none;
}

.dynamic-params .slider-block {
    margin-top: 10px;
}

.dynamic-params .slider-block:first-child {
    margin-top: 0;
}

/* Pantalla Dividida (Split Screen) */
.split-bar {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.split-bar.hidden {
    display: none;
}

.split-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 3px;
    background: var(--accent);
    transform: translateX(-50%);
    box-shadow: 0 0 12px var(--accent);
    pointer-events: auto;
    cursor: ew-resize;
    z-index: 10;
}

.split-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #06111f;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .6);
    user-select: none;
}

.split-label {
    position: absolute;
    top: 12px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: .75rem;
    font-weight: 800;
    background: rgba(15, 23, 42, .78);
    border: 1px solid var(--panel-border);
    color: var(--text);
    backdrop-filter: blur(8px);
    user-select: none;
}

.split-label.left {
    left: 12px;
}

.split-label.right {
    right: 12px;
}

/* --- YouTube Overlay & Custom Effects --- */
.youtube-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.25s ease;
    border-radius: 20px;
}

/* CRT Overlay */
.overlay-crt {
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.45) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.04), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.04));
    background-size: 100% 4px, 6px 100%;
    box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.8);
    animation: crtFlicker 0.15s infinite;
}

@keyframes crtFlicker {
    0% { opacity: 0.85; }
    50% { opacity: 1; }
    100% { opacity: 0.88; }
}

/* VHS Overlay */
.overlay-vhs {
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.2) 0px, rgba(0, 0, 0, 0.2) 1px, transparent 1px, transparent 3px),
                linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.1) 50%, transparent 100%);
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.6);
    animation: vhsScan 4s linear infinite;
}

@keyframes vhsScan {
    0% { background-position: 0 0, 0 -100%; }
    100% { background-position: 0 0, 0 100%; }
}

/* Glitch Overlay */
.overlay-glitch {
    background: linear-gradient(90deg, rgba(255, 0, 80, 0.15) 0%, transparent 30%, rgba(0, 240, 255, 0.15) 100%);
    animation: glitchJitter 0.4s infinite alternate;
}

@keyframes glitchJitter {
    0% { transform: translate(0, 0); }
    20% { transform: translate(-2px, 1px); }
    40% { transform: translate(2px, -1px); }
    60% { transform: translate(-1px, 2px); }
    80% { transform: translate(1px, -2px); }
    100% { transform: translate(0, 0); }
}

/* Matrix Overlay */
.overlay-matrix {
    background: repeating-linear-gradient(0deg, rgba(0, 255, 70, 0.15) 0px, transparent 2px),
                radial-gradient(circle, transparent 30%, rgba(0, 25, 5, 0.85) 100%);
    box-shadow: inset 0 0 70px rgba(0, 255, 70, 0.35);
    mix-blend-mode: screen;
}

/* Cyberpunk Overlay */
.overlay-cyberpunk {
    background: linear-gradient(135deg, rgba(255, 0, 128, 0.3), rgba(0, 240, 255, 0.3));
    mix-blend-mode: overlay;
}

/* Heatmap Overlay */
.overlay-heatmap {
    background: linear-gradient(180deg, rgba(255, 0, 0, 0.25) 0%, rgba(255, 255, 0, 0.2) 50%, rgba(0, 0, 255, 0.25) 100%);
    mix-blend-mode: color-burn;
}

/* Wave Overlay */
.overlay-wave {
    background: repeating-radial-gradient(circle at 50% 50%, transparent 0, rgba(255, 255, 255, 0.08) 10px, transparent 20px);
    animation: wavePulse 2s infinite ease-in-out;
}

@keyframes wavePulse {
    0% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.03); opacity: 0.8; }
    100% { transform: scale(1); opacity: 0.5; }
}

/* Fisheye Overlay */
.overlay-fisheye {
    background: radial-gradient(circle at 50% 50%, transparent 40%, rgba(0, 0, 0, 0.75) 100%);
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.9);
}

/* Swirl / Ripple Overlay */
.overlay-swirl,
.overlay-ripple {
    background: radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.2) 0%, transparent 70%);
    mix-blend-mode: screen;
}

/* PRO Filter Overlays para YouTube */
.overlay-ascii {
    background: repeating-linear-gradient(0deg, rgba(0, 255, 65, 0.18) 0px, transparent 2px, transparent 4px),
                repeating-linear-gradient(90deg, rgba(0, 255, 65, 0.12) 0px, transparent 2px, transparent 4px);
    mix-blend-mode: screen;
}

.overlay-thermal_vision {
    background: linear-gradient(180deg, rgba(0, 0, 255, 0.25), rgba(255, 0, 255, 0.2), rgba(255, 255, 0, 0.25));
    mix-blend-mode: color-dodge;
}

.overlay-kaleidoscope {
    background: radial-gradient(circle at 50% 50%, rgba(255, 0, 200, 0.2), rgba(0, 240, 255, 0.2), transparent 70%);
    mix-blend-mode: color-dodge;
}

.overlay-synthwave_80s {
    background: linear-gradient(180deg, rgba(255, 0, 160, 0.25) 0%, rgba(120, 0, 255, 0.2) 60%, rgba(0, 240, 255, 0.3) 100%),
                repeating-linear-gradient(0deg, rgba(255, 0, 180, 0.15) 0px, transparent 2px, transparent 12px);
    mix-blend-mode: overlay;
}

.overlay-halftone {
    background: radial-gradient(circle, rgba(0, 0, 0, 0.4) 20%, transparent 20%);
    background-size: 8px 8px;
    mix-blend-mode: multiply;
}

.overlay-oil_painting {
    background: radial-gradient(circle at 50% 50%, rgba(255, 240, 200, 0.15), transparent 80%);
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.4);
}

.overlay-chromatic_zoom {
    background: radial-gradient(circle at 50% 50%, transparent 20%, rgba(255, 0, 100, 0.25) 70%, rgba(0, 200, 255, 0.3) 100%);
    animation: wavePulse 1.5s infinite ease-in-out;
}

.overlay-bloom_glow {
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.35) 0%, rgba(56, 189, 248, 0.2) 50%, transparent 80%);
    mix-blend-mode: screen;
}

/* --- Tooltips y Cuadro de Ayuda --- */
/* Elevación de z-index del contenedor padre cuando se pasa el mouse por un tooltip */
.controls-panel:has(.info-tooltip:hover),
.preview-panel:has(.info-tooltip:hover),
.field-label:has(.info-tooltip:hover),
.slider-block:has(.info-tooltip:hover),
.preset-block:has(.info-tooltip:hover) {
    z-index: 9999 !important;
}

.info-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: rgba(56, 189, 248, 0.2);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 800;
    cursor: help;
    margin-left: 6px;
    position: relative;
    vertical-align: middle;
    user-select: none;
    transition: background 0.15s ease, transform 0.15s ease;
}

.info-tooltip:hover {
    background: var(--accent);
    color: #06111f;
    transform: scale(1.15);
    z-index: 10000 !important;
}

.info-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 135%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: rgba(15, 23, 42, 0.98);
    color: #f8fafc;
    border: 1px.5px solid var(--accent);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: normal;
    width: max-content;
    max-width: 280px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.85), 0 0 20px rgba(56, 189, 248, 0.35);
    backdrop-filter: blur(16px);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 10001 !important;
    text-align: left;
}

.info-tooltip::before {
    content: '';
    position: absolute;
    bottom: 112%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 7px;
    border-style: solid;
    border-color: rgba(56, 189, 248, 0.8) transparent transparent transparent;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 10002 !important;
}

.info-tooltip:hover::after,
.info-tooltip:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.filter-help-box {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.45);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: #cbd5e1;
    font-size: 0.82rem;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.filter-help-box::before {
    content: "💡";
    font-size: 0.95rem;
    flex-shrink: 0;
}

/* --- Marca de Agua Flotante (Visit www.distortfx.app) --- */
.watermark-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 30;
    pointer-events: none;
    user-select: none;
    background: rgba(15, 23, 42, 0.82);
    border: 1.5px solid rgba(56, 189, 248, 0.55);
    color: #f8fafc;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    padding: 8px 18px;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.65), 0 0 16px rgba(56, 189, 248, 0.35);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.35;
    transition: top 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), left 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.watermark-main {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #f8fafc;
}

.watermark-sub {
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--accent);
    opacity: 0.92;
    margin-top: 2px;
}

/* --- Navbar Profesional Superior --- */
.navbar-pro {
    background: rgba(15, 23, 42, 0.85);
    border-bottom: 1px solid var(--panel-border);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 10px 24px;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: nowrap;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.brand-logo {
    font-size: 1.45rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #f8fafc 30%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-badge {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.06em;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.brand-sub {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-left: 6px;
    display: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

@media (min-width: 1280px) {
    .brand-sub { display: inline-block; }
}

.nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
}

.nav-link {
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.06);
}

.nav-link.active {
    color: var(--accent);
    background: rgba(56, 189, 248, 0.12);
}

.nav-link.highlight {
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.08);
}

.nav-link.highlight:hover {
    background: rgba(251, 191, 36, 0.2);
    box-shadow: 0 0 16px rgba(251, 191, 36, 0.25);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.lang-select {
    background: rgba(2, 6, 23, 0.6);
    border: 1px solid var(--panel-border);
    color: #f8fafc;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    white-space: nowrap;
}

.lang-select:focus {
    border-color: var(--accent);
}

.user-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.82rem;
    white-space: nowrap;
}

.user-badge {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 12px;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.user-badge.free {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.user-badge.pro {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #000;
    border: none;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.icon-btn {
    padding: 7px 9px;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

@media (max-width: 980px) {
    .nav-container {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .nav-links {
        flex: none;
        width: 100%;
        justify-content: center;
    }
}

/* Utilidad global para ocultar elementos */
.hidden {
    display: none !important;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-backdrop.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: flex !important;
}

.modal-card {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(56, 189, 248, 0.15);
    overflow: hidden;
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-card.modal-wide {
    max-width: 1040px;
    width: 95%;
}

@keyframes modalPop {
    from { transform: scale(0.92) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(2, 6, 23, 0.4);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 400;
    color: #f8fafc;
}

.modal-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease;
}

.modal-close:hover {
    color: #f8fafc;
}

.modal-body {
    padding: 24px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-desc {
    color: #94a3b8;
    font-size: 0.88rem;
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
}

.modal-tabs {
    display: flex;
    background: rgba(2, 6, 23, 0.5);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: var(--accent);
    color: #06111f;
    box-shadow: 0 2px 10px rgba(56, 189, 248, 0.3);
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Tarjeta de Perfil de Usuario en Modal */
.user-profile-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 10px 0;
}

.profile-avatar {
    font-size: 2.8rem;
    line-height: 1;
    background: rgba(56, 189, 248, 0.1);
    border: 2px solid var(--accent);
    padding: 14px;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
}

.user-profile-box h4 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: #f8fafc;
}

.profile-email {
    margin: 0;
    font-size: 0.88rem;
    color: #94a3b8;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-top: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #cbd5e1;
}

.form-group input,
.form-group textarea {
    background: rgba(2, 6, 23, 0.6);
    border: 1px solid var(--panel-border);
    color: #f8fafc;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

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

.full-width {
    width: 100%;
}

.form-message {
    font-size: 0.82rem;
    font-weight: 600;
    margin: 0;
    min-height: 20px;
    text-align: center;
}

.form-message.error { color: #f87171; }
.form-message.success { color: #4ade80; }

/* Planes PRO Grid */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.plan-card {
    background: rgba(2, 6, 23, 0.4);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.plan-card.pro {
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid #f59e0b;
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.2);
}

.plan-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.plan-badge.pro {
    background: #f59e0b;
    color: #000;
}

.plan-card.paypal {
    background: rgba(15, 23, 42, 0.85);
    border: 2px solid #0070ba;
    box-shadow: 0 0 25px rgba(0, 112, 186, 0.25);
}

.plan-badge.paypal {
    background: linear-gradient(135deg, #0070ba 0%, #003087 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.plan-card h4 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    color: #f8fafc;
}

.plan-price {
    font-size: 1.5rem;
    font-weight: 900;
    color: #cbd5e1;
    margin-bottom: 16px;
}

.plan-price.pro {
    color: #fbbf24;
    margin-bottom: 2px;
}

.plan-price.paypal {
    color: #38bdf8;
    margin-bottom: 2px;
}

.plan-price-annual {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 16px;
    letter-spacing: 0.02em;
}

.plan-price-annual.paypal {
    color: #ffc439;
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: 0.02em;
}

.btn-paypal-checkout {
    background: linear-gradient(135deg, #0070ba 0%, #00458e 100%);
    color: #ffffff;
    font-weight: 700;
    border: 1px solid #38bdf8;
    box-shadow: 0 4px 15px rgba(0, 112, 186, 0.35);
    transition: all 0.25s ease;
    cursor: pointer;
}

.btn-paypal-checkout:hover {
    background: linear-gradient(135deg, #0082d6 0%, #0054ad 100%);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.45);
    transform: translateY(-1px);
}

.pp-plan-btn {
    background: rgba(30, 41, 59, 0.7);
    color: #94a3b8;
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pp-plan-btn:hover {
    color: #ffffff;
    border-color: rgba(56, 189, 248, 0.6);
    background: rgba(14, 165, 233, 0.15);
}

.pp-plan-btn.active {
    background: linear-gradient(135deg, #0070ba 0%, #00458e 100%) !important;
    color: #ffffff !important;
    border-color: #38bdf8 !important;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.4) !important;
    opacity: 1 !important;
}

.paypal-notice-box {
    font-size: 0.76rem;
    line-height: 1.35;
    text-align: center;
    color: #93c5fd;
    background: rgba(0, 112, 186, 0.12);
    border: 1px dashed rgba(56, 189, 248, 0.4);
    border-radius: 8px;
    padding: 8px 10px;
    margin-top: 4px;
}

#paypal-button-container {
    margin-top: 4px;
    position: relative;
    z-index: 1;
}

#paypal-status-alert.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid #10b981;
    color: #34d399;
}

#paypal-status-alert.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid #ef4444;
    color: #f87171;
}

#paypal-status-alert.info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid #3b82f6;
    color: #93c5fd;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.82rem;
    color: #cbd5e1;
}

.plan-features li.negative {
    color: #64748b;
}

.pro-redeem-box {
    background: rgba(2, 6, 23, 0.5);
    border: 1px dashed var(--panel-border);
    border-radius: 14px;
    padding: 16px;
}

.pro-redeem-box h4 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    color: #f8fafc;
}

/* Guía OBS */
.guide-steps {
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.guide-steps li {
    background: rgba(2, 6, 23, 0.4);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 0.88rem;
    line-height: 1.4;
    color: #cbd5e1;
}

/* Avatar de Perfil & File Upload */
.avatar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.profile-avatar-wrapper {
    position: relative;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 3px solid var(--accent, #6366f1);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.profile-avatar-wrapper:hover {
    transform: scale(1.05);
    box-shadow: 0 0 22px rgba(99, 102, 241, 0.7);
}

.profile-avatar-wrapper:hover .avatar-overlay {
    opacity: 1;
}

.profile-avatar-icon {
    font-size: 48px;
    line-height: 1;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    font-size: 26px;
    backdrop-filter: blur(2px);
}

.avatar-upload-btn {
    margin-top: 10px;
    font-size: 0.82rem;
    padding: 6px 14px;
}

.avatar-message {
    font-size: 0.82rem;
    margin-top: 6px;
    min-height: 20px;
}

.nav-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent, #6366f1);
    margin-right: 6px;
    vertical-align: middle;
}

/* Modal Profesional de Confirmación de Pago PRO */
.pro-success-modal {
    max-width: 520px;
    border: 2px solid rgba(245, 158, 11, 0.65);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 40px rgba(245, 158, 11, 0.25);
}

.pro-success-header {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.16) 0%, rgba(2, 6, 23, 0.6) 100%);
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
}

.pro-success-body {
    text-align: center;
    padding: 28px 26px 24px;
}

.pro-success-icon-wrap {
    position: relative;
    width: 82px;
    height: 82px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.28) 0%, rgba(15, 23, 42, 0.9) 75%);
    border: 2px solid #f59e0b;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 28px rgba(245, 158, 11, 0.4);
}

.pro-success-crown {
    font-size: 2.5rem;
    line-height: 1;
}

.pro-success-check {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #10b981;
    color: #022c22;
    font-size: 0.95rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #0f172a;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.6);
}

.pro-success-title {
    margin: 0 0 8px;
    font-size: 1.45rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fde68a 0%, #f59e0b 55%, #fbbf24 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.pro-success-subtitle {
    margin: 0 0 20px;
    font-size: 0.9rem;
    color: #cbd5e1;
    line-height: 1.45;
}

.pro-success-details {
    background: rgba(2, 6, 23, 0.65);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.pro-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.85rem;
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(148, 163, 184, 0.14);
}

.pro-detail-row:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.pro-detail-label {
    color: #94a3b8;
    font-weight: 600;
}

.pro-detail-value {
    color: #f8fafc;
    font-weight: 700;
}

.badge-pro-active {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #06111f;
    font-size: 0.72rem;
    font-weight: 900;
    padding: 3px 10px;
    border-radius: 999px;
    letter-spacing: 0.04em;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.pro-detail-code {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    color: #38bdf8;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-family: monospace;
}

.pro-success-perks {
    list-style: none;
    padding: 12px 14px;
    margin: 0 0 20px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 12px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 0.82rem;
    color: #d1fae5;
}

.pro-success-cta {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #06111f;
    font-weight: 800;
    font-size: 0.95rem;
    padding: 12px 18px;
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pro-success-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(245, 158, 11, 0.55);
}

/* Términos y Condiciones / Deslinde Legal en Registro, Footer y Modal */
.terms-check-group {
    margin-top: 2px;
    padding: 10px 12px;
    background: rgba(2, 6, 23, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
}

.terms-check-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.81rem;
    line-height: 1.45;
    color: #cbd5e1;
    cursor: pointer;
    user-select: none;
}

.terms-check-label input[type="checkbox"] {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    accent-color: var(--accent, #38bdf8);
    cursor: pointer;
    flex-shrink: 0;
}

.terms-inline-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent, #38bdf8);
    font-size: 0.81rem;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    display: inline;
    text-align: left;
}

.terms-inline-link:hover {
    color: #7dd3fc;
}

#btnRegisterSubmit:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    filter: grayscale(45%);
    box-shadow: none;
}

.footer-legal-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--accent, #38bdf8);
    font-size: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color 0.15s ease;
}

.footer-legal-link:hover {
    color: #7dd3fc;
}

.modal-terms-backdrop {
    z-index: 1150;
}

.modal-terms-card {
    max-width: 720px;
    width: 95%;
}

.terms-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.terms-legal-box {
    background: rgba(2, 6, 23, 0.65);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 18px 20px;
    max-height: 55vh;
    overflow-y: auto;
    color: #cbd5e1;
    font-size: 0.85rem;
    line-height: 1.58;
    text-align: left;
}

.terms-legal-box h4 {
    color: #f8fafc;
    font-size: 0.94rem;
    font-weight: 800;
    margin: 16px 0 6px;
}

.terms-legal-box h4:first-child {
    margin-top: 0;
}

.terms-legal-box p {
    margin: 0 0 10px;
    color: #cbd5e1;
}

.terms-legal-list {
    margin: 6px 0 12px;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.terms-legal-list li {
    color: #cbd5e1;
}

.terms-modal-actions {
    margin-top: 4px;
}






