/* ═══════════════════════════════════════════════════════
   WordDuel — Responsive Breakpoints v2 (3D preserved)
   ═══════════════════════════════════════════════════════ */

/* ── Extra-small phones / foldables (≤ 320px) ─────── */
@media (max-width: 320px) {
    :root {
        --tile-size: 40px;
        --tile-gap: 3px;
        --key-height: 42px;
        --key-width: 24px;
        --key-gap: 3px;
        --tile-3d-depth: 3px;
        --key-3d-depth: 2px;
    }

    h1 {
        font-size: var(--text-xl);
    }

    h2 {
        font-size: var(--text-lg);
    }

    .container {
        padding: 0 var(--space-sm);
    }

    .hero__title {
        font-size: var(--text-2xl);
    }

    .tile {
        font-size: var(--text-lg);
    }

    .key {
        font-size: 0.65rem;
    }

    .battle__players {
        gap: var(--space-xs);
    }

    .mini-tile {
        width: 16px;
        height: 16px;
        border-radius: 2px;
    }

    /* Powerups: stack vertically on tiny screens */
    .powerups {
        flex-direction: column;
        gap: var(--space-xs);
    }

    .powerups .btn {
        font-size: var(--text-xs);
        padding: 6px 12px;
    }
}

/* ── Small phones (321px – 375px) ────────────────── */
@media (min-width: 321px) and (max-width: 375px) {
    :root {
        --tile-size: 46px;
        --tile-gap: 4px;
        --key-height: 46px;
        --key-width: 28px;
        --key-gap: 4px;
        --tile-3d-depth: 4px;
        --key-3d-depth: 3px;
    }

    h1 {
        font-size: var(--text-2xl);
    }

    h2 {
        font-size: var(--text-xl);
    }

    .container {
        padding: 0 var(--space-md);
    }

    .hero__title {
        font-size: var(--text-3xl);
    }

    .battle__players {
        gap: var(--space-sm);
    }

    .mini-tile {
        width: 18px;
        height: 18px;
        border-radius: 3px;
    }

    .tile {
        font-size: var(--text-xl);
    }

    .key {
        font-size: var(--text-xs);
    }
}

/* ── Phones (≤ 640px) ──────────────────────────────── */
@media (max-width: 640px) {
    :root {
        --tile-size: 52px;
        --tile-gap: 5px;
        --key-height: 50px;
        --key-width: 32px;
        --key-gap: 4px;
        --header-height: 56px;
        --tile-3d-depth: 4px;
        --key-3d-depth: 3px;
    }

    h1 {
        font-size: var(--text-3xl);
    }

    .container {
        padding: 0 var(--space-md);
    }

    .header__nav {
        gap: var(--space-xs);
    }

    .mode-grid {
        grid-template-columns: 1fr;
    }

    .battle__players {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .battle__result-stats {
        flex-direction: column;
        gap: var(--space-md);
    }

    .footer__links {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .leaderboard-table {
        font-size: var(--text-sm);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .hero__actions {
        flex-direction: column;
        width: 100%;
    }

    .hero__actions .btn {
        width: 100%;
    }

    .tile {
        font-size: var(--text-xl);
    }
}

/* ── Tablets (641px – 1024px) ──────────────────────── */
@media (min-width: 641px) and (max-width: 1024px) {
    :root {
        --tile-size: 58px;
        --tile-gap: 5px;
        --key-height: 54px;
        --key-width: 40px;
        --tile-3d-depth: 4px;
        --key-3d-depth: 4px;
    }

    .mode-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ── Desktop (≥ 1025px) ────────────────────────────── */
@media (min-width: 1025px) {
    :root {
        --tile-size: 62px;
        --tile-3d-depth: 5px;
        --key-3d-depth: 4px;
    }

    .mode-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ── Landscape phones ──────────────────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
    :root {
        --tile-size: 38px;
        --key-height: 38px;
        --key-width: 28px;
        --tile-3d-depth: 3px;
        --key-3d-depth: 2px;
    }

    .game {
        gap: var(--space-sm);
        padding: var(--space-sm) 0;
    }

    .game__status {
        min-height: 20px;
        font-size: var(--text-sm);
    }

    .tile {
        font-size: var(--text-base);
    }

    .key {
        font-size: 0.7rem;
    }
}

/* ── Hover-capable devices only ────────────────────── */
@media (hover: hover) {
    .card--interactive:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg), var(--shadow-glow);
    }

    .key:hover {
        filter: brightness(1.08);
        transform: translateY(-1px);
    }
}

/* ── Reduced motion ────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Print ─────────────────────────────────────────── */
@media print {

    .header,
    .footer,
    .keyboard,
    .chat,
    .powerups,
    .btn,
    .toast-container {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}