/* =====================================================================
   Платформа «Ясновидение» — v3: Карма, профиль, колесо, ладони
   ===================================================================== */

/* === ТЕМЫ ПРОФИЛЯ === */
/* Применяется к body.profile-page через data-theme */
body.profile-page {
    transition: background 1.5s ease, color 1.5s ease;
}

body[data-theme="void"] {
    background: #000 !important;
    color: #2a2a2a;
    filter: brightness(0.7) contrast(1.2);
}
body[data-theme="void"] .site-header,
body[data-theme="void"] .card,
body[data-theme="void"] .stat-block,
body[data-theme="void"] .profile-header {
    background: #0a0a0a !important;
    border-color: #1a1a1a !important;
    box-shadow: 0 0 0 1px #000 inset;
}
body[data-theme="void"]::after {
    content: '';
    position: fixed; inset: 0; pointer-events: none; z-index: -1;
    background: radial-gradient(ellipse at center, #000 0%, #000 100%);
    opacity: 1;
}

body[data-theme="darkness"] {
    background: linear-gradient(135deg, #0a0010, #1a0020) !important;
    color: #4a3050;
}
body[data-theme="darkness"] .site-header,
body[data-theme="darkness"] .card {
    background: linear-gradient(135deg, #15001a, #20002a) !important;
    border-color: #2a1040 !important;
}
body[data-theme="darkness"]::after {
    content: '';
    position: fixed; inset: 0; pointer-events: none; z-index: -1;
    background:
        radial-gradient(circle at 30% 40%, rgba(80,0,120,0.3), transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(40,0,60,0.4), transparent 50%);
}

body[data-theme="shadow"] {
    background: linear-gradient(135deg, #14121a, #1a1822) !important;
    color: #8a7090;
}
body[data-theme="shadow"] .site-header,
body[data-theme="shadow"] .card {
    background: #1c1a26 !important;
    border-color: #2a2638 !important;
}

body[data-theme="neutral"] {
    /* базовая тема — без изменений */
}

body[data-theme="light"] {
    background: linear-gradient(135deg, #1a1d35, #232845) !important;
    color: #e8e9f3;
}
body[data-theme="light"] .site-header,
body[data-theme="light"] .card {
    background: linear-gradient(135deg, #232845, #2a3055) !important;
    border-color: #d4af37 !important;
    box-shadow: 0 0 24px rgba(212,175,55,0.15);
}
body[data-theme="light"]::after {
    content: '';
    position: fixed; inset: 0; pointer-events: none; z-index: -1;
    background:
        radial-gradient(circle at 50% 20%, rgba(212,175,55,0.15), transparent 50%),
        radial-gradient(circle at 30% 80%, rgba(155,89,182,0.12), transparent 50%);
}

body[data-theme="divine"] {
    background:
        radial-gradient(circle at 50% 30%, rgba(255,215,0,0.25), transparent 40%),
        radial-gradient(circle at 50% 70%, rgba(255,0,128,0.2), transparent 50%),
        linear-gradient(135deg, #1a1525, #2a1a3a) !important;
    color: #fff8dc;
    animation: divineGlow 4s ease-in-out infinite;
}
@keyframes divineGlow {
    0%, 100% { filter: brightness(1) saturate(1); }
    50% { filter: brightness(1.15) saturate(1.3); }
}
body[data-theme="divine"] .site-header,
body[data-theme="divine"] .card,
body[data-theme="divine"] .profile-header {
    background: linear-gradient(135deg, rgba(212,175,55,0.15), rgba(155,89,182,0.15)) !important;
    border-color: #ffd700 !important;
    box-shadow: 0 0 32px rgba(255,215,0,0.4) !important;
}
body[data-theme="divine"] h1,
body[data-theme="divine"] h2 {
    text-shadow: 0 0 20px rgba(255,215,0,0.6);
}

/* === ПРОФИЛЬ === */
.profile-page .profile-header {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-secondary));
    border-radius: 20px;
    padding: 32px;
    margin-bottom: 28px;
    display: grid;
    grid-template-columns: 200px 1fr 200px;
    gap: 28px;
    align-items: center;
    position: relative;
    overflow: hidden;
}
.profile-page .profile-header::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at 50% 50%, var(--theme-glow, transparent), transparent 70%);
    pointer-events: none;
    opacity: 0.4;
    transition: opacity 1s ease;
}

@media (max-width: 900px) {
    .profile-page .profile-header {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

/* Аватар */
.profile-avatar-big {
    width: 180px; height: 180px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-indigo));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 64px; font-weight: 700;
    box-shadow: 0 0 40px rgba(155,89,182,0.6);
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    border: 4px solid var(--theme-accent, var(--accent-gold));
}
.profile-avatar-big img {
    width: 100%; height: 100%; object-fit: cover;
}
.profile-avatar-big .pa-level-badge {
    position: absolute;
    bottom: 8px; right: 8px;
    background: var(--accent-gold);
    color: var(--bg-primary);
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700;
    border: 3px solid var(--bg-card);
    z-index: 2;
}

/* Статус под аватаром */
.profile-status {
    text-align: center;
    margin-top: 14px;
}
.profile-status .ps-icon {
    font-size: 28px;
    margin-bottom: 4px;
}
.profile-status .ps-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 2px;
}
.profile-status .ps-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Силуэт человека */
.silhouette {
    width: 100%; max-width: 200px;
    margin: 0 auto;
    position: relative;
}
.silhouette svg {
    width: 100%; height: auto;
    filter: drop-shadow(0 0 16px var(--theme-glow, rgba(155,89,182,0.4)));
}
.silhouette .silhouette-age {
    position: absolute;
    bottom: -8px; left: 50%; transform: translateX(-50%);
    background: var(--bg-card);
    padding: 4px 16px;
    border-radius: 20px;
    border: 1px solid var(--theme-accent, var(--border));
    font-size: 14px; font-weight: 700;
    color: var(--theme-accent, var(--accent-gold));
    white-space: nowrap;
}

/* === КАРМА — пульсирующий шар по центру === */
.karma-orb-wrap {
    text-align: center;
    padding: 40px 20px;
    position: relative;
}
.karma-orb {
    width: 200px; height: 200px;
    border-radius: 50%;
    margin: 0 auto;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 35% 35%,
        var(--karma-light, #d4af37),
        var(--karma-dark, #9b59b6) 60%,
        rgba(0,0,0,0.4));
    box-shadow:
        0 0 40px var(--karma-glow, rgba(212,175,55,0.6)),
        inset 0 0 40px rgba(255,255,255,0.1);
    animation: karmaPulse 3s ease-in-out infinite;
}
@keyframes karmaPulse {
    0%, 100% {
        box-shadow:
            0 0 40px var(--karma-glow, rgba(212,175,55,0.6)),
            0 0 80px var(--karma-glow, rgba(212,175,55,0.3)),
            inset 0 0 40px rgba(255,255,255,0.1);
        transform: scale(1);
    }
    50% {
        box-shadow:
            0 0 60px var(--karma-glow, rgba(212,175,55,0.8)),
            0 0 120px var(--karma-glow, rgba(212,175,55,0.4)),
            inset 0 0 50px rgba(255,255,255,0.2);
        transform: scale(1.04);
    }
}
.karma-orb:hover {
    transform: scale(1.08);
}
.karma-orb .ko-value {
    font-size: 56px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 20px var(--karma-glow, #fff), 0 4px 8px rgba(0,0,0,0.5);
    z-index: 2;
}
.karma-orb .ko-label {
    position: absolute;
    bottom: -28px; left: 50%; transform: translateX(-50%);
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    white-space: nowrap;
}

/* Эффект при наведении: тёмные или светлые сущности */
.karma-entities {
    position: absolute;
    inset: -40px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}
.karma-orb-wrap:hover .karma-entities {
    opacity: 1;
}
.karma-entity {
    position: absolute;
    width: 24px; height: 24px;
    border-radius: 50%;
    opacity: 0.7;
    animation: entityFloat 4s ease-in-out infinite;
}
@keyframes entityFloat {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.7; }
    50% { transform: translateY(-20px) scale(1.2); opacity: 1; }
}
.karma-entity.light {
    background: radial-gradient(circle, #fff, #d4af37);
    box-shadow: 0 0 16px #fff, 0 0 24px #d4af37;
}
.karma-entity.dark {
    background: radial-gradient(circle, #4a0080, #000);
    box-shadow: 0 0 16px #4a0080, 0 0 24px #1a0033;
}

/* Кнопка "Добавить кармы" */
.karma-spin-btn {
    margin-top: 40px;
    padding: 14px 36px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-indigo));
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(155,89,182,0.5);
    position: relative;
    overflow: hidden;
}
.karma-spin-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(155,89,182,0.7);
}
.karma-spin-btn:disabled {
    background: var(--bg-hover);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}
.karma-spin-btn::before {
    content: '🎡';
    margin-right: 8px;
}

/* === КОЛЕСО ФОРТУНЫ === */
.wheel-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    backdrop-filter: blur(8px);
}
.wheel-overlay.active {
    display: flex;
    animation: fadeIn 0.4s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.wheel-container {
    position: relative;
    width: 500px; max-width: 90vw;
    aspect-ratio: 1;
}
.wheel-svg {
    width: 100%; height: 100%;
    filter: drop-shadow(0 0 32px rgba(212,175,55,0.5));
    transition: transform 5s cubic-bezier(0.17, 0.67, 0.21, 0.99);
}
.wheel-pointer {
    position: absolute;
    top: -10px; left: 50%; transform: translateX(-50%);
    width: 0; height: 0;
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-top: 32px solid var(--accent-gold);
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
    z-index: 10;
}
.wheel-center {
    position: absolute;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 80px; height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-gold), #8b6914);
    box-shadow: 0 0 24px rgba(212,175,55,0.8), inset 0 0 16px rgba(0,0,0,0.3);
    display: flex; align-items: center; justify-content: center;
    font-size: 36px;
    z-index: 5;
    border: 4px solid var(--bg-primary);
}

.wheel-result {
    margin-top: 32px;
    text-align: center;
    color: #fff;
    animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.wheel-result .wr-icon {
    font-size: 80px;
    margin-bottom: 8px;
    animation: spin 2s linear;
}
.wheel-result .wr-label {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-gold);
    text-shadow: 0 0 24px currentColor;
}
.wheel-result .wr-amount {
    font-size: 18px;
    color: var(--text-muted);
    margin-top: 4px;
}

.wheel-close {
    position: absolute;
    top: 20px; right: 20px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: none;
    width: 40px; height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
}
.wheel-close:hover { background: rgba(231,76,60,0.5); }

.wheel-info {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 16px;
}

/* === ЛАДОНИ (хиромантия) === */
.palm-reading {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 28px;
    border: 1px solid var(--border);
}
.palm-reading h2 {
    color: var(--accent-gold);
    margin-bottom: 8px;
    text-align: center;
}
.palm-reading .pr-subtitle {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 24px;
    font-size: 14px;
}
.palm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
@media (max-width: 720px) {
    .palm-grid { grid-template-columns: 1fr; }
}
.palm-side {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
}
.palm-side .ps-title {
    text-align: center;
    font-size: 16px;
    color: var(--accent-cyan);
    margin-bottom: 16px;
    font-weight: 700;
}
.palm-slots {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.palm-slot {
    aspect-ratio: 1;
    background: var(--bg-secondary);
    border: 2px dashed var(--border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.palm-slot:hover {
    border-color: var(--accent-purple);
    background: rgba(155,89,182,0.1);
}
.palm-slot img {
    width: 100%; height: 100%; object-fit: cover;
}
.palm-slot .ps-label {
    position: absolute;
    bottom: 4px; left: 4px; right: 4px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 4px;
    text-align: center;
}
.palm-slot.empty .ps-icon {
    font-size: 32px;
    color: var(--text-muted);
    opacity: 0.5;
}
.palm-slot input[type="file"] {
    display: none;
}

/* === Статистика с цветовыми акцентами === */
.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin: 24px 0;
}
.profile-stat-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border);
    transition: var(--transition);
}
.profile-stat-card:hover {
    border-color: var(--accent-purple);
    transform: translateY(-2px);
}
.profile-stat-card .psc-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-gold);
}
.profile-stat-card .psc-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}
.profile-stat-card.wins .psc-value { color: var(--success); }
.profile-stat-card.losses .psc-value { color: var(--danger); }
.profile-stat-card.karma .psc-value { color: var(--accent-purple); }

/* Win rate bar */
.winrate-bar {
    height: 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    overflow: hidden;
    margin: 16px 0;
    display: flex;
    border: 1px solid var(--border);
}
.winrate-bar .wrb-wins {
    background: linear-gradient(90deg, var(--success), #27ae60);
    transition: width 1s ease;
}
.winrate-bar .wrb-losses {
    background: linear-gradient(90deg, #c0392b, var(--danger));
    transition: width 1s ease;
}
.winrate-legend {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* === Settings page === */
.settings-form .form-group {
    margin-bottom: 20px;
}
.avatar-preview {
    width: 120px; height: 120px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 3px solid var(--accent-gold);
    margin: 0 auto 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #fff;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-indigo));
}
.avatar-preview img {
    width: 100%; height: 100%; object-fit: cover;
}
