/* Mobile-only responsive layer. Loaded after style.css and scoped to small screens. */

@media (max-width: 900px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    img,
    video,
    canvas,
    table {
        max-width: 100%;
    }

    .navbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.85rem;
    }

    .nav-center {
        order: -1;
    }

    .main-logo {
        width: 76px;
    }

    .nav-left,
    .nav-right {
        width: 100%;
        flex: none;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .navbar a,
    .nav-dropdown-toggle,
    .logout-form button {
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.45rem 0.6rem;
        border-radius: 8px;
        background: rgba(255,255,255,0.045);
        font-size: 0.72rem;
        line-height: 1.15;
        letter-spacing: 0;
        text-align: center;
    }

    .nav-dropdown {
        padding: 0;
        margin: 0;
    }

    .nav-dropdown-menu {
        left: 50%;
        min-width: 150px;
        z-index: 10020;
    }

    .main-content {
        width: 100%;
        padding: 1rem;
    }

    .footer {
        margin-top: 2.5rem;
        padding: 2.25rem 1rem;
    }

    .footer-logo {
        width: 82px;
    }

    .footer-links {
        gap: 0.55rem;
    }

    .footer-links a {
        min-height: 36px;
        display: inline-flex;
        align-items: center;
        padding: 0.45rem 0.65rem;
        border-radius: 8px;
        background: rgba(255,255,255,0.05);
        font-size: 0.75rem;
    }

    .deck-builder-page,
    .pro-ranking-grid,
    .starter-wrapper {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .deck-builder-page,
    .cards-section,
    .rules-page,
    .news-page,
    .my-team-container,
    .pro-page {
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    .deck-panel {
        position: static;
        max-height: none;
        overflow: visible;
    }

    .starter-info,
    .starter-image,
    #buyBundle {
        width: 100%;
        max-width: 460px;
    }

    .points-hud {
        top: auto;
        right: 1rem;
        bottom: 1rem;
        padding: 0.65rem 0.85rem;
        border-radius: 14px;
    }

    .points-icon {
        width: 38px;
        height: 38px;
    }

    .points-text {
        font-size: 0.9rem;
    }

    .hero-slider,
    .rules-hero {
        min-height: 62vh;
        border-radius: 18px;
    }

    .hero-slide,
    .rules-hero-content {
        padding: 1.5rem;
    }

    .rules-navigation,
    .features-grid,
    .classes-grid,
    .points-grid,
    .open-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .rule-card,
    .rule-highlight,
    .rule-warning,
    .cta-box,
    .rules-cta-box,
    .single-post,
    .error-card,
    .collection-panel,
    .deck-panel {
        padding: 1.1rem;
        border-radius: 16px;
    }

    .leaderboard-sort,
    .rank-sort-horizontal,
    .pill-row,
    .collection-actions,
    .deck-actions,
    .hero-buttons,
    .rules-buttons,
    .error-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 15px;
    }

    .title,
    .posts-title,
    .shop-title,
    .shop-subtitle,
    .page-title,
    .single-post-title {
        font-size: clamp(1.55rem, 8vw, 2.15rem);
        line-height: 1.12;
        letter-spacing: 0;
        overflow-wrap: anywhere;
    }

    .title::after {
        width: min(160px, 58vw);
    }

    .home-container,
    .auth-container,
    .page-center,
    .page-top,
    .profile-container {
        min-height: auto;
        justify-content: flex-start;
        padding: 1rem 0;
    }

    .home-container h1,
    .auth-container h1,
    .page-center h1,
    .page-top h1,
    .profile-container h1 {
        font-size: clamp(1.65rem, 8vw, 2.15rem);
        line-height: 1.15;
        overflow-wrap: anywhere;
    }

    .auth-form,
    .user-search,
    .profile-customization,
    .favorite-card-display {
        width: 100%;
        max-width: 100%;
    }

    .auth-form {
        padding: 1.2rem;
    }

    input,
    select,
    textarea,
    button {
        max-width: 100%;
        font-size: 16px;
    }

    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
        justify-items: center;
        gap: 0.7rem;
        padding: 0;
    }

    .card {
        max-width: 170px;
        height: 286px;
    }

    .card-info {
        min-height: 72px;
        height: auto;
    }

    .card-name {
        font-size: 0.78rem;
    }

    .card-number {
        font-size: 0.72rem;
    }

    .card:hover,
    .builder-card:hover,
    .shop-pack-section:hover,
    .daily-reward-wrapper:hover,
    .leaderboard-row:hover,
    .feature-card:hover,
    .rule-nav-card:hover {
        transform: none;
    }

    .cards-section #collection-card-grid,
    .database-card-grid,
    .player-database-grid {
        grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
        gap: 0.65rem;
    }

    .cards-section .collection-card {
        height: 252px;
    }

    .cards-section .collection-summary,
    .cards-section .collection-stats-grid,
    .collection-summary,
    .collection-stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .cards-section .collection-hero,
    .collection-hero {
        padding: 1rem;
        border-radius: 14px;
    }

    .database-search {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .database-tabs,
    .sort-scroll {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.35rem;
        scrollbar-width: none;
    }

    .database-tabs::-webkit-scrollbar,
    .sort-scroll::-webkit-scrollbar {
        display: none;
    }

    .database-tabs a,
    .sort-pill,
    .collection-action-btn,
    .evolve-card-btn {
        flex: 0 0 auto;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
    }

    .shop-container {
        padding: 1.25rem 0;
        gap: 1.35rem;
    }

    .pack-row {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
        gap: 1rem;
    }

    .shop-pack-section,
    #buyBundle {
        width: 100%;
        max-width: 360px;
        margin-left: auto;
        margin-right: auto;
        padding: 1.2rem;
    }

    .shop-pack-button,
    .daily-reward-button {
        width: min(230px, 78vw);
        height: min(330px, 82vw);
    }

    .starter-pack-button img,
    #buyBundle img {
        width: min(320px, 85vw);
        height: auto;
    }

    .card-popup {
        width: min(92vw, 380px);
    }

    .card-popup img,
    .opening-pack,
    .big-pack,
    #packImage {
        width: min(260px, 78vw);
        max-width: 78vw;
    }

    .leaderboard,
    .leaderboard-sort,
    .rank-sort-container {
        width: 100%;
        max-width: 100%;
    }

    .leaderboard-sort {
        justify-content: flex-start;
        overflow-x: auto;
        padding: 0.55rem;
        scrollbar-width: none;
    }

    .leaderboard-sort::-webkit-scrollbar {
        display: none;
    }

    .leaderboard-row {
        align-items: start;
        gap: 0.45rem;
        padding: 0.85rem;
    }

    .rank-sort-group {
        width: 100%;
        min-width: 0;
    }

    .pro-hero {
        width: 100%;
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .pro-grid,
    .card-grid2,
    .decks-grid,
    .deck-stats {
        grid-template-columns: 1fr;
    }

    .pro-section,
    .open-checklist,
    .world-champion {
        padding: 1rem;
        border-radius: 16px;
    }

    .section-divider {
        width: 85%;
        margin: 2rem auto;
    }

    .deck-builder-page {
        gap: 1rem;
        padding: 1rem 0 2rem;
    }

    .collection-grid {
        grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
        justify-content: center;
        gap: 0.55rem;
    }

    .builder-card {
        width: 100%;
        max-width: 150px;
        height: 312px;
    }

    .builder-card img {
        height: 190px;
    }

    .saved-decks-header,
    .deck-header {
        flex-direction: column;
        align-items: stretch;
    }

    .saved-decks-list {
        grid-template-columns: 1fr;
    }

    .deck-cards-area {
        max-height: none;
        grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
    }

    .bv-wrap {
        padding: 0 0 1.25rem;
    }

    .bv-topbar {
        grid-template-columns: 1fr;
        gap: 0.45rem;
        padding: 0.75rem;
        text-align: center;
    }

    .bv-topbar-left,
    .bv-topbar-right {
        justify-content: center;
        text-align: center;
    }

    .bv-arena {
        grid-template-columns: 1fr;
        grid-template-areas:
            "top"
            "table"
            "bottom"
            "left"
            "right";
    }

    .bv-table {
        min-height: 230px;
        border-radius: 18px;
    }

    .bv-table-felt,
    .bv-seat-bottom {
        padding: 0.75rem;
    }

    .bv-seat-left,
    .bv-seat-right,
    .bv-player-footer,
    .bv-scoreboard {
        justify-content: center;
    }

    .bv-hand-cards {
        gap: 0.4rem;
        padding-bottom: 0.55rem;
    }

    .bv-card {
        flex-basis: 96px;
    }

    .bv-card img {
        height: 118px;
    }

    .bv-play-btn {
        width: 100%;
        align-self: stretch;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 0.75rem;
    }

    .navbar {
        padding: 0.65rem;
    }

    .nav-left,
    .nav-right {
        gap: 0.35rem;
    }

    .navbar a,
    .nav-dropdown-toggle,
    .logout-form button {
        padding: 0.42rem 0.48rem;
        font-size: 0.66rem;
    }

    .notification-bell {
        min-width: 36px;
    }

    .card-grid,
    .cards-section #collection-card-grid,
    .database-card-grid,
    .player-database-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .card {
        max-width: 152px;
        height: 258px;
    }

    .cards-section .collection-card {
        height: 230px;
    }

    .cards-section .collection-summary,
    .cards-section .collection-stats-grid,
    .collection-summary,
    .collection-stats-grid {
        grid-template-columns: 1fr;
    }

    .database-card-body,
    .cards-section .collection-card .card-info {
        padding: 0.5rem;
    }

    .collection-actions,
    .error-actions,
    .deck-actions,
    .rules-buttons,
    .hero-buttons,
    .cta-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .collection-action-btn,
    .rules-btn,
    .hero-btn,
    .btn,
    .btn-select,
    .btn-edit {
        width: 100%;
        text-align: center;
    }

    .rule-card,
    .rule-highlight,
    .rule-warning,
    .cta-box,
    .rules-cta-box,
    .single-post,
    .error-card {
        padding: 0.9rem;
    }

    .hero-slider,
    .rules-hero {
        min-height: 540px;
    }

    .hero-content h1,
    .rules-hero h1 {
        font-size: clamp(2.1rem, 13vw, 3.2rem);
    }

    .hero-description,
    .rules-subtitle,
    .news-body,
    .rule-card p,
    .rules-list li {
        line-height: 1.65;
    }

    .pro-avatar img,
    .profile-avatar {
        width: 104px;
        height: 104px;
    }

    .profile-battle-stats {
        grid-template-columns: 1fr 1fr;
    }

    .favorite-card-display img {
        width: 150px;
        height: 210px;
    }

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

    .builder-card {
        max-width: 138px;
        height: 292px;
    }

    .builder-card img {
        height: 176px;
    }

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

    .points-hud {
        left: 0.75rem;
        right: 0.75rem;
        justify-content: center;
    }

    .bv-sb-seat {
        min-width: 0;
        width: calc(50% - 0.3rem);
        padding: 0.45rem 0.55rem;
    }
}

