/* ═══════════════════════════════════════════════════════════════
   DouwNo — Ludo design-language alignment layer.
   Loaded AFTER douwno.css: brings the neon glassmorphism look of
   Ludo (fonts, tokens, glass panels, vignette, 3D depth, glows)
   to the DouwNo pages without rewriting the base stylesheet.
   ═══════════════════════════════════════════════════════════════ */

:root {
    --l-bg: #090612;
    --l-glass: rgba(22, 15, 44, 0.72);
    --l-glass-strong: rgba(18, 12, 36, 0.88);
    --l-border: rgba(255, 255, 255, 0.12);
    --l-text: #f5f3ff;
    --l-muted: #a99fd1;
    --l-accent: #a855f7;
    --l-hot: #ec4899;
    --l-blue: #38bdf8;
    --l-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
    --l-font-display: 'Fredoka', 'Poppins', system-ui, sans-serif;
}

/* ── Page backdrop & 3D scene canvas ───────────────────────── */
body {
    background: var(--l-bg);
}

.douwno-scene {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}
.douwno-scene canvas { display: block; width: 100%; height: 100%; opacity: 0.48; }

/* Vignette like Ludo's, above the scene but below the UI */
.douwno-vignette {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 55%, transparent 45%, rgba(5, 3, 14, 0.75) 100%),
        linear-gradient(to bottom, rgba(5, 3, 14, 0.55), transparent 16%, transparent 80%, rgba(5, 3, 14, 0.6));
}

/* Keep UI above scene/vignette (headers are already sticky with z-index 100) */
.douwno-main, .dm-main { position: relative; z-index: 2; }

/* During a match the game takes the whole screen: hide the site header
   so it cannot bleed through the translucent game backdrop. */
body.douwno-ingame header { display: none; }
body.douwno-ingame { overflow: hidden; }

/* ── Typography ────────────────────────────────────────────── */
.douwno-logo__card,
.douwno-room-code,
.douwno-gameover__title,
.douwno-gameover__text,
.douwno-uno-btn,
h1, h2, h3 {
    font-family: var(--l-font-display);
}

/* ── Glass panels (lobby, waiting room, modals) ────────────── */
.douwno-main .card {
    background: var(--l-glass);
    border: 1px solid var(--l-border);
    border-radius: 22px;
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.douwno-input,
.douwno-prize-input,
.douwno-bot-difficulty {
    background: rgba(9, 6, 18, 0.55);
    border: 1px solid var(--l-border);
    border-radius: 12px;
    color: var(--l-text);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.douwno-input:focus,
.douwno-prize-input:focus {
    outline: none;
    border-color: var(--l-accent);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.22);
}

/* Pill buttons with spring hover, like Ludo */
.douwno-main .btn,
.douwno-gameover .btn {
    border-radius: 999px;
    font-weight: 700;
    transition: transform 0.2s var(--l-ease), box-shadow 0.25s, background 0.2s, filter 0.2s;
}
.douwno-main .btn:hover,
.douwno-gameover .btn:hover { transform: translateY(-2px); }
.douwno-main .btn:active,
.douwno-gameover .btn:active { transform: scale(0.96); }
.douwno-main .btn-primary,
.douwno-gameover .btn-primary {
    background: linear-gradient(135deg, var(--l-accent), #7c3aed);
    border: none;
    box-shadow: 0 10px 26px rgba(168, 85, 247, 0.35);
}
.douwno-main .btn-primary:hover,
.douwno-gameover .btn-primary:hover {
    box-shadow: 0 14px 34px rgba(168, 85, 247, 0.5);
}

/* ── Logo: floating 3D cards ───────────────────────────────── */
.douwno-logo { perspective: 600px; }
.douwno-logo__card {
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45), 0 0 18px rgba(168, 85, 247, 0.25);
    transform-style: preserve-3d;
}
.douwno-logo__card:hover {
    transform: translateY(-10px) rotateY(16deg) rotate(-4deg) scale(1.12);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55), 0 0 26px rgba(168, 85, 247, 0.45);
}

/* ── Game board ────────────────────────────────────────────── */
/* Let the 3D scene show through the board backdrop */
.douwno-game {
    background:
        radial-gradient(ellipse at 50% 42%, rgba(22, 15, 44, 0.25) 0%, rgba(9, 6, 18, 0.72) 78%, rgba(5, 3, 14, 0.9) 100%);
}

/* Floor glow: a soft pool of light under the table for spatial depth */
.douwno-game::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 52%;
    width: 130vw;
    height: 55vh;
    transform: translateX(-50%);
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 12%, rgba(168, 85, 247, 0.14), rgba(56, 189, 248, 0.04) 45%, transparent 68%);
    z-index: 0;
}

.douwno-topbar {
    background: var(--l-glass);
    border-bottom: 1px solid var(--l-border);
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
}

