/* Mobile-first responsive enhancements for game pages */
/* This file is loaded after styles.css to override/add mobile rules */

/* Base tweaks that apply on all sizes (kept minimal) */
.actions .btn.primary {
    transition: transform .15s ease, box-shadow .25s ease;
}

.actions .btn.primary:active {
    transform: scale(.96);
}

/* Desktop baseline (>=901px) keep original inline header */
@media (min-width: 901px) {
    .topbar {
        display: flex;
        align-items: center;
        gap: 1.25rem;
    }

    .topbar .nav {
        display: flex;
    }

    .topbar .userbox {
        display: flex;
    }

    .topbar .nav-toggle {
        display: none;
    }

    body.menu-open::before {
        display: none;
    }
}

/* Breakpoint: tablets & phones */
@media (max-width: 768px) {

    /* Remove large vertical centering padding so natural flow works */
    .vh-center {
        min-height: 0;
    }

    /* Turn the two-column grid into a normal flow we can reorder */
    .grid.grid-2 {
        display: flex;
        flex-direction: column;
    }

    /* Put the formerly right (controls) section first, game stage second */
    .grid.grid-2>.card.game-stage {
        order: 2;
    }

    .grid.grid-2>.card:not(.game-stage) {
        order: 1;
    }

    /* Buttons full width for easier tapping */
    .actions .btn.primary {
        width: 100%;
        justify-content: center;
        font-size: 1rem;
    }

    .pill {
        flex: 1 1 calc(33.33% - .75rem);
        text-align: center;
    }

    /* Reduce excessive padding for tighter mobile UI */
    .card {
        padding: 1.35rem 1.15rem;
    }

    .game-stage.card {
        padding: 1.25rem .5rem 2rem;
    }

    /* Slots / reels scaling */
    .slots-container.large {
        gap: 10px;
        margin: 1.25rem 0 0.5rem;
    }

    .slots-container.large .slot-reel {
        width: 82px;
        height: 130px;
    }

    .slots-container.large .slot-symbol,
    .slots-container.large .slot-cell {
        height: 130px;
        font-size: 2.3rem;
    }

    /* Dice / coin containers smaller */
    .coin-container.large {
        height: 200px;
    }

    .dice-container.large {
        height: 200px;
    }

    .dice.big {
        width: 100px;
        height: 100px;
    }

    .dice.big .dice-face {
        width: 100px;
        height: 100px;
    }

    .dice.big .dice-face-1 {
        transform: rotateY(0deg) translateZ(50px);
    }

    .dice.big .dice-face-2 {
        transform: rotateY(90deg) translateZ(50px);
    }

    .dice.big .dice-face-3 {
        transform: rotateY(180deg) translateZ(50px);
    }

    .dice.big .dice-face-4 {
        transform: rotateY(-90deg) translateZ(50px);
    }

    .dice.big .dice-face-5 {
        transform: rotateX(90deg) translateZ(50px);
    }

    .dice.big .dice-face-6 {
        transform: rotateX(-90deg) translateZ(50px);
    }

    /* High–Low number scaling */
    .num {
        font-size: 3.2rem;
    }

    /* Duplicate button (appended below game stage) styling */
    .mobile-dup-actions {
        margin-top: .75rem;
        display: flex;
        justify-content: center;
    }

    .mobile-dup-actions .btn.primary {
        width: min(420px, 100%);
    }

    /* Make primary action sticky at top while scrolling the controls (first section) */
    .grid.grid-2>.card:not(.game-stage) .actions:first-of-type .btn.primary {
        position: sticky;
        top: 0;
        z-index: 10;
    }
}

/* Small phones tweak */
@media (max-width: 480px) {
    .slots-container.large .slot-reel {
        width: 70px;
        height: 118px;
    }

    .slots-container.large .slot-symbol,
    .slots-container.large .slot-cell {
        height: 118px;
        font-size: 2.05rem;
    }

    .chip {
        font-size: .75rem;
    }

    .hero {
        font-size: 2rem;
    }

    .actions {
        gap: .5rem;
    }

    .pill {
        flex: 1 1 calc(50% - .5rem);
    }
}

