/* 7-inch tablet baseline */
:root {
    --mobile-bg: #f8f3d4;
    --card-bg: #fffdf0;
    --border-soft: #d6c982;
    --brand-dark: #064e3b;
    --brand-green: #0f766e;
    --brand-green-soft: #d1fae5;
    --brand-yellow: #fef3c7;
    --brand-yellow-strong: #facc15;
    --text-main: #1f2933;
    --text-muted: #5f6b5f;
    --tap-size: 52px;
    --radius: 14px;
    --gap: 10px;
    --font-xs: 0.75rem;
    --font-sm: 0.85rem;
    --font-md: 1rem;
    --font-lg: 1.15rem;
    --font-xl: 1.35rem;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--mobile-bg);
    color: var(--text-main);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    overscroll-behavior: none;
}

body {
    min-height: 100vh;
}

/* Default: tablet portrait / small landscape */
.mobile-page {
    padding: 10px;
    max-width: 1280px;
    margin: 0 auto;
}

/* 7-inch tablet landscape */
@media (min-width: 900px) and (max-width: 1366px) and (orientation: landscape) {
    .mobile-page {
        padding: 12px 16px;
    }
}

/* Phone fallback */
@media (max-width: 700px) {
    .mobile-page {
        padding: 8px;
    }
}

.scoreboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--gap);
}

@media (max-width: 700px) {
    .scoreboard-grid {
        grid-template-columns: 1fr;
    }
}

.shooter-card {
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 10px;
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 100px;
    gap: 10px;
    align-items: center;
    box-shadow: 0 1px 3px rgba(6, 78, 59, 0.14);
}

.shooter-bib {
    font-size: 1.4rem;
    font-weight: 900;
    text-align: center;
    background: var(--brand-yellow);
    color: var(--brand-dark);
    border-radius: 10px;
    padding: 10px 4px;
}

.shooter-info {
    min-width: 0;
}

