/* ═══════════════════════════════════════════════════════
   Casino TopList v2 — Enhanced Design
   Drop-in replacement for assets/style.css (no PHP changes)
═══════════════════════════════════════════════════════ */

:root {
    /* Brand */
    --ctl-green:        #16a34a;
    --ctl-green-h:      #15803d;
    --ctl-green-d:      #14532d;

    /* Top-3 medals */
    --ctl-gold-1:       #fbbf24;
    --ctl-gold-2:       #f59e0b;
    --ctl-silver-1:     #d4d4d8;
    --ctl-silver-2:     #a1a1aa;
    --ctl-bronze-1:     #d97706;
    --ctl-bronze-2:     #b45309;

    /* Accent */
    --ctl-red:          #ef4444;
    --ctl-red-d:        #dc2626;

    /* Neutrals */
    --ctl-text:         #0f172a;
    --ctl-muted:        #64748b;
    --ctl-border:       #e2e8f0;
    --ctl-bg:           #ffffff;
    --ctl-bg-soft:      #f8fafc;

    /* Sizing & shadow */
    --ctl-radius:       16px;
    --ctl-radius-sm:    10px;
    --ctl-shadow-sm:    0 1px 2px rgba(0,0,0,0.04), 0 2px 8px rgba(15,23,42,0.06);
    --ctl-shadow-md:    0 4px 12px rgba(15,23,42,0.08), 0 8px 24px rgba(15,23,42,0.06);
    --ctl-shadow-gold:  0 10px 30px rgba(245,158,11,0.18), 0 4px 14px rgba(15,23,42,0.08);
}

/* ────────── Toplist container ────────── */
.ctl-toplist {
    display: grid;
    grid-template-columns: auto auto auto auto 1fr;
    row-gap: 14px;
    width: 100%;
    max-width: 920px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    box-sizing: border-box;
    color: var(--ctl-text);
}

/* ────────── Card ────────── */
.ctl-card {
    position: relative;
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
    align-items: center;
    background: var(--ctl-bg);
    border: 1px solid var(--ctl-border);
    border-radius: var(--ctl-radius);
    box-shadow: var(--ctl-shadow-sm);
    overflow: hidden;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
    box-sizing: border-box;
    isolation: isolate;
}
.ctl-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 5px;
    background: linear-gradient(180deg, var(--ctl-green), var(--ctl-green-d));
    z-index: 1;
    border-top-left-radius: var(--ctl-radius);
    border-bottom-left-radius: var(--ctl-radius);
}
.ctl-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--ctl-shadow-md);
    border-color: rgba(22,163,74,0.25);
}

/* ── #1: gold accent (no bg gradient, no ribbon — pill goes inside brand) ── */
.ctl-card:nth-child(1) {
    border-color: rgba(245,158,11,0.4);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 14px rgba(245,158,11,0.18);
}
.ctl-card:nth-child(1):hover {
    box-shadow: 0 4px 12px rgba(15,23,42,0.08), 0 8px 24px rgba(245,158,11,0.25);
    border-color: rgba(245,158,11,0.55);
}
.ctl-card:nth-child(1)::before {
    width: 6px;
    background: linear-gradient(180deg, var(--ctl-gold-1), var(--ctl-gold-2));
}

/* ── #2 silver, #3 bronze accent bars ── */
.ctl-card:nth-child(2)::before {
    background: linear-gradient(180deg, var(--ctl-silver-1), var(--ctl-silver-2));
}
.ctl-card:nth-child(3)::before {
    background: linear-gradient(180deg, var(--ctl-bronze-1), var(--ctl-bronze-2));
}
/* Positions 4+ — no colored side bar */
.ctl-card:nth-child(n+4)::before {
    content: none;
}

/* ────────── Position ────────── */
.ctl-pos {
    flex-shrink: 0;
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px 0 10px;
    position: relative;
}
.ctl-pos-num {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: var(--ctl-text);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 1px 2px rgba(0,0,0,0.08);
    transition: transform .2s;
}
.ctl-card:hover .ctl-pos-num { transform: scale(1.05); }

