/* ════════════════════════════════════════════════════════════════
   BIOMAGNETISMO PARA TODOS — Design System v11.0 "Aurora"
   Ultra-premium medical-grade UI · Glassmorphism · Fluid typography
   ════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Sora:wght@600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ═══════════ DESIGN TOKENS ═══════════ */
:root {
    /* Surfaces */
    --bg: #F6F7FB;
    --bg-card: #FFFFFF;
    --bg-surface: #EEF0F6;
    --bg-elevated: #FFFFFF;
    --bg-dark: #0B1120;
    --bg-glass: rgba(255,255,255,0.72);
    --bg-glass-strong: rgba(255,255,255,0.88);

    /* Text */
    --text: #101828;
    --text-secondary: #475467;
    --text-muted: #98A2B3;

    /* Borders */
    --border: #E4E7EF;
    --border-light: #F0F2F7;
    --border-strong: #D0D5DF;

    /* Brand */
    --primary: #5B5BD6;
    --primary-light: #7C7CF0;
    --primary-dark: #4646B8;
    --primary-bg: #EEEEFC;
    --primary-bg-hover: #E1E1FA;

    /* Semantic palette */
    --red: #E5484D;      --red-bg: #FEEEEE;      --red-dark: #CE2C31;
    --green: #12A150;    --green-bg: #E9F9EF;
    --amber: #E79A13;    --amber-bg: #FEF6E7;
    --blue: #2F80ED;     --blue-bg: #EAF2FE;
    --purple: #8E4EC6;   --purple-bg: #F5EEFC;
    --teal: #0D9488;     --teal-bg: #E6F7F5;
    --pink: #D6409F;     --pink-bg: #FCEEF7;
    --orange: #F76B15;   --orange-bg: #FEF0E6;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(16,24,40,0.04);
    --shadow-sm: 0 1px 3px rgba(16,24,40,0.07), 0 1px 2px rgba(16,24,40,0.04);
    --shadow: 0 4px 8px -2px rgba(16,24,40,0.08), 0 2px 4px -2px rgba(16,24,40,0.04);
    --shadow-md: 0 12px 16px -4px rgba(16,24,40,0.08), 0 4px 6px -2px rgba(16,24,40,0.04);
    --shadow-lg: 0 20px 24px -4px rgba(16,24,40,0.09), 0 8px 8px -4px rgba(16,24,40,0.035);
    --shadow-xl: 0 25px 50px -12px rgba(16,24,40,0.22);
    --glow-primary: 0 0 0 4px rgba(91,91,214,0.13);
    --glow-red: 0 0 0 4px rgba(229,72,77,0.13);

    /* Geometry */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 18px;
    --radius-xl: 26px;
    --radius-full: 9999px;

    /* Motion */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition: all 0.2s var(--ease);
    --transition-slow: all 0.35s var(--ease);

    /* Typography */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Sora', 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

    /* Layout */
    --header-h: 62px;
    --bottom-nav-h: 66px;
    --content-max: 820px;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #5B5BD6 0%, #7C5CD6 55%, #9D5CE0 100%);
    --gradient-neg: linear-gradient(135deg, #3538CD 0%, #5B5BD6 100%);
    --gradient-pos: linear-gradient(135deg, #CE2C31 0%, #E5484D 100%);
    --gradient-emotions: linear-gradient(135deg, #8E4EC6 0%, #D6409F 100%);
    --gradient-protocols: linear-gradient(135deg, #0D9488 0%, #2F80ED 100%);
    --gradient-favorites: linear-gradient(135deg, #E5484D 0%, #D6409F 100%);
    --gradient-guide: linear-gradient(135deg, #E79A13 0%, #F76B15 100%);
}

[data-theme="dark"] {
    --bg: #0B1120;
    --bg-card: #151B2C;
    --bg-surface: #1C2438;
    --bg-elevated: #232C44;
    --bg-glass: rgba(15,20,36,0.72);
    --bg-glass-strong: rgba(15,20,36,0.9);

    --text: #F2F4F8;
    --text-secondary: #A9B4C8;
    --text-muted: #64748B;

    --border: #263049;
    --border-light: #1C2438;
    --border-strong: #344263;

    --primary: #8B8BF5;
    --primary-light: #A5A5FA;
    --primary-dark: #6D6DE8;
    --primary-bg: rgba(139,139,245,0.14);
    --primary-bg-hover: rgba(139,139,245,0.24);

    --red: #F27276;      --red-bg: rgba(229,72,77,0.14);
    --green: #3DD68C;    --green-bg: rgba(18,161,80,0.15);
    --amber: #F5B349;    --amber-bg: rgba(231,154,19,0.14);
    --blue: #6BA6F8;     --blue-bg: rgba(47,128,237,0.15);
    --purple: #BE93E4;   --purple-bg: rgba(142,78,198,0.16);
    --teal: #37C9BB;     --teal-bg: rgba(13,148,136,0.15);
    --pink: #E38EC3;     --pink-bg: rgba(214,64,159,0.15);
    --orange: #FA934E;   --orange-bg: rgba(247,107,21,0.15);

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.25);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow: 0 4px 8px -2px rgba(0,0,0,0.35);
    --shadow-md: 0 12px 16px -4px rgba(0,0,0,0.4);
    --shadow-lg: 0 20px 24px -4px rgba(0,0,0,0.45);
    --shadow-xl: 0 25px 50px -12px rgba(0,0,0,0.6);
    --glow-primary: 0 0 0 4px rgba(139,139,245,0.16);
    --glow-red: 0 0 0 4px rgba(242,114,118,0.16);
}

/* ═══════════ RESET & BASE ═══════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: var(--font); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); background-clip: padding-box; }
::selection { background: var(--primary); color: white; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ═══════════ SPLASH SCREEN ═══════════ */
.splash {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(160deg, #0B1120 0%, #171A3E 35%, #2B2470 68%, #131637 100%);
    transition: opacity 0.7s ease, transform 0.7s ease;
    overflow: hidden;
}
.splash.hidden { opacity: 0; transform: scale(1.06); pointer-events: none; }

.splash-bg {
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 30% 20%, rgba(91,91,214,0.18) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 80%, rgba(142,78,198,0.14) 0%, transparent 60%);
}
.splash-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}
.splash-orb {
    position: absolute; border-radius: 50%;
    filter: blur(90px); opacity: 0.38;
    animation: orbFloat 9s ease-in-out infinite;
}
.splash-orb-1 { width: 420px; height: 420px; background: #5B5BD6; top: -110px; left: -110px; }
.splash-orb-2 { width: 360px; height: 360px; background: #8E4EC6; bottom: -90px; right: -90px; animation-delay: -3s; }
.splash-orb-3 { width: 260px; height: 260px; background: #D6409F; top: 50%; left: 50%; transform: translate(-50%,-50%); animation-delay: -6s; }

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -40px) scale(1.06); }
    66% { transform: translate(-24px, 30px) scale(0.94); }
}

.splash-content {
    position: relative; z-index: 2;
    text-align: center;
    padding: 2rem;
    max-width: 440px;
    animation: splashRise 0.9s var(--ease-spring) both;
}
@keyframes splashRise {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: translateY(0); }
}

.splash-logo-wrap {
    display: flex; align-items: center; justify-content: center;
    gap: 1.5rem; margin-bottom: 2.2rem;
}
.splash-magnet {
    width: 76px; height: 76px;
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900; font-size: 1.7rem;
    font-family: var(--font-display);
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: magnetPulse 2.5s ease-in-out infinite;
    color: white;
}
.splash-magnet-n { background: var(--gradient-neg); }
.splash-magnet-s { background: var(--gradient-pos); animation-delay: -1.25s; }
.magnet-field {
    position: absolute; inset: -9px;
    border-radius: 25px;
    border: 2px solid rgba(255,255,255,0.16);
    animation: fieldPulse 2.5s ease-in-out infinite;
}
.splash-magnet-s .magnet-field { animation-delay: -1.25s; }

@keyframes magnetPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes fieldPulse { 0%, 100% { opacity: 0.3; transform: scale(1); } 50% { opacity: 0.75; transform: scale(1.14); } }

.splash-energy { display: flex; flex-direction: column; gap: 7px; width: 62px; }
.energy-line {
    height: 3px;
    background: linear-gradient(90deg, rgba(91,91,214,0.7), rgba(214,64,159,0.7), rgba(229,72,77,0.7));
    border-radius: 3px;
    animation: energyFlow 1.8s ease-in-out infinite;
}
.energy-line:nth-child(2) { animation-delay: -0.3s; width: 80%; margin: 0 auto; }
.energy-line:nth-child(3) { animation-delay: -0.6s; width: 60%; margin: 0 auto; }
@keyframes energyFlow { 0%, 100% { opacity: 0.3; transform: scaleX(0.6); } 50% { opacity: 1; transform: scaleX(1); } }

.splash-title {
    font-family: var(--font-display);
    font-size: clamp(2.1rem, 8vw, 2.6rem);
    font-weight: 800;
    background: linear-gradient(135deg, #FFFFFF 0%, #C7D2FE 45%, #C4A5F5 85%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    line-height: 1.15; margin-bottom: 0.75rem; letter-spacing: -0.03em;
}
.splash-title span {
    font-weight: 600; font-size: 0.62em;
    background: linear-gradient(135deg, #C7D2FE 0%, #A5B4FC 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.splash-subtitle {
    color: rgba(255,255,255,0.62);
    font-size: 0.95rem; margin-bottom: 2rem;
    font-weight: 300; letter-spacing: 0.01em;
}
.splash-stats {
    display: flex; align-items: center; justify-content: center;
    gap: 1.5rem; margin-bottom: 2.2rem;
    padding: 1.1rem 1.6rem;
    background: rgba(255,255,255,0.055);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.splash-stat { text-align: center; }
.splash-stat-num {
    font-family: var(--font-display);
    font-size: 1.6rem; font-weight: 800;
    background: linear-gradient(135deg, #A5A5FA, #C4A5F5);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}
.splash-stat-label { color: rgba(255,255,255,0.5); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 500; margin-top: 2px; }
.splash-stat-divider { width: 1px; height: 38px; background: rgba(255,255,255,0.11); }

.splash-btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 15px 40px;
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: 1.02rem; font-weight: 700;
    transition: var(--transition);
    box-shadow: 0 6px 22px rgba(91,91,214,0.42), inset 0 1px 0 rgba(255,255,255,0.2);
    letter-spacing: 0.01em;
    position: relative; overflow: hidden;
}
.splash-btn::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.25) 50%, transparent 60%);
    transform: translateX(-100%);
    animation: btnShine 3.2s ease-in-out infinite;
}
@keyframes btnShine { 0%, 65% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
/* Solo para lectores de pantalla: fuera de la vista pero anunciado. */
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Estado de carga: los scripts van con `defer`, así que hay un instante en que
   el botón está pintado pero aún no es funcional. Se muestra como "cargando". */
.splash-btn[disabled] { opacity: 0.62; cursor: progress; }
.splash-btn[disabled]:hover { transform: none; box-shadow: 0 6px 22px rgba(91,91,214,0.42); }
.splash-btn:not([disabled]):hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(91,91,214,0.55); }
.splash-btn:active { transform: translateY(0); }
.splash-btn i { transition: transform 0.25s var(--ease-spring); }
.splash-btn:hover i { transform: translateX(4px); }

.splash-credits {
    margin-top: 1.6rem;
    color: rgba(255,255,255,0.32);
    font-size: 0.72rem; font-weight: 300; letter-spacing: 0.02em;
}

/* ═══════════ APP LAYOUT ═══════════ */
.app { display: none; min-height: 100vh; }
.app.active { display: block; animation: fadeIn 0.5s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.main {
    padding: calc(var(--header-h) + 10px) 16px calc(var(--bottom-nav-h) + 24px);
    max-width: var(--content-max);
    margin: 0 auto;
}

/* ═══════════ HEADER ═══════════ */
.header {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--header-h);
    z-index: 100;
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    background: var(--bg-glass);
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}
.header-inner {
    max-width: var(--content-max);
    margin: 0 auto; height: 100%;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px;
}
.header-brand { display: flex; align-items: center; gap: 11px; cursor: pointer; border-radius: var(--radius-sm); }
.header-logo {
    width: 40px; height: 40px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 1.05rem;
    box-shadow: 0 3px 10px rgba(91,91,214,0.35), inset 0 1px 0 rgba(255,255,255,0.25);
    transition: var(--transition);
}
.header-brand:hover .header-logo { transform: rotate(-8deg) scale(1.05); }
.header-title-wrap { display: flex; flex-direction: column; line-height: 1.15; }
.header-title {
    font-family: var(--font-display);
    font-size: 1.08rem; font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}
.header-subtitle {
    font-size: 0.62rem; font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.14em;
}
.header-actions { display: flex; gap: 6px; }
.header-btn {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    transition: var(--transition);
    background: var(--bg-surface);
    border: 1px solid transparent;
}
.header-btn:hover {
    background: var(--primary-bg);
    color: var(--primary);
    border-color: var(--primary-bg-hover);
    transform: translateY(-1px);
}
.header-btn:active { transform: translateY(0) scale(0.96); }

/* ═══════════ SECTION HEROES ═══════════ */
.section-hero {
    position: relative;
    text-align: center;
    padding: 34px 20px 30px;
    margin-bottom: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.section-hero::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 5px;
    background: var(--gradient-primary);
}
.hero-emotions::before { background: var(--gradient-emotions); }
.hero-protocols::before { background: var(--gradient-protocols); }
.hero-favorites::before { background: var(--gradient-favorites); }
.hero-guide::before { background: var(--gradient-guide); }

.section-hero-icon {
    width: 58px; height: 58px;
    margin: 0 auto 14px;
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.45rem; color: white;
    background: var(--gradient-primary);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.25);
}
.hero-emotions .section-hero-icon { background: var(--gradient-emotions); }
.hero-protocols .section-hero-icon { background: var(--gradient-protocols); }
.hero-favorites .section-hero-icon { background: var(--gradient-favorites); }
.hero-guide .section-hero-icon { background: var(--gradient-guide); }

.section-hero h2 {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 4.5vw, 1.55rem);
    font-weight: 800; color: var(--text);
    margin-bottom: 8px; letter-spacing: -0.02em;
}
.section-hero p {
    color: var(--text-secondary);
    font-size: 0.89rem; line-height: 1.6;
    max-width: 520px; margin: 0 auto;
}

/* ═══════════ STICKY SEARCH ═══════════ */
.sticky-search {
    position: sticky;
    top: var(--header-h);
    z-index: 50;
    padding: 12px 16px 8px;
    background: var(--bg);
    margin: 0 -16px;
    transition: box-shadow 0.25s ease, background 0.25s ease;
}
.sticky-search.scrolled {
    background: var(--bg-glass-strong);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    box-shadow: 0 8px 24px rgba(16,24,40,0.09);
    border-bottom: 1px solid var(--border-light);
}
.search-box {
    position: relative;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    transition: var(--transition);
    box-shadow: var(--shadow);
}
.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: var(--glow-primary), var(--shadow-md);
}
.search-input-wrap { display: flex; align-items: center; padding: 0 16px; height: 56px; }
.search-icon { color: var(--text-muted); font-size: 1.05rem; margin-right: 12px; display: flex; transition: var(--transition); }
.search-box:focus-within .search-icon { color: var(--primary); }
.search-input {
    flex: 1; border: none; background: none;
    font-size: 1rem; color: var(--text);
    outline: none; font-weight: 500; min-width: 0;
}
.search-input::placeholder { color: var(--text-muted); font-weight: 400; }
.search-actions { display: flex; gap: 4px; align-items: center; }
.search-kbd {
    font-family: var(--font-mono);
    font-size: 0.68rem; font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 8px;
    margin-right: 2px;
}
@media (max-width: 640px) { .search-kbd { display: none; } }
.search-btn {
    width: 38px; height: 38px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 0.9rem;
    transition: var(--transition);
}
.search-btn:hover { background: var(--bg-surface); color: var(--primary); }
.search-btn.recording { color: var(--red); animation: recordPulse 1s infinite; background: var(--red-bg); }
@keyframes recordPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }

