/* =========================================================
   R2E2 Wheel of Wisdom — Complete Styles
   Preserves all existing rules. Adds: nickname edit,
   share button gradients, scrollbar, footer, animations.
   ========================================================= */

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

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --gold:        #FFD700;
    --orange:      #FFA500;
    --gold-dim:    rgba(255,215,0,0.15);
    --gold-border: rgba(255,215,0,0.35);
    --bg1:         #0a0a2a;
    --bg2:         #050515;
    --card-bg:     rgba(8,8,28,0.82);
    --glass:       rgba(255,255,255,0.04);
    --text:        #f2f2f2;
    --muted:       #a0a0c0;
    --radius:      20px;
    --radius-sm:   12px;
}

/* ================= BODY & BACKGROUND ================= */

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(ellipse at 20% 0%, #1a0a3a 0%, var(--bg1) 40%, var(--bg2) 100%);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 15% 85%, rgba(255,215,0,0.06) 0%, transparent 50%),
        radial-gradient(circle at 85% 15%, rgba(160,80,255,0.06) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255,165,0,0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.4) 0%, transparent 100%),
        radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,0.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 80% 20%, rgba(255,255,255,0.35) 0%, transparent 100%),
        radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,0.25) 0%, transparent 100%),
        radial-gradient(1px 1px at 90% 55%, rgba(255,255,255,0.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 10% 60%, rgba(255,255,255,0.2) 0%, transparent 100%);
    pointer-events: none;
    z-index: -1;
}

/* ================= LAYOUT ================= */

.game-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 24px 18px 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

/* ================= HEADER ================= */

.site-header-compact {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 3px;
    color: var(--gold);
    padding: 11px 28px;
    margin-bottom: 10px;
    border-radius: 40px;
    border: 1px solid var(--gold-border);
    background: var(--gold-dim);
    backdrop-filter: blur(10px);
    text-shadow: 0 0 20px rgba(255,215,0,0.5);
    box-shadow: 0 0 30px rgba(255,215,0,0.08), inset 0 1px 0 rgba(255,255,255,0.05);
}

/* ================= NICKNAME STRIP ================= */

.nickname-strip {
    width: 100%;
    max-width: 620px;
    text-align: center;
    margin: 0 auto 10px;
    padding: 9px 14px;
    border: 1px solid rgba(255,215,0,0.28);
    border-radius: 999px;
    background: rgba(0,0,0,0.38);
    color: rgba(255,255,255,0.85);
    font-size: 0.82rem;
}

.nickname-strip strong {
    color: var(--gold);
    font-weight: 700;
}

/* ================= NICKNAME EDIT ================= */

.nick-edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    opacity: 0.55;
    padding: 0 4px;
    transition: opacity 0.2s, transform 0.2s;
    vertical-align: middle;
    line-height: 1;
}

.nick-edit-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

.nick-edit-panel {
    width: 100%;
    max-width: 620px;
    margin: 6px auto 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px 16px;
    background: rgba(0,0,0,0.45);
    border-radius: 999px;
    border: 1px solid rgba(255,215,0,0.3);
    backdrop-filter: blur(8px);
}

.nick-input {
    flex: 1;
    min-width: 160px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,215,0,0.4);
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.nick-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 8px rgba(255,215,0,0.2);
}

.nick-save-btn {
    background: linear-gradient(135deg, var(--gold), var(--orange));
    border: none;
    border-radius: 999px;
    padding: 6px 16px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: #000;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.nick-save-btn:hover { opacity: 0.85; }

.nick-cancel-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 999px;
    padding: 6px 14px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.nick-cancel-btn:hover { background: rgba(255,255,255,0.14); }

.nick-edit-msg {
    font-size: 0.75rem;
    color: #ff8888;
    width: 100%;
    text-align: center;
    min-height: 16px;
    padding: 0 4px;
}

.nick-edit-msg.ok { color: #88ff88; }

/* ================= LANGUAGE SWITCHER ================= */

.lang-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    background: rgba(255,215,0,0.06);
    border: 1px solid rgba(255,215,0,0.2);
    border-radius: 999px;
    padding: 6px 18px;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    font-family: 'Poppins', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    letter-spacing: 1px;
    transition: color 0.2s ease;
    padding: 2px 4px;
    border-radius: 4px;
}

.lang-btn:hover { color: var(--gold); }

.lang-btn.lang-active {
    color: var(--gold);
    text-shadow: 0 0 10px rgba(255,215,0,0.4);
}

.lang-divider {
    color: rgba(255,215,0,0.2);
    font-size: 0.8rem;
}

/* ================= WHEEL ================= */

.wheel-wrapper {
    margin: 20px 0 8px;
    position: relative;
    filter: drop-shadow(0 0 40px rgba(255,165,0,0.2));
}

#wheelCanvas {
    width: 100%;
    max-width: 550px;
    border-radius: 50%;
    border: 2px solid var(--gold-border);
    box-shadow:
        0 0 0 6px rgba(255,215,0,0.05),
        0 0 60px rgba(255,165,0,0.15),
        0 20px 60px rgba(0,0,0,0.5);
}

