:root {
    --bg: #081118;
    --panel: #0f1b24;
    --panel-2: #132636;
    --line: #1d3444;
    --text: #eaf7ff;
    --muted: #89a5b6;
    --cyan: #28b7ff;
    --cyan-dark: #0f8bd1;
    --green: #26d28f;
    --red: #fb7185;
    --shadow: 0 18px 40px rgba(0, 0, 0, .26);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(40, 183, 255, .18), transparent 28rem),
        linear-gradient(135deg, #050a0e 0%, var(--bg) 42%, #0a1925 100%);
    font-family: "Segoe UI", Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }

.landing-body { min-height: 100vh; padding: 28px; }
.landing-header, .landing-main { max-width: 1240px; margin: 0 auto; }
.landing-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 18px; }
.landing-nav { display: flex; gap: 12px; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 44px; height: 44px; border-radius: 12px;
    background: linear-gradient(135deg, var(--cyan), #48ffd7);
    color: #042130; display: inline-flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 900;
}
.brand strong, .brand small { display: block; }
.brand small, .muted, .eyebrow, .student-meta { color: var(--muted); }

.hero {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 24px;
    align-items: center;
    padding: 40px 0 24px;
}

.hero h1 { font-size: clamp(36px, 5vw, 60px); line-height: 1.05; margin: 0 0 16px; }
.hero-copy { color: #c6dde9; font-size: 18px; line-height: 1.7; max-width: 720px; }
.hero-actions { display: flex; gap: 12px; margin-top: 26px; }

.panel-card, .auth-card, .student-card, .stat-card {
    background: rgba(15, 27, 36, .9);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.hero-card, .panel-card { padding: 24px; }
.player-card-preview {
    background: linear-gradient(180deg, rgba(16, 42, 66, .96), rgba(10, 23, 35, .98));
    border: 1px solid rgba(40, 183, 255, .18);
    border-radius: 22px;
    padding: 22px;
}

.player-card-head, .section-head, .app-topbar, .student-card-top {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

.section-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.score-lines, .score-panel { display: grid; gap: 12px; margin-top: 18px; }
.score-lines > div, .score-row {
    display: grid;
    grid-template-columns: 80px 1fr 46px;
    align-items: center;
    gap: 12px;
}
.score-row.large { grid-template-columns: 130px 1fr 70px; }
.score-track {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.06);
    overflow: hidden;
}
.score-track i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--cyan), #73d4ff);
}

.landing-grid, .dashboard-grid, .student-card-grid, .stat-grid, .form-grid.two-cols {
    display: grid;
    gap: 20px;
}
.landing-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 22px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--cyan), var(--cyan-dark));
    color: white;
    border: 0;
    border-radius: 12px;
    padding: 12px 18px;
    font-weight: 800;
    cursor: pointer;
}
.btn-secondary {
    background: rgba(255,255,255,.04);
    border: 1px solid var(--line);
}
.btn-ghost {
    background: transparent;
    color: var(--muted);
}

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-card {
    width: min(460px, 100%);
    padding: 30px;
}
.auth-card h1 { margin: 14px 0 8px; }

.form-group { display: grid; gap: 8px; margin-bottom: 16px; }
.form-control {
    width: 100%;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--text);
    padding: 12px 14px;
    outline: none;
}
textarea.form-control { resize: vertical; }