@media (max-width: 760px) {
    .navbar {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.35rem;
        padding: 0.45rem 0.55rem;
    }

    .main-logo {
        width: 48px;
    }

    .nav-left,
    .nav-right {
        gap: 0.25rem;
    }

    .navbar a,
    .nav-dropdown-toggle,
    .logout-form button {
        min-height: 28px;
        padding: 0.25rem 0.38rem;
        border-radius: 5px;
        font-size: 0.58rem;
        line-height: 1;
    }

    .game-room {
        height: 100svh !important;
        padding: 4px !important;
        overflow: hidden !important;
    }

    .game-header {
        padding-left: 60px !important;
        gap: 4px !important;
        margin-bottom: 3px !important;
    }

    .game-header h1 {
        font-size: 13px !important;
    }

    .game-header p,
    .score-chip span {
        font-size: 7px !important;
    }

    .score-strip {
        gap: 3px !important;
        overflow-x: auto;
    }

    .score-chip {
        min-width: 48px !important;
        padding: 2px 4px !important;
    }

    .score-chip strong {
        font-size: 12px !important;
    }

    .game-layout {
        grid-template-columns: 76px minmax(0, 1fr) !important;
        gap: 3px !important;
        height: calc(100% - 34px) !important;
    }

    .event-sequence {
        padding: 4px !important;
        border-right-width: 1px !important;
    }

    .event-sequence h2 {
        font-size: 8px !important;
        margin-bottom: 2px !important;
    }

    .event-sequence li {
        grid-template-columns: 12px minmax(0,1fr) !important;
        font-size: 6px !important;
        padding: 0 2px !important;
    }

    .event-sequence li small,
    .sidebar-event-call p,
    .attribute-log,
    .battle-chat {
        display: none !important;
    }

    .sidebar-event-call {
        margin-top: 3px !important;
        padding: 3px !important;
    }

    .sidebar-event-call h2 {
        font-size: 8px !important;
    }

    .battle-board {
        grid-template-rows: minmax(0, 1fr) 142px !important;
        gap: 3px !important;
    }

    .table-stage {
        min-height: 0 !important;
    }

    .seat {
        width: 74px !important;
        font-size: 7px !important;
    }

    .avatar {
        width: 30px !important;
        height: 30px !important;
    }

    .turn-indicator {
        font-size: 6px !important;
        padding: 2px 4px !important;
    }

    .table-play img,
    .table-stage .table-play.played-count-1 img,
    .table-stage .table-play.played-count-2 img,
    .table-stage .table-play.played-count-4 img {
        width: 42px !important;
        height: 59px !important;
    }

    .table-play {
        gap: 2px !important;
    }

    .play-controls {
        grid-template-columns: minmax(0, 1fr) 86px !important;
        gap: 3px !important;
        padding: 3px !important;
    }

    .hand-pane {
        gap: 3px !important;
    }

    .card-fan,
    .support-row {
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
        gap: 2px !important;
    }

    .hand-card-info {
        display: none !important;
    }

    .play-selected,
    .next-turn-button,
    .use-attribute-button {
        min-height: 32px !important;
        padding: 4px !important;
        font-size: 7px !important;
    }
}

