/* Desktop-only layout. Keep every rule inside a min-width: 769px query. */
/* Desktop workspace: consistent density without changing the phone layout. */
@media (min-width: 769px) {
    .app-shell-root {
        grid-template-columns: 220px minmax(0, 1fr);
        gap: 24px;
    }

    .section-sidebar {
        height: auto;
        max-height: calc(100dvh - 124px);
        overflow-y: auto;
        padding: 16px;
        border-radius: 20px;
    }

    .home-hero {
        min-height: 220px;
        grid-template-columns: minmax(0, 1fr) minmax(220px, 0.42fr);
        padding: 28px;
        border-radius: 22px;
    }

    .home-hero h1 { font-size: clamp(30px, 3vw, 42px); line-height: 1.12; }
    .home-hero p { max-width: 480px; font-size: 15px; }
    .home-next-match { min-height: 160px; padding: 18px; border-radius: 16px; }
    .home-next-match strong { font-size: 23px; line-height: 1.2; }
    .home-next-match small { line-height: 1.5; }
    .home-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); align-items: start; }
    .home-grid > * { min-width: 0; }

    .home-grid .player-spotlight {
        display: grid;
        grid-template-columns: 92px minmax(0, 1fr);
        gap: 18px;
        min-height: 218px;
        padding: 22px;
        border-radius: 20px;
    }
    .home-grid .player-spotlight__avatar { width: 92px; height: 92px; }
    .home-grid .player-spotlight__title { font-size: 27px; overflow-wrap: anywhere; }
    .home-grid .player-spotlight__subtitle { font-size: 13px; line-height: 1.5; }
    .home-grid .player-spotlight__action { grid-column: 2; justify-self: start; margin: 0; padding: 7px 12px; font-size: 12px; }
    .home-grid .player-spotlight__tag { padding: 6px 9px; font-size: 11px; }
    .home-card--agenda { min-height: 218px; }

    .home-grid .app-session-card {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        min-height: auto;
        margin: 0;
        padding: 16px 20px;
        border-radius: 16px;
    }
    .app-session-card__email { overflow-wrap: anywhere; }
    .app-session-card .btn { flex-shrink: 0; }
}

