* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    background: #202423;
    color: #f5f7f6;
}


/* =========================================================
   HEADER
========================================================= */

.topbar {
    height: 69px;

    background: #073324;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 48px;

    border-bottom: 1px solid
        rgba(255, 255, 255, .025);
}


.brand {
    display: flex;
    align-items: center;

    gap: 13px;
}


.brand-ball {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 29px;
}


.brand-title {
    font-size: 17px;
    font-weight: 800;

    letter-spacing: 1.2px;
}


.brand-subtitle {
    margin-top: 2px;

    color: #89bfae;

    font-size: 10px;

    letter-spacing: 1.5px;
}


.demo-btn {
    text-decoration: none;

    padding: 8px 16px;

    border-radius: 18px;

    background: #19563f;

    color: #d8efe6;

    font-size: 11px;

    font-weight: 700;
}


/* =========================================================
   MAIN
========================================================= */

.page-container {
    width: 100%;

    max-width: 1450px;

    margin: 0 auto;

    padding:
        28px
        28px
        50px;
}


.main-grid {
    display: grid;

    grid-template-columns:
        minmax(450px, 535px)
        minmax(600px, 1fr);

    gap: 22px;

    align-items: start;
}


/* =========================================================
   CARDS
========================================================= */

.card {
    background: #101211;

    border:
        1px solid
        #3a3e3d;

    border-radius: 16px;
}


.players-card {
    padding:
        26px
        22px
        20px;
}


.setup-card {
    padding:
        26px
        23px
        21px;
}


/* =========================================================
   SECTION HEADER
========================================================= */

.section-header {
    display: flex;

    justify-content: space-between;
    align-items: flex-start;

    gap: 15px;

    margin-bottom: 22px;
}


.section-header h2 {
    margin: 0;

    color: #f7f8f7;

    font-size: 21px;

    line-height: 1.2;

    font-weight: 800;
}


.section-header p {
    margin:
        8px
        0
        0;

    color: #858f8a;

    font-size: 13px;
}


.selected-badge {
    flex-shrink: 0;

    padding:
        8px
        14px;

    border-radius: 18px;

    background: #172b22;

    color: #38c882;

    font-size: 12px;

    font-weight: 800;
}


/* =========================================================
   SELECTION BUTTONS
========================================================= */

.selection-buttons {
    display: flex;

    gap: 8px;

    margin-bottom: 14px;
}


.secondary-btn {
    border: 0;

    border-radius: 9px;

    padding:
        10px
        14px;

    background: #252a28;

    color: #d8dfdc;

    font-size: 12px;

    font-weight: 750;

    cursor: pointer;
}


.secondary-btn:hover {
    background: #2c3330;
}


/* =========================================================
   ADD PLAYER
========================================================= */

.add-player {
    display: grid;

    grid-template-columns:
        minmax(120px, 1fr)
        110px
        78px
        72px;

    gap: 7px;

    margin-bottom: 16px;
}


.add-player input,
.add-player select,
.setup-controls select {
    height: 41px;

    border:
        1px solid
        #3a3e3d;

    border-radius: 9px;

    outline: none;

    background: #101211;

    color: #dce3e0;

    padding:
        0
        11px;

    font-size: 12px;
}


.add-player input:focus,
.add-player select:focus,
.setup-controls select:focus {
    border-color: #168e58;
}


.add-btn {
    border: 0;

    border-radius: 9px;

    background: #07834e;

    color: #fff;

    font-size: 12px;

    font-weight: 800;

    cursor: pointer;
}


.add-btn:hover {
    background: #09935a;
}


/* =========================================================
   TIGER LEGEND
========================================================= */

.tiger-legend {
    display: flex;

    align-items: center;

    flex-wrap: wrap;

    gap: 7px;

    margin-bottom: 13px;
}


.tiger-badge,
.team-tiger {
    display: inline-flex;

    justify-content: center;
    align-items: center;

    border-radius: 6px;

    font-weight: 800;
}


.tiger-badge {
    width: 25px;
    height: 24px;

    font-size: 11px;
}