@media (max-width: 1100px), (hover: none) and (pointer: coarse) {
    .navbar {
        position: relative;
        display: grid !important;
        grid-template-columns: 42px 1fr 42px;
        grid-template-areas:
            "notify logo toggle"
            "left left left"
            "right right right";
        align-items: center !important;
        justify-content: space-between;
        gap: 0 !important;
        padding: 0.45rem 0.75rem !important;
        min-height: 58px;
    }

    .nav-center {
        grid-area: logo;
        order: 0 !important;
        justify-content: center !important;
    }

    .logo-link {
        min-height: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        border-radius: 0 !important;
    }

    .main-logo {
        width: 54px !important;
        display: block;
    }

    .mobile-nav-toggle {
        grid-area: toggle;
        display: inline-grid;
        place-items: center;
        justify-self: end;
        width: 42px;
        height: 42px;
        padding: 0;
        border: 1px solid rgba(201, 162, 39, 0.75);
        border-radius: 6px;
        background: rgba(0, 0, 0, 0.35);
        cursor: pointer;
    }

    .mobile-notification-bell {
        grid-area: notify;
        display: inline-flex !important;
        position: relative;
        align-items: center;
        justify-content: center;
        justify-self: start;
        width: 42px !important;
        height: 42px !important;
        min-height: 42px !important;
        padding: 0 !important;
        border: 1px solid rgba(201, 162, 39, 0.75);
        border-radius: 6px !important;
        background: rgba(0, 0, 0, 0.35) !important;
        color: #f4d45f !important;
        font-size: 1rem !important;
    }

    .mobile-notification-bell strong {
        position: absolute;
        right: -4px;
        top: -5px;
        min-width: 16px;
        height: 16px;
        display: grid;
        place-items: center;
        padding: 0 3px;
        border-radius: 999px;
        background: #c22;
        color: #fff;
        font-size: 9px;
        line-height: 1;
    }

    .nav-right > .notification-bell {
        display: none !important;
    }

    .mobile-nav-toggle span {
        display: block;
        width: 20px;
        height: 2px;
        margin: 2px 0;
        background: #f4d45f;
        border-radius: 2px;
    }

    .nav-left,
    .nav-right {
        display: none !important;
        width: 100% !important;
        padding: 0.5rem 0 0;
        justify-content: stretch !important;
        align-items: stretch !important;
        flex-direction: column;
        gap: 0.35rem !important;
    }

    .nav-left {
        grid-area: left;
    }

    .nav-right {
        grid-area: right;
    }

    .navbar.mobile-menu-open .nav-left,
    .navbar.mobile-menu-open .nav-right {
        display: flex !important;
    }

    .navbar a,
    .nav-dropdown,
    .nav-dropdown-toggle,
    .logout-form,
    .logout-form button {
        width: 100%;
        box-sizing: border-box;
    }

    .navbar a,
    .nav-dropdown-toggle,
    .logout-form button {
        min-height: 38px !important;
        justify-content: center !important;
        padding: 0.55rem 0.7rem !important;
        font-size: 0.72rem !important;
        line-height: 1.1 !important;
        background: rgba(255, 255, 255, 0.055) !important;
        border-radius: 6px !important;
    }

    .navbar .logo-link {
        width: auto !important;
        min-height: 0 !important;
        padding: 0 !important;
        background: transparent !important;
    }

    .nav-dropdown {
        display: flex !important;
        flex-direction: column;
        padding: 0 !important;
        margin: 0 !important;
    }

    .nav-dropdown-menu {
        position: static !important;
        display: none;
        min-width: 0 !important;
        width: 100%;
        margin-top: 0.3rem;
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: none !important;
        border-radius: 6px !important;
    }

    .nav-dropdown:focus-within .nav-dropdown-menu,
    .nav-dropdown:hover .nav-dropdown-menu {
        display: block;
    }
}

@media (hover: hover) and (pointer: fine) {
    .navbar .mobile-notification-bell {
        display: none !important;
    }
}