@media (min-width: 769px) and (max-width: 1100px) {
    .app-shell-root { grid-template-columns: 196px minmax(0, 1fr); gap: 18px; }
    .section-sidebar { padding: 12px; }
    .section-sidebar-title { font-size: 15px; }
    .home-hero { grid-template-columns: minmax(0, 1fr); padding: 22px; }
    .home-next-match { min-height: auto; }
    .home-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Use the available desktop workspace rather than a phone-width column. */
@media (min-width: 769px) {
    #progress-container #progress { width: 100%; }
    #progress-container #progress .progress-screen-tabs { width: min(100%, 480px); margin-bottom: 24px; }
    #progress-container #progress .progress-screen { gap: 20px; }
    #progress-container #progress .progress-page-heading { padding: 0; }
    #progress-container #progress .progress-page-heading h1 { font-size: 36px; }
    #progress-container #progress .progress-page-heading > span { font-size: 11px; }
    #progress-container #progress .progress-screen--overview,
    #progress-container #progress .progress-screen--analytics { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; }
    #progress-container #progress .progress-page-heading,
    #progress-container #progress .progress-period-toolbar,
    #progress-container #progress .progress-period-anchor,
    #progress-container #progress .progress-analytics-tabs { grid-column: 1 / -1; }
    #progress-container #progress .progress-period-toolbar { width: min(100%, 480px); }
    #progress-container #progress .progress-period-anchor { width: min(100%, 480px); }
    #progress-container #progress .progress-season-card { grid-column: 1; grid-row: span 2; min-height: 340px; padding: 24px; }
    #progress-container #progress .progress-season-card__heading h2 { font-size: 23px; }
    #progress-container #progress .progress-season-grid { inset: auto 16px 16px; gap: 12px; }
    #progress-container #progress .progress-season-stat { min-height: 86px; padding: 12px; }
    #progress-container #progress .progress-overall-card { grid-column: 2; width: 100%; min-height: 256px; padding: 20px; }
    #progress-container #progress .progress-overall-card__content { grid-template-columns: 116px minmax(0, 1fr); }
    #progress-container #progress .progress-ring { width: 112px; height: 112px; }
    #progress-container #progress .progress-ring::before { width: 94px; height: 94px; }
    #progress-container #progress .progress-analytics-link { grid-column: 2; min-height: 64px; }
    #progress-container #progress .progress-goals-toolbar { max-width: 560px; }
    #progress-container #progress .progress-goal-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
    #progress-container #progress .progress-goal-cards > .progress-goals-editor { grid-column: 1 / -1; }
    #progress-container #progress .progress-focus-card { min-height: 116px; }
    #progress-container #progress .progress-analytics-chart-card { grid-column: 1; grid-row: span 2; }
    #progress-container #progress .progress-analytics-chart { height: 300px; }
    #progress-container #progress .progress-comparison-card,
    #progress-container #progress .progress-key-card { grid-column: 2; }
    #progress-container #progress .progress-quote-card { grid-column: 1 / -1; }
}

@media (min-width: 769px) and (max-width: 1100px) {
    #progress-container #progress .progress-screen--overview,
    #progress-container #progress .progress-screen--analytics { grid-template-columns: minmax(0, 1fr); }
    #progress-container #progress .progress-screen > * { grid-column: 1; grid-row: auto; }
    #progress-container #progress .progress-goal-cards { grid-template-columns: minmax(0, 1fr); }
    #progress-container #progress .progress-overall-card { min-height: auto; }
}

@media (min-width: 769px) {
    :root { --desktop-gap: clamp(16px, 1.4vw, 24px); }
    body > header,
    body > footer,
    #app-root.app-shell-root { width: min(1480px, 100%); }
    #app-root.app-shell-root { gap: var(--desktop-gap); }
    .main-content { min-width: 0; }
    .main-content > .content-section { min-width: 0; }

    /* Higher specificity keeps lazy-loaded section styles from restoring narrow widths. */
    #profilePage.profile-card,
    #notes.notes-page,
    #teamsSection.teams-section,
    #tournamentsPage.tournaments-page,
    #social-container .social-page,
    #matches { width: 100%; max-width: none; margin-inline: 0; }

    #profilePage .profile-view__content,
    #notes .notes-overview,
    #teamsSection .teams-list-shell,
    #tournamentsPage,
    #social-container .social-page { gap: var(--desktop-gap); }

    #teamsSection .teams-header-copy .section-title,
    #tournamentsPage .tournaments-hero h1,
    #social-container .social-hero h1,
    #notes .notes-hero h1,
    #matches .matches-header .section-title {
        font-size: clamp(30px, 2.6vw, 38px);
        line-height: 1.12;
    }

    #teamsSection .teams-grid,
    #teamsSection .teams-discovery-grid,
    #tournamentsPage .tournaments-grid,
    #social-container .social-list,
    #notes .notes-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr));
        gap: var(--desktop-gap);
        align-items: start;
    }
    #teamsSection .teams-grid > *,
    #teamsSection .teams-discovery-grid > *,
    #tournamentsPage .tournaments-grid > *,
    #social-container .social-list > *,
    #notes .notes-list > * { min-width: 0; }

    #teamsSection .teams-header { gap: 18px; align-items: center; }
    #teamsSection .teams-atmosphere-motto { top: -30px; right: 12px; }
    #teamsSection .teams-directory { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
    #teamsSection .teams-directory-filter-panel { grid-column: 1 / -1; }
    #teamsSection .teams-actions { flex-wrap: wrap; }
    #teamsSection .team-card { width: 100%; }
    #teamsSection .team-card__name { overflow-wrap: anywhere; }

    #tournamentsPage .tournaments-hero { min-height: 190px; padding: 26px; }
    #tournamentsPage .tournaments-hero__copy { width: min(64%, 620px); }
    #tournamentsPage .tournaments-hero p { max-width: 540px; font-size: 14px; }
    #tournamentsPage .tournaments-filter-bar { display: flex; flex-wrap: wrap; gap: 8px; }
    #tournamentsPage .tournaments-filter { flex: 0 1 auto; }
    #tournamentsPage .tournament-card h3 { overflow-wrap: anywhere; }
    #tournamentsPage .tournament-create-page { max-width: 900px; margin-inline: 0; }
    #tournamentsPage .tournament-details-page { max-width: 1120px; margin-inline: 0; }

    #social-container .social-search { max-width: 760px; }
    #social-container .social-player-card {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
        min-height: 180px;
        padding: 20px;
    }
    #social-container .social-player-card__top > div { min-width: 0; }
    #social-container .social-player-card h3 { overflow-wrap: anywhere; }
    #social-container .social-player-card__actions { flex-wrap: wrap; justify-content: flex-start; }
    #social-container .social-player-card__actions > .btn { flex: 1 1 auto; min-width: 0; }
    #social-container .social-state { grid-column: 1 / -1; }

    #notes .notes-hero {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        min-height: 180px;
        padding: 24px;
        border: 1px solid var(--notes-border);
        border-radius: 22px;
        background: linear-gradient(110deg, rgba(4, 26, 33, 0.85), rgba(4, 26, 33, 0.3));
    }
    #notes .notes-hero__copy { width: 100%; max-width: 560px; }
    #notes .notes-hero p { max-width: 520px; font-size: 14px; line-height: 1.6; }
    #notes .notes-hero__motto { top: 12px; right: 24px; font-size: 12px; }
    #notes .notes-hero > .notes-primary-action { width: auto; padding-inline: 20px; align-self: end; }
    #notes .notes-browser { max-width: 900px; }
    #notes .note-card__open { min-height: 145px; padding: 18px; }
    #notes .note-card__heading strong { font-size: 16px; }
    #notes .note-card__preview { font-size: 13px; line-height: 1.6; }
    #notes .notes-empty-state { min-height: 240px; padding: 32px; }
    #notes .notes-empty-state p { max-width: 460px; font-size: 13px; }
    #notes .note-detail { max-width: 1000px; gap: 20px; }
    #notes .note-detail-content { font-size: 16px; line-height: 1.75; }

    #matches .matches-toolbar { grid-template-columns: minmax(0, 480px) 225px; }
    #matches .matches-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
    #matches .matches-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--desktop-gap); }
    #matches .matches-list > .empty-state { grid-column: 1 / -1; }
    #matches .match-detail-page { max-width: 1120px; margin-inline: 0; }
    #matches .match-item { min-width: 0; }

    /* Artwork remains proportional and fades behind the wider workspace. */
    html body.is-progress-section::before {
        background-size: auto, auto, cover;
        background-position: center, center, center 35%;
        opacity: 0.55;
        height: 720px;
    }
    body.is-profile-section::before,
    body.is-notes-section::before,
    body.is-teams-section::before,
    body.is-tournaments-section::before { max-height: 780px; }
}