.douwno-btn-sm {
    border-radius: 999px;
    border: 1px solid var(--l-border);
    background: var(--l-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.2s var(--l-ease), background 0.2s;
}
.douwno-btn-sm:hover { transform: scale(1.1); background: rgba(60, 40, 110, 0.75); }
.douwno-btn-sm:active { transform: scale(0.94); }
.douwno-btn-sm.is-off { opacity: 0.5; }

/* Neon turn-timer bar */
.douwno-timer__bar {
    background: linear-gradient(90deg, var(--l-blue), var(--l-accent), var(--l-hot)) !important;
    box-shadow: 0 0 14px rgba(168, 85, 247, 0.65);
}

/* ── Table: neon-glass arena with REAL 3D depth ────────────── */
/* The whole play area becomes a 3D viewport: the table is tilted
   like a real card table seen from a seat, piles stand on top. */
.douwno-game-area {
    perspective: 1250px;
    perspective-origin: 50% 18%;
    padding: clamp(0px, 1vh, 8px);
}

.douwno-table {
    width: min(90vw, 700px);
    height: min(46vh, 350px);
    transform: translateY(-2%)
        rotateX(calc(34deg + var(--douwno-tilt-x, 0deg)))
        rotateY(var(--douwno-tilt-y, 0deg));
    transform-style: preserve-3d;
    transition: transform 0.25s ease-out;
    background:
        radial-gradient(ellipse at 50% 24%, rgba(80, 155, 132, 0.28), transparent 58%),
        repeating-linear-gradient(118deg, rgba(220, 255, 242, 0.018) 0 1px, transparent 1px 5px),
        linear-gradient(155deg, #173b3d 0%, #102d35 58%, #0b202b 100%);
    border: 6px solid rgba(133, 111, 190, 0.6);
    box-shadow:
        /* extruded rim → table thickness */
        0 12px 0 -2px #302958,
        0 22px 0 -5px #191a31,
        /* ground shadow */
        0 42px 72px rgba(0, 0, 0, 0.72),
        /* neon glow */
        0 0 34px rgba(122, 91, 207, 0.2),
        inset 0 0 55px rgba(0, 0, 0, 0.48),
        inset 0 0 22px rgba(145, 221, 193, 0.1);
}
.douwno-table::before {
    border-top-color: rgba(232, 220, 255, 0.42);
    border-left-color: rgba(232, 220, 255, 0.2);
}
.douwno-table::after {
    border: 2px solid rgba(180, 214, 199, 0.2);
    box-shadow: inset 0 0 24px rgba(145, 221, 193, 0.08);
}

/* Piles stand ON the tilted table: counter-tilt keeps the cards
   readable while they float above the felt with a drop shadow. */
.douwno-center {
    transform-style: preserve-3d;
    transform: rotateX(-32deg) translateZ(58px);
}
.douwno-center .douwno-card-3d,
.douwno-center .douwno-card {
    filter: drop-shadow(0 22px 18px rgba(0, 0, 0, 0.55));
}

/* The direction arrow orbits ON the tilted plane (true 3D path) */
.douwno-table-arrow { transform-style: preserve-3d; }

/* Discard aura glow (neon) */
.douwno-discard-aura {
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.22) 0%, rgba(236, 72, 153, 0.1) 45%, transparent 70%);
    filter: blur(6px);
    animation: douwnoAuraPulse 3.2s ease-in-out infinite;
    pointer-events: none;
}
@keyframes douwnoAuraPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.12); opacity: 1; }
}

/* ── Hand: 3D card fan ─────────────────────────────────────── */
.douwno-hand {
    perspective: 1100px;
    perspective-origin: 50% 120%;
    height: auto;
    min-height: clamp(142px, calc(29vh + 28px), 205px);
    padding: 0 1rem max(1.75rem, env(safe-area-inset-bottom));
    overflow: visible;
}
.douwno-hand .douwno-card-3d {
    transform-style: preserve-3d;
    width: clamp(72px, min(11vw, 18.35vh), 120px);
    height: auto;
    aspect-ratio: 12 / 17;
    flex: 0 0 auto;
    filter: drop-shadow(0 7px 8px rgba(0, 0, 0, 0.38));
}
.douwno-hand .douwno-card-3d__inner {
    transform: rotateX(7deg) translateZ(2px);
    transform-origin: center bottom;
    transform-style: preserve-3d;
}
.douwno-hand .douwno-card-3d--flipped .douwno-card-3d__inner {
    transform: rotateY(180deg) rotateX(7deg) translateZ(2px);
}
.douwno-hand .douwno-card-3d:hover {
    transform: translateY(-18px) rotateX(8deg) scale(1.06) !important;
    filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.5));
}
.douwno-hand .douwno-card-3d--playable {
    filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.35));
}
.douwno-hand .douwno-card-3d--playable:hover {
    transform: translateY(-28px) rotateX(10deg) scale(1.12) !important;
    filter: drop-shadow(0 0 22px rgba(251, 191, 36, 0.85)) drop-shadow(0 18px 26px rgba(0, 0, 0, 0.5));
}

