/* ===== COINFLIP GAME ===== */
.cf-page { max-width: 900px; margin: 0 auto; padding: 20px 16px; overflow-x: hidden; }

/* ===== HISTORY BAR ===== */
.cf-history {
    display: flex; gap: 6px; margin-bottom: 18px;
    overflow-x: auto; padding-bottom: 4px;
    scrollbar-width: thin; scrollbar-color: #333 transparent;
}
.cf-history__item {
    flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 800; background: #0d0d14; border: 2px solid #1a1a2e;
    transition: transform 0.2s;
}
.cf-history__item:hover { transform: scale(1.15); }
.cf-history__item--eagle { color: #f5c842; border-color: #f5c84266; text-shadow: 0 0 8px #f5c84244; }
.cf-history__item--tails { color: #5b9bd5; border-color: #5b9bd566; text-shadow: 0 0 8px #5b9bd544; }

/* ===== MAIN LAYOUT ===== */
.cf-layout {
    display: flex; gap: 24px; align-items: flex-start;
    flex-wrap: wrap;
}
.cf-center { flex: 1; min-width: 0; }
.cf-right { width: 300px; flex-shrink: 0; }
.cf-top-wins { flex-basis: 100%; }

/* ===== COIN ARENA ===== */
.cf-arena {
    position: relative;
    width: 100%; min-height: 460px;
    background: radial-gradient(ellipse at 50% 80%, #0e0e1a 0%, #0a0a12 60%);
    border-radius: 20px; border: 1px solid #1a1a2e;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    overflow: hidden; margin-bottom: 20px;
    transform: translateZ(0);
}

/* Shadow on the "ground" under the coin */
.cf-coin-shadow {
    position: absolute;
    width: 160px; height: 30px;
    bottom: 80px;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(0,0,0,0.5) 0%, transparent 70%);
    filter: blur(8px);
    transition: all 0.1s;
    pointer-events: none;
}

/* Glow ring behind coin */
.cf-arena__glow {
    position: absolute; top: 50%; left: 50%;
    width: 280px; height: 280px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245,200,66,0.08) 0%, transparent 70%);
    pointer-events: none;
    transition: all 0.5s;
}
.cf-arena__glow--tails {
    background: radial-gradient(circle, rgba(91,155,213,0.08) 0%, transparent 70%);
}
.cf-arena__glow--spinning {
    animation: glowPulse 0.4s ease-in-out infinite alternate;
}

@keyframes glowPulse {
    0% { opacity: 0.4; filter: blur(0px); }
    100% { opacity: 1; filter: blur(4px); }
}

/* ===== 3D COIN — realistic top-down view ===== */
.cf-coin-wrapper {
    position: relative;
    width: 200px; height: 200px;
    transform-style: preserve-3d;
    will-change: transform;
}
.cf-coin-wrapper--idle {
    animation: coinFloat 3s ease-in-out infinite;
}
@keyframes coinFloat {
    0%, 100% { transform: rotateX(0deg) scale(1); }
    50% { transform: rotateX(6deg) scale(1.02); }
}

/* Each face of the coin */
.cf-coin__face {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    border-radius: 50%;
    backface-visibility: hidden;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}