.alert {
    border-radius: 12px;
    margin-bottom: 16px;
    padding: 12px 14px;
}
.alert-danger { background: rgba(251, 113, 133, .12); border: 1px solid rgba(251, 113, 133, .28); color: #ffd2dc; }
.alert-success { background: rgba(38, 210, 143, .1); border: 1px solid rgba(38, 210, 143, .24); color: #c5f9df; }

.app-layout { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar {
    background: rgba(8, 17, 24, .95);
    border-right: 1px solid var(--line);
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.side-nav { display: grid; gap: 6px; margin-top: 28px; }
.side-nav a {
    border-radius: 12px;
    color: #d7ebf6;
    padding: 12px;
}
.side-nav a:hover { background: rgba(40, 183, 255, .08); }
.sidebar-footer { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
.sidebar-footer a { color: var(--red); font-weight: 700; }

.app-content { min-width: 0; }
.app-topbar { border-bottom: 1px solid var(--line); padding: 22px 28px; }
.page-content { padding: 28px; }
.eyebrow { font-size: 12px; letter-spacing: .08em; margin: 0; text-transform: uppercase; }

.user-box {
    display: grid;
    justify-items: end;
    gap: 2px;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
}
.user-box span { color: var(--cyan); font-size: 12px; }

.stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 22px; }
.stat-card { padding: 20px; }
.stat-card small { color: var(--muted); }
.stat-card strong { display: block; font-size: 28px; margin-top: 8px; }

.dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.section-head h2 { margin: 0; }

.student-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.student-card { padding: 18px; transition: transform .18s ease; }
.student-card:hover { transform: translateY(-2px); }
.primary-student-card {
    border-color: rgba(40, 183, 255, .24);
    background: linear-gradient(180deg, rgba(15, 27, 36, .96), rgba(12, 28, 40, .98));
}
.fifa-student-card {
    position: relative;
    overflow: hidden;
}
.fifa-student-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(140deg, rgba(40, 183, 255, .05), transparent 40%, rgba(255, 255, 255, .03));
    pointer-events: none;
}
.fifa-card-topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.fifa-rating,
.fifa-jersey {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 32px;
    border-radius: 10px;
    font-weight: 800;
}
.fifa-rating {
    background: rgba(40, 183, 255, .14);
    color: #9ee3ff;
    border: 1px solid rgba(40, 183, 255, .18);
}
.fifa-jersey {
    background: rgba(255,255,255,.05);
    color: #d4e6f0;
    border: 1px solid rgba(255,255,255,.08);
}
.teammate-card {
    box-shadow: none;
}
.student-card-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}
.student-avatar {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(40, 183, 255, .16), rgba(115, 212, 255, .1));
    border: 1px solid rgba(40, 183, 255, .16);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--text);
    font-size: 22px;
    font-weight: 800;
}
.student-avatar.large {
    width: 120px;
    height: 120px;
    flex: 0 0 120px;
    border-radius: 26px;
    font-size: 42px;
}
.student-avatar.has-photo {
    background: rgba(255,255,255,.03);
}
.student-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.student-status {
    background: rgba(40, 183, 255, .1);
    border: 1px solid rgba(40, 183, 255, .22);
    border-radius: 999px;
    color: #9ddfff;
    padding: 6px 10px;
    text-transform: capitalize;
}
.student-meta { margin: 10px 0 14px; }
.student-profile-hero {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 20px;
    align-items: start;
    margin-bottom: 20px;
}
.detail-grid.compact {
    margin-bottom: 0;
}

.timeline-list { display: grid; gap: 16px; }
.timeline-list > div {
    background: rgba(255,255,255,.025);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
}
.timeline-list strong, .timeline-list small { display: block; }
.timeline-list small { margin-top: 4px; color: var(--muted); }
.timeline-list p { margin: 10px 0 0; color: #d7ebf6; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; min-width: 720px; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.data-table th { color: var(--muted); text-transform: uppercase; font-size: 12px; }
.table-note-row td {
    background: rgba(255,255,255,.015);
    font-size: 14px;
}

.row-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.row-actions a { color: var(--cyan); font-weight: 700; }
.inline-form { display: inline-flex; }
.btn-link {
    background: none;
    border: 0;
    color: var(--cyan);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0;
}
.empty-state { color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.detail-grid small, .note-box { color: var(--muted); }
.detail-grid strong { display: block; margin-top: 4px; }
.note-box {
    background: rgba(255,255,255,.03);
    border: 1px dashed var(--line);
    border-radius: 14px;
    padding: 14px;
}
.subsection-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(40, 183, 255, .28), transparent);
    margin: 24px 0;
}
.compact-space {
    margin-bottom: 14px;
}
.compact-space h3 {
    margin: 0;
}
.team-card-grid {
    margin-top: 0;
}

