:root {
    --page-glow: radial-gradient(circle at top, rgba(148, 163, 184, 0.10), transparent 35%);
    --page-bg: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-faint: #94a3b8;
    --card-bg: rgba(255, 255, 255, 0.96);
    --card-border: rgba(226, 232, 240, 0.85);
    --card-shadow: 0 20px 50px rgba(15, 23, 42, 0.10), 0 6px 18px rgba(15, 23, 42, 0.05);
    --surface-bg: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    --surface-border: #e2e8f0;
    --surface-border-hover: #cbd5e1;
    --divider: #e2e8f0;
    --particle-color: rgba(71, 85, 105, 0.35);
    --particle-line-color: rgba(71, 85, 105, 0.14);
    --btn-close-filter: none;
}

@media (prefers-color-scheme: dark) {
    :root {
        --page-glow: radial-gradient(circle at top, rgba(59, 130, 246, 0.10), transparent 40%);
        --page-bg: linear-gradient(180deg, #0b1220 0%, #05070d 100%);
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #94a3b8;
        --text-faint: #64748b;
        --card-bg: rgba(17, 24, 39, 0.92);
        --card-border: rgba(255, 255, 255, 0.08);
        --card-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04);
        --surface-bg: linear-gradient(180deg, #1e293b 0%, #131c2c 100%);
        --surface-border: rgba(255, 255, 255, 0.08);
        --surface-border-hover: rgba(255, 255, 255, 0.20);
        --divider: rgba(255, 255, 255, 0.08);
        --particle-color: rgba(96, 165, 250, 0.65);
        --particle-line-color: rgba(52, 211, 153, 0.22);
        --btn-close-filter: invert(1) grayscale(100%) brightness(200%);
    }
}

/* Ruční přepnutí režimu přebíjí systémové nastavení */
:root[data-theme="dark"] {
    --page-glow: radial-gradient(circle at top, rgba(59, 130, 246, 0.10), transparent 40%);
    --page-bg: linear-gradient(180deg, #0b1220 0%, #05070d 100%);
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-faint: #64748b;
    --card-bg: rgba(17, 24, 39, 0.92);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04);
    --surface-bg: linear-gradient(180deg, #1e293b 0%, #131c2c 100%);
    --surface-border: rgba(255, 255, 255, 0.08);
    --surface-border-hover: rgba(255, 255, 255, 0.20);
    --divider: rgba(255, 255, 255, 0.08);
    --particle-color: rgba(96, 165, 250, 0.65);
    --particle-line-color: rgba(52, 211, 153, 0.22);
    --btn-close-filter: invert(1) grayscale(100%) brightness(200%);
}

:root[data-theme="light"] {
    --page-glow: radial-gradient(circle at top, rgba(148, 163, 184, 0.10), transparent 35%);
    --page-bg: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-faint: #94a3b8;
    --card-bg: rgba(255, 255, 255, 0.96);
    --card-border: rgba(226, 232, 240, 0.85);
    --card-shadow: 0 20px 50px rgba(15, 23, 42, 0.10), 0 6px 18px rgba(15, 23, 42, 0.05);
    --surface-bg: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    --surface-border: #e2e8f0;
    --surface-border-hover: #cbd5e1;
    --divider: #e2e8f0;
    --particle-color: rgba(71, 85, 105, 0.35);
    --particle-line-color: rgba(71, 85, 105, 0.14);
    --btn-close-filter: none;
}

/* Tlačítko pro přepnutí barevného režimu */
.theme-toggle-btn {
    position: fixed;
    bottom: calc(20px + env(safe-area-inset-bottom));
    right: calc(20px + env(safe-area-inset-right));
    z-index: 20;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--surface-border);
    background: var(--surface-bg);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
}

.theme-toggle-btn:hover,
.theme-toggle-btn:focus {
    transform: translateY(-2px) scale(1.06);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
    color: var(--text-primary);
}

#bgCanvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    display: block;
}

body > .container {
    position: relative;
    z-index: 1;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--page-glow), var(--page-bg);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.card-tilt-wrap {
    perspective: 1200px;
}