/* -------- EAGLE (gold) face -------- */
.cf-coin__face--eagle {
    z-index: 2;
    background:
        radial-gradient(ellipse at 35% 30%, rgba(255,255,255,0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 65% 70%, rgba(0,0,0,0.15) 0%, transparent 50%),
        conic-gradient(from 0deg, #f5c842, #ffe066, #f5c842, #d4960a, #f5c842, #ffe066, #f5c842);
    box-shadow:
        0 0 0 6px #c8960a,
        0 0 0 8px #a07600,
        0 0 0 10px rgba(200,150,10,0.3),
        inset 0 0 30px rgba(0,0,0,0.15),
        inset 0 -4px 12px rgba(0,0,0,0.2),
        inset 0 4px 12px rgba(255,255,255,0.2);
}
/* Outer rim ring */
.cf-coin__face--eagle::before {
    content: '';
    position: absolute; top: 8px; left: 8px; right: 8px; bottom: 8px;
    border-radius: 50%;
    border: 3px solid rgba(200,150,10,0.5);
    box-shadow: inset 0 0 6px rgba(0,0,0,0.1);
    pointer-events: none;
}
/* Specular highlight sweep */
.cf-coin__face--eagle::after {
    content: '';
    position: absolute; top: -60%; left: -60%;
    width: 220%; height: 220%;
    background: linear-gradient(
        105deg,
        transparent 42%,
        rgba(255,255,255,0.35) 48%,
        rgba(255,255,255,0.08) 52%,
        transparent 58%
    );
    animation: coinHighlight 5s linear infinite;
    pointer-events: none;
}
@keyframes coinHighlight {
    0% { transform: translateX(-80%) rotate(0deg); }
    100% { transform: translateX(80%) rotate(0deg); }
}

/* -------- TAILS (silver-blue) face -------- */
.cf-coin__face--tails {
    transform: rotateX(180deg);
    background:
        radial-gradient(ellipse at 35% 30%, rgba(255,255,255,0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 65% 70%, rgba(0,0,0,0.15) 0%, transparent 50%),
        conic-gradient(from 0deg, #5b9bd5, #8ec5f0, #5b9bd5, #3a6d99, #5b9bd5, #8ec5f0, #5b9bd5);
    box-shadow:
        0 0 0 6px #3a6d99,
        0 0 0 8px #2d5575,
        0 0 0 10px rgba(59,109,153,0.3),
        inset 0 0 30px rgba(0,0,0,0.15),
        inset 0 -4px 12px rgba(0,0,0,0.2),
        inset 0 4px 12px rgba(255,255,255,0.15);
}
.cf-coin__face--tails::before {
    content: '';
    position: absolute; top: 8px; left: 8px; right: 8px; bottom: 8px;
    border-radius: 50%;
    border: 3px solid rgba(59,109,153,0.5);
    box-shadow: inset 0 0 6px rgba(0,0,0,0.1);
    pointer-events: none;
}
.cf-coin__face--tails::after {
    content: '';
    position: absolute; top: -60%; left: -60%;
    width: 220%; height: 220%;
    background: linear-gradient(
        105deg,
        transparent 42%,
        rgba(255,255,255,0.28) 48%,
        rgba(255,255,255,0.06) 52%,
        transparent 58%
    );
    animation: coinHighlight 5s linear infinite;
    pointer-events: none;
}

/* Center emblem area */
.cf-coin__emblem {
    position: relative; z-index: 1;
    width: 90px; height: 90px;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
}
.cf-coin__icon {
    width: 70px; height: 70px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}
/* Tails star emblem */
.cf-coin__star {
    font-size: 52px;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
    line-height: 1;
}

/* Coin edge (visible during spin - creates thickness) */
.cf-coin__thickness {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border-radius: 50%;
    transform-style: preserve-3d;
    pointer-events: none;
}
.cf-coin__thickness-ring {
    position: absolute;
    width: 100%; height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(180,140,20,0.6);
    box-sizing: border-box;
}


/* ===== STATUS TEXT ===== */
.cf-status {
    margin-top: 24px;
    font-size: 22px; font-weight: 800;
    text-transform: uppercase;
    color: #8a8aaa;
    text-align: center;
    transition: color 0.4s;
    letter-spacing: 1px;
}
.cf-status--win { color: #4ade80; text-shadow: 0 0 20px #4ade8044; }
.cf-status--lose { color: #ef4444; text-shadow: 0 0 20px #ef444444; }
.cf-status--eagle { color: #f5c842; text-shadow: 0 0 20px #f5c84244; }
.cf-status--tails { color: #5b9bd5; text-shadow: 0 0 20px #5b9bd544; }

/* ===== TOP WINS (last 60 min) ===== */
.cf-top-wins {
    background: #0d0d14;
    border-radius: 16px;
    border: 1px solid #1a1a2e;
    padding: 16px 18px;
    margin-bottom: 20px;
}
.cf-top-wins__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #1a1a2e;
}
.cf-top-wins__title {
    font-size: 15px;
    font-weight: 700;
    color: #f5c842;
    letter-spacing: 0.3px;
}
.cf-top-wins__period {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #151520;
    padding: 3px 10px;
    border-radius: 20px;
}
.cf-top-wins__list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 340px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #222 transparent;
}
.cf-top-wins__empty {
    text-align: center;
    color: #444;
    font-size: 13px;
    padding: 18px 0;
    font-weight: 500;
}
.cf-top-wins__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: #0a0a12;
    border: 1px solid #141425;
    transition: background 0.2s, border-color 0.2s;
}
.cf-top-wins__row:hover {
    background: #111120;
    border-color: #1e1e36;
}
.cf-top-wins__rank {
    flex: 0 0 24px;
    width: 24px; height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #888;
    background: #151520;
}
.cf-top-wins__rank--1 { background: linear-gradient(135deg, #f5c842, #d4960a); color: #1a1a2e; }
.cf-top-wins__rank--2 { background: linear-gradient(135deg, #b0b0b0, #808080); color: #1a1a2e; }
.cf-top-wins__rank--3 { background: linear-gradient(135deg, #cd7f32, #a06020); color: #1a1a2e; }
.cf-top-wins__avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #1a1a2e;
    flex-shrink: 0;
}
.cf-top-wins__name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.cf-top-wins__side {
    flex-shrink: 0;
    width: 22px; height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
}
.cf-top-wins__side--eagle {
    background: rgba(245,200,66,0.15);
    color: #f5c842;
    border: 1px solid rgba(245,200,66,0.25);
}
.cf-top-wins__side--tails {
    background: rgba(91,155,213,0.15);
    color: #5b9bd5;
    border: 1px solid rgba(91,155,213,0.25);
}
.cf-top-wins__amount {
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 800;
    color: #4ade80;
    text-shadow: 0 0 10px rgba(74,222,128,0.15);
    text-align: right;
    min-width: 70px;
}
.cf-top-wins__bet {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 500;
    color: #555;
    text-align: right;
    min-width: 50px;
}

/* Win notification */
.cf-win-popup {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: radial-gradient(ellipse, rgba(10,10,18,0.97) 0%, rgba(10,10,18,0.9) 100%);
    border: 2px solid #4ade80; border-radius: 24px;
    padding: 40px 60px; text-align: center;
    z-index: 1000;
    opacity: 0; transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}
.cf-win-popup.active {
    opacity: 1; transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}
.cf-win-popup__amount {
    font-size: 48px; font-weight: 900; color: #4ade80;
    text-shadow: 0 0 30px #4ade8044;
}
.cf-win-popup__label {
    font-size: 14px; color: #8a8aaa; margin-top: 6px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 2px;
}

/* ===== BET PANEL ===== */
.cf-bet-panel {
    background: #0d0d14; border-radius: 16px; border: 1px solid #1a1a2e;
    padding: 20px; margin-bottom: 20px;
}
.cf-bet-panel__title {
    font-size: 13px; font-weight: 700; color: #8a8aaa;
    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 14px;
}

.cf-bet-row { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.cf-bet-label { color: #8a8aaa; font-size: 12px; font-weight: 600; min-width: 70px; }
.cf-bet-input {
    flex: 1; background: #0a0a12; border: 1px solid #333; border-radius: 10px;
    color: #fff; font-size: 16px; font-weight: 700; padding: 12px 14px;
    outline: none; font-family: inherit; text-align: center;
}
.cf-bet-input:focus { border-color: #f5c842; }

.cf-bet-presets { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.cf-bet-presets button {
    flex: 1; min-width: 50px;
    background: #1a1a2e; border: 1px solid #2a2a3e; border-radius: 8px;
    color: #8a8aaa; font-size: 12px; font-weight: 700; padding: 8px 6px;
    cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.cf-bet-presets button:hover { background: #2a2a3e; color: #fff; }

/* Side choice buttons */
.cf-side-choice {
    display: flex; gap: 10px; margin-bottom: 16px;
}
.cf-side-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px; border-radius: 12px; border: 2px solid transparent;
    font-size: 15px; font-weight: 700; cursor: pointer;
    font-family: inherit; transition: all 0.2s;
    text-transform: uppercase;
}
.cf-side-btn--eagle {
    background: rgba(245,200,66,0.08); border-color: #f5c84233; color: #f5c842;
}
.cf-side-btn--eagle:hover,
.cf-side-btn--eagle.active {
    background: rgba(245,200,66,0.18); border-color: #f5c842;
    box-shadow: 0 0 20px #f5c84222;
}
.cf-side-btn--tails {
    background: rgba(91,155,213,0.08); border-color: #5b9bd533; color: #5b9bd5;
}
.cf-side-btn--tails:hover,
.cf-side-btn--tails.active {
    background: rgba(91,155,213,0.18); border-color: #5b9bd5;
    box-shadow: 0 0 20px #5b9bd522;
}

.cf-side-btn__icon {
    width: 24px; height: 24px; border-radius: 50%;
}
.cf-side-btn__icon--eagle { background: linear-gradient(135deg, #f5c842, #e8a020); }
.cf-side-btn__icon--tails { background: linear-gradient(135deg, #5b9bd5, #4178a3); }

/* Main flip button */
.cf-btn-flip {
    width: 100%; padding: 16px; border-radius: 12px; border: none;
    font-size: 17px; font-weight: 800; cursor: pointer;
    font-family: inherit; transition: all 0.2s; text-transform: uppercase;
    background: linear-gradient(135deg, #f5c842, #e8a020);
    color: #0a0a12; letter-spacing: 1px;
}
.cf-btn-flip:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px #f5c84244;
}
.cf-btn-flip:disabled {
    opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none;
}

/* ===== GAME INFO PANEL ===== */
.cf-info {
    background: #0d0d14; border-radius: 16px; border: 1px solid #1a1a2e;
    padding: 16px;
}
.cf-info__title {
    font-size: 13px; font-weight: 700; color: #8a8aaa;
    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px;
}
.cf-info__row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid #1a1a2e;
}
.cf-info__row:last-child { border-bottom: none; }
.cf-info__label { color: #8a8aaa; font-size: 13px; }
.cf-info__value { color: #fff; font-size: 14px; font-weight: 700; }
.cf-info__value--gold { color: #f5c842; }
.cf-info__value--green { color: #4ade80; }

/* ===== RULES ===== */
.cf-rules {
    background: #0d0d14; border-radius: 16px; border: 1px solid #1a1a2e;
    padding: 16px; margin-top: 16px;
}
.cf-rules__title {
    font-size: 13px; font-weight: 700; color: #8a8aaa;
    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px;
}
.cf-rules__text {
    font-size: 12px; color: #666; line-height: 1.6;
}

/* ===== PARTICLES (win celebration) ===== */
.cf-particle {
    position: fixed; pointer-events: none; z-index: 999;
    width: 8px; height: 8px; border-radius: 2px;
    animation: particleFall linear forwards;
}
@keyframes particleFall {
    0% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
    100% { opacity: 0; transform: translateY(100vh) rotate(720deg) scale(0.3); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .cf-layout { flex-direction: column; }
    .cf-center { order: 1; width: 100%; }
    .cf-right { width: 100%; order: 2; }
    .cf-top-wins { order: 3; width: 100%; }
    .cf-arena { min-height: 360px; margin-left: auto; margin-right: auto; }
    .cf-coin-wrapper { width: 160px; height: 160px; }
    .cf-coin__icon { width: 56px; height: 56px; }
    .cf-coin__emblem { width: 72px; height: 72px; }
    .cf-coin__star { font-size: 42px; }
    .cf-status { font-size: 18px; }
    .cf-win-popup { padding: 30px 40px; }
    .cf-win-popup__amount { font-size: 36px; }
    .cf-coin-shadow { width: 120px; height: 22px; bottom: 60px; }
    .cf-top-wins__row { padding: 6px 8px; gap: 8px; }
    .cf-top-wins__avatar { width: 28px; height: 28px; }
    .cf-top-wins__amount { font-size: 13px; min-width: 60px; }
}