/* Simplified Mobile Header (<=900px) */
@media (max-width: 900px) {
    .topbar {
        position: sticky;
        top: 0;
        z-index: 150;
        padding: .7rem .9rem;
        gap: .75rem;
        justify-content: space-between;
    }

    .hdr-right {
        display: flex;
        align-items: center;
        gap: .6rem;
    }

    .topbar .nav {
        display: none;
    }

    .topbar .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: 1px solid var(--border-primary);
        background: var(--surface-elevated);
        border-radius: 10px;
        cursor: pointer;
        transition: background .25s, border-color .25s;
    }

    .topbar .nav-toggle:hover {
        background: var(--surface);
        border-color: var(--border-accent);
    }

    .topbar .nav-toggle .bars {
        width: 18px;
        height: 14px;
        position: relative;
        display: block;
    }

    .topbar .nav-toggle .bars span {
        position: absolute;
        left: 0;
        width: 100%;
        height: 2px;
        background: var(--text-primary);
        border-radius: 2px;
        transition: transform .35s, top .35s, opacity .25s;
    }

    .topbar .nav-toggle .bars span:nth-child(1) {
        top: 0;
    }

    .topbar .nav-toggle .bars span:nth-child(2) {
        top: 6px;
    }

    .topbar .nav-toggle .bars span:nth-child(3) {
        top: 12px;
    }

    .topbar.menu-open .nav-toggle .bars span:nth-child(1) {
        top: 6px;
        transform: rotate(45deg);
    }

    .topbar.menu-open .nav-toggle .bars span:nth-child(2) {
        opacity: 0;
    }

    .topbar.menu-open .nav-toggle .bars span:nth-child(3) {
        top: 6px;
        transform: rotate(-45deg);
    }

    /* Dropdown panel */
    .topbar.menu-open .nav {
        display: flex;
        flex-direction: column;
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        background: rgba(10, 10, 15, 0.95);
        backdrop-filter: blur(18px) saturate(180%);
        -webkit-backdrop-filter: blur(18px) saturate(180%);
        padding: 1rem 1rem 1.2rem;
        gap: .55rem;
        border-bottom: 1px solid var(--border-primary);
        animation: menuDrop .35s cubic-bezier(.4, .8, .3, 1);
        max-height: calc(100dvh - 60px);
        overflow-y: auto;
    }

    @keyframes menuDrop {
        from {
            opacity: 0;
            transform: translateY(-8px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .topbar.menu-open .nav a {
        border: 1px solid var(--border-secondary);
        background: var(--surface-glass);
        padding: .8rem .95rem;
        border-radius: .85rem;
        font-size: 1rem;
    }

    .topbar.menu-open .nav a:active {
        transform: scale(.97);
    }

    body.menu-open {
        overflow: hidden;
    }

    body.menu-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .55);
        z-index: 100;
    }

    /* Compact userbox spacing */
    .topbar .userbox {
        gap: .5rem;
    }

    .topbar .userbox a.btn {
        display: none;
    }

    /* Login / Logout als erster Block im Dropdown nach Links anhängen */
    .topbar.menu-open .nav::after {
        content: '';
    }
}

/* Leaderboard horizontal scroll utility */
.lb-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.lb-scroll::-webkit-scrollbar {
    height: 8px;
}

.lb-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.lb-scroll::-webkit-scrollbar-thumb {
    background: var(--surface-elevated);
    border-radius: 4px;
}

.lb-scroll .lb-table {
    min-width: 620px;
}

.lb-scroll .lb-header,
.lb-scroll .lb-list {
    min-width: 620px;
}

@media (max-width:640px) {

    .lb-scroll .lb-table,
    .lb-scroll .lb-header,
    .lb-scroll .lb-list {
        min-width: 560px;
    }
}

/* ------------------------------------------------------ */
/* Emoji Normalization (Twemoji images)                   */
/* Ensures consistent look across OS incl. Win10 legacy   */
/* Twemoji © Twitter, CC-BY 4.0                           */
/* ------------------------------------------------------ */
img.emoji {
    height: 1em;
    width: 1em;
    vertical-align: -0.15em;
    pointer-events: none;
    display: inline-block;
}

.emoji.big,
.emoji-xl img.emoji {
    height: 1.8em;
    width: 1.8em;
}

.emoji-shadow img.emoji {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .4));
}