/* Search suggestions dropdown */
.search-suggestions {
    display: none;
    position: absolute;
    top: calc(100% + 6px); left: -2px; right: -2px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    z-index: 60;
    max-height: 340px;
    overflow-y: auto;
}
.search-suggestions.open { display: block; animation: suggestIn 0.18s var(--ease); }
@keyframes suggestIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.suggestion-group-label {
    padding: 10px 16px 4px;
    font-size: 0.64rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-muted);
}
.suggestion-item {
    display: flex; align-items: center; gap: 12px;
    width: 100%; text-align: left;
    padding: 10px 16px;
    font-size: 0.86rem; color: var(--text);
    transition: background 0.12s ease;
    border: none;
}
.suggestion-item:hover, .suggestion-item.highlighted { background: var(--primary-bg); }
.suggestion-item i { width: 18px; text-align: center; color: var(--text-muted); font-size: 0.8rem; flex-shrink: 0; }
.suggestion-item .sug-type {
    margin-left: auto; flex-shrink: 0;
    font-size: 0.6rem; font-weight: 700;
    padding: 2px 8px; border-radius: var(--radius-full);
}
.suggestion-item mark { background: none; color: var(--primary); font-weight: 700; }

/* ═══════════ CATEGORY CHIPS ═══════════ */
.category-chips {
    display: flex; gap: 8px;
    overflow-x: auto;
    padding: 10px 2px 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.category-chips::-webkit-scrollbar { display: none; }
.cat-chip {
    flex-shrink: 0;
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 16px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.78rem; font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    white-space: nowrap;
}
.cat-chip i { font-size: 0.78rem; }
.cat-chip:hover { border-color: var(--primary-light); color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.cat-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(91,91,214,0.35);
}
.cat-chip.active i { color: white !important; }
.cat-chip .chip-count {
    font-size: 0.62rem; font-weight: 700;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    color: var(--text-muted);
    font-family: var(--font-mono);
}
.cat-chip.active .chip-count { background: rgba(255,255,255,0.22); color: white; }

/* ═══════════ ACTIVE FILTER BAR ═══════════ */
.active-filter-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 14px; margin-top: 10px;
    background: var(--primary-bg);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    animation: slideDown 0.2s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.active-filter-label {
    font-size: 0.78rem; font-weight: 600; color: var(--primary);
    display: flex; align-items: center; gap: 7px;
}
.active-filter-clear {
    width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(91,91,214,0.15); color: var(--primary);
    font-size: 0.7rem; transition: var(--transition);
}
.active-filter-clear:hover { background: var(--primary); color: white; transform: rotate(90deg); }

/* ═══════════ RESULTS INFO ═══════════ */
.results-info {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 2px 10px;
    font-size: 0.78rem; color: var(--text-muted);
}
.results-count { font-weight: 600; }
.results-count strong { color: var(--primary); font-family: var(--font-mono); }
.sort-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.72rem; font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
}
.sort-btn:hover { background: var(--primary-bg); color: var(--primary); border-color: var(--primary-light); }