.ctl-card:nth-child(1) .ctl-pos-num {
    background: linear-gradient(135deg, var(--ctl-gold-1), var(--ctl-gold-2));
    color: #fff;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
    box-shadow: 0 2px 8px rgba(245,158,11,0.5);
    width: 44px;
    height: 44px;
}
.ctl-card:nth-child(2) .ctl-pos-num {
    background: linear-gradient(135deg, var(--ctl-silver-1), var(--ctl-silver-2));
    color: #fff;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
    box-shadow: 0 2px 8px rgba(161,161,170,0.5);
}
.ctl-card:nth-child(3) .ctl-pos-num {
    background: linear-gradient(135deg, var(--ctl-bronze-1), var(--ctl-bronze-2));
    color: #fff;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
    box-shadow: 0 2px 8px rgba(180,83,9,0.5);
}

/* ────────── Logo ────────── */
.ctl-logo-wrap {
    flex-shrink: 0;
    width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 10px;
    gap: 6px;
    position: relative;
}
.ctl-logo-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    display: block;
    border-radius: 10px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.06));
    transition: transform .25s ease;
}
.ctl-card:hover .ctl-logo-img { transform: scale(1.05); }

.ctl-logo-placeholder {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--ctl-green), var(--ctl-green-h));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    border-radius: 10px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    letter-spacing: .5px;
}

.ctl-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, var(--ctl-red), var(--ctl-red-d));
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .8px;
    box-shadow: 0 2px 6px rgba(239,68,68,0.35);
    animation: ctl-pulse 2s ease-in-out infinite;
    position: relative;
    overflow: hidden;
    line-height: 1.2;
}
@keyframes ctl-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.06); }
}

/* ── HOT — fire vibe ── */
.ctl-badge-hot {
    background: linear-gradient(135deg, #fbbf24 0%, #f97316 50%, #dc2626 100%);
    box-shadow:
        0 2px 8px rgba(249, 115, 22, 0.55),
        0 0 14px rgba(220, 38, 38, 0.35);
    animation: ctl-fire 1.6s ease-in-out infinite;
}
.ctl-badge-hot::before {
    content: '\1F525';                  /* 🔥 */
    font-size: 11px;
    line-height: 1;
}
@keyframes ctl-fire {
    0%, 100% {
        transform: scale(1);
        box-shadow:
            0 2px 8px rgba(249, 115, 22, 0.55),
            0 0 12px rgba(220, 38, 38, 0.35);
    }
    50% {
        transform: scale(1.05);
        box-shadow:
            0 4px 14px rgba(251, 191, 36, 0.7),
            0 0 22px rgba(220, 38, 38, 0.55);
    }
}

/* ── NEW — fresh / shine vibe ── */
.ctl-badge-new {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.45);
    animation: none;
}
.ctl-badge-new::before {
    content: '\2728';                   /* ✨ */
    font-size: 10px;
    line-height: 1;
}
.ctl-badge-new::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
    transform: translateX(-100%);
    animation: ctl-shine 2.8s ease-in-out infinite;
    pointer-events: none;
    will-change: transform;
}
@keyframes ctl-shine {
    0%   { transform: translateX(-100%); }
    50%, 100% { transform: translateX(283%); }
}

/* ────────── Brand & Rating ────────── */
.ctl-brand-wrap {
    flex-shrink: 0;
    width: 150px;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
}

/* "TOP CHOICE" pill for #1 — sits above brand name, never overlaps CTA */
.ctl-card:nth-child(1) .ctl-brand-wrap::before {
    content: '\2605 TOP CHOICE';
    display: inline-block;
    background: linear-gradient(135deg, var(--ctl-gold-1), var(--ctl-gold-2));
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.2px;
    padding: 3px 10px;
    border-radius: 20px;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
    box-shadow: 0 2px 6px rgba(245,158,11,0.4);
    text-transform: uppercase;
    white-space: nowrap;
}

.ctl-brand {
    font-size: 20px;
    font-weight: 800;
    color: var(--ctl-text);
    line-height: 1.2;
    letter-spacing: -0.01em;
    word-break: break-word;
}