.span-2 { grid-column: span 2; }

.squad-builder {
    display: grid;
    gap: 12px;
}
.squad-row {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 16px;
    align-items: center;
    background: rgba(255,255,255,.025);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
}
.squad-row small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}
.squad-role-select {
    min-width: 0;
}
.squad-preview {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
.squad-preview h3 {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}
.pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.pill {
    background: rgba(40, 183, 255, .1);
    border: 1px solid rgba(40, 183, 255, .18);
    border-radius: 999px;
    color: #ccefff;
    padding: 8px 12px;
    font-size: 13px;
}
.vertical-list {
    align-items: flex-start;
}
.muted-pill {
    background: rgba(255,255,255,.04);
    border-color: rgba(255,255,255,.08);
    color: var(--muted);
}
.match-detail-grid .match-pitch-card {
    overflow: hidden;
}
.pitch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    padding: 24px;
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(18, 61, 44, .95), rgba(9, 39, 28, .98)),
        repeating-linear-gradient(
            0deg,
            rgba(255,255,255,.03) 0px,
            rgba(255,255,255,.03) 2px,
            transparent 2px,
            transparent 48px
        );
    border: 1px solid rgba(38, 210, 143, .24);
}
.pitch-player-card {
    background: rgba(5, 15, 11, .38);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    box-shadow: inset 0 0 0 1px rgba(38, 210, 143, .08);
}
.pitch-player-card strong,
.pitch-player-card small {
    display: block;
}
.pitch-player-card small {
    color: #b9d9c9;
    margin-top: 6px;
}
.match-hub-layout {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 20px;
    margin-top: 20px;
}
.match-squad-column,
.match-list-column {
    min-width: 0;
}
.selected-match-card {
    background: rgba(255,255,255,.025);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px;
}
.scoreboard-badge {
    background: rgba(38, 210, 143, .12);
    border: 1px solid rgba(38, 210, 143, .22);
    color: #c7ffe6;
    border-radius: 999px;
    padding: 10px 14px;
    font-weight: 800;
}
.match-actions-row {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.squad-column-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 18px;
}
.squad-mini-card h3,
.match-list-column h3 {
    margin-top: 0;
}
.roster-list {
    display: grid;
    gap: 12px;
}
.roster-item {
    display: grid;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255,255,255,.025);
    border: 1px solid var(--line);
}
.roster-stats-inline {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 13px;
}
.centered-stats {
    justify-content: center;
}
.match-history-list {
    max-height: 900px;
    overflow: auto;
    padding-right: 4px;
}
.match-history-item {
    display: block;
    background: rgba(255,255,255,.025);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
}
.match-history-item.active {
    border-color: rgba(40, 183, 255, .26);
    box-shadow: inset 0 0 0 1px rgba(40, 183, 255, .08);
}
.match-history-item p {
    margin: 10px 0 0;
    color: #d7ebf6;
}
.match-mini-score {
    font-weight: 800;
    color: #c7ffe6;
}
.stats-builder .squad-row-stats {
    grid-template-columns: minmax(280px, 1.6fr) 140px 100px 100px 100px;
}
.compact-stat-grid {
    margin-top: 18px;
    margin-bottom: 0;
}
.compact-timeline > div p {
    margin-bottom: 0;
}
.match-detail-grid .detailed-pitch-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.detailed-player-card .student-avatar {
    margin: 0 auto 12px;
}

@media (max-width: 980px) {
    .hero,
    .landing-grid,
    .app-layout,
    .dashboard-grid,
    .student-card-grid,
    .stat-grid,
    .detail-grid,
    .form-grid.two-cols {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
    }

    .student-profile-hero,
    .squad-row,
    .match-hub-layout,
    .squad-column-grid {
        grid-template-columns: 1fr;
    }

    .stats-builder .squad-row-stats {
        grid-template-columns: 1fr;
    }
}