/* ═══════════ PAIRS GRID & CARDS ═══════════ */
.pairs-grid { display: grid; gap: 12px; }
@media (min-width: 700px) { .pairs-grid { grid-template-columns: repeat(2, 1fr); } }

.pair-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    animation: cardIn 0.35s var(--ease) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.pair-card::before {
    content: '';
    position: absolute; top: 0; left: 0;
    width: 4px; height: 100%;
    border-radius: 0 4px 4px 0;
    opacity: 0;
    background: var(--gradient-primary);
    transition: var(--transition);
}
.pair-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}
.pair-card:hover::before { opacity: 1; }
.pair-card:active { transform: translateY(-1px); }

.pair-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.pair-card-id {
    font-size: 0.64rem; font-weight: 700;
    color: var(--primary);
    background: var(--primary-bg);
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-family: var(--font-mono);
    white-space: nowrap;
}
.pair-card-type {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.64rem; font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    text-transform: capitalize;
}
.pair-card-views { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.pair-fav-flag { color: var(--red); font-size: 0.82rem; }

.pair-card-title {
    font-size: 0.98rem; font-weight: 700;
    color: var(--text); line-height: 1.3;
    margin-bottom: 10px; letter-spacing: -0.01em;
}
.pair-card-points { display: flex; flex-direction: column; gap: 7px; }
.pair-card-point {
    display: flex; align-items: center; gap: 9px;
    font-size: 0.8rem; color: var(--text-secondary); line-height: 1.35;
}
.pair-card-pole {
    width: 25px; height: 25px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.6rem; font-weight: 800; color: white; flex-shrink: 0;
}
.pair-card-pole.neg { background: var(--gradient-neg); box-shadow: 0 2px 6px rgba(53,56,205,0.35); }
.pair-card-pole.pos { background: var(--gradient-pos); box-shadow: 0 2px 6px rgba(206,44,49,0.35); }

/* Type colors */
.type-virus { background: var(--red-bg); color: var(--red); }
.type-bacteria { background: var(--purple-bg); color: var(--purple); }
.type-parasito { background: var(--amber-bg); color: var(--amber); }
.type-hongo { background: var(--green-bg); color: var(--green); }
.type-especial { background: var(--pink-bg); color: var(--pink); }
.type-emocional { background: var(--blue-bg); color: var(--blue); }
.type-disfuncion { background: var(--teal-bg); color: var(--teal); }
.type-reservorio { background: var(--orange-bg); color: var(--orange); }
.type-dolor { background: var(--blue-bg); color: var(--blue); }

/* ═══════════ BOTTOM NAV ═══════════ */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: flex;
    z-index: 100;
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    background: var(--bg-glass-strong);
    border-top: 1px solid var(--border-light);
}
.nav-item {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.6rem; font-weight: 600;
    transition: var(--transition);
    padding-top: 6px;
    position: relative;
}
.nav-item i { font-size: 1.12rem; transition: transform 0.25s var(--ease-spring); }
.nav-item.active { color: var(--primary); }
.nav-item.active::before {
    content: '';
    position: absolute; top: 0; left: 50%;
    transform: translateX(-50%);
    width: 34px; height: 3px;
    background: var(--gradient-primary);
    border-radius: 0 0 4px 4px;
}
.nav-item.active i { transform: translateY(-2px) scale(1.12); }
.nav-badge {
    position: absolute;
    top: 4px; right: calc(50% - 22px);
    min-width: 16px; height: 16px;
    padding: 0 4px;
    background: var(--red);
    color: white;
    font-size: 0.56rem; font-weight: 800;
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 2px var(--bg-card);
}

