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

body {
    background: #0a0e1a;
    color: #c8ccd4;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(30, 50, 100, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(80, 40, 120, 0.1) 0%, transparent 50%);
    min-height: 100vh;
}

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

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid #1e2a45;
    margin-bottom: 30px;
}

h1 {
    color: #b8a472;
    font-size: 1.8em;
    text-shadow: 0 0 20px rgba(184, 164, 114, 0.2);
}

h2 {
    color: #d4c8a0;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, #1a3a6a, #1e4d8a);
    color: #c8d6e8;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    border: 1px solid #2a5090;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn:hover {
    background: linear-gradient(135deg, #1e4d8a, #2560a8);
    border-color: #3a6ab0;
    color: #fff;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

.header-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.battle-tag {
    color: #b8a472;
    font-weight: 600;
}

.oauth-hint {
    display: block;
    color: #5a6a8a;
    font-size: 11px;
    margin-top: 4px;
    text-align: right;
}

.hidden {
    display: none !important;
}

/* Selection panel */
#selection-panel {
    background: linear-gradient(180deg, #101828, #0d1420);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid #1a2540;
}

.hint {
    color: #7a8090;
    margin-bottom: 15px;
    font-size: 14px;
}

.selection-grid {
    display: grid;
    grid-template-columns: 150px 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.selection-slot label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #8a8e9a;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
}

.selection-slot select {
    width: 100%;
    padding: 8px 10px;
    background: #0c1225;
    color: #c8ccd4;
    border: 1px solid #1e2a45;
    border-radius: 4px;
    font-size: 14px;
}

.selection-slot select:focus {
    border-color: #3a5a90;
    outline: none;
}

#save-btn {
    padding: 10px 30px;
    background: linear-gradient(135deg, #6a4f1a, #8a6a2a);
    color: #f0e0b0;
    border: 1px solid #9a7a30;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

#save-btn:hover {
    background: linear-gradient(135deg, #8a6a2a, #a07a30);
    color: #fff;
}

#save-status {
    display: inline-block;
    margin-left: 15px;
    color: #b8a472;
    font-weight: 600;
}

/* Roster table */
#roster-section {
    background: linear-gradient(180deg, #101828, #0d1420);
    border-radius: 8px;
    padding: 25px;
    border: 1px solid #1a2540;
}

#roster-loading, #roster-empty {
    text-align: center;
    color: #5a6070;
    padding: 30px;
}

.roster-table-header {
    display: grid;
    grid-template-columns: 80px 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 8px;
}

.roster-col-label {
    text-align: center;
    padding: 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid;
}

.roster-col-label.col-main {
    background: rgba(184, 164, 114, 0.08);
    color: #ffd700;
    border-color: #ffd700;
}

.roster-col-label.col-alt1 {
    background: rgba(100, 160, 220, 0.08);
    color: #64a0dc;
    border-color: #64a0dc;
}

.roster-col-label.col-alt2 {
    background: rgba(140, 120, 200, 0.08);
    color: #8c78c8;
    border-color: #8c78c8;
}

.roster-row {
    display: grid;
    grid-template-columns: 80px 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 6px;
    align-items: center;
}

.roster-nick-cell {
    font-size: 12px;
    font-weight: 600;
    color: #8a8e9a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
    padding: 0 4px;
}

.roster-col-label.col-nick {
    background: transparent;
    border: none;
}

.roster-cell {
    min-width: 0;
}

.roster-card {
    background: #0c1225;
    border-radius: 6px;
    padding: 10px 12px;
    border: 1px solid #18243e;
    transition: border-color 0.2s, background 0.2s;
    height: 100%;
}

.roster-card:hover {
    border-color: #3a5080;
    background: #101a30;
}

.roster-card-empty {
    background: transparent;
    border: 1px dashed #14203a;
    min-height: 48px;
}

.roster-card-empty:hover {
    background: transparent;
    border-color: #14203a;
}

.card-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.card-row.card-sub {
    margin-top: 2px;
    font-size: 12px;
    color: #5a6078;
}

.card-name {
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    position: relative;
    z-index: 1;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-name:hover {
    text-decoration: underline;
}

.card-ilvl {
    font-weight: 700;
    font-size: 14px;
    color: #b8a472;
    font-variant-numeric: tabular-nums;
    min-width: 30px;
    text-align: right;
    flex-shrink: 0;
}

.card-spec {
    color: #6a7088;
}

.card-charname {
    font-weight: 400;
    font-size: 11px;
    opacity: 0.6;
}

#input-nickname {
    width: 100%;
    padding: 8px 10px;
    background: #0c1225;
    color: #c8ccd4;
    border: 1px solid #1e2a45;
    border-radius: 4px;
    font-size: 14px;
}

#input-nickname:focus {
    border-color: #3a5a90;
    outline: none;
}

@media (max-width: 600px) {
    header {
        flex-direction: column;
        gap: 10px;
    }
    .selection-grid {
        grid-template-columns: 1fr;
    }
    .roster-table-header,
    .roster-row {
        grid-template-columns: 1fr;
    }
    .roster-nick-cell,
    .roster-col-label.col-nick {
        display: none;
    }
}
