/* === HIDDEN COIN === */
.hcc-coin-wrapper {
    position: fixed;
    bottom: 80px;
    right: 40px;
    z-index: 9998;
    cursor: pointer;
    opacity: 0;
    transform: scale(0);
    animation: hcc-pop-in 0.45s ease-out 0s forwards, hcc-float 3s ease-in-out infinite 0.45s;
}

@keyframes hcc-pop-in {
    0% { opacity: 0; transform: scale(0) rotate(-180deg); }
    70% { transform: scale(1.2) rotate(10deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes hcc-float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.hcc-coin {
    width: 50px;
    height: 50px;
    position: relative;
    transform-style: preserve-3d;
    animation: hcc-spin 4s linear infinite;
}

@keyframes hcc-spin {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

.hcc-coin-face {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 22px;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6), inset 0 0 10px rgba(0,0,0,0.2);
}

.hcc-coin-front {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #8B6508;
    transform: rotateY(0deg);
    border: 3px solid #DAA520;
}

.hcc-coin-back {
    background: linear-gradient(135deg, #FFA500 0%, #FF8C00 100%);
    color: #fff;
    transform: rotateY(180deg);
    border: 3px solid #B8860B;
}

.hcc-coin-glow {
    position: absolute;
    top: -10px; left: -10px; right: -10px; bottom: -10px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,215,0,0.3) 0%, transparent 70%);
    animation: hcc-pulse-glow 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes hcc-pulse-glow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.hcc-coin-wrapper.collected .hcc-coin {
    animation: hcc-collect-burst 0.8s ease-out forwards !important;
}

@keyframes hcc-collect-burst {
    0% { transform: scale(1) rotateY(0deg); }
    30% { transform: scale(1.5) rotateY(180deg); }
    60% { transform: scale(0.5) rotateY(360deg); opacity: 1; }
    100% { transform: scale(0) rotateY(540deg); opacity: 0; }
}

.hcc-coin-wrapper.collected .hcc-coin-glow {
    animation: hcc-glow-burst 0.8s ease-out forwards;
}

@keyframes hcc-glow-burst {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(3); }
}

/* === TRACKER BAR === */
.hcc-tracker {
    position: fixed;
    top: 32px;
    right: 20px;
    z-index: 9999;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 25px;
    padding: 8px 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3), 0 0 10px rgba(255,215,0,0.2);
    border: 2px solid #FFD700;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.5s ease;
    min-width: 160px;
}

.hcc-tracker.visible {
    opacity: 1;
    transform: translateY(0);
}

.hcc-tracker-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.hcc-tracker-icon {
    font-size: 20px;
    animation: hcc-icon-bounce 1s ease infinite;
}

@keyframes hcc-icon-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.hcc-tracker-count {
    color: #FFD700;
    font-weight: bold;
    font-size: 18px;
    font-family: 'Courier New', monospace;
    min-width: 32px;
    text-align: center;
}

.hcc-tracker-bar {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.hcc-tracker-fill {
    height: 100%;
    background: linear-gradient(90deg, #FFD700, #FFA500);
    border-radius: 3px;
    width: 0%;
    transition: width 0.6s ease;
    box-shadow: 0 0 8px rgba(255,215,0,0.5);
}

/* === MODAL === */
.hcc-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hcc-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.hcc-modal {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
    border-radius: 20px;
    padding: 0;
    max-width: 420px;
    width: 90%;
    border: 2px solid #FFD700;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 30px rgba(255,215,0,0.2);
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

.hcc-modal-overlay.active .hcc-modal { transform: scale(1); }

.hcc-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.hcc-modal-close:hover { background: rgba(255,255,255,0.1); }

.hcc-modal-header {
    text-align: center;
    padding: 30px 30px 20px;
    background: linear-gradient(180deg, rgba(255,215,0,0.1) 0%, transparent 100%);
}

.hcc-modal-coin {
    font-size: 60px;
    animation: hcc-modal-coin-spin 1s ease-out;
    margin-bottom: 10px;
}

@keyframes hcc-modal-coin-spin {
    0% { transform: scale(0) rotate(-360deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.hcc-modal-header h2 {
    color: #FFD700;
    margin: 0 0 8px;
    font-size: 24px;
    text-shadow: 0 2px 10px rgba(255,215,0,0.3);
}

.hcc-modal-header p { color: #aaa; margin: 0; font-size: 14px; }
.hcc-modal-body { padding: 20px 30px 30px; }
.hcc-save-options { display: flex; flex-direction: column; gap: 15px; }

.hcc-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #666;
    font-size: 13px;
}

.hcc-divider::before,
.hcc-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #333;
}

.hcc-divider span { padding: 0 15px; }
.hcc-save-form { display: flex; flex-direction: column; gap: 12px; }

.hcc-save-form input {
    padding: 12px 15px;
    border-radius: 10px;
    border: 1px solid #333;
    background: rgba(0,0,0,0.3);
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.hcc-save-form input:focus { border-color: #FFD700; }
.hcc-save-form input::placeholder { color: #666; }

.hcc-btn {
    padding: 12px 20px;
    border-radius: 10px;
    border: none;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.hcc-btn-primary {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #1a1a2e;
    box-shadow: 0 4px 15px rgba(255,215,0,0.3);
}

.hcc-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,215,0,0.4);
}

.hcc-btn-secondary {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid #444;
}

.hcc-btn-secondary:hover {
    background: rgba(255,255,255,0.15);
    border-color: #666;
}

.hcc-guest-save { text-align: center; }
.hcc-guest-save p { color: #888; font-size: 13px; margin: 0 0 10px; }

.hcc-particle {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

@media (max-width: 768px) {
    .hcc-coin-wrapper { bottom: 30px; right: 20px; }
}

/* v1.2 reward/profile additions */
.hcc-profile-linked { text-align:center; color:#ddd; }
.hcc-profile-linked p { margin:0 0 14px; }
.hcc-balance-note { margin-top:18px; padding-top:14px; border-top:1px solid rgba(255,255,255,.1); color:#888; text-align:center; font-size:12px; }
.hcc-balance-note strong { color:#FFD700; }
.hcc-form-error { min-height:18px; color:#ff8f8f; font-size:12px; text-align:center; }
.hcc-coin-front { font-size:20px; }


/* === SITE-WIDE PLAYER HUD === */
.hcc-player-hud {
    position: fixed;
    top: 22px;
    right: 20px;
    z-index: 9999;
    width: 190px;
    min-height: 62px;
    padding: 9px 12px;
    border: 2px solid #FFD700;
    border-radius: 16px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    box-shadow: 0 6px 22px rgba(0,0,0,.35), 0 0 12px rgba(255,215,0,.18);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    opacity: 1;
    transform: none;
    text-align: left;
    font: inherit;
}

body.admin-bar .hcc-player-hud { top: 52px; }

.hcc-player-hud:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 26px rgba(0,0,0,.4), 0 0 16px rgba(255,215,0,.24);
}

.hcc-hud-icon {
    flex: 0 0 auto;
    font-size: 27px;
    line-height: 1;
}

.hcc-hud-main {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.hcc-player-name {
    display: block;
    max-width: 128px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.1;
}

.hcc-hud-score {
    color: #FFD700;
    font-size: 13px;
    line-height: 1.1;
}

.hcc-hud-score strong {
    font-family: 'Courier New', monospace;
    font-size: 16px;
}

.hcc-hud-label {
    color: #d8c45a;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.hcc-hud-bar {
    display: block;
    width: 100%;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
}

.hcc-hud-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #FFD700, #FFA500);
    box-shadow: 0 0 8px rgba(255,215,0,.55);
    transition: width .45s ease;
}

@media (max-width: 768px) {
    .hcc-player-hud {
        top: 12px;
        right: 10px;
        width: 165px;
        min-height: 54px;
        padding: 7px 10px;
        border-radius: 14px;
    }

    body.admin-bar .hcc-player-hud { top: 58px; }

    .hcc-hud-icon { font-size: 23px; }
    .hcc-player-name { max-width: 108px; font-size: 11px; }
    .hcc-hud-score strong { font-size: 14px; }
}

/* === v1.5 mining/HUD refinements === */
/* Keep an unclaimed node permanently visible. Entrance is one-time only; the coin itself spins forever. */
.hcc-coin-wrapper {
    animation: hcc-pop-in 0.42s ease-out 0s forwards !important;
}

/* Move the modal reward coin slightly upward so it never crowds the heading. */
.hcc-modal-header {
    padding-top: 24px;
}
.hcc-modal-coin {
    position: relative;
    top: -8px;
    margin-bottom: -2px;
}

/* Preserve the compact player HUD as a bottom-left persistent control. */
.hcc-player-hud {
    top: auto !important;
    right: auto !important;
    bottom: 18px !important;
    left: 18px !important;
}
body.admin-bar .hcc-player-hud {
    top: auto !important;
}

/* Site-wide compact status line for the G1/Bimber menu bar. */
.hcc-top-status {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 32px;
    margin: 0 9px 0 0;
    padding: 4px 8px;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    line-height: 1;
    white-space: nowrap;
    vertical-align: middle;
    transition: background .18s ease, opacity .18s ease;
}
.hcc-top-status:hover {
    background: rgba(255,215,0,.10);
}
.hcc-top-status-icon {
    font-size: 16px;
}
.hcc-top-status-name {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: inherit;
    font-size: 11px;
    font-weight: 700;
}
.hcc-top-status-total {
    color: #d9b100;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}
.hcc-top-status-label {
    color: inherit;
    opacity: .72;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.hcc-top-status-hint {
    padding-left: 6px;
    border-left: 1px solid rgba(128,128,128,.28);
    color: inherit;
    opacity: .62;
    font-size: 9px;
}

/* If the expected theme header is unavailable, keep the status usable as a fallback. */
.hcc-top-status-floating {
    position: fixed;
    top: 12px;
    right: 18px;
    z-index: 9998;
    background: rgba(20,20,32,.93);
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
body.admin-bar .hcc-top-status-floating {
    top: 44px;
}

@media (max-width: 768px) {
    .hcc-player-hud {
        bottom: 12px !important;
        left: 10px !important;
    }
    .hcc-top-status {
        gap: 4px;
        margin-right: 4px;
        padding: 3px 5px;
    }
    .hcc-top-status-name,
    .hcc-top-status-hint {
        display: none;
    }
    .hcc-top-status-floating {
        top: 8px;
        right: 8px;
    }
}

/* === v1.6 instant feedback, auth, and mined-state refinements === */
.hcc-modal-header {
    padding: 22px 28px 18px;
}

.hcc-modal-heading-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.hcc-modal-heading-copy {
    min-width: 0;
    text-align: left;
}

.hcc-modal-coin {
    position: static;
    top: auto;
    margin: 0;
    flex: 0 0 auto;
    font-size: 44px;
    line-height: 1;
}

.hcc-modal-header h2 {
    margin: 0 0 5px;
}

.hcc-modal-header p {
    margin: 0;
}

.hcc-auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 16px;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 10px;
    background: rgba(0,0,0,.18);
    color: #aaa;
    font-size: 12px;
}

.hcc-auth-link {
    flex: 0 0 auto;
    color: #FFD700;
    font-weight: 700;
    text-decoration: none;
}

.hcc-auth-link:hover {
    color: #fff2a8;
    text-decoration: underline;
}

.hcc-mined-marker {
    position: fixed;
    right: 32px;
    bottom: 74px;
    z-index: 9998;
    display: none;
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
    border: 1px solid rgba(255,215,0,.55);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(26,26,46,.96), rgba(22,33,62,.96));
    box-shadow: 0 4px 16px rgba(0,0,0,.32), 0 0 10px rgba(255,215,0,.16);
    color: #fff;
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px) scale(.96);
    transition: opacity .18s ease, transform .18s ease;
}

.hcc-mined-marker.visible {
    display: inline-flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.hcc-mined-icon {
    font-size: 20px;
    line-height: 1;
}

.hcc-mined-text {
    color: #e7d77b;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

/* Keep the HUD visible even while an article's claim-state request is resolving. */
.hcc-player-hud {
    opacity: 1 !important;
    visibility: visible !important;
}

@media (max-width: 768px) {
    .hcc-modal-heading-row {
        gap: 10px;
    }

    .hcc-modal-coin {
        font-size: 38px;
    }

    .hcc-modal-header h2 {
        font-size: 21px;
    }

    .hcc-auth-row {
        font-size: 11px;
    }

    .hcc-mined-marker {
        right: 14px;
        bottom: 26px;
        padding: 7px 9px;
    }

    .hcc-mined-text {
        display: none;
    }
}

/* === v1.7 instant reveal, player identity, visible confetti === */
.hcc-modal-playerline {
    margin-top: 8px;
    color: rgba(255,255,255,.78);
    font-size: 15px;
    line-height: 1.25;
    font-weight: 600;
}
.hcc-modal-playerline strong {
    color: #fff;
    font-size: 17px;
    font-weight: 900;
}
.hcc-auth-link-solo {
    margin-left: auto;
}

/* Modal overlay is z-index 10000; particles need to burst in front of it. */
.hcc-particle {
    z-index: 10005 !important;
    box-shadow: 0 0 6px rgba(255,255,255,.35);
}

/* A quick visual ping accompanies the first usable scroll/gesture. */
.hcc-coin-wrapper.hcc-spawn-ping .hcc-coin-glow {
    animation: hcc-spawn-ping-glow .42s ease-out 1 !important;
}
.hcc-coin-wrapper.hcc-spawn-ping .hcc-coin {
    animation: hcc-spawn-ping-coin .42s ease-out 1, hcc-spin 4s linear infinite .42s !important;
}
@keyframes hcc-spawn-ping-glow {
    0% { opacity:.45; transform:scale(1); }
    50% { opacity:1; transform:scale(1.5); }
    100% { opacity:.6; transform:scale(1); }
}
@keyframes hcc-spawn-ping-coin {
    0% { transform:scale(1) rotateY(0deg); }
    45% { transform:scale(1.16) rotateY(90deg); }
    100% { transform:scale(1) rotateY(180deg); }
}


/* === v1.9 player auth + modal cleanup === */
/* The click-site coin/confetti already supplies the reward flourish. Keep the modal headline unobstructed. */
.hcc-modal-heading-row {
    justify-content: center;
}
.hcc-modal-heading-copy {
    text-align: center;
    width: 100%;
}
.hcc-modal-coin {
    display: none !important;
}

.hcc-auth-link {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    font: inherit;
}

.hcc-player-login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: -4px 0 16px;
    padding: 14px;
    border: 1px solid rgba(255,215,0,.22);
    border-radius: 12px;
    background: rgba(0,0,0,.20);
}

.hcc-player-login-form[style*="display:none"],
.hcc-player-login-form[style*="display: none"] {
    display: none;
}

.hcc-player-login-form input {
    padding: 11px 13px;
    border-radius: 9px;
    border: 1px solid #333;
    background: rgba(0,0,0,.34);
    color: #fff;
    outline: none;
}

.hcc-player-login-form input:focus {
    border-color: #FFD700;
}

.hcc-login-title {
    margin: 0 0 2px;
    color: #FFD700;
    font-weight: 800;
    font-size: 14px;
}


/* === v2.0 player identity + mobile state cleanup === */
.hcc-profile-linked {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #d7d7df;
    text-align: center;
}
.hcc-profile-linked p { margin: 0; font-size: 13px; color: #b9bac6; }
.hcc-profile-linked .hcc-done { min-width: 150px; }
.hcc-guest-account-panel { text-align: center; }
.hcc-guest-account-panel > p { margin: 0 0 14px; color: #b9bac6; }
.hcc-account-actions { display:flex; gap:10px; }
.hcc-account-actions .hcc-btn { flex:1; }
.hcc-guest-link {
    margin-top: 12px;
    border: 0;
    background: transparent;
    color: #8f92a1;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
}
.hcc-signout-footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,.08);
    text-align: center;
}
.hcc-signout-footer .hcc-auth-link {
    color: #8f92a1;
    font-size: 11px;
    font-weight: 500;
    text-decoration: underline;
}
.hcc-signout-footer .hcc-auth-link:hover { color:#FFD700; }

/* The modal has no decorative coin in any viewport. */
.hcc-modal-coin { display:none !important; }

@media (max-width:768px) {
    .hcc-account-actions { flex-direction:column; }
    .hcc-player-login-form { margin:0 0 14px; padding:12px; }
    .hcc-modal-body { padding:16px 20px 22px; }
    .hcc-modal-header { padding:20px 22px 15px; }
    /* A mined marker and live coin are mutually exclusive in JS; keep marker tucked into the node location. */
    .hcc-mined-marker { right:20px; bottom:100px; }
}