/* ═══════════ PAGINATION ═══════════ */
.pagination { display: flex; justify-content: center; gap: 6px; padding: 24px 0 8px; flex-wrap: wrap; }
.page-btn {
    min-width: 40px; height: 40px;
    padding: 0 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.82rem; font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--font-mono);
}
.page-btn.active {
    background: var(--primary); color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(91,91,214,0.35);
}
.page-btn:hover:not(.active):not([disabled]) { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.page-btn[disabled] { opacity: 0.4; cursor: default; }

/* ═══════════ FAB ═══════════ */
.fab {
    position: fixed;
    right: 18px;
    bottom: calc(var(--bottom-nav-h) + 18px + env(safe-area-inset-bottom, 0px));
    width: 46px; height: 46px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--primary);
    font-size: 0.95rem;
    box-shadow: var(--shadow-lg);
    display: flex; align-items: center; justify-content: center;
    z-index: 90;
    opacity: 0; visibility: hidden;
    transform: translateY(12px);
    transition: all 0.3s var(--ease);
}
.fab.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.fab:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* ═══════════ DETAIL OVERLAY ═══════════ */
.detail-overlay {
    position: fixed; inset: 0;
    z-index: 200;
    display: none;
    background: var(--bg);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.detail-overlay.active { display: block; animation: slideUp 0.32s var(--ease); }
@keyframes slideUp { from { transform: translateY(34px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.detail-close-bar {
    position: sticky; top: 0; z-index: 10;
    background: var(--bg-glass-strong);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px;
}
.detail-close-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 18px;
    background: var(--bg-surface);
    border-radius: var(--radius-full);
    font-size: 0.85rem; font-weight: 600;
    color: var(--text);
    transition: var(--transition);
}
.detail-close-btn:hover { background: var(--primary-bg); color: var(--primary); }
.detail-bar-actions { display: flex; gap: 6px; }
.detail-bar-btn {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: var(--transition);
}
.detail-bar-btn:hover { background: var(--primary-bg); color: var(--primary); transform: translateY(-1px); }
.detail-fav-btn.is-fav { background: var(--red-bg); color: var(--red); }
.detail-fav-btn.is-fav:hover { background: var(--red); color: white; }
@keyframes heartPop { 0% { transform: scale(1); } 40% { transform: scale(1.4); } 100% { transform: scale(1); } }
.detail-fav-btn.pop i { animation: heartPop 0.4s var(--ease-spring); }

.detail-content { max-width: 720px; margin: 0 auto; padding: 22px 16px 48px; }

.detail-header { margin-bottom: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.detail-pair-name {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 5vw, 1.55rem);
    font-weight: 800; color: var(--text);
    line-height: 1.2; margin-bottom: 10px; letter-spacing: -0.02em;
}
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 0.68rem; font-weight: 700;
    letter-spacing: 0.02em;
}

.detail-info-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 12px;
    transition: var(--transition);
}
.detail-info-block:hover { box-shadow: var(--shadow-sm); }
.detail-info-label {
    font-size: 0.66rem; font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.09em;
    margin-bottom: 7px;
    display: flex; align-items: center; gap: 7px;
}
.detail-info-label i { font-size: 0.75rem; color: var(--primary); }
.detail-info-value { font-size: 0.9rem; color: var(--text); line-height: 1.55; }

/* ═══════════ BODY DIAGRAM ═══════════ */
.body-diagram-wrapper { margin: 18px 0; }
.body-diagram-title {
    font-size: 0.85rem; font-weight: 700; color: var(--text);
    margin-bottom: 12px;
    display: flex; align-items: center; gap: 9px;
    padding: 11px 15px;
    background: var(--primary-bg);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
}
.body-diagram-title i { color: var(--primary); }

.body-views-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}
@media (min-width: 700px) { .body-views-container { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .body-views-container { grid-template-columns: 1fr; } }

.body-view-single { display: flex; flex-direction: column; }
.body-view-label {
    text-align: center;
    font-size: 0.7rem; font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.1em;
    margin-bottom: 8px;
    display: flex; align-items: center; justify-content: center; gap: 7px;
    padding: 7px 12px;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
}
.body-view-label i { color: var(--primary); font-size: 0.85rem; }

.body-image-container {
    position: relative;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: zoom-in;
    transition: var(--transition);
    box-shadow: var(--shadow);
}
[data-theme="dark"] .body-image-container { background: #171c2e; }
.body-image-container:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md), var(--glow-primary);
    transform: scale(1.01);
}
.body-image-container img { width: 100%; max-height: 460px; object-fit: contain; display: block; margin: 0 auto; }