.pointer-indicator {
    font-size: 38px;
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    filter: drop-shadow(0 0 8px rgba(255,215,0,0.8));
    z-index: 2;
}

/* ================= SPIN BUTTON ================= */

.spin-area {
    margin: 20px 0 24px;
    text-align: center;
}

.spin-btn {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
    color: #0a0a0a;
    padding: 18px 52px;
    border-radius: 60px;
    border: none;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 6px 0 rgba(0,0,0,0.4),
        0 12px 40px rgba(255,165,0,0.35),
        inset 0 1px 0 rgba(255,255,255,0.3);
    transition: all 0.2s ease;
}

.spin-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.spin-btn:hover::before { left: 100%; }

.spin-btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 0 rgba(0,0,0,0.4),
        0 18px 50px rgba(255,165,0,0.45),
        inset 0 1px 0 rgba(255,255,255,0.3);
}

.spin-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.4), 0 6px 20px rgba(255,165,0,0.25);
}

.press-counter {
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--muted);
    letter-spacing: 0.5px;
    display: flex;
    justify-content: center;
    gap: 16px;
}

#pressCounter, #doublePressIndicator {
    background: rgba(255,215,0,0.08);
    border: 1px solid rgba(255,215,0,0.15);
    border-radius: 20px;
    padding: 3px 12px;
}

/* ================= TIP CARD ================= */

.tip-card {
    width: 100%;
    max-width: 620px;
    margin: 20px auto 12px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--gold-border);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
    backdrop-filter: blur(20px);
}

.tip-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.favorite-btn {
    position: absolute;
    top: 14px; right: 14px;
    width: 42px; height: 42px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    border: 1px solid var(--gold-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.25s ease;
    backdrop-filter: blur(10px);
}

.favorite-btn:hover {
    transform: scale(1.12);
    border-color: var(--gold);
    background: rgba(255,215,0,0.1);
}

.favorite-btn.is-favorite {
    border-color: #ff5577;
    box-shadow: 0 0 15px rgba(255,85,119,0.3);
}

#favoriteIcon { color: #ffffff; transition: transform 0.2s ease; }
.favorite-btn.is-favorite #favoriteIcon { color: #ff5577; }

.tip-card-inner {
    padding: 30px 28px 26px;
    text-align: center;
}

.tip-emoji { font-size: 1.8rem; margin-bottom: 8px; }

.tip-label {
    font-size: 0.68rem;
    letter-spacing: 3px;
    color: rgba(255,215,0,0.85);
    margin-bottom: 10px;
    text-transform: uppercase;
    font-weight: 600;
}

.tip-text {
    font-size: 1.1rem;
    line-height: 1.7;
    margin: 12px 0 16px;
    color: rgba(255,255,255,0.95);
    max-height: 220px;
    overflow-y: auto;
    overflow-wrap: anywhere;
    font-weight: 300;
    font-style: italic;
}

.tip-text::-webkit-scrollbar { width: 4px; }
.tip-text::-webkit-scrollbar-track { background: transparent; }
.tip-text::-webkit-scrollbar-thumb { background: var(--gold-border); border-radius: 4px; }

.tip-category { font-size: 0.85rem; color: var(--gold); font-weight: 500; }
.tip-author { font-size: 0.8rem; color: var(--muted); margin-top: 6px; font-weight: 400; }

/* ================= RATING BUTTONS ================= */

.rating-row {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,215,0,0.1);
}

.rating-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.rating-btn:hover {
    background: rgba(255,255,255,0.12);
    transform: scale(1.12);
}

.rating-btn.active-up {
    background: rgba(0,200,100,0.18);
    border-color: rgba(0,200,100,0.5);
    box-shadow: 0 0 14px rgba(0,200,100,0.3);
    transform: scale(1.05);
}