.ctl-rating {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    justify-content: center;
}
.ctl-rating-star {
    font-size: 18px;
    line-height: 1;
    align-self: center;
    background: linear-gradient(
        90deg,
        var(--ctl-gold-2) 0%,
        var(--ctl-gold-2) var(--ctl-fill, 100%),
        #cbd5e1            var(--ctl-fill, 100%),
        #cbd5e1            100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
.ctl-rating-value {
    font-size: 16px;
    font-weight: 800;
    color: var(--ctl-text);
    letter-spacing: -0.01em;
}
.ctl-rating-scale {
    font-size: 12px;
    font-weight: 700;
    color: var(--ctl-muted);
}

/* ────────── Bonus ────────── */
.ctl-bonus-wrap {
    flex: 1;
    padding: 16px 16px 16px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0;
}
.ctl-bonus-label {
    font-size: 10px;
    font-weight: 800;
    color: var(--ctl-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    white-space: nowrap;
}
.ctl-bonus-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--ctl-text);
    line-height: 1.3;
    letter-spacing: -0.01em;
}

/* ────────── CTA Button ────────── */
.ctl-cta-wrap {
    padding: 16px 28px 16px 24px;
    box-sizing: border-box;
    width: 100%;
}
.ctl-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 10px;
    background: linear-gradient(135deg, var(--ctl-green), var(--ctl-green-h));
    color: #fff !important;
    font-size: 17px;
    font-weight: 800;
    padding: 16px 24px;
    border-radius: var(--ctl-radius-sm);
    text-decoration: none !important;
    white-space: nowrap;
    overflow: hidden;
    box-sizing: border-box;
    box-shadow: 0 4px 14px rgba(22,163,74,0.35), inset 0 1px 0 rgba(255,255,255,0.2);
    transition: transform .15s ease, box-shadow .15s ease;
    letter-spacing: .5px;
    text-transform: uppercase;
}
.ctl-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
    transition: left .6s ease;
    pointer-events: none;
}
.ctl-btn::after {
    content: '\2192';
    font-size: 18px;
    line-height: 1;
    transition: transform .2s ease;
}
.ctl-btn:hover {
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(22,163,74,0.5), inset 0 1px 0 rgba(255,255,255,0.25);
    text-decoration: none !important;
}
.ctl-btn:hover::before { left: 100%; }
.ctl-btn:hover::after  { transform: translateX(4px); }
.ctl-btn:active        { transform: translateY(0); }
.ctl-btn:focus-visible {
    outline: 2px solid var(--ctl-gold-2);
    outline-offset: 3px;
}

/* Extra glow on #1's CTA */
.ctl-card:nth-child(1) .ctl-btn {
    box-shadow:
        0 4px 14px rgba(22,163,74,0.45),
        0 0 0 3px rgba(245,158,11,0.18),
        inset 0 1px 0 rgba(255,255,255,0.2);
}

/* ═══════════════════════════════════════
   Tablet ≤ 760px
═══════════════════════════════════════ */
@media screen and (max-width: 760px) {
    .ctl-toplist {
        display: flex;
        flex-direction: column;
        gap: 14px;
    }
    .ctl-card {
        display: flex;
        grid-template-columns: none;
        grid-column: auto;
        flex-wrap: wrap;
        padding-bottom: 14px;
    }
    .ctl-trail { display: none; }
    .ctl-brand-wrap {
        width: auto;
        flex: 1;
        min-width: 130px;
        padding: 14px 12px 8px;
    }
    .ctl-bonus-wrap {
        padding: 14px;
    }
    .ctl-cta-wrap {
        flex: 0 0 100%;
        padding: 0 14px;
        order: 6;
    }
    .ctl-btn {
        width: 100%;
        justify-content: center;
        padding: 14px;
    }
    .ctl-logo-wrap { width: 96px; padding: 14px 8px; }
    .ctl-logo-img,
    .ctl-logo-placeholder { width: 76px; height: 76px; }
}