.tiger-T1 {
    background: #4b2928;
    color: #ff776c;
}


.tiger-T2 {
    background: #392f18;
    color: #efa81d;
}


.tiger-T3 {
    background: #172c3d;
    color: #54a9e8;
}


.tiger-T4 {
    background: #292646;
    color: #b4a9ff;
}


.tiger-T5 {
    background: #193229;
    color: #7bd5a8;
}


.legend-text {
    margin-left: 7px;

    color: #808984;

    font-size: 11px;
}


/* =========================================================
   PLAYER LIST
========================================================= */

.player-list {
    display: flex;

    flex-direction: column;

    gap: 8px;
}


.player-row {
    min-height: 48px;

    display: grid;

    grid-template-columns:
        27px
        minmax(110px, 1fr)
        34px
        62px
        75px
        20px;

    align-items: center;

    gap: 7px;

    padding:
        7px
        10px;

    background: #101211;

    border:
        1px solid
        #393d3c;

    border-radius: 11px;
}


.player-row:hover {
    background: #121514;

    border-color: #4a504d;
}


/* =========================================================
   CHECKBOX
========================================================= */

.player-check,
.keeper-check {
    cursor: pointer;

    accent-color: #14925a;
}


.player-check {
    width: 18px;
    height: 18px;
}


/* =========================================================
   PLAYER NAME
========================================================= */

.player-name {
    min-width: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    overflow: visible;
    color: #f1f4f2;
    font-size: 13px;
    font-weight: 750;
}

.player-name-text {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}


.player-name.temp {
    color: #83ddb3;
}


.temp-label {
    margin-left: 5px;

    color: #4bc88a;

    font-size: 9px;

    font-weight: 800;
}


/* =========================================================
   TIGER SELECT
========================================================= */

.tiger-select {
    width: 34px;
    height: 27px;

    padding: 0;

    border: 0;

    border-radius: 6px;

    outline: none;

    text-align: center;

    font-size: 10px;

    font-weight: 800;

    cursor: pointer;

    appearance: auto;
}


.tiger-select.tiger-T1 {
    background: #4b2928;
    color: #ff776c;
}


.tiger-select.tiger-T2 {
    background: #392f18;
    color: #efa81d;
}


.tiger-select.tiger-T3 {
    background: #172c3d;
    color: #54a9e8;
}


.tiger-select.tiger-T4 {
    background: #292646;
    color: #b4a9ff;
}


.tiger-select.tiger-T5 {
    background: #193229;
    color: #7bd5a8;
}


/* =========================================================
   POINTS
========================================================= */

.player-points {
    width: 60px;
    height: 28px;

    border:
        1px solid
        #777d7a;

    border-radius: 6px;

    background: #383c3b;

    color: #fff;

    padding:
        0
        7px;

    font-size: 12px;
}


/* =========================================================
   KEEPER
========================================================= */

.keeper-control {
    display: flex;

    align-items: center;

    gap: 5px;

    color: #a5ada9;

    white-space: nowrap;

    font-size: 11px;
}


.keeper-control input {
    width: 18px;
    height: 18px;
}


/* =========================================================
   REMOVE
========================================================= */

.remove-player {
    border: 0;

    background: transparent;

    color: #737d78;

    font-size: 17px;

    cursor: pointer;
}


.remove-player:hover {
    color: #ef7266;
}


/* =========================================================
   SETUP
========================================================= */

.right-column {
    min-width: 0;
}


.setup-controls {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 12px;

    margin-bottom: 16px;
}


.control-group {
    display: flex;

    flex-direction: column;

    gap: 7px;
}


.control-group label {
    color: #8c9691;

    font-size: 11px;

    font-weight: 600;
}


.setup-controls select {
    width: 100%;

    height: 43px;

    font-weight: 700;
}


/* =========================================================
   SPLIT BUTTON
========================================================= */

.split-btn {
    width: 100%;

    height: 49px;

    border: 0;

    border-radius: 10px;

    background: #07834e;

    color: #fff;

    font-size: 14px;

    font-weight: 850;

    cursor: pointer;
}


