:root {
    /* Yaru color scheme */
    --yaru-orange: #E95420;
    --yaru-warm-grey: #AEA79F;
    --yaru-cool-grey: #333333;
    --yaru-dark-grey: #2C2C2C;
    --yaru-bg-dark: #1E1E1E;
    --yaru-text-light: #F7F7F7;
    --yaru-text-muted: #BCBCBC;
    --yaru-border: #3D3D3D;
    --yaru-card-bg: #2D2D2D;
    --yaru-lobby-bg: #35262A;
    --yaru-ongoing-bg: #262D35;
}

body {
    font-family: 'Ubuntu', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--yaru-bg-dark);
    color: var(--yaru-text-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.main-container {
    width: 95%;
    max-width: 1200px;
    margin: 20px auto;
    background-color: var(--yaru-card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid var(--yaru-border);
}

h1, h2, h3 {
    color: var(--yaru-orange);
    text-align: center;
}

.subtitle {
    color: var(--yaru-text-muted);
    text-align: center;
    margin-bottom: 30px;
}

/* Navigation */
.nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.nav a {
    text-decoration: none;
    color: var(--yaru-text-light);
    padding: 8px 16px;
    border-radius: 6px;
    background-color: var(--yaru-dark-grey);
    transition: all 0.2s ease;
    border: 1px solid var(--yaru-border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.nav a:hover {
    background-color: var(--yaru-orange);
    border-color: var(--yaru-orange);
}

.nav a.active {
    background-color: var(--yaru-orange);
    border-color: var(--yaru-orange);
    font-weight: bold;
}

/* Grid Layout for Home */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.game-card {
    background: var(--yaru-dark-grey);
    border: 1px solid var(--yaru-border);
    border-radius: 10px;
    padding: 20px;
    text-decoration: none;
    color: var(--yaru-text-light);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(233, 84, 32, 0.3);
    border-color: var(--yaru-orange);
}

.game-card .game-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

/* Table Styling */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--yaru-border);
    table-layout: auto;
}

th {
    background-color: var(--yaru-dark-grey);
    color: var(--yaru-orange);
    padding: 12px 15px;
    text-align: center;
    font-weight: bold;
    border-bottom: 2px solid var(--yaru-border);
    vertical-align: middle;
    white-space: nowrap;
}

th:nth-child(2), td:nth-child(2) {
    text-align: center;
    width: 100%; /* Stretch middle column */
}

td {
    padding: 10px 15px;
    border-bottom: 1px solid var(--yaru-border);
    vertical-align: middle;
}

.cell-content {
    display: flex;
    align-items: center;
    justify-content: center; /* Center content in cells */
    min-height: 32px;
    font-variant-numeric: tabular-nums;
}

.map-col { min-width: 150px; justify-content: center; }
.rating-col { width: 80px; }
.type-col { width: 140px; } /* Wider for ranked names */
.duration-col { width: 100px; }
.server-col { width: 120px; }

/* Player elements */
.player-list-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    flex-wrap: wrap;
    padding: 5px 15px; /* Spacing from icons */
}

.team-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1; /* Key for VS alignment: teams take equal space */
    min-width: 140px;
}

.team-column:first-child {
    text-align: right;
}

.team-column:first-child .player-item {
    justify-content: flex-end;
}

.team-column:last-child {
    text-align: left;
}

.team-column:last-child .player-item {
    justify-content: flex-start;
}

.lobby-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-align: center;
}

.lobby-column .player-item {
    justify-content: center;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
}

.player-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    overflow: hidden;
}

.player-name {
    font-weight: normal;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.player-rating {
    font-size: 12px; /* Slightly bigger */
    font-weight: 300;
    color: var(--yaru-text-muted);
}

.civ-icon {
    width: 32px; /* Bigger */
    height: 32px; /* Bigger */
    object-fit: contain;
}

.vs-separator {
    font-size: 10px;
    color: var(--yaru-orange);
    font-weight: bold;
    font-style: italic;
    text-transform: uppercase;
    padding: 0 4px;
    align-self: center; /* Ensure vertical center */
    display: flex;
    align-items: center;
}

/* Zebra Stripping */
tbody tr:nth-child(odd) {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Icons & Buttons */
.player-avatar {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    margin-right: 8px;
    vertical-align: middle;
}

.copy-icon {
    cursor: pointer;
    width: 22px;
    height: 22px;
    fill: var(--yaru-text-muted);
    transition: fill 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-icon:hover {
    fill: var(--yaru-orange);
}

.copy-icon:active {
    transform: scale(0.9);
}

.btn {
    padding: 6px 12px;
    text-decoration: none;
    border-radius: 4px;
    color: white;
    display: inline-block;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    transition: opacity 0.2s;
}

.btn:hover {
    opacity: 0.8;
}

.btn-join { background-color: #2E7D32; }
.btn-observe { background-color: #1976D2; }