/* ═══════════════════════════════════════
   Mobile redesign ≤ 540px
   ─────────────────────────────────────────
   Full vertical stack:
      ⌜badge⌝
      [    LOGO    ]
      [    Brand   ]
      [  ★ 9.8/10  ]
      ────────────
      [ WELCOME BONUS ]
      [  100% up to.. ]
      [    PLAY  →    ]
═══════════════════════════════════════ */
@media screen and (max-width: 540px) {
    .ctl-card {
        flex-wrap: wrap;
        overflow: visible;            /* let the corner badge stick out */
        padding-top: 4px;
    }

    /* Position circle → absolute "rank badge" overlapping top-left corner */
    .ctl-pos {
        position: absolute;
        top: -10px;
        left: 12px;
        width: 38px;
        height: 38px;
        padding: 0;
        z-index: 10;
    }
    .ctl-pos-num,
    .ctl-card:nth-child(1) .ctl-pos-num,
    .ctl-card:nth-child(2) .ctl-pos-num,
    .ctl-card:nth-child(3) .ctl-pos-num {
        width: 38px;
        height: 38px;
        font-size: 15px;
        border: 2px solid #fff;
        box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    }
    /* TOP CHOICE pill replaced by gold corner badge — hide on mobile */
    .ctl-card:nth-child(1) .ctl-brand-wrap::before {
        display: none;
    }

    /* Each section becomes its own full-width row */
    .ctl-logo-wrap {
        flex: 0 0 100%;
        width: auto;
        padding: 16px 14px 4px;
        justify-content: center;
        align-items: center;
    }
    .ctl-logo-img,
    .ctl-logo-placeholder {
        width: 76px;
        height: 76px;
    }
    .ctl-logo-placeholder {
        font-size: 22px;
        border-radius: 12px;
    }

    .ctl-brand-wrap {
        flex: 0 0 100%;
        width: auto;
        padding: 4px 14px 12px;
        align-items: center;
        text-align: center;
        gap: 6px;
        border-right: none;
    }
    .ctl-brand {
        font-size: 20px;
        line-height: 1.2;
    }
    .ctl-rating-star  { font-size: 18px; }
    .ctl-rating-value { font-size: 16px; }
    .ctl-rating-scale { font-size: 13px; }

    .ctl-bonus-wrap {
        flex: 0 0 100%;
        padding: 12px 16px;
        align-items: center;
        text-align: center;
        border-top: 1px solid var(--ctl-border);
    }
    .ctl-bonus-label {
        font-size: 10px;
        letter-spacing: 1.2px;
    }
    .ctl-bonus-title {
        font-size: 17px;
    }

    .ctl-cta-wrap {
        flex: 0 0 100%;
        order: 6;
        padding: 0 14px 14px;
    }
    .ctl-btn {
        width: 100%;
        justify-content: center;
        padding: 14px;
    }
}

/* ═══════════════════════════════════════
   Mobile ≤ 400px (tighter — small iPhones)
═══════════════════════════════════════ */
@media screen and (max-width: 400px) {
    .ctl-pos { left: 10px; top: -8px; width: 34px; height: 34px; }
    .ctl-pos-num,
    .ctl-card:nth-child(1) .ctl-pos-num,
    .ctl-card:nth-child(2) .ctl-pos-num,
    .ctl-card:nth-child(3) .ctl-pos-num {
        width: 34px; height: 34px; font-size: 14px;
    }

    .ctl-logo-img,
    .ctl-logo-placeholder { width: 66px; height: 66px; }
    .ctl-logo-placeholder { font-size: 19px; }

    .ctl-brand { font-size: 18px; }
    .ctl-rating-star  { font-size: 17px; }
    .ctl-rating-value { font-size: 15px; }
    .ctl-rating-scale { font-size: 12px; }
    .ctl-bonus-title  { font-size: 16px; }
    .ctl-btn { font-size: 14px; padding: 12px; letter-spacing: .2px; }
}

/* ═══════════════════════════════════════
   Reduced motion (a11y)
═══════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .ctl-card,
    .ctl-btn,
    .ctl-btn::before,
    .ctl-btn::after,
    .ctl-logo-img,
    .ctl-pos-num,
    .ctl-badge,
    .ctl-badge-hot,
    .ctl-badge-new,
    .ctl-badge-new::after {
        transition: none !important;
        animation: none !important;
    }
}