.rating-btn.active-down {
    background: rgba(220,60,60,0.18);
    border-color: rgba(220,60,60,0.5);
    box-shadow: 0 0 14px rgba(220,60,60,0.3);
    transform: scale(1.05);
}

/* ================= FAVOURITES LINK ================= */

.favorites-link-row {
    width: 100%;
    max-width: 620px;
    margin: 6px auto 12px;
    text-align: left;
}

.favorites-link {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.88rem;
    transition: color 0.2s;
}

.favorites-link:hover { color: var(--gold); }
#favCountBadge { color: var(--gold); font-weight: 600; }

/* ================= STATS ROW ================= */

.info-row {
    width: 100%;
    max-width: 620px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--gold-border);
    margin-bottom: 18px;
    box-shadow: 0 4px 30px rgba(0,0,0,0.3);
}

.stat-box {
    background: var(--card-bg);
    padding: 18px 14px 16px;
    text-align: center;
    border-right: 1px solid rgba(255,215,0,0.1);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    min-height: 110px;
    transition: background 0.25s;
}

.stat-box:hover { background: rgba(255,215,0,0.04); }
.stat-box:last-child { border-right: none; }

.stat-box div {
    font-family: 'Cinzel', serif;
    font-size: 0.6rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--gold);
    font-weight: 400;
    line-height: 1.3;
}

.stat-box span {
    display: block;
    font-family: 'Poppins', sans-serif;
    font-size: 1.7rem;
    color: #ffffff;
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: -0.5px;
}

#wisdomLevel {
    font-family: 'Poppins', sans-serif !important;
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.2px;
    line-height: 1.3;
    color: #000 !important;
    text-shadow: none !important;
    background: linear-gradient(135deg, var(--gold), var(--orange));
    padding: 5px 11px;
    border-radius: 999px;
    display: inline-block;
    max-width: 95%;
}

/* ================= SHARE SECTION ================= */

.share-section {
    width: 100%;
    max-width: 620px;
    margin: 14px auto;
    padding: 20px;
    background: var(--card-bg);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius);
    text-align: center;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 30px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}

.share-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,215,0,0.4), transparent);
}

.share-label {
    color: rgba(255,255,255,0.85);
    font-size: 0.88rem;
    margin-bottom: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.share-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.share-btn {
    border: none;
    border-radius: 999px;
    padding: 9px 18px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.share-btn:active { transform: translateY(0); }

.share-btn.facebook {
    background: linear-gradient(135deg, #1877f2, #0d5bbd);
    box-shadow: 0 4px 15px rgba(24,119,242,0.3);
}

.share-btn.twitter {
    background: #ffffff;
    color: #000000;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 4px 15px rgba(255,255,255,0.15);
}

.share-btn.twitter:hover {
    background: #f0f0f0;
    box-shadow: 0 8px 24px rgba(255,255,255,0.2);
}

.share-btn.telegram {
    background: linear-gradient(135deg, #229ed9, #1a85bb);
    box-shadow: 0 4px 15px rgba(34,158,217,0.3);
}

.share-btn.whatsapp {
    background: linear-gradient(135deg, #25d366, #1aaa50);
    box-shadow: 0 4px 15px rgba(37,211,102,0.3);
}

/* ================= WISDOM CARD ================= */

.wisdom-card {
    width: 100%;
    max-width: 620px;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 26px 24px 22px;
    border: 1px solid var(--gold-border);
    text-align: center;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 40px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.04);
    margin-top: 4px;
}

.wisdom-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--orange), var(--gold), var(--orange), transparent);
}

.wisdom-title {
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    letter-spacing: 5px;
    color: rgba(255,215,0,0.8);
    text-transform: uppercase;
    margin-bottom: 14px;
    text-shadow: 0 0 20px rgba(255,215,0,0.25);
}

.wisdom-circle {
    width: 110px;
    height: 110px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFE44D 0%, #FFB700 50%, #FF8C00 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 0 5px rgba(255,215,0,0.12),
        0 0 0 10px rgba(255,215,0,0.05),
        0 0 45px rgba(255,165,0,0.45);
}

.wisdom-pct-ring {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.wisdom-pct-ring span {
    font-family: 'Poppins', sans-serif;
    font-size: 2rem !important;
    font-weight: 800;
    color: rgba(0,0,0,0.8) !important;
    text-shadow: none !important;
    line-height: 1;
    letter-spacing: -1px;
}

.wisdom-pct-ring small {
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(0,0,0,0.6);
}

#wisdomMessage {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 4px;
    line-height: 1.5;
    min-height: 20px;
}

.wisdom-stats {
    margin: 16px auto 0;
    font-size: 0.82rem;
    line-height: 2;
    color: rgba(255,255,255,0.45);
    text-align: center;
    padding: 12px 20px;
    background: rgba(255,215,0,0.04);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,215,0,0.08);
}