@media (min-width: 1024px) {
    #app-root.app-shell-root { grid-template-columns: 220px minmax(0, 1fr); }
    #profilePage .profile-view__content {
        grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
        align-items: start;
        grid-template-areas: 'identity story' 'attributes bio' 'completion actions' 'secondary secondary';
    }
    #profilePage .profile-header { grid-area: identity; min-height: 240px; padding: 22px; }
    #profilePage .physical-stats { grid-area: attributes; }
    #profilePage .profile-completion { grid-area: completion; height: 100%; }
    #profilePage .profile-story { grid-area: story; height: 100%; padding: 24px; align-content: start; gap: 20px; }
    #profilePage .profile-personal-content { grid-area: bio; height: 100%; padding: 20px; }
    #profilePage .action-buttons { grid-area: actions; margin: 0; }
    #profilePage .profile-secondary-actions { grid-area: secondary; }
    #profilePage .player-name { overflow-wrap: anywhere; }
    #profilePage .profile-edit-form { max-width: 1080px; margin-inline: auto; }
    #profilePage .profile-edit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #matches .matches-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1440px) {
    #app-root.app-shell-root { grid-template-columns: 240px minmax(0, 1fr); }
    #matches .matches-list { grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); }
    #profilePage .profile-header { min-height: 270px; }
    #teamsSection .team-profile-card__content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
    #teamsSection .team-profile-card__content > * { min-width: 0; }
}

@media (min-width: 1920px) {
    body > header,
    body > footer,
    #app-root.app-shell-root { width: min(1760px, calc(100% - 48px)); }
    #app-root.app-shell-root { grid-template-columns: 248px minmax(0, 1fr); gap: 32px; }
    #teamsSection .teams-grid,
    #teamsSection .teams-discovery-grid,
    #tournamentsPage .tournaments-grid,
    #social-container .social-list,
    #notes .notes-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 769px) and (max-width: 1023px) {
    #teamsSection .teams-directory,
    #notes .notes-hero { grid-template-columns: minmax(0, 1fr); }
    #notes .notes-hero > .notes-primary-action { justify-self: start; }
    #matches .matches-toolbar { grid-template-columns: minmax(0, 1fr); }
    #matches .matches-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 769px) {
    #teamsSection .team-tile__name,
    #profilePage .player-name,
    #social-container .social-player-card h3,
    #notes .note-card__heading strong {
        white-space: normal;
        overflow-wrap: anywhere;
        text-overflow: clip;
    }
    #notes .note-card__heading { align-items: start; gap: 8px; }
    #notes .note-card__heading time { font-size: 10px; }
    .home-grid .player-spotlight__avatar-fallback { padding: 8px; gap: 4px; }
    .home-grid .player-spotlight__avatar-fallback .photo-placeholder__text { font-size: 9px; }
    .home-grid .player-spotlight__avatar-fallback .photo-placeholder__icon { width: 28px; height: 28px; font-size: 16px; }
}

/* Full-width artwork, consistent with teams, notes and tournaments. */
@media (min-width: 769px) {
    html body.is-matches-section::before,
    html body.is-social-section::before {
        left: 0;
        right: 0;
        width: 100%;
        height: 640px;
        background-size: auto, auto, auto, cover;
        background-position: center, center, center, center 25%;
    }
}

/* Keep the sidebar quick action on laptops; wider screens use page actions. */
@media (min-width: 1440px) {
    .section-sidebar .section-nav-action { display: none; }
}