.split-btn:hover {
    background: #09945a;
}


.split-btn span {
    margin-right: 6px;
}


/* =========================================================
   SUMMARY
========================================================= */

.result-summary {
    margin-top: 17px;

    color: #818c87;

    font-size: 12px;
}


/* =========================================================
   TEAMS
========================================================= */

.teams-section {
    margin-top: 18px;
}


#teams {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 14px;
}


.team-card {
    overflow: hidden;

    background: #101211;

    border:
        1px solid
        #3a3e3d;

    border-radius: 15px;
}


.team-header {
    min-height: 77px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding:
        16px;

    color: #fff;
}


.team-header.team-0 {
    background: #c53e37;
}


.team-header.team-1 {
    background: #287bb1;
}


.team-header.team-2 {
    background: #a96c23;
}


.team-header.team-3 {
    background: #6e4ca5;
}


.team-title {
    font-size: 15px;

    font-weight: 850;
}


.team-player-count {
    margin-top: 6px;

    font-size: 12px;

    opacity: .9;
}


.team-score {
    font-size: 14px;

    font-weight: 850;
}


.team-body {
    padding:
        7px
        15px
        12px;
}


.team-player {
    min-height: 43px;

    display: grid;

    grid-template-columns:
        1fr
        auto
        auto;

    align-items: center;

    gap: 8px;

    border-bottom:
        1px solid
        #343837;
}


.team-player:last-child {
    border-bottom: 0;
}


.team-player-name {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    padding: 6px 0;
    font-size: 13px;
    font-weight: 700;
}

.team-player-stats {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 0;
}

.team-player-name-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.player-points-badge {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    align-items: center;
    padding: 2px 6px;
    border: 1px solid #66512b;
    border-radius: 6px;
    color: #f2d18a;
    background: #302719;
    font-size: 10px;
    line-height: 1.35;
    font-weight: 800;
    white-space: nowrap;
}


.team-player-right {
    display: flex;

    align-items: center;

    gap: 6px;
}


.team-tiger {
    width: 26px;
    height: 25px;

    font-size: 10px;
}


.team-keeper {
    font-size: 13px;
}


.move-player {
    width: 28px;
    height: 27px;

    border: 0;

    border-radius: 6px;

    background: #1d2925;

    color: #7fa99e;

    cursor: pointer;
}


.move-player:hover {
    background: #293b35;

    color: #b5d9cd;
}


/* =========================================================
   RESULT BUTTONS
========================================================= */

.result-actions {
    display: flex;

    gap: 8px;

    margin-top: 14px;
}


.result-btn {
    border: 0;

    border-radius: 8px;

    padding:
        9px
        13px;

    background: #252a28;

    color: #d0d8d4;

    font-size: 11px;

    font-weight: 700;

    cursor: pointer;
}


.result-btn:hover {
    background: #2d3431;
}


.result-btn.danger {
    background: #2b211f;

    color: #ef776a;
}


/* =========================================================
   FOOTER
========================================================= */

.footer-note {
    margin-top: 20px;

    color: #727c77;

    font-size: 11px;

    line-height: 1.6;
}


.loading,
.empty {
    padding: 25px;

    text-align: center;

    color: #7c8782;

    font-size: 12px;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1050px) {

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

}


@media (max-width: 700px) {

    .topbar {
        padding:
            0
            18px;
    }


    .page-container {
        padding:
            16px
            12px
            35px;
    }


    .players-card,
    .setup-card {
        padding:
            18px
            14px;
    }


    .add-player {
        grid-template-columns:
            1fr
            1fr;
    }


    .add-player input:first-child {
        grid-column:
            1 / -1;
    }


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


    .player-row {
        grid-template-columns:
            25px
            minmax(80px, 1fr)
            30px
            55px
            26px
            18px;
    }


    .keeper-control span {
        display: none;
    }


    .keeper-control {
        justify-content: center;
    }


    .setup-controls {
        grid-template-columns: 1fr;
    }

}


