body {
    margin: 0;
    padding: 0 8px;
    background: #222;
    font-family: Arial, sans-serif;
    color: #eee;
}

#app-container {
    width: 100%;
    max-width: 1200px;
    margin: auto;
    padding: 15px 10px 25px;
    box-sizing: border-box;
}

.panel {
    background: #333;
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 6px;
    position: relative;
}

h2, h3 {
    margin-top: 0;
}

.inherit-link {
    color: inherit;
}

.inherit-link:hover,
.inherit-link:focus {
    color: inherit;
}

.grouped-panel {
    position: relative;
    padding-top: 24px;
    border: 1px solid #666;
}

.top-right {
    position: absolute;
    top: 10px;
    right: 10px;
}


.inline-status {
    align-self: center;
    text-align: left;
    font-size: 12px;
    color: #cfcfcf;
}


.status-text {
    margin-top: 0;
    text-align: left;
}

.status-error {
    color: #ff4444;
}


.apikey-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 10px;
    align-items: start;
}

.apikey-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 10px 8px;
    background: #1f1f1f;
    border: 1px solid #333;
    border-radius: 6px;
}

.apikey-control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.apikey-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.apikey-display-row {
    display: flex;
    align-items: center;
    column-gap: 6px;
    row-gap: 4px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.apikey-input-row input {
    flex: 1;
}

.apikey-subtext {
    font-size: 12px;
    color: #cfcfcf;
    margin: 0;
}

.remember-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #cfcfcf;
    white-space: nowrap;
}

.remember-toggle input {
    width: 14px;
    height: 14px;
}

.apikey-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.apikey-prompt {
    padding: 4px 8px;
    border: 1px dashed #555;
    border-radius: 4px;
    color: #d8d8d8;
    font-size: 11px;
    font-weight: 600;
    background: #161616;
    line-height: 1.3;
}

input[type="text"], input[type="number"] {
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #666;
    background: #111;
    color: #eee;
}

select {
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #666;
    background: #111;
    color: #eee;
}

button {
    padding: 6px 12px;
    background: #555;
    border: 1px solid #888;
    border-radius: 4px;
    cursor: pointer;
    color: #fff;
}
button:hover {
    background: #666;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

th {
    background: #444;
    padding: 8px;
}

#player-table a,
#player-table a:visited,
#player-table a:hover {
    color: inherit;
    text-decoration: underline;
}

.player-name-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dot-green {
    background: #4caf50;
}

.dot-yellow {
    background: #f1c40f;
}

.dot-grey {
    background: #777;
}

th.sortable {
    cursor: pointer;
    position: relative;
    user-select: none;
    padding-right: 16px;
}

th.sortable::after {
    content: "";
    position: absolute;
    right: 6px;
    color: #ccc;
}

th.sorted-asc::after {
    content: "▲";
}

th.sorted-desc::after {
    content: "▼";
}

td {
    padding: 6px;
    border-top: 1px solid #555;
}

tr.selected-row {
    background: #555 !important;
}

.eliminated-row {
    color: #ff6666;
}

.hidden {
    display: none !important;
}

.clear-button {
    background: #6c3636;
    border-color: #a24a4a;
    padding: 4px 8px;
    width: auto;
    flex-shrink: 0;
    font-size: 14px;
    line-height: 1;
    min-height: 28px;
}

.storage-note {
    font-size: 12px;
    color: #cfcfcf;
    margin: 0 0 8px 0;
    padding: 6px 8px;
    background: #2b2b2b;
    border-radius: 4px;
}

/* REFRESH SPINNER */

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    margin-right: 6px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* COLOR STATES */
.state-green { color: #00cc44; }
.state-yellow { color: #ffdf00; }
.state-orange { color: #ff9900; }
.state-red { color: #ff3333; }
.state-blue { color: #33aaff; }

/* Box grouping user + team list */
#meta-section {
    margin-bottom: 20px;
}

.userinfo-box {
    padding: 8px;
    margin-top: 10px;
}

.user-info-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.user-team-label {
    font-weight: 600;
}

#player-section {
    border: 1px solid #666;
}

#player-filters {
    margin-bottom: 10px;
    padding: 10px;
    background: #2b2b2b;
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
}

#player-filters label {
    margin-right: 12px;
}

.range-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.range-input {
    width: 70px;
}

.abroad-list {
    margin-top: 6px;
}

@media (max-width: 768px) {
    body {
        padding: 0 6px;
    }

    #app-container {
        padding: 12px 8px 20px;
    }

    .panel {
        padding: 12px;
    }

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

    .apikey-input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .apikey-row input,
    .apikey-input-row button,
    .apikey-row .inline-status,
    #player-filters input[type="text"],
    #player-filters input[type="number"],
    #player-filters select,
    #player-filters button {
        width: 100%;
    }

    .apikey-display-row .clear-button {
        width: auto;
        margin-left: auto;
    }

    #player-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    #player-filters label {
        margin-right: 0;
    }

    table {
        font-size: 14px;
    }

    th, td {
        padding: 6px 8px;
        white-space: nowrap;
    }
}