.shooter-name {
    font-size: 1.15rem;
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shooter-club {
    margin-top: 2px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shooter-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.stat-box {
    border-radius: 10px;
    background: #f1f5f9;
    text-align: center;
    padding: 5px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 800;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 900;
}

.shot-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(5, minmax(64px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.shot-cell {
    min-height: 58px;
    border-radius: 12px;
    border: 2px solid #cbd5e1;
    background: #ffffff;
    color: var(--brand-dark);
    font-size: 1.15rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

    .shot-cell.hit {
        background: #dcfce7;
        border-color: #22c55e;
        color: #14532d;
    }

    .shot-cell.miss {
        background: #fee2e2;
        border-color: #ef4444;
        color: #7f1d1d;
    }

    .shot-cell.active-shot {
        min-height: 74px;
        font-size: 1.5rem;
        border-width: 4px;
        border-color: var(--brand-dark);
        background: var(--brand-yellow);
        box-shadow: 0 0 0 3px rgba(6, 78, 59, 0.18);
    }

    .shot-cell:disabled {
        opacity: 0.65;
    }

    .shot-cell:active {
        transform: scale(0.96);
    }

.block-nav {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin: 6px 0 10px 0;
}

.block-btn {
    min-height: 46px;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-weight: 700;
    font-size: var(--font-md);
}

    .block-btn.active {
        background: #198754;
        color: white;
        border-color: #198754;
    }

body {
    background: var(--mobile-bg);
    color: var(--text-main);
}

.mobile-toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--brand-dark);
    color: #ffffff;
    padding: 10px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
    border-radius: 0 0 14px 14px;
    margin: -10px -10px 12px -10px;
}

.mobile-title {
    font-size: var(--font-lg);
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toolbar-btn {
    min-height: 46px;
    min-width: 46px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.35);
    background: var(--brand-yellow);
    color: var(--brand-dark);
    font-weight: 800;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-card {
    display: block;
    text-decoration: none;
    color: var(--brand-dark);
    background: var(--card-bg);
    border: 2px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 18px;
    min-height: 110px;
    box-shadow: 0 2px 5px rgba(6, 78, 59, 0.16);
}

    .mobile-menu-card:active {
        transform: scale(0.98);
    }

.mobile-menu-title {
    font-size: var(--font-xl);
    font-weight: 900;
}

.mobile-menu-subtitle {
    margin-top: 6px;
    font-size: var(--font-sm);
    color: var(--text-muted);
}

.block-btn.active {
    background: var(--brand-dark);
    color: #ffffff;
    border-color: var(--brand-dark);
}

.block-btn {
    min-height: 50px;
    border-radius: 12px;
    border: 2px solid var(--border-soft);
    background: var(--brand-yellow);
    color: var(--brand-dark);
    font-weight: 900;
    font-size: var(--font-md);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    font-size: var(--font-sm);
}

    .results-table th,
    .results-table td {
        padding: 8px 6px;
        border-bottom: 1px solid #e5e7eb;
    }

    .results-table th {
        background: #f1f5f9;
        font-weight: 700;
        text-align: left;
    }

    .results-table .rank,
    .results-table .score,
    .results-table .last-miss {
        text-align: center;
        font-weight: 700;
    }

@media (max-width: 700px) {
    .results-table {
        font-size: var(--font-xs);
    }

        .results-table th,
        .results-table td {
            padding: 6px 4px;
        }
}

.mobile-menu-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--gap);
    margin-top: 12px;
}

.mobile-menu-card {
    display: block;
    text-decoration: none;
    color: var(--text-main);
    background: var(--card-bg);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 18px;
    min-height: 110px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.mobile-menu-title {
    font-size: var(--font-xl);
    font-weight: 700;
}

.mobile-menu-subtitle {
    margin-top: 6px;
    font-size: var(--font-sm);
    color: var(--text-muted);
}

@media (max-width: 700px) {
    .mobile-menu-grid {
        grid-template-columns: 1fr;
    }
}

.mobile-filter-card {
    background: var(--card-bg);
    border: 2px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 2px 5px rgba(6, 78, 59, 0.12);
}

.mobile-label {
    display: block;
    font-size: var(--font-sm);
    font-weight: 800;
    color: var(--brand-dark);
    margin-bottom: 6px;
}

.mobile-select {
    width: 100%;
    min-height: 48px;
    border-radius: 10px;
    border: 2px solid var(--border-soft);
    background: var(--brand-yellow);
    color: var(--brand-dark);
    font-size: var(--font-md);
    font-weight: 800;
    padding: 8px 10px;
}

.slot-nav {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin: 10px 0 6px 0;
}

.slot-btn {
    min-height: 46px;
    border-radius: 12px;
    border: 2px solid var(--border-soft);
    background: #ffffff;
    color: var(--brand-dark);
    font-weight: 900;
    font-size: var(--font-md);
}

    .slot-btn.active {
        background: var(--brand-dark);
        color: #ffffff;
        border-color: var(--brand-dark);
    }

.block-nav {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin: 6px 0 10px 0;
}

.block-btn {
    min-height: 46px;
    border-radius: 12px;
    border: 2px solid var(--border-soft);
    background: var(--brand-yellow);
    color: var(--brand-dark);
    font-weight: 900;
    font-size: var(--font-md);
}

    .block-btn.active {
        background: var(--brand-green);
        color: #ffffff;
        border-color: var(--brand-green);
    }

.mobile-current-context {
    grid-column: 1 / -1;
    background: var(--brand-dark);
    color: #ffffff;
    border-radius: 12px;
    padding: 8px 12px;
    font-weight: 900;
    text-align: center;
}

.finalize-btn {
    min-height: 46px;
    border-radius: 12px;
    border: 2px solid var(--brand-dark);
    background: #1f2937;
    color: #ffffff;
    font-weight: 900;
    font-size: var(--font-md);
    border-color: #1f2937;
}

    .finalize-btn:active {
        transform: scale(0.98);
    }

    .finalize-btn:disabled {
        opacity: 0.65;
    }

.results-mobile-shell {
    padding: 10px;
}

    .results-mobile-shell .mobile-toolbar {
        margin-bottom: 12px;
    }