:root {
    --bg: #0f1419;
    --surface: #1a2332;
    --surface2: #243044;
    --border: #2d3f56;
    --text: #e8edf4;
    --text-muted: #8899aa;
    --primary: #00c853;
    --primary-dark: #00a844;
    --home: #2196f3;
    --away: #f44336;
    --gold: #ffd700;
    --radius: 10px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: relative; }

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface2);
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.nav-toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.nav-backdrop {
    display: none;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.nav-links { list-style: none; display: flex; gap: 24px; }
.nav-links a { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.nav-links a:hover { color: var(--primary); }

main { padding: 32px 0 60px; }

.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 2rem; margin-bottom: 6px; }
.subtitle { color: var(--text-muted); font-size: 0.95rem; }

.section-title { font-size: 1.3rem; margin: 32px 0 16px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.card h2, .card h3 { margin-bottom: 16px; font-size: 1.1rem; }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: #000; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-block { display: block; width: 100%; margin-bottom: 8px; }

.alert {
    padding: 14px 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.alert-success {
    background: rgba(0, 200, 83, 0.15);
    border: 1px solid var(--primary);
    color: var(--primary);
}

.alert-warning {
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid #ffc107;
    color: #f0c040;
}

.rules-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rules-section h2 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--primary);
}

.rules-section h3 {
    font-size: 1rem;
    margin: 18px 0 10px;
    color: var(--text);
}

.rules-list {
    margin-left: 20px;
    color: var(--text-muted);
}

.rules-list li {
    margin-bottom: 6px;
}

.rules-list.ordered {
    list-style: decimal;
}

.rules-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.95rem;
}

.rules-table th,
.rules-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.rules-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.rules-table td strong {
    color: var(--text);
}

.rules-note {
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.rules-section code {
    background: var(--surface2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88rem;
}

.rules-flow {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px;
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-muted);
    white-space: pre-wrap;
    overflow-x: auto;
}

.rules-formula {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: 6px;
    padding: 12px 14px;
    margin: 10px 0 12px;
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--text-muted);
    white-space: pre-wrap;
    overflow-x: auto;
    font-family: Consolas, "Courier New", monospace;
}

.rules-summary {
    border-color: var(--primary);
}

.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.team-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.2s, border-color 0.2s;
}

.team-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
}

.team-badge {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 12px;
    border: 2px solid var(--border);
}

.team-badge.large { width: 72px; height: 72px; font-size: 1.2rem; }

.team-card h3 { font-size: 1rem; margin-bottom: 12px; }

.team-stats { display: flex; gap: 16px; margin-bottom: 10px; }
.stat .label { display: block; font-size: 0.75rem; color: var(--text-muted); }
.stat .value { font-weight: 700; }
.stat .value.power { color: var(--primary); }

.power-bar {
    height: 4px;
    background: var(--surface2);
    border-radius: 2px;
    overflow: hidden;
}

.power-fill { height: 100%; background: var(--primary); border-radius: 2px; }

.match-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.vs { color: var(--text-muted); font-size: 0.9rem; }
.match-meta { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 16px; }

.stat-row { display: flex; justify-content: space-between; margin-bottom: 12px; }

.progress-bar {
    height: 8px;
    background: var(--surface2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill { height: 100%; background: var(--primary); transition: width 0.5s; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; }
.data-table tr:hover { background: var(--surface2); }
.data-table tr.leader { background: rgba(255, 215, 0, 0.08); }
.data-table a { color: var(--text); text-decoration: none; }
.data-table a:hover { color: var(--primary); }

.points-cell { color: var(--primary); }
.power-tag {
    font-size: 0.7rem;
    background: var(--surface2);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-muted);
    margin-left: 6px;
}

.badge { padding: 3px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; text-decoration: none; }
.badge-live { background: #f44336; color: #fff; }
.badge-finished { background: var(--surface2); color: var(--text-muted); }

.breadcrumb { color: var(--text-muted); margin-bottom: 20px; font-size: 0.9rem; }
.breadcrumb a { color: var(--primary); text-decoration: none; }

.team-header { display: flex; align-items: center; gap: 20px; margin-bottom: 28px; }
.team-meta { color: var(--text-muted); }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 28px; }

.info-list .info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.stats-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.stat-box { text-align: center; padding: 12px 8px; background: var(--surface2); border-radius: 6px; }
.stat-box .num { display: block; font-size: 1.4rem; font-weight: 700; }
.stat-box .lbl { font-size: 0.75rem; color: var(--text-muted); }
.stat-box.win .num { color: var(--primary); }
.stat-box.draw .num { color: var(--gold); }
.stat-box.loss .num { color: var(--away); }
.stat-box.points .num { color: var(--primary); font-size: 1.6rem; }

.fixture-round-active h3 { color: var(--primary); }
.fixture-round-active { border-left: 3px solid var(--primary); padding-left: 12px; }

.fixture-round { margin-bottom: 20px; }
.fixture-round h3 { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 8px; }
.fixture-list { display: flex; flex-direction: column; gap: 8px; }
.fixture-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--surface2);
    border-radius: 8px;
    font-size: 0.9rem;
}
.fixture-teams {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    line-height: 1.35;
}
.fixture-teams strong {
    color: var(--primary);
    white-space: nowrap;
}
.fixture-item .btn-sm { flex-shrink: 0; }
.fixture-item.status-finished { opacity: 0.7; }