@media (max-height: 560px) {
    .douwno-hand {
        min-height: clamp(142px, calc(28vh + 20px), 190px);
    }

    .douwno-hand .douwno-card-3d {
        width: clamp(72px, min(11vw, 16.1vh), 120px);
    }

    .douwno-game-area {
        perspective-origin: 50% 25%;
    }

    .douwno-table {
        width: min(84vw, 640px);
        height: min(30vh, 160px);
        transform: rotateX(calc(30deg + var(--douwno-tilt-x, 0deg)))
            rotateY(var(--douwno-tilt-y, 0deg));
    }

    .douwno-center {
        transform: rotateX(-20deg) translateZ(30px);
    }

    .douwno-center .douwno-card-3d,
    .douwno-center .douwno-card {
        width: clamp(54px, min(8vw, 13vh), 88px);
        height: auto;
        aspect-ratio: 12 / 17;
    }

    .douwno-discard-pile {
        min-width: clamp(54px, min(8vw, 13vh), 88px);
        min-height: auto;
    }
}

@media (max-height: 360px) {
    .douwno-topbar {
        padding: 0.15rem 0.5rem;
    }

    .douwno-topbar .douwno-btn-sm {
        width: 28px;
        height: 28px;
        padding: 0;
    }

    .douwno-game .douwno-my-seat {
        padding: 0.25rem 0.75rem;
    }

    .douwno-my-seat .douwno-opponent__avatar {
        width: 28px;
        height: 28px;
    }

    .douwno-game .douwno-sort-bar {
        padding: 0.1rem 0.5rem;
    }

    .douwno-table {
        height: min(18vh, 70px);
    }
}

.douwno-my-seat {
    align-self: center;
    gap: 0.65rem;
    padding: 0.35rem 0.9rem;
    border: 1px solid rgba(206, 194, 242, 0.14);
    border-radius: 999px;
    background: rgba(15, 20, 35, 0.72);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.douwno-my-seat--active {
    border-color: rgba(251, 191, 36, 0.42);
    background: linear-gradient(110deg, rgba(251, 191, 36, 0.1), rgba(15, 20, 35, 0.78) 65%);
    box-shadow: 0 0 24px rgba(251, 191, 36, 0.1), 0 8px 24px rgba(0, 0, 0, 0.24);
}

.douwno-sort-bar {
    gap: 0.45rem;
    padding: 0.4rem 1rem 0.3rem;
}

.douwno-sort-btn {
    border-color: rgba(206, 194, 242, 0.16);
    background: rgba(22, 23, 42, 0.68);
    color: #eee9ff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.douwno-sort-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.douwno-waiting__actions [data-start-game]:disabled {
    cursor: not-allowed;
    filter: grayscale(0.45);
    opacity: 0.55;
}

/* ── Sidebar / chat / overlays: glassmorphism ──────────────── */
.douwno-sidebar {
    background: var(--l-glass-strong);
    border-right: 1px solid var(--l-border);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    box-shadow: 10px 0 36px rgba(0, 0, 0, 0.35);
}

.douwno-chat {
    background: var(--l-glass-strong);
    border: 1px solid var(--l-border);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
}

.douwno-toast {
    background: var(--l-glass-strong);
    border: 1px solid var(--l-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.douwno-color-picker {
    background: rgba(5, 3, 14, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.douwno-color-picker__inner {
    background: var(--l-glass-strong);
    border: 1px solid var(--l-border);
    border-radius: 22px;
    padding: 1.8rem 2.2rem;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.douwno-gameover {
    background: rgba(5, 3, 14, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.douwno-gameover__inner {
    background: var(--l-glass-strong);
    border: 1px solid var(--l-border);
    border-radius: 26px;
    padding: 2.2rem 3rem;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 60px rgba(168, 85, 247, 0.18);
}

/* ── DOUWNO! button: neon pulse ────────────────────────────── */
.douwno-uno-btn {
    letter-spacing: 0.06em;
    box-shadow: 0 0 24px rgba(236, 72, 153, 0.5), 0 10px 26px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s var(--l-ease), box-shadow 0.25s;
}
.douwno-uno-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 0 36px rgba(236, 72, 153, 0.75), 0 14px 32px rgba(0, 0, 0, 0.5);
}

.douwno-sort-btn {
    border-radius: 999px;
    border: 1px solid var(--l-border);
    background: var(--l-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.2s var(--l-ease), background 0.2s;
}
.douwno-sort-btn:hover { transform: translateY(-2px); background: rgba(60, 40, 110, 0.75); }

/* ── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .douwno-discard-aura { animation: none; }
    .douwno-logo__card { animation: none; }
}

/* ═══ DouwNo MENU page (dm-*) alignment ═══════════════════════ */
.dm-logo__letter { font-family: var(--l-font-display); }

.dm-header {
    background: var(--l-glass-strong);
    border-bottom: 1px solid var(--l-border);
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.dm-menu__btn,
.dm-play-card,
.dm-auth-gate__card {
    background: var(--l-glass);
    border: 1px solid var(--l-border);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.dm-menu__btn {
    transition: transform 0.25s var(--l-ease), box-shadow 0.3s, border-color 0.3s;
}
.dm-menu__btn:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: var(--l-accent);
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(168, 85, 247, 0.25);
}