/* Hlavní karta */
.profile-card {
    position: relative;
    border: 1px solid var(--card-border);
    border-radius: 28px;
    overflow: hidden;
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(10px);
    transform-style: preserve-3d;
    transition: transform 0.15s ease-out, background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
}

/* Tlačítko sdílení */
.share-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 5;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.10);
    color: #ffffff;
    backdrop-filter: blur(6px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: transform 0.18s ease, background-color 0.18s ease;
}

.share-btn:hover,
.share-btn:focus {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px) scale(1.05);
    color: #ffffff;
}

.coffee-btn {
    top: 64px;
}

/* Modální okno „Pošli mi kávu“ */
.coffee-modal-content {
    border-radius: 24px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: var(--text-primary);
}

.coffee-modal-content .modal-title {
    color: var(--text-primary);
}

.coffee-modal-content .btn-close {
    filter: var(--btn-close-filter);
}

.coffee-modal-content .text-muted {
    color: var(--text-muted) !important;
}

.coffee-qr-wrap {
    display: inline-flex;
    padding: 0.75rem;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.coffee-amount {
    font-family: 'Manrope', 'Inter', sans-serif;
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--text-primary);
}


/* Hero */
.hero-bg {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 42%, #111827 72%, #0b1220 100%);
    background-size: 250% 250%;
    animation: gradientShift 10s ease-in-out infinite;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.hero-bg::before {
    content: "";
    position: absolute;
    width: 520px;
    height: 520px;
    top: -180px;
    left: -140px;
    background: radial-gradient(circle, rgba(96, 165, 250, 0.42) 0%, transparent 65%);
    filter: blur(72px);
    animation: floatGlowOne 7s ease-in-out infinite alternate;
    pointer-events: none;
}

.hero-bg::after {
    content: "";
    position: absolute;
    width: 460px;
    height: 460px;
    right: -140px;
    bottom: -180px;
    background: radial-gradient(circle, rgba(52, 211, 153, 0.30) 0%, transparent 65%);
    filter: blur(68px);
    animation: floatGlowTwo 8s ease-in-out infinite alternate;
    pointer-events: none;
}

.hero-bg > * {
    position: relative;
    z-index: 2;
}

/* Doplňkový jemný overlay pro lepší hloubku */
.hero-bg .hero-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.00) 35%, rgba(0,0,0,0.10) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Avatar */
.avatar {
    width: 122px;
    height: 122px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.92);
    box-shadow:
        0 14px 32px rgba(0, 0, 0, 0.32),
        0 0 0 8px rgba(255, 255, 255, 0.05);
    background: #cbd5e1;
}

/* Texty v hero */
.profile-name {
    font-family: 'Manrope', 'Inter', sans-serif;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.3rem;
}

.avatar-initials {
    font-family: 'Manrope', 'Inter', sans-serif;
    font-size: 2.4rem;
    font-weight: 700;
    color: #ffffff;
}

.avatar.bg-secondary {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%) !important;
}

.profile-role {
    font-size: 1.18rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.82);
    margin-bottom: 0;
}

/* Tělo karty */
.profile-body {
    padding: 1.75rem 1.5rem 1.5rem;
}

.profile-bio {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.65;
    margin-bottom: 1.5rem;
}

.btn-save-contact {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: 0;
    color: #ffffff;
    border-radius: 18px;
    padding: 0.98rem 1.15rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow:
        0 14px 28px rgba(16, 185, 129, 0.24),
        0 0 0 rgba(16, 185, 129, 0.00);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    animation: savePulse 2.6s ease-in-out infinite;
}

.btn-save-contact::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        120deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.12) 35%,
        rgba(255,255,255,0.34) 50%,
        rgba(255,255,255,0.12) 65%,
        rgba(255,255,255,0) 100%
    );
    transform: translateX(-130%);
    animation: saveShine 3.2s ease-in-out infinite;
    pointer-events: none;
}

.btn-save-contact:hover,
.btn-save-contact:focus {
    color: #ffffff;
    transform: translateY(-2px) scale(1.01);
    box-shadow:
        0 18px 34px rgba(5, 150, 105, 0.30),
        0 0 0 8px rgba(16, 185, 129, 0.10);
    filter: brightness(1.03);
}