.click-hint {
    position: absolute; bottom: 8px; left: 50%;
    transform: translateX(-50%);
    background: rgba(11,17,32,0.7);
    color: white;
    padding: 5px 14px;
    border-radius: var(--radius-full);
    font-size: 0.64rem; font-weight: 500;
    display: flex; align-items: center; gap: 5px;
    backdrop-filter: blur(10px);
    pointer-events: none;
    opacity: 0.85;
    transition: var(--transition);
    white-space: nowrap;
}
.body-image-container:hover .click-hint { opacity: 1; }

/* ═══════════ MAGNET MARKERS ═══════════ */
.magnet-marker {
    position: absolute;
    width: 23px; height: 23px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.56rem; font-weight: 900; color: white;
    transform: translate(-50%, -50%);
    z-index: 10; cursor: pointer;
    transition: transform 0.2s ease;
    /* Es un <button> real (v18.5): hay que neutralizar los estilos que el
       navegador aplica por defecto, o el círculo se vería como un botón gris
       con borde y con la tipografía del sistema. */
    padding: 0; border: 0; margin: 0;
    font-family: inherit; line-height: 1;
    -webkit-appearance: none; appearance: none;
}
.magnet-marker:hover { transform: translate(-50%, -50%) scale(1.3); z-index: 20; }
/* Foco de teclado bien visible sobre cualquier zona de la silueta: anillo
   blanco interior + halo oscuro exterior, para que contraste tanto sobre la
   piel clara como sobre el fondo. Se amplía igual que en `hover` para que el
   usuario de teclado vea exactamente lo mismo que el de ratón. */
.magnet-marker:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 1px;
    box-shadow: 0 0 0 6px rgba(17,24,39,0.85);
    transform: translate(-50%, -50%) scale(1.35);
    z-index: 30;
}
/* Al enfocar con el teclado se muestra la etiqueta, igual que al pasar el ratón
   (en miniatura `magnet-precision.css` la oculta con `opacity`). Sin esto el
   usuario de teclado vería sólo un círculo, sin saber qué punto es. */