@media (max-width: 430px) {

    .brand-subtitle {
        display: none;
    }


    .brand-title {
        font-size: 15px;
    }


    .demo-btn {
        padding:
            6px
            10px;

        font-size: 9px;
    }


    .section-header h2 {
        font-size: 18px;
    }


    .player-row {
        grid-template-columns:
            23px
            minmax(70px, 1fr)
            28px
            53px
            20px
            17px;
    }


    .player-points {
        width: 53px;
    }

}

/* =========================================================
   NAVIGATION + GOOGLE SHEETS FUNDS
========================================================= */
[hidden] { display: none !important; }

.main-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px 0;
    background: #202423;
}

.main-nav-btn {
    border: 1px solid #315647;
    border-radius: 999px;
    padding: 10px 18px;
    color: #cbd8d2;
    background: #29332f;
    font: inherit;
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

.main-nav-btn:hover { border-color: #5ca989; }
.main-nav-btn.active { background: #176244; border-color: #25845c; color: #fff; }

.funds-view { max-width: 1440px; }
.funds-card { min-width: 0; }
.funds-header { align-items: center; gap: 16px; }
.funds-header p { max-width: 780px; }
.funds-refresh { white-space: nowrap; }

.funds-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0 14px;
}
.funds-controls label { color: #b7c9c0; font-size: 13px; font-weight: 700; }
.funds-controls select {
    min-width: min(100%, 280px);
    padding: 10px 12px;
    border: 1px solid #466455;
    border-radius: 8px;
    background: #17221d;
    color: #f5f7f6;
    font: inherit;
}

.funds-status {
    margin: 12px 0;
    padding: 11px 13px;
    border-radius: 8px;
    background: #27342e;
    color: #cbd8d2;
    font-size: 13px;
    overflow-wrap: anywhere;
}
.funds-status.error { background: #432b2b; color: #ffd6d6; border: 1px solid #774444; }
.funds-status.success { background: #203b2e; color: #c9f3d9; }
.funds-table-wrap {
    width: 100%;
    overflow: auto;
    border: 1px solid #394740;
    border-radius: 10px;
    background: #1b211e;
    min-height: 150px;
}
.funds-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    color: #e9efec;
    font-size: 13px;
    white-space: nowrap;
}
.funds-table th, .funds-table td {
    padding: 10px 12px;
    border-right: 1px solid #35413b;
    border-bottom: 1px solid #35413b;
    text-align: left;
    vertical-align: top;
    min-width: 82px;
    max-width: 320px;
}
.funds-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #12432f;
    color: #f3fff8;
    font-weight: 800;
}
.funds-table tbody tr:nth-child(even) { background: #222a26; }
.funds-table tbody tr:hover { background: #2b3931; }
.funds-table tr:last-child td { border-bottom: 0; }
.funds-table th:last-child, .funds-table td:last-child { border-right: 0; }
.funds-empty { padding: 28px 18px; text-align: center; color: #aebdb5; font-size: 13px; }
.funds-footnote { margin: 12px 0 0; color: #91a49a; font-size: 12px; line-height: 1.6; }

@media (max-width: 640px) {
    .main-nav { padding: 12px 12px 0; }
    .main-nav-btn { flex: 1; padding: 10px 8px; font-size: 12px; }
    .funds-header { align-items: stretch; flex-direction: column; }
    .funds-refresh { width: 100%; }
    .funds-controls { align-items: stretch; flex-direction: column; }
    .funds-controls select { width: 100%; }
    .funds-table { font-size: 12px; }
    .funds-table th, .funds-table td { padding: 8px 10px; }
}

/* Win/loss difference from the latest meal-fund sheet; display-only metadata. */
.player-record {
    display: inline-flex;
    align-items: center;
    margin-left: 7px;
    padding: 2px 6px;
    border: 1px solid #3b4540;
    border-radius: 6px;
    color: #c7d4cd;
    background: #202723;
    font-size: 10px;
    line-height: 1.35;
    font-weight: 700;
    white-space: nowrap;
    vertical-align: middle;
}