/* League page */
.league-standings-card {
    margin-bottom: 24px;
}

.league-standings-card h2 {
    font-size: 1rem;
    margin-bottom: 14px;
}

.league-fixtures-panel .league-fixtures-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.league-fixtures-panel h2 {
    font-size: 1rem;
    margin: 0;
}

.week-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.week-nav-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
}

.week-nav-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.week-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.week-select {
    min-width: 140px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface2);
    color: var(--text);
    font-size: 0.875rem;
}

.week-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.league-week-fixtures .fixture-teams {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.league-week-fixtures .fixture-home {
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.league-week-fixtures .fixture-away {
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.league-week-fixtures .fixture-score {
    font-weight: 700;
    white-space: nowrap;
}

.league-week-fixtures .week-match-lock {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.table-wrap {
    overflow-x: auto;
}

.compact-table th,
.compact-table td {
    padding: 8px 10px;
    font-size: 0.85rem;
}

.compact-table th:not(:nth-child(2)),
.compact-table td:not(.team-cell) {
    text-align: center;
}

.compact-table .team-cell {
    min-width: 120px;
}

/* Match Page */
.match-page { max-width: 100%; }

.scoreboard {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 32px;
    margin-bottom: 20px;
}

.team-side { flex: 1; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.team-side.home { text-align: right; align-items: flex-end; }
.team-side.away { text-align: left; align-items: flex-start; }

.team-badge-score {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
}
.home-badge { background: #2196f3; color: #fff; }
.away-badge { background: #f44336; color: #fff; }

.team-name.home-name { color: #64b5f6; }
.team-name.away-name { color: #ef5350; }

.score-home { color: #64b5f6; }
.score-away { color: #ef5350; }
.team-name { display: block; font-size: 1.2rem; font-weight: 700; }
.team-power { font-size: 0.8rem; color: var(--text-muted); }

.score-center { text-align: center; }
.score-display { font-size: 3rem; font-weight: 800; line-height: 1; }
.score-sep { color: var(--text-muted); margin: 0 8px; }
.minute-display { font-size: 1.2rem; color: var(--primary); font-weight: 700; margin-top: 4px; }

.match-stats {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--text-muted);
    min-width: 160px;
}

.match-stats .stat-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 3px;
}

.match-stats .stat-label { font-weight: 600; }
.match-stats .stat-values { font-variant-numeric: tabular-nums; }

.tactics-card .tactic-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.tactics-card label {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.match-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
}

.canvas-wrapper {
    position: relative;
    background: linear-gradient(180deg, #0d2818 0%, #071810 100%);
    border: 1px solid rgba(76, 175, 80, 0.25);
    border-radius: 14px;
    overflow: hidden;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

#match-canvas {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: auto;
}

.match-auth-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(7, 24, 16, 0.82);
    z-index: 5;
    text-align: center;
    padding: 20px;
}

.match-auth-overlay p {
    color: var(--text);
    font-size: 1rem;
    max-width: 280px;
}

.match-auth-overlay .btn {
    min-width: 140px;
}

.goal-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.goal-overlay span {
    font-size: 4rem;
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
    animation: goalPulse 1.5s ease-out;
}

.goal-overlay.hidden { display: none; }

@keyframes goalPulse {
    0% { transform: scale(0.3); opacity: 0; }
    30% { transform: scale(1.2); opacity: 1; }
    70% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.1); opacity: 0; }
}

.events-panel {
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow: hidden;
}

.event-item {
    padding: 8px 10px;
    background: var(--surface2);
    border-radius: 6px;
    font-size: 0.82rem;
    line-height: 1.35;
    border-left: 3px solid var(--border);
}

.event-minute {
    display: inline-block;
    min-width: 28px;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-right: 4px;
}

.event-item.event-goal { border-left-color: var(--gold); background: rgba(255, 215, 0, 0.10); font-weight: 600; }
.event-item.event-shot { border-left-color: #42a5f5; }
.event-item.event-post { border-left-color: #ff9800; }
.event-item.event-corner { border-left-color: #66bb6a; }
.event-item.event-foul { border-left-color: #ef5350; }
.event-item.event-offside { border-left-color: #ab47bc; }
.event-item.event-turnover { border-left-color: var(--border); }
.event-item.event-home { border-left-color: var(--home); }
.event-item.event-away { border-left-color: var(--away); }

.match-controls { margin-top: 16px; }

.match-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.45;
}

.error-card { text-align: center; padding: 60px; }
.error-card h1 { font-size: 4rem; color: var(--text-muted); margin-bottom: 16px; }

/* Auth */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 12px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-card h1 {
    font-size: 1.6rem;
    margin-bottom: 8px;
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    font-size: 0.95rem;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
}

.auth-footer {
    margin-top: 18px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-footer a,
.match-controls a {
    color: var(--primary);
}

.auth-hint {
    margin-top: 10px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.auth-field-hint {
    margin-top: 4px;
    margin-bottom: 0;
    text-align: left;
    font-size: 0.78rem;
    line-height: 1.4;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-user-name {
    color: var(--text);
    font-size: 0.9rem;
}

.nav-badge {
    background: rgba(0, 200, 83, 0.15);
    color: var(--primary);
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(0, 200, 83, 0.35);
}

.nav-logout-form {
    display: inline;
    margin: 0;
}

.nav-link-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.nav-link-btn:hover {
    color: var(--primary);
}

/* ─── Mobil / tablet ─── */
@media (max-width: 768px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    main {
        padding: 20px 0 48px;
    }

    .navbar {
        padding: 10px 0;
        padding-top: max(10px, env(safe-area-inset-top));
    }

    .logo {
        font-size: 1.15rem;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 150;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s;
    }

    .nav-backdrop.is-open {
        opacity: 1;
        pointer-events: auto;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        width: min(300px, 88vw);
        height: 100vh;
        height: 100dvh;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin: 0;
        padding: max(72px, calc(env(safe-area-inset-top) + 56px)) 20px 24px;
        padding-bottom: max(24px, env(safe-area-inset-bottom));
        background: var(--surface);
        border-left: 1px solid var(--border);
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.45);
        z-index: 200;
        transform: translateX(105%);
        transition: transform 0.25s ease;
        overflow-y: auto;
    }

    .nav-links.is-open {
        transform: translateX(0);
    }

    .nav-links li {
        border-bottom: 1px solid var(--border);
    }

    .nav-links li:last-child {
        border-bottom: none;
    }

    .nav-links a,
    .nav-link-btn {
        display: block;
        padding: 14px 4px;
        font-size: 1rem;
    }

    .nav-user {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 14px 4px;
    }

    .nav-user-name {
        max-width: none;
        font-size: 0.95rem;
    }

    .nav-logout-form {
        display: block;
        width: 100%;
    }

    body.nav-open {
        overflow: hidden;
    }

    .page-header {
        margin-bottom: 20px;
    }

    .page-header h1 {
        font-size: 1.45rem;
        line-height: 1.25;
    }

    .subtitle {
        font-size: 0.88rem;
    }

    .section-title {
        font-size: 1.15rem;
        margin: 24px 0 12px;
    }

    .card {
        padding: 16px;
    }

    .card h2,
    .card h3 {
        font-size: 1rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .teams-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .team-card {
        padding: 14px;
    }

    .team-card h3 {
        font-size: 0.9rem;
    }

    .team-stats {
        flex-wrap: wrap;
        gap: 10px;
    }

    .team-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
    }

    .team-header h1 {
        font-size: 1.35rem;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

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

    .stat-box {
        padding: 10px 4px;
    }

    .stat-box .num {
        font-size: 1.15rem;
    }

    .stat-box.points .num {
        font-size: 1.25rem;
    }

    .fixture-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }

    .fixture-item .btn-sm,
    .fixture-item .week-match-lock {
        align-self: stretch;
        text-align: center;
    }

    .fixture-item .btn-sm {
        padding: 10px 12px;
    }

    .match-preview {
        flex-wrap: wrap;
        font-size: 1rem;
    }

    .league-fixtures-head {
        flex-direction: column;
        align-items: stretch;
    }

    .week-nav {
        justify-content: space-between;
    }

    .week-select {
        flex: 1;
        min-width: 0;
    }

    .league-week-fixtures .fixture-teams {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 4px;
    }

    .league-week-fixtures .fixture-home,
    .league-week-fixtures .fixture-away {
        text-align: center;
        white-space: normal;
    }

    .compact-table th,
    .compact-table td {
        padding: 7px 6px;
        font-size: 0.78rem;
    }

    .compact-table .team-cell {
        min-width: 100px;
    }

    .table-wrap {
        margin: 0 -4px;
        -webkit-overflow-scrolling: touch;
    }

    .table-wrap-card {
        padding-bottom: 12px;
    }

    .team-history-table {
        min-width: 520px;
    }

    .rules-page {
        gap: 14px;
    }

    .rules-section h2 {
        font-size: 1.1rem;
    }

    .rules-table {
        min-width: 480px;
        font-size: 0.85rem;
    }

    .rules-table th,
    .rules-table td {
        padding: 8px 10px;
    }

    .rules-flow,
    .rules-formula {
        font-size: 0.82rem;
        padding: 12px;
    }

    .rules-list {
        margin-left: 16px;
        font-size: 0.92rem;
    }

    .auth-page {
        padding-top: 0;
    }

    .auth-card h1 {
        font-size: 1.35rem;
    }

    .form-input {
        font-size: 16px;
        padding: 12px;
    }

    .btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .btn-block {
        width: 100%;
    }

    .error-card {
        padding: 40px 20px;
    }

    .error-card h1 {
        font-size: 3rem;
    }

    .footer {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
        font-size: 0.8rem;
    }

    /* Maç sayfası */
    .match-page {
        margin-left: -4px;
        margin-right: -4px;
    }

    .match-layout {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .match-header {
        margin-bottom: 0;
    }

    .scoreboard {
        flex-direction: row;
        align-items: center;
        gap: 6px;
        padding: 8px 10px;
        margin-bottom: 10px;
    }

    .team-side {
        flex: 1;
        min-width: 0;
        gap: 2px;
    }

    .team-side.home {
        text-align: right;
        align-items: flex-end;
    }

    .team-side.away {
        text-align: left;
        align-items: flex-start;
    }

    .team-badge-score {
        padding: 1px 5px;
        font-size: 0.58rem;
    }

    .team-name {
        font-size: 0.78rem;
        line-height: 1.15;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .team-power {
        display: none;
    }

    .score-center {
        flex-shrink: 0;
        min-width: 72px;
        padding: 0 2px;
    }

    .score-display {
        font-size: 1.55rem;
    }

    .score-sep {
        margin: 0 3px;
    }

    .minute-display {
        font-size: 0.8rem;
        margin-top: 1px;
    }

    .match-stats {
        min-width: 0;
        font-size: 0.68rem;
        margin-top: 6px;
        padding-top: 6px;
    }

    .canvas-wrapper {
        border-radius: 10px;
    }

    .match-sidebar .card {
        margin-bottom: 0;
    }

    .match-controls .alert {
        font-size: 0.88rem;
        padding: 12px 14px;
    }

    .goal-overlay span {
        font-size: 2.2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

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

    .team-badge {
        width: 40px;
        height: 40px;
        font-size: 0.8rem;
    }

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

    .stat-box.points {
        grid-column: span 3;
    }

    .breadcrumb {
        font-size: 0.82rem;
        word-break: break-word;
    }

    .alert {
        padding: 12px 14px;
        font-size: 0.9rem;
    }

    .scoreboard {
        padding: 6px 8px;
        gap: 4px;
    }

    .team-badge-score {
        display: none;
    }

    .team-name {
        font-size: 0.7rem;
    }

    .score-display {
        font-size: 1.35rem;
    }

    .score-center {
        min-width: 58px;
    }

    .match-stats .stat-row {
        gap: 4px;
    }
}

@media (max-width: 360px) {
    .logo {
        font-size: 1rem;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }

    .score-display {
        font-size: 1.2rem;
    }
}