.wisdom-stats span {
    color: var(--gold);
    font-weight: 700;
    font-size: 0.95rem;
}

/* ================= RETURN MESSAGE ================= */

.return-encouragement {
    width: 100%;
    max-width: 620px;
    text-align: center;
    margin: 12px auto;
    color: #ffffff;
    font-size: 0.9rem;
    min-height: 24px;
}

/* ================= FOOTER ================= */

.page-footer-links {
    margin-top: 28px;
    font-size: 0.82rem;
    opacity: 0.7;
    letter-spacing: 0.3px;
}

.page-footer-links a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    transition: color 0.2s;
}

.page-footer-links a:hover { color: var(--gold); }

.page-footer-links .sep {
    margin: 0 6px;
    color: rgba(255,255,255,0.3);
}

footer {
    margin-top: 10px;
    font-size: 0.68rem;
    opacity: 0.45;
    text-align: center;
    letter-spacing: 0.5px;
}

/* ================= ANIMATIONS ================= */

.wisdom-pulse { animation: wisdomPulse 0.5s ease; }

@keyframes wisdomPulse {
    0%   { transform: scale(1);    box-shadow: 0 0 0 5px rgba(255,215,0,0.12), 0 0 0 10px rgba(255,215,0,0.05), 0 0 45px rgba(255,165,0,0.45); }
    50%  { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(255,215,0,0.2),  0 0 0 16px rgba(255,215,0,0.08), 0 0 65px rgba(255,165,0,0.7); }
    100% { transform: scale(1);    box-shadow: 0 0 0 5px rgba(255,215,0,0.12), 0 0 0 10px rgba(255,215,0,0.05), 0 0 45px rgba(255,165,0,0.45); }
}

.tip-appear { animation: tipAppear 0.4s cubic-bezier(0.16,1,0.3,1); }

@keyframes tipAppear {
    from { opacity: 0; transform: translateY(8px) scale(0.99); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.spin-pulse { animation: spinPulse 0.3s ease; }

@keyframes spinPulse {
    0%,100% { transform: scale(1); }
    50%     { transform: scale(1.04); }
}

/* ================= MOBILE ================= */

@media (max-width: 550px) {
    .game-container { padding: 14px 12px 40px; }

    .site-header-compact {
        font-size: 0.75rem;
        letter-spacing: 2px;
        padding: 10px 18px;
    }

    .spin-btn { font-size: 0.9rem; padding: 15px 28px; }

    .tip-card-inner { padding: 26px 18px 22px; }
    .tip-text { font-size: 1rem; max-height: 190px; }
    .favorite-btn { width: 38px; height: 38px; font-size: 1.1rem; }

    .info-row { grid-template-columns: 1fr; }

    .stat-box {
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid rgba(255,215,0,0.1);
        flex-direction: row;
        justify-content: space-between;
        padding: 14px 16px;
        gap: 0;
    }

    .stat-box:last-child { border-bottom: none; }
    .stat-box div { text-align: left; font-size: 0.58rem; }
    .stat-box span { font-size: 1.4rem; text-align: right; }
    #wisdomLevel { font-size: 0.65rem !important; }

    .wisdom-circle { width: 95px; height: 95px; }
    .wisdom-pct-ring span { font-size: 1.6rem !important; }
    .wisdom-title { font-size: 0.75rem; letter-spacing: 3px; }

    .share-buttons { flex-direction: column; align-items: stretch; }
    .share-btn { width: 100%; justify-content: center; }

    .press-counter { flex-direction: column; gap: 6px; align-items: center; }

    .rating-row { gap: 10px; }
    .rating-btn { width: 36px; height: 36px; font-size: 1rem; }

    .nick-edit-panel {
        border-radius: var(--radius);
        padding: 12px 14px;
    }

    .nick-input { min-width: 120px; font-size: 0.8rem; }
}