/* A season workspace built from the existing section components and data. */
@media (min-width: 769px) {
    body.is-home-section { position: relative; background: #06191f; }
    body.is-home-section::before {
        position: absolute;
        inset: 0 0 auto;
        z-index: 0;
        height: 900px;
        background: linear-gradient(180deg, rgba(3, 18, 25, .28), #06191f 96%), url('../img/progress/progress-stadium-growth-hero-v1.webp') center 32% / cover no-repeat;
        content: '';
        pointer-events: none;
    }
    body.is-home-section > header,
    body.is-home-section > #app-root,
    body.is-home-section > footer { position: relative; }
    .home-dashboard { gap: var(--desktop-gap); }
    .home-hero {
        grid-template-columns: minmax(0, 1.25fr) minmax(0, .9fr);
        align-items: stretch;
        gap: 32px;
        min-height: 360px;
        padding: clamp(24px, 2.5vw, 40px);
        background: linear-gradient(105deg, rgba(3, 25, 33, .96), rgba(3, 25, 33, .48)), url('../img/profile/profile-stadium-hero-v1.webp') center 44% / cover no-repeat;
        border-color: rgba(80, 218, 192, .3);
        border-radius: 26px;
    }
    .home-hero__copy { min-width: 0; justify-content: flex-start; gap: 20px; }
    .home-hero__copy > .home-eyebrow,
    .home-hero__copy > #homeUserName,
    .home-hero__copy > p { display: none; }
    .home-season-heading { order: 0; }
    .home-season-heading > span { color: #5cdec0; font-size: 10px; font-weight: 800; letter-spacing: .2em; }
    .home-season-heading h1 { margin: 8px 0; font-size: clamp(28px, 2.8vw, 42px); line-height: 1.1; }
    .home-season-heading p { max-width: none; font-size: 13px; color: #a2bcc4; }
    .home-hero__actions { order: 2; gap: 10px; margin: 0; }
    .home-hero__actions .btn { padding: 10px 16px; font-size: 13px; border-radius: 12px; }
    .home-hero .player-spotlight {
        order: 1;
        display: grid;
        grid-template-columns: 92px minmax(0, 1fr);
        align-items: center;
        min-height: 0;
        padding: 0;
        gap: 12px 18px;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        transform: none;
    }
    .home-hero .player-spotlight::before { display: none; }
    .home-hero .player-spotlight__avatar { width: 92px; height: 92px; grid-row: span 2; border-width: 2px; border-color: #38d6b0; }
    .home-hero .photo-placeholder { padding: 9px; gap: 4px; }
    .home-hero .photo-placeholder__text { font-size: 9px; }
    .home-hero .photo-placeholder__icon { width: 26px; height: 26px; font-size: 14px; }
    .home-hero .player-spotlight__copy { gap: 8px; }
    .home-hero .player-spotlight__eyebrow { font-size: 9px; }
    .home-hero .player-spotlight__title { font-size: clamp(22px, 1.9vw, 30px); line-height: 1.15; overflow-wrap: anywhere; }
    .home-hero .player-spotlight__subtitle { display: none; }
    .home-hero .player-spotlight__tags { gap: 6px; }
    .home-hero .player-spotlight__tag { padding: 5px 9px; font-size: 10px; }
    .home-hero .player-spotlight__action { grid-column: 2; justify-self: start; margin: 0; padding: 6px 10px; font-size: 11px; }
    .home-identity-details { display: flex; flex-wrap: wrap; gap: 5px 12px; color: #a0bac2; font-size: 10px; }
    .home-next-match { min-width: 0; padding: 22px; justify-content: flex-start; border-radius: 20px; background: rgba(3, 23, 31, .8); border-color: rgba(115, 200, 207, .25); }
    .home-next-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; color: #75dcc1; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
    .home-next-match .home-last-match { flex: 1; gap: 15px; min-height: 0; }
    .home-next-match .home-match-scoreboard > b { font-size: 23px; background: transparent; border: 0; padding: 0; color: #46e4b8; }
    .home-next-match .home-match-scoreboard strong { font-size: 13px; }
    .home-next-match .home-avatar { width: 40px; height: 40px; font-size: 13px; }
    .home-next-detail { color: #55dfbb; font-size: 12px; }
    .home-next-match .home-overview-empty { min-height: 200px; border: 0; padding: 12px 0; }
    .home-overview { display: grid; gap: 16px; }
    .home-stat-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .home-stat-heading > span { color: var(--text-muted); font-size: 11px; letter-spacing: .16em; font-weight: 800; }
    .home-stat-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
    .home-stat-tile {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        gap: 9px 8px;
        min-width: 0;
        padding: 18px;
        border: 1px solid var(--border-color);
        border-radius: 17px;
        background: linear-gradient(130deg, rgba(38, 167, 141, .07), transparent), var(--surface);
        color: var(--text-strong);
        font: inherit;
        text-align: left;
        cursor: pointer;
    }
    .home-stat-tile > i { align-self: center; color: #42dab0; font-size: 18px; }
    .home-stat-tile:nth-child(3n+2) > i { color: #67b7ff; }
    .home-stat-tile:nth-child(3n) > i { color: #ffce68; }
    .home-stat-tile > strong { font-size: clamp(24px, 2vw, 32px); line-height: 1.1; overflow-wrap: anywhere; }
    .home-stat-tile > span { grid-column: 1 / -1; color: var(--text-muted); font-size: 11px; }
    .home-overview-panels { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-flow: row dense; gap: var(--desktop-gap); align-items: stretch; }
    .home-panel { grid-column: span 6; min-width: 0; padding: 24px; border: 1px solid var(--border-color); border-radius: 22px; background: linear-gradient(145deg, rgba(39, 154, 133, .06), transparent 60%), var(--surface); box-shadow: var(--shadow-card); }
    .home-panel--chart { grid-column: span 8; grid-row: span 2; display: flex; flex-direction: column; }
    .home-panel--progress,
    .home-panel--minutes { grid-column: span 4; }
    .home-panel--last,
    .home-panel--tournaments,
    .home-panel--notes { grid-column: span 7; }
    .home-panel--teams,
    .home-panel--friends,
    .home-panel--upcoming { grid-column: span 5; }
    .home-panel--last { background: linear-gradient(115deg, rgba(5, 34, 42, .98), rgba(3, 28, 37, .76)), url('../img/matches-stadium-tunnel-hero-v1.webp') center / cover; }
    .home-panel--actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 24px; background: linear-gradient(120deg, rgba(31, 171, 138, .12), rgba(66, 130, 197, .1)), var(--surface); }
    .home-panel-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 20px; }
    .home-panel-heading h2 { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--text-strong); font-size: 17px; line-height: 1.3; }
    .home-panel-heading h2 i { color: #4cdbb3; font-size: 15px; }
    .home-text-action { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 6px 0 6px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text-muted); font: inherit; font-size: 11px; cursor: pointer; }
    .home-count { display: inline-grid; place-items: center; min-width: 24px; min-height: 24px; padding: 3px 6px; border-radius: 9px; background: var(--surface-soft); color: #65dbbe; font-size: 11px; }
    .home-overview-empty { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; min-height: 150px; padding: 20px; border: 1px dashed var(--border-color); border-radius: 14px; gap: 12px; color: var(--text-muted); font-size: 13px; line-height: 1.6; }
    .home-overview-empty > i { color: #4cceaf; font-size: 24px; }
    .home-overview-empty p { margin: 0; max-width: 42ch; }
    .home-loading,
    .home-data-error { display: flex; align-items: center; gap: 12px; min-height: 120px; color: var(--text-muted); font-size: 13px; line-height: 1.6; }
    .home-loading span { width: 24px; height: 24px; flex-shrink: 0; border: 2px solid var(--border-color); border-top-color: #45d8ae; border-radius: 50%; }
    .home-data-error i { color: #ffd16d; }
    .home-chart-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
    .home-chart-toolbar label { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 11px; }
    .home-chart-toolbar select { border: 1px solid var(--border-color); border-radius: 10px; padding: 8px 10px; background: var(--surface-soft); color: var(--text-strong); font: inherit; cursor: pointer; }
    .home-chart-legend { display: flex; gap: 18px; font-size: 11px; color: var(--text-muted); }
    .home-chart-legend span::before { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #51eeba; content: ''; }
    .home-chart-legend span:nth-child(2)::before { background: #5caaff; }
    .home-chart-wrap { position: relative; flex: 1; min-height: 300px; margin-top: 18px; }
    .home-chart-wrap canvas { display: block; }
    .home-small-chart { position: relative; height: 145px; }
    .home-chart-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border-color); margin-top: 18px; padding-top: 16px; color: var(--text-muted); font-size: 11px; }
    .home-chart-footer strong { margin-left: 10px; color: var(--text-strong); font-size: 20px; }
    .home-chart-note { margin: 12px 0 0; color: var(--text-muted); font-size: 11px; }
    .home-chart-state { position: absolute; inset: 12px 0 0; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 90%, transparent); border-radius: 14px; }
    .home-chart-state .home-overview-empty { min-height: 0; border: 0; background: transparent; }
    .home-chart-tooltip { position: absolute; top: 8px; z-index: 3; max-width: min(300px, 90%); padding: 10px 12px; border: 1px solid #2abf99; border-radius: 11px; background: #08232c; color: #d9f9ef; box-shadow: 0 8px 20px rgba(0, 0, 0, .25); font-size: 12px; pointer-events: none; transform: translateX(-20%); }
    .home-chart-tooltip[hidden] { display: none; }
    .home-last-match { display: grid; gap: 18px; width: 100%; min-height: 240px; padding: 0; border: 0; background: transparent; color: var(--text-strong); font: inherit; text-align: left; cursor: pointer; }
    .home-match-caption { color: var(--text-muted); font-size: 11px; line-height: 1.5; }
    .home-match-scoreboard { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 16px; align-items: center; text-align: center; }
    .home-match-scoreboard > span { display: grid; justify-items: center; gap: 10px; min-width: 0; }
    .home-match-scoreboard strong { font-size: 16px; overflow-wrap: anywhere; line-height: 1.4; }
    .home-match-scoreboard > b { padding: 12px 20px; border: 1px solid var(--border-color); border-radius: 16px; background: var(--surface-soft); font-size: 36px; white-space: nowrap; }
    .home-match-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
    .home-match-badges > span { padding: 4px 8px; border-radius: 7px; color: var(--text-muted); background: var(--surface-soft); font-size: 10px; }
    .home-match-badges .home-result--win { color: #55efbc; }
    .home-match-badges .home-result--loss { color: #ff929e; }
    .home-match-badges .home-result--draw { color: #ffd16d; }
    .home-match-personal { display: flex; flex-wrap: wrap; gap: 12px 20px; padding-top: 16px; border-top: 1px solid var(--border-color); color: var(--text-muted); font-size: 11px; }
    .home-match-personal b { margin-left: 5px; color: var(--text-strong); }
    .home-match-personal > span:last-child { margin-left: auto; color: #56d9b4; }
    .home-avatar { position: relative; isolation: isolate; display: inline-grid; place-items: center; width: 48px; height: 48px; flex: 0 0 48px; overflow: hidden; border: 1px solid rgba(83, 210, 192, .35); border-radius: 14px; background: linear-gradient(140deg, #12594f, #154864); color: #e5fff6; font-size: 16px; font-weight: 800; }
    .home-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
    .home-avatar img[hidden] { display: none; }
    .home-overview-row { display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; padding: 15px 0; border: 0; border-top: 1px solid var(--border-color); background: transparent; color: var(--text-strong); font: inherit; text-align: left; cursor: pointer; }
    .home-row-copy { flex: 1; min-width: 0; display: grid; gap: 6px; }
    .home-row-copy strong { font-size: 14px; overflow-wrap: anywhere; }
    .home-row-copy small { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; color: var(--text-muted); font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
    .home-overview-row > i { color: var(--text-muted); font-size: 10px; }
    .home-row-icon { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; border-radius: 11px; background: rgba(69, 199, 163, .1); color: #59dab5; }
    .home-tournament-progress { display: grid; gap: 8px; padding: 0 0 16px 48px; }
    .home-tournament-progress small { color: var(--text-muted); font-size: 10px; }
    .home-mini-bar { display: block; height: 4px; overflow: hidden; border-radius: 10px; background: var(--surface-strong); }
    .home-mini-bar i { display: block; height: 100%; background: linear-gradient(90deg, #27cfa5, #67bafb); border-radius: inherit; }
    .home-progress-preview { display: flex; align-items: center; gap: 16px; width: 100%; padding: 0; border: 0; background: transparent; color: var(--text-strong); font: inherit; text-align: left; cursor: pointer; }
    .home-progress-preview__ring { display: grid; place-items: center; width: 84px; height: 84px; flex: 0 0 84px; border-radius: 50%; background: conic-gradient(#42e5b6 var(--home-progress), var(--surface-strong) 0); }
    .home-progress-preview__ring b { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; background: var(--surface); font-size: 23px; }
    .home-progress-preview > span:last-child { display: grid; gap: 10px; min-width: 0; }
    .home-progress-preview strong { font-size: 14px; line-height: 1.5; }
    .home-progress-preview small { color: var(--text-muted); font-size: 10px; }
    .home-goals-caption { display: block; margin-top: 16px; color: var(--text-muted); font-size: 10px; }
    .home-goals-preview { display: grid; gap: 10px; margin-top: 10px; }
    .home-goals-preview > button { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 0; border: 0; color: var(--text-strong); background: transparent; font: inherit; text-align: left; cursor: pointer; }
    .home-goals-preview small { color: var(--text-muted); font-size: 11px; }
    .home-goals-preview strong { font-size: 11px; }
    .home-goals-preview .home-mini-bar { grid-column: 1 / -1; }
    .home-panel--actions h2 { margin: 6px 0 0; color: var(--text-strong); font-size: 20px; }
    .home-quick-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
    .home-quick-action { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 14px; border: 1px solid rgba(77, 207, 171, .32); border-radius: 11px; background: rgba(24, 100, 83, .14); color: var(--text-strong); font: inherit; font-size: 11px; cursor: pointer; }
    .home-quick-action:hover { background: rgba(35, 157, 119, .2); }
    .home-overview button:focus-visible,
    .home-next-match button:focus-visible { outline: 2px solid #45dbb2; outline-offset: 4px; }
    .home-overview button:hover,
    .home-next-match button:hover { border-color: #45dbb2; }
    .home-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
    .home-card--agenda { min-height: auto; }
    .home-grid .app-session-card { grid-column: auto; height: 100%; align-items: flex-start; flex-direction: column; justify-content: center; }
    .home-grid .app-session-card__caption { display: none; }
}

@media (min-width: 769px) and (max-width: 1250px) {
    .home-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .home-panel--chart { grid-column: 1 / -1; grid-row: auto; min-height: 420px; }
    .home-panel--progress,
    .home-panel--minutes { grid-column: span 6; }
    .home-panel--last,
    .home-panel--teams,
    .home-panel--tournaments,
    .home-panel--friends,
    .home-panel--notes,
    .home-panel--upcoming { grid-column: span 6; }
    .home-hero { gap: 22px; padding: 24px; }
    .home-hero .player-spotlight { grid-template-columns: 70px minmax(0, 1fr); gap: 12px; }
    .home-hero .player-spotlight__avatar { width: 70px; height: 70px; }
    .home-hero .photo-placeholder__text { font-size: 8px; }
    .home-hero .photo-placeholder__icon { display: none; }
    .home-next-match { padding: 16px; }
    .home-panel { padding: 20px; }
    .home-panel--actions { flex-direction: column; align-items: flex-start; }
    .home-quick-actions { justify-content: flex-start; }
}

@media (min-width: 769px) and (max-width: 1100px) {
    .home-hero { grid-template-columns: minmax(0, 1fr); }
    .home-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .home-stat-tile { padding: 14px; }
    .home-overview-panels { grid-template-columns: minmax(0, 1fr); }
    .home-overview-panels > .home-panel { grid-column: 1; grid-row: auto; }
    .home-chart-wrap { min-height: 260px; }
    .home-small-chart { height: 180px; }
    .home-grid { grid-template-columns: minmax(0, 1fr); }
    .home-grid .app-session-card { flex-direction: row; align-items: center; }
}

@media (min-width: 769px) {
    .home-match-badges { align-items: center; }
    .home-match-badges > span { align-self: center; }
    .home-panel--teams .home-overview-row { position: relative; flex-direction: column; align-items: flex-start; justify-content: center; gap: 18px; min-height: 220px; }
    .home-panel--teams .home-overview-row > .home-avatar { width: 64px; height: 64px; flex-basis: 64px; font-size: 23px; border-radius: 20px; }
    .home-panel--teams .home-row-copy { flex: 0 1 auto; }
    .home-panel--teams .home-row-copy strong { font-size: 20px; }
    .home-panel--teams .home-overview-row > i { position: absolute; right: 2px; top: 18px; }
    .home-panel--teams:has(.home-overview-row + .home-overview-row) .home-overview-row { flex-direction: row; align-items: center; min-height: 110px; }
    .home-panel--teams:has(.home-overview-row + .home-overview-row) .home-row-copy strong { font-size: 15px; }
    .home-chart-state--compact { inset: 0; padding: 14px; color: var(--text-muted); font-size: 12px; line-height: 1.6; text-align: center; }
}

@media (min-width: 769px) {
    .home-grid > .app-session-card:only-child {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* Match centre: retain the mobile view and expand the existing desktop cards. */
@media (min-width: 769px) {
    #matches-container #matches.is-detail-open {
        width: 100%;
        max-width: none;
        margin-inline: 0;
        overflow: visible;
    }
    #matches-container #matches .match-detail-page {
        max-width: none;
        gap: 22px;
        padding: 0 0 24px;
    }
    #matches-container #matches .match-detail-header {
        grid-template-columns: 44px minmax(0, 1fr) auto;
        gap: 16px;
        padding: 0;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }
    #matches-container #matches .match-detail-header h2 {
        font-size: 22px;
        line-height: 1.35;
        text-align: left;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    #matches-container #matches .match-detail-header__button { width: 42px; height: 42px; border-radius: 13px; }
    #matches-container #matches .match-detail-hero {
        padding: 32px;
        border: 1px solid rgba(88, 210, 193, .3);
        border-radius: 24px;
        background: linear-gradient(115deg, rgba(4, 28, 37, .9), rgba(4, 28, 37, .55)), url('../img/matches-stadium-tunnel-hero-v1.webp') center 45% / cover no-repeat;
    }
    #matches-container #matches .match-detail-hero__teams {
        grid-template-columns: minmax(0, 1fr) minmax(150px, .65fr) minmax(0, 1fr);
        gap: 24px;
        max-width: 1000px;
        margin-inline: auto;
    }
    #matches-container #matches .match-detail-hero__team { gap: 15px; }
    #matches-container #matches .match-detail-hero__team strong {
        max-width: 300px;
        font-size: 19px;
        line-height: 1.4;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    #matches-container #matches .match-detail-emblem { width: 86px; height: 86px; border-radius: 22px; }
    #matches-container #matches .match-detail-hero__score { gap: 12px; }
    #matches-container #matches .match-detail-hero__score b { font-size: clamp(44px, 4.5vw, 68px); line-height: 1.05; }
    #matches-container #matches .match-detail-hero__score > span { padding: 6px 14px; font-size: 11px; }
    #matches-container #matches .match-detail-hero__score time { gap: 5px; font-size: 13px; }
    #matches-container #matches .match-detail-hero__score time small { font-size: 12px; }
    #matches-container #matches .match-detail-hero__meta { margin-top: 24px; gap: 10px; }
    #matches-container #matches .match-detail-hero__meta > span { padding: 9px 12px; font-size: 12px; white-space: normal; overflow-wrap: anywhere; }
    #matches-container #matches .match-detail-tabs { max-width: 760px; padding: 5px; border-radius: 16px; }
    #matches-container #matches .match-detail-tabs button { min-height: 44px; padding: 12px 16px; font-size: 13px; }
    #matches-container #matches .match-detail-content,
    #matches-container #matches .match-detail-panel { gap: 20px; }
    #matches-container #matches .match-detail-section,
    #matches-container #matches .match-lineup-team { padding: 22px; border-radius: 20px; }
    #matches-container #matches .match-detail-section h3,
    #matches-container #matches .match-lineup-team h3 { gap: 10px; margin-bottom: 18px; font-size: 16px; line-height: 1.4; }
    #matches-container #matches .match-detail-section__heading { flex-wrap: wrap; gap: 12px; }
    #matches-container #matches .match-detail-info { gap: 12px; }
    #matches-container #matches .match-detail-info__item { padding: 14px; gap: 12px; border-radius: 13px; }
    #matches-container #matches .match-detail-info__item small { font-size: 11px; }
    #matches-container #matches .match-detail-info__item strong { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
    #matches-container #matches .match-detail-metrics { gap: 14px; }
    #matches-container #matches .match-detail-metric > strong { font-size: 16px; }
    #matches-container #matches .match-detail-metric__label { font-size: 12px; line-height: 1.4; }
    #matches-container #matches .match-detail-links { gap: 12px; }
    #matches-container #matches .match-detail-links > button { padding: 16px; gap: 12px; border-radius: 13px; }
    #matches-container #matches .match-detail-links > button strong { font-size: 14px; }
    #matches-container #matches .match-detail-links > button small { font-size: 11px; line-height: 1.5; }
    #matches-container #matches .match-detail-empty { font-size: 13px; line-height: 1.7; }
    #matches-container #matches .match-lineups-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
    #matches-container #matches .match-lineup-player { width: 30px; height: 30px; font-size: 10px; }
    #matches-container #matches .match-detail-segmented { max-width: 480px; }
    #matches-container #matches .match-detail-segmented button { padding: 12px; font-size: 12px; }
    #matches-container #matches .match-event-filters { flex-wrap: wrap; }
    #matches-container #matches .match-detail-best-player__body strong { font-size: 16px; overflow-wrap: anywhere; }
    #matches-container #matches .match-detail-best-player__body small { font-size: 12px; }
    #matches-container #matches .match-card-main { grid-template-columns: 60px minmax(0, 1fr) 32px; gap: 12px; padding: 20px 16px; }
    #matches-container #matches .match-card-fixture { grid-template-columns: minmax(0, 1fr) minmax(100px, .8fr) minmax(0, 1fr); gap: 14px; padding: 0; }
    #matches-container #matches .match-card-team { min-width: 0; gap: 10px; }
    #matches-container #matches .match-card-team .team-name-text { font-size: 13px; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
    #matches-container #matches .match-score { min-width: 90px; padding: 12px; font-size: 30px; }
    #matches-container #matches .match-card-competition { max-width: 100%; font-size: 11px; line-height: 1.5; white-space: normal; overflow-wrap: anywhere; text-align: center; }
    #matches-container #matches .match-card-date strong { font-size: 24px; }
    #matches-container #matches .match-stat-item { flex-direction: column; gap: 8px; padding: 12px 6px; text-align: center; }
    #matches-container #matches .match-stat-item strong { font-size: 18px; }
    #matches-container #matches .match-stat-item > div > span:last-child { white-space: normal; line-height: 1.3; font-size: 10px; }
    #matches-container #matches .matches-list { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 1200px) {
    #matches-container #matches .matches-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #matches-container #matches [data-match-detail-panel="overview"],
    #matches-container #matches [data-match-detail-panel="statistics"] { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
    #matches-container #matches [data-match-detail-panel="overview"] > :has(.match-detail-links) { grid-column: 1 / -1; }
    #matches-container #matches .match-detail-links { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    #matches-container #matches [data-match-detail-panel="overview"] > .match-workflow,
    #matches-container #matches [data-match-detail-panel="overview"] > .team-match-detail-collapse,
    #matches-container #matches [data-match-detail-panel="statistics"] > .match-events-edit-button,
    #matches-container #matches [data-match-detail-panel="statistics"] > .match-statistics-additional { grid-column: 1 / -1; }
}

@media (min-width: 769px) and (max-width: 1023px) {
    #matches-container #matches .match-detail-hero { padding: 22px 16px; }
    #matches-container #matches .match-detail-hero__teams { grid-template-columns: minmax(0, 1fr) 100px minmax(0, 1fr); gap: 12px; }
    #matches-container #matches .match-detail-hero__team strong { font-size: 14px; }
    #matches-container #matches .match-detail-hero__score b { font-size: 38px; }
    #matches-container #matches .match-detail-emblem { width: 60px; height: 60px; }
    #matches-container #matches .match-lineups-grid { grid-template-columns: minmax(0, 1fr); }
    #matches-container #matches .match-detail-tabs button { padding-inline: 6px; font-size: 12px; }
}

@media (min-width: 769px) {
    #matches-container #matches .match-detail-info__item strong {
        white-space: normal;
        text-overflow: clip;
        overflow: visible;
    }
    #matches-container #matches .match-detail-section__heading > button { padding: 8px 10px; font-size: 12px; }
    #matches-container #matches [data-match-detail-panel="statistics"] > .match-detail-section:has(> .match-detail-empty) { grid-column: 1 / -1; }
}