.magnet-marker:focus-visible .magnet-label { opacity: 1; }
.magnet-marker-neg {
    background: var(--gradient-neg);
    box-shadow: 0 0 0 3px rgba(53,56,205,0.22), 0 2px 8px rgba(53,56,205,0.45);
    animation: magnetGlowNeg 2.5s ease-in-out infinite;
}
.magnet-marker-pos {
    background: var(--gradient-pos);
    box-shadow: 0 0 0 3px rgba(206,44,49,0.22), 0 2px 8px rgba(206,44,49,0.45);
    animation: magnetGlowPos 2.5s ease-in-out infinite;
}
@keyframes magnetGlowNeg {
    0%, 100% { box-shadow: 0 0 0 3px rgba(53,56,205,0.22), 0 2px 8px rgba(53,56,205,0.45); }
    50% { box-shadow: 0 0 0 7px rgba(53,56,205,0.14), 0 2px 12px rgba(53,56,205,0.55), 0 0 22px rgba(53,56,205,0.25); }
}
@keyframes magnetGlowPos {
    0%, 100% { box-shadow: 0 0 0 3px rgba(206,44,49,0.22), 0 2px 8px rgba(206,44,49,0.45); }
    50% { box-shadow: 0 0 0 7px rgba(206,44,49,0.14), 0 2px 12px rgba(206,44,49,0.55), 0 0 22px rgba(206,44,49,0.25); }
}
.magnet-label {
    position: absolute;
    white-space: nowrap;
    font-size: 0.6rem; font-weight: 700;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    pointer-events: none;
    z-index: 15;
    box-shadow: var(--shadow-sm);
}
.magnet-label-neg { background: #3538CD; color: white; }
.magnet-label-pos { background: #CE2C31; color: white; }

/* ═══════════ PLACEMENT CARD ═══════════ */
.placement-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-top: 14px;
    box-shadow: var(--shadow-sm);
}
.placement-row { display: flex; align-items: center; gap: 13px; padding: 10px 0; }
.placement-divider { display: flex; justify-content: center; color: var(--text-muted); font-size: 0.75rem; padding: 2px 0; opacity: 0.5; }
.placement-polarity {
    width: 44px; height: 44px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.75rem;
    color: white; flex-shrink: 0; gap: 2px;
}
.placement-polarity i { font-size: 0.55rem; }
.placement-polarity.neg { background: var(--gradient-neg); box-shadow: 0 3px 10px rgba(53,56,205,0.32); }
.placement-polarity.pos { background: var(--gradient-pos); box-shadow: 0 3px 10px rgba(206,44,49,0.32); }
.placement-text { flex: 1; min-width: 0; }
.placement-name { font-size: 0.89rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.placement-pole { font-size: 0.65rem; font-weight: 500; color: var(--text-muted); margin-left: 4px; }
.placement-location {
    font-size: 0.78rem; color: var(--text-secondary);
    margin-top: 2px;
    display: flex; align-items: center; gap: 5px;
}
.placement-location i { font-size: 0.65rem; color: var(--text-muted); }

/* ═══════════ ZOOM MODAL ═══════════ */
.zoom-modal { position: fixed; inset: 0; z-index: 500; display: none; }
.zoom-modal.active { display: flex; flex-direction: column; animation: zoomIn 0.25s ease; }
@keyframes zoomIn { from { opacity: 0; } to { opacity: 1; } }
.zoom-modal-bg {
    position: fixed; inset: 0;
    background: rgba(5,8,18,0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.zoom-modal-content { position: relative; z-index: 2; display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.zoom-close-btn {
    position: absolute; top: 14px; right: 14px; z-index: 20;
    width: 46px; height: 46px;
    background: rgba(255,255,255,0.14);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 1.1rem;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}
.zoom-close-btn:hover { background: rgba(255,255,255,0.28); transform: scale(1.06) rotate(90deg); }
.zoom-image-container { flex: 1; overflow: auto; position: relative; -webkit-overflow-scrolling: touch; }
.zoom-image-container img { width: 100%; object-fit: contain; transition: transform 0.3s ease; transform-origin: center center; }
.zoom-magnets { position: absolute; inset: 0; pointer-events: none; }
.zoom-magnet {
    position: absolute;
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900; font-size: 0.75rem; color: white;
    transform: translate(-50%, -50%);
    z-index: 5; pointer-events: auto; cursor: help;
}
.zoom-magnet-neg { background: var(--gradient-neg); box-shadow: 0 0 0 4px rgba(53,56,205,0.28), 0 0 24px rgba(53,56,205,0.45); animation: magnetGlowNeg 2.5s ease-in-out infinite; }
.zoom-magnet-pos { background: var(--gradient-pos); box-shadow: 0 0 0 4px rgba(206,44,49,0.28), 0 0 24px rgba(206,44,49,0.45); animation: magnetGlowPos 2.5s ease-in-out infinite; }
.zoom-magnet-tooltip {
    position: absolute;
    bottom: calc(100% + 10px); left: 50%;
    transform: translateX(-50%);
    background: rgba(5,8,18,0.88);
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem; font-weight: 600;
    white-space: nowrap;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md);
    pointer-events: none;
}
.zoom-info {
    background: rgba(11,17,32,0.96);
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(20px);
    max-height: 210px;
    overflow-y: auto;
}
.zoom-info-title {
    font-size: 0.74rem; font-weight: 700;
    color: rgba(255,255,255,0.9);
    margin-bottom: 10px;
    display: flex; align-items: center; gap: 8px;
    text-transform: uppercase; letter-spacing: 0.08em;
}
.zoom-info-title i { color: #A5A5FA; }
.zoom-info-point {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.zoom-info-point:last-child { border-bottom: none; }
.zoom-point-badge {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 800; color: white;
    flex-shrink: 0; gap: 2px;
}
.zoom-point-badge i { font-size: 0.5rem; }
.zoom-point-badge.neg { background: var(--gradient-neg); }
.zoom-point-badge.pos { background: var(--gradient-pos); }
.zoom-point-name { font-size: 0.82rem; font-weight: 600; color: rgba(255,255,255,0.92); }
.zoom-point-location {
    font-size: 0.72rem; color: rgba(255,255,255,0.5);
    margin-top: 2px;
    display: flex; align-items: center; gap: 5px;
}
.zoom-point-location i { font-size: 0.6rem; }

/* ═══════════ GUIDE & INFO CARDS ═══════════ */
.info-card, .guide-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 14px;
    transition: var(--transition);
}
.info-card:hover, .guide-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.info-card h3, .guide-card h3 {
    font-size: 1rem; font-weight: 700; color: var(--text);
    margin-bottom: 13px;
    display: flex; align-items: center; gap: 11px;
}
.info-card-text { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.65; }
.info-icon {
    width: 38px; height: 38px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; flex-shrink: 0;
}
.guide-num {
    width: 31px; height: 31px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 0.8rem; font-weight: 800; flex-shrink: 0;
}
.guide-num-warning { background: var(--gradient-pos); }
.guide-num-warning i { font-size: 0.68rem; }
.guide-card-warning { border-color: rgba(229,72,77,0.3); }
.guide-card-warning:hover { border-color: var(--red); }

.guide-list { list-style: none; padding: 0; }
.guide-list li {
    padding: 9px 0 9px 26px;
    position: relative;
    font-size: 0.88rem; color: var(--text-secondary); line-height: 1.55;
    border-bottom: 1px solid var(--border-light);
}
.guide-list li:last-child { border-bottom: none; }
.guide-list li::before {
    content: '';
    position: absolute; left: 2px; top: 16px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.55;
}
.sources-list li::before { background: var(--amber); }

.polarity-visual { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.polarity-item {
    text-align: center;
    padding: 18px 14px;
    border-radius: var(--radius);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    transition: var(--transition);
}
.polarity-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.polarity-circle {
    width: 54px; height: 54px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 10px;
    font-size: 1.15rem; font-weight: 900; color: white;
    font-family: var(--font-display);
}
.polarity-circle.neg { background: var(--gradient-neg); box-shadow: 0 5px 14px rgba(53,56,205,0.35); }
.polarity-circle.pos { background: var(--gradient-pos); box-shadow: 0 5px 14px rgba(206,44,49,0.35); }
.polarity-label { font-weight: 700; font-size: 0.82rem; margin-bottom: 4px; }
.polarity-desc { color: var(--text-muted); font-size: 0.72rem; line-height: 1.45; }

.pair-type-row {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border-light);
}
.pair-type-row:last-child { border-bottom: none; }
.pair-type-icon {
    width: 34px; height: 34px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; flex-shrink: 0;
}
.pair-type-name { font-size: 0.86rem; font-weight: 600; color: var(--text); }
.pair-type-desc { font-size: 0.73rem; color: var(--text-muted); line-height: 1.45; }

.disclaimer-card {
    display: flex; align-items: flex-start; gap: 13px;
    padding: 18px;
    background: var(--amber-bg);
    border: 1px solid rgba(231,154,19,0.32);
    border-radius: var(--radius-lg);
    margin-bottom: 14px;
}
.disclaimer-card i { color: var(--amber); font-size: 1.25rem; margin-top: 2px; }
.disclaimer-card p { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.6; }

/* ═══════════ MINI SEARCH ═══════════ */
.mini-search-wrap { position: relative; margin-bottom: 14px; }
.mini-search-wrap > i {
    position: absolute; left: 16px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted); font-size: 0.85rem;
    pointer-events: none;
}
.mini-search {
    width: 100%; height: 46px;
    padding: 0 16px 0 42px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 0.9rem; color: var(--text);
    outline: none;
    transition: var(--transition);
    box-shadow: var(--shadow-xs);
}
.mini-search:focus { border-color: var(--primary); box-shadow: var(--glow-primary); }
.mini-search::placeholder { color: var(--text-muted); }

/* ═══════════ SIDEBAR ═══════════ */
.sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(5,8,18,0.55);
    backdrop-filter: blur(4px);
    z-index: 200;
    opacity: 0; visibility: hidden;
    transition: all 0.3s ease;
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

.sidebar-nav {
    position: fixed; top: 0; right: -340px;
    width: 322px; max-width: 88vw;
    height: 100vh; height: 100dvh;
    background: var(--bg-card);
    z-index: 250;
    transition: right 0.35s var(--ease);
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-xl);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.sidebar-nav.active { right: 0; }

.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-card);
    position: sticky; top: 0; z-index: 5;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; }
.sidebar-brand-logo {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: var(--gradient-primary);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    box-shadow: 0 3px 10px rgba(91,91,214,0.35);
}
.sidebar-brand-name { font-family: var(--font-display); font-weight: 700; font-size: 0.98rem; color: var(--text); line-height: 1.2; }
.sidebar-brand-sub { font-size: 0.64rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; }
.sidebar-close-btn {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); font-size: 1rem;
    transition: var(--transition);
    background: var(--bg-surface);
}
.sidebar-close-btn:hover { background: var(--red-bg); color: var(--red); transform: rotate(90deg); }

.sidebar-section { padding: 16px 20px; border-bottom: 1px solid var(--border-light); }
.sidebar-section-title {
    font-size: 0.7rem; font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.09em;
    margin-bottom: 12px;
    display: flex; align-items: center; gap: 8px;
}
.sidebar-section-title i { font-size: 0.7rem; color: var(--primary); }

.sidebar-nav-links { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav-link {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.86rem; font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    text-align: left; width: 100%;
}
.sidebar-nav-link:hover { background: var(--bg-surface); color: var(--text); }
.sidebar-nav-link.active { background: var(--primary-bg); color: var(--primary); font-weight: 700; }
.sidebar-nav-link i { width: 20px; text-align: center; font-size: 0.82rem; }
.sidebar-fav-count {
    margin-left: auto;
    font-size: 0.62rem; font-weight: 800;
    padding: 1px 8px;
    background: var(--red-bg); color: var(--red);
    border-radius: var(--radius-full);
    font-family: var(--font-mono);
}

.sidebar-disease-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sidebar-disease-btn {
    display: flex; align-items: center; gap: 7px;
    padding: 9px 12px;
    background: var(--bg-surface);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.73rem; font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-disease-btn:hover { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.sidebar-disease-btn i { font-size: 0.7rem; flex-shrink: 0; }

.sidebar-filter-list { display: flex; flex-direction: column; gap: 3px; }
.sidebar-filter-btn {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.82rem; font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    width: 100%; text-align: left;
}
.sidebar-filter-btn:hover { background: var(--bg-surface); color: var(--text); }
.sidebar-filter-btn.active { background: var(--primary-bg); color: var(--primary); font-weight: 700; border-color: var(--primary); }
.sidebar-filter-btn i { width: 20px; text-align: center; font-size: 0.82rem; }
.sidebar-filter-count {
    margin-left: auto;
    font-size: 0.62rem; font-weight: 700;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.sidebar-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sidebar-stat { text-align: center; padding: 13px 8px; background: var(--bg-surface); border-radius: var(--radius-sm); }
.sidebar-stat-num {
    font-family: var(--font-display);
    font-size: 1.3rem; font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    line-height: 1;
}
.sidebar-stat-label { font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 500; margin-top: 4px; }

.sidebar-footer {
    padding: 20px;
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: auto; flex-shrink: 0;
    line-height: 1.7;
}
.sidebar-disclaimer { margin-top: 8px; font-size: 0.66rem; opacity: 0.8; }

/* ═══════════ EMOTIONS & PROTOCOLS ═══════════ */
.emotion-card, .protocol-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: var(--transition);
}
.emotion-card:hover, .protocol-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.emotion-card.expanded, .protocol-card.expanded { border-color: var(--primary-light); box-shadow: var(--shadow-md); }

.emotion-card-header, .protocol-card-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 10px; cursor: pointer;
}
.emotion-card-title {
    font-size: 0.94rem; font-weight: 700; color: var(--text);
    margin-bottom: 4px;
    display: flex; align-items: center; gap: 9px;
}
.emotion-card-desc { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.45; }
.emotion-header-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.card-fav-btn {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: var(--transition);
}
.card-fav-btn:hover { background: var(--red-bg); color: var(--red); }
.card-fav-btn.is-fav { background: var(--red-bg); color: var(--red); }
.emotion-expand-icon {
    flex-shrink: 0;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.7rem;
    transition: var(--transition);
}
.emotion-card.expanded .emotion-expand-icon,
.protocol-card.expanded .emotion-expand-icon {
    background: var(--primary-bg); color: var(--primary);
    transform: rotate(180deg);
}

.emotion-expand, .proto-detail { animation: expandIn 0.25s var(--ease); }
@keyframes expandIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

.emotion-diagram-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin: 14px 0 12px;
    justify-items: center;
}
.emotion-diagram-item { display: flex; flex-direction: column; align-items: center; }
.emotion-diagram-view-label {
    font-size: 0.6rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 5px; text-align: center;
}

.clickable-diagram {
    cursor: zoom-in;
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: var(--transition);
    border: 2px solid var(--border-light);
    background: white;
}
[data-theme="dark"] .clickable-diagram { background: #171c2e; }
.clickable-diagram:hover {
    border-color: var(--primary-light);
    box-shadow: var(--glow-primary), var(--shadow);
    transform: scale(1.02);
}
.clickable-diagram:active { transform: scale(0.98); }
.diagram-zoom-hint {
    position: absolute; bottom: 5px; right: 5px;
    width: 24px; height: 24px;
    background: rgba(5,8,18,0.62);
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.55rem;
    opacity: 0;
    transition: var(--transition);
    backdrop-filter: blur(4px);
}
.clickable-diagram:hover .diagram-zoom-hint { opacity: 1; }
@media (max-width: 768px) { .diagram-zoom-hint { opacity: 0.75; } }

.emotion-diagram-body { position: relative; width: 138px; flex-shrink: 0; }
.emotion-diagram-body img { width: 100%; border-radius: var(--radius-xs); }
.emotion-mini-magnet {
    position: absolute;
    width: 15px; height: 15px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900; font-size: 0.44rem; color: white;
    transform: translate(-50%, -50%);
    z-index: 5; line-height: 1;
}
.emotion-mini-magnet.neg { background: var(--gradient-neg); box-shadow: 0 0 0 2px rgba(53,56,205,0.32); }
.emotion-mini-magnet.pos { background: var(--gradient-pos); box-shadow: 0 0 0 2px rgba(206,44,49,0.32); }

.emotion-pairs-detail { flex: 1; }
.emotion-pair-row {
    display: flex; align-items: center; gap: 7px;
    padding: 5px 0;
    font-size: 0.76rem; color: var(--text-secondary);
}
.emotion-pair-pole {
    width: 19px; height: 19px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.52rem; color: white; flex-shrink: 0;
}
.emotion-pair-pole.neg { background: var(--gradient-neg); }
.emotion-pair-pole.pos { background: var(--gradient-pos); }

.protocol-card-title {
    font-size: 0.94rem; font-weight: 700; color: var(--text);
    margin-bottom: 6px;
    display: flex; align-items: center; gap: 8px;
}
.protocol-card-pairs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.protocol-card-pair-chip {
    padding: 4px 10px;
    background: var(--bg-surface);
    border-radius: var(--radius-full);
    font-size: 0.66rem; font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}
.proto-protocol-note {
    font-size: 0.82rem; color: var(--text-secondary); line-height: 1.55;
    margin-top: 12px; padding-top: 12px;
    border-top: 1px solid var(--border);
}
.card-author-note {
    margin-top: 8px;
    font-size: 0.68rem; color: var(--text-muted);
    display: flex; align-items: center; gap: 6px;
}

/* ═══════════ FAVORITES ═══════════ */
.fav-section-label {
    display: flex; align-items: center; gap: 9px;
    font-size: 0.74rem; font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.09em;
    margin: 20px 2px 10px;
}
.fav-section-label i { color: var(--primary); }
.fav-section-label:first-child { margin-top: 4px; }

/* ═══════════ EMPTY STATE ═══════════ */
.empty-state { text-align: center; padding: 52px 20px; }
.empty-state-icon {
    width: 76px; height: 76px;
    margin: 0 auto 18px;
    border-radius: 24px;
    background: var(--bg-surface);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; color: var(--text-muted);
}
.empty-state-title { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state-desc { font-size: 0.85rem; color: var(--text-muted); max-width: 320px; margin: 0 auto 18px; line-height: 1.6; }
.empty-state-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 22px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.82rem; font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(91,91,214,0.3);
}
.empty-state-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(91,91,214,0.4); }

/* ═══════════ TOAST ═══════════ */
.toast {
    position: fixed;
    bottom: calc(var(--bottom-nav-h) + 18px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-dark);
    color: white;
    padding: 11px 22px;
    border-radius: var(--radius-full);
    font-size: 0.82rem; font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s var(--ease);
    pointer-events: none;
    box-shadow: var(--shadow-xl);
    white-space: nowrap;
    display: flex; align-items: center; gap: 9px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    max-width: 92vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast i { color: #A5A5FA; }

/* ═══════════ TAB PANELS ═══════════ */
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: panelIn 0.3s var(--ease); }
@keyframes panelIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ═══════════ SKELETON ═══════════ */
.loading-skeleton {
    background: linear-gradient(90deg, var(--bg-surface) 25%, var(--border-light) 50%, var(--bg-surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 480px) {
    .header-subtitle { display: none; }
    .splash-magnet { width: 62px; height: 62px; font-size: 1.45rem; border-radius: 16px; }
    .splash-energy { width: 46px; }
    .detail-close-btn span { display: none; }
    .detail-close-btn { padding: 9px 14px; }
}

@media (min-width: 900px) {
    .main { padding-left: 24px; padding-right: 24px; }
}

/* ═══════════ PRINT ═══════════ */
@media print {
    .header, .bottom-nav, .splash, .detail-close-bar, .fab, .sticky-search, .sidebar-nav, .sidebar-overlay { display: none !important; }
    .main { padding: 0; }
    .pair-card, .info-card, .guide-card { break-inside: avoid; box-shadow: none; }
}