@keyframes savePulse {
    0% {
        box-shadow:
            0 14px 28px rgba(16, 185, 129, 0.22),
            0 0 0 0 rgba(16, 185, 129, 0.00);
    }
    50% {
        box-shadow:
            0 18px 32px rgba(16, 185, 129, 0.28),
            0 0 0 10px rgba(16, 185, 129, 0.08);
    }
    100% {
        box-shadow:
            0 14px 28px rgba(16, 185, 129, 0.22),
            0 0 0 0 rgba(16, 185, 129, 0.00);
    }
}

@keyframes saveShine {
    0% {
        transform: translateX(-130%);
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    45% {
        transform: translateX(130%);
        opacity: 1;
    }
    100% {
        transform: translateX(130%);
        opacity: 0;
    }
}

/* Druhotná tlačítka */
.btn-soft {
    background: var(--surface-bg);
    border: 1px solid var(--surface-border);
    color: var(--text-primary);
    border-radius: 18px;
    padding: 0.92rem 1rem;
    font-weight: 500;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.btn-soft:hover,
.btn-soft:focus {
    border-color: var(--surface-border-hover);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

/* Sekce socials */
.socials-heading {
    color: var(--text-muted);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

/* Ikonová tlačítka */
.social-icon-btn {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    border: 1px solid var(--surface-border);
    background: var(--surface-bg);
    color: var(--text-primary);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.social-icon-btn:hover,
.social-icon-btn:focus {
    transform: translateY(-2px);
    border-color: var(--surface-border-hover);
    box-shadow: 0 14px 24px rgba(15, 23, 42, 0.10);
    color: var(--text-primary);
}

/* Staré class ponechány kvůli kompatibilitě */
.social-btn {
    transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.social-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

/* Adresa */
.profile-address {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--divider);
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Jemné oddělení CTA bloků */
.actions-stack {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/* Animace */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes floatGlowOne {
    0% {
        transform: translate(0, 0) scale(1);
    }
    100% {
        transform: translate(62px, 40px) scale(1.16);
    }
}

@keyframes floatGlowTwo {
    0% {
        transform: translate(0, 0) scale(1);
    }
    100% {
        transform: translate(-54px, -34px) scale(1.12);
    }
}

/* Mobile tuning */
@media (max-width: 575.98px) {
    .profile-card {
        border-radius: 24px;
    }

    .hero-bg {
        padding-top: 1.75rem;
        padding-bottom: 1.75rem;
    }

    .avatar {
        width: 112px;
        height: 112px;
    }

    .profile-name {
        font-size: 2rem;
    }

    .profile-role {
        font-size: 1.05rem;
    }

    .profile-body {
        padding: 1.35rem 1.1rem 1.2rem;
    }

    .social-icon-btn {
        width: 50px;
        height: 50px;
        border-radius: 16px;
    }
}

/* Rychlé akce (volat / e-mail / web) */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 0.5rem;
    border-radius: 16px;
    border: 1px solid var(--surface-border);
    background: var(--surface-bg);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.quick-action-btn:hover,
.quick-action-btn:focus {
    color: var(--text-primary);
    transform: translateY(-2px);
    border-color: var(--surface-border-hover);
    box-shadow: 0 12px 22px rgba(15, 23, 42, 0.09);
}

.quick-action-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    font-size: 1rem;
}

.quick-action-label small {
    display: block;
    font-weight: 400;
    color: var(--text-faint);
    font-size: 0.68rem;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 0.1rem;
}

/* Vstupní animace */
.reveal {
    opacity: 0;
    transform: translateY(16px);
    animation: revealUp 0.7s cubic-bezier(0.16, 0.84, 0.44, 1) forwards;
    animation-delay: var(--d, 0s);
}

@keyframes revealUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .hero-bg,
    .hero-bg::before,
    .hero-bg::after,
    .social-btn,
    .social-icon-btn,
    .btn-save-contact,
    .btn-save-contact::before,
    .btn-soft,
    .reveal,
    .profile-card,
    .quick-action-btn,
    .share-btn,
    .theme-toggle-btn {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    #bgCanvas {
        display: none !important;
    }
}