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

html, body {
    height: 100%;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: #e0e0e0;
    background: #0f0f1a;
}

body {
    display: flex;
}

/* Sidebar */

.sidebar {
    width: 200px;
    min-height: 100vh;
    background: #1a1a2e;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid #2d2d4e;
}

.sidebar-header {
    padding: 20px 16px 16px;
    font-size: 16px;
    font-weight: 600;
    color: #a0a8d0;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #2d2d4e;
}

.nav-links {
    list-style: none;
    padding: 8px 0;
}

.nav-links li a {
    display: block;
    padding: 10px 16px;
    color: #8890b0;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.nav-links li a:hover {
    background: #252540;
    color: #c0c8e8;
}

.nav-links li a.active {
    background: #252550;
    color: #a8b4ff;
    border-left: 3px solid #6677dd;
    padding-left: 13px;
}

/* Content area */

.content {
    flex: 1;
    min-height: 100vh;
    background: #12121e;
    padding: 28px 32px;
    overflow-y: auto;
}

/* Placeholder */

.placeholder {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding-top: 8px;
}

.placeholder h1 {
    font-size: 22px;
    font-weight: 600;
    color: #c0c8e8;
}

.placeholder-text {
    color: #6070a0;
    font-size: 15px;
}

/* Floating error panel */

.error-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 360px;
    background: #2a1a1a;
    border: 1px solid #7a3030;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.error-panel.hidden {
    display: none;
}

.error-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #3a1f1f;
    border-bottom: 1px solid #7a3030;
    border-radius: 6px 6px 0 0;
    font-weight: 600;
    color: #e06060;
}

.error-panel-close {
    background: none;
    border: none;
    color: #e06060;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
}

.error-panel-close:hover {
    color: #ff8080;
}

.error-panel-body {
    padding: 12px 14px;
    color: #d0a0a0;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Page header */

.page-header {
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 600;
    color: #c0c8e8;
}

/* Filters bar */

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    padding: 14px 16px;
    background: #1a1a2e;
    border: 1px solid #2d2d4e;
    border-radius: 6px;
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-label {
    font-size: 12px;
    font-weight: 600;
    color: #8890b0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.filter-input {
    background: #12121e;
    border: 1px solid #3a3a60;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 13px;
    padding: 5px 10px;
    width: 180px;
    outline: none;
    transition: border-color 0.15s;
}

.filter-input:focus {
    border-color: #6677dd;
}

.radio-group {
    display: flex;
    gap: 12px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #c0c8e8;
    cursor: pointer;
    font-size: 13px;
}

.radio-label input[type="radio"] {
    accent-color: #6677dd;
    cursor: pointer;
}

/* Data table */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead th {
    padding: 9px 12px;
    background: #1a1a2e;
    border-bottom: 2px solid #2d2d4e;
    color: #8890b0;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    white-space: nowrap;
}

.data-table thead th.sortable {
    cursor: pointer;
    user-select: none;
}

.data-table thead th.sortable:hover {
    color: #c0c8e8;
    background: #252540;
}

.data-table thead th.sorted-asc,
.data-table thead th.sorted-desc {
    color: #a8b4ff;
}

.data-table tbody tr {
    border-bottom: 1px solid #1e1e32;
    transition: background 0.1s;
}

.data-table tbody tr:hover {
    background: #181828;
}

.data-table td {
    padding: 9px 12px;
    color: #c8d0e8;
    vertical-align: middle;
}

.col-id {
    color: #6677dd;
    font-weight: 600;
    width: 70px;
}

.col-map {
    font-family: monospace;
    font-size: 12px;
    color: #a0c8a0;
}

.col-datetime {
    color: #8090b0;
    font-size: 12px;
    white-space: nowrap;
}

.col-player {
    white-space: nowrap;
}

.col-empty {
    color: #3a3a60;
}

.player-name {
    color: #c0c8e8;
    margin-right: 4px;
}

.player-id {
    color: #5060a0;
    font-size: 12px;
}

/* No results */

.no-results {
    padding: 40px 0;
    text-align: center;
    color: #4a5080;
    font-size: 15px;
}

/* Pagination */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 4px;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination-info {
    color: #5060a0;
    font-size: 12px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-btn {
    background: #1a1a2e;
    border: 1px solid #2d2d4e;
    border-radius: 4px;
    color: #8890b0;
    cursor: pointer;
    font-size: 13px;
    min-width: 32px;
    padding: 4px 8px;
    transition: background 0.1s, color 0.1s, border-color 0.1s;
}

.page-btn:hover:not(:disabled) {
    background: #252540;
    border-color: #4a4a70;
    color: #c0c8e8;
}

.page-btn.active {
    background: #252550;
    border-color: #6677dd;
    color: #a8b4ff;
    font-weight: 600;
}

.page-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.page-ellipsis {
    color: #4a5080;
    padding: 0 4px;
    font-size: 13px;
}

/* Game type badge */

.game-type-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.game-type-network {
    background: #1a2a4a;
    color: #6090d0;
    border: 1px solid #2a3a6a;
}

.game-type-local {
    background: #1a3a1a;
    color: #60a060;
    border: 1px solid #2a4a2a;
}

.game-type-tutorial {
    background: #2a2a1a;
    color: #a09060;
    border: 1px solid #3a3a2a;
}

.game-status-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.game-status-challenge {
    background: #2a2a1a;
    color: #a09060;
    border: 1px solid #3a3a2a;
}

.game-status-in_progress {
    background: #1a2a4a;
    color: #6090d0;
    border: 1px solid #2a3a6a;
}

.game-status-completed {
    background: #1a3a1a;
    color: #60a060;
    border: 1px solid #2a4a2a;
}

/* Games table */

.col-turns {
    text-align: right;
    width: 60px;
    color: #8090b0;
    font-size: 12px;
}

.col-opponents {
    min-width: 140px;
}

.opponent-entry {
    white-space: nowrap;
    line-height: 1.7;
}

.opponent-active .player-name {
    color: #ffd266;
    font-weight: 600;
}

.player-type {
    color: #6878b0;
    font-size: 12px;
    margin-right: 4px;
}

.alliance-id {
    color: #5060a0;
    font-size: 12px;
    margin-right: 4px;
}

.col-uuid {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 12px;
    color: #8090c0;
    white-space: nowrap;
}

/* Players table */

.col-counts {
    white-space: nowrap;
    text-align: right;
    width: 80px;
}

.count-total {
    color: #c0c8e8;
}

.count-separator {
    color: #3a3a60;
    margin: 0 2px;
}

.count-active {
    color: #6090d0;
}

.online-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: middle;
}

.online-dot.online {
    background: #40c040;
    box-shadow: 0 0 4px #40c040;
}

.online-dot.offline {
    background: #604040;
}

/* Account type badge */

.account-type-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.account-type-human {
    background: #1a2a1a;
    color: #60a060;
    border: 1px solid #2a4a2a;
}

.account-type-ai {
    background: #1a1a3a;
    color: #6060c0;
    border: 1px solid #2a2a5a;
}

.account-type-support {
    background: #2a2a1a;
    color: #a09040;
    border: 1px solid #3a3a2a;
}

.account-type-dev {
    background: #2a1a2a;
    color: #a060a0;
    border: 1px solid #4a2a4a;
}

.account-type-admin {
    background: #3a1a1a;
    color: #d06060;
    border: 1px solid #5a2a2a;
}

.account-type-unknown {
    background: #1e1e2e;
    color: #505080;
    border: 1px solid #2a2a4a;
}

/* Online identities list */

.identities-list {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.identity-entry {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    white-space: nowrap;
}

.identity-platform {
    display: inline-block;
    padding: 1px 5px;
    border-radius: 2px;
    background: #1a2a3a;
    border: 1px solid #2a3a5a;
    color: #6090c0;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.identity-id {
    color: #8090b0;
    font-family: monospace;
}

.identity-empty {
    color: #3a3a60;
    font-style: italic;
}

/* Action icons */

.col-type {
    white-space: nowrap;
    position: relative;
}

.action-icon {
    background: none;
    border: none;
    color: #4a5080;
    cursor: pointer;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 3px;
    vertical-align: middle;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
    text-decoration: none;
    display: inline-block;
}

.action-icon:hover {
    color: #a8b4ff;
    background: #252540;
}

.action-icon-active {
    color: #a8b4ff;
    background: #252550;
}

.action-icon-danger {
    color: #604040;
}

.action-icon-danger:hover {
    color: #e06060;
    background: #3a1f1f;
}

/* Delete confirmation row */

.row-confirm-delete td {
    background: #1e1214;
    border-top: 1px solid #7a3030;
    border-bottom: 1px solid #7a3030;
}

.confirm-delete {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 2px 0;
}

.confirm-delete-text {
    color: #d0a0a0;
    font-size: 13px;
}

.confirm-delete-text strong {
    color: #e0c0c0;
}

.btn-confirm-delete {
    background: #5a1a1a;
    border: 1px solid #8a3030;
    border-radius: 4px;
    color: #e06060;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    transition: background 0.1s, border-color 0.1s;
}

.btn-confirm-delete:hover {
    background: #7a2020;
    border-color: #c04040;
    color: #ff8080;
}

.btn-cancel-delete {
    background: #1a1a2e;
    border: 1px solid #3a3a60;
    border-radius: 4px;
    color: #8890b0;
    cursor: pointer;
    font-size: 12px;
    padding: 4px 12px;
    transition: background 0.1s, color 0.1s;
}

.btn-cancel-delete:hover {
    background: #252540;
    color: #c0c8e8;
}

/* Account type dropdown */

.type-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    background: #1a1a2e;
    border: 1px solid #3a3a60;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    min-width: 110px;
    padding: 4px 0;
    margin-top: 2px;
}

.type-option {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: #c0c8e8;
    cursor: pointer;
    font-size: 12px;
    padding: 6px 12px;
    text-align: left;
    transition: background 0.1s, color 0.1s;
}

.type-option:hover {
    background: #252550;
    color: #ffffff;
}

.type-option-current {
    color: #a8b4ff;
    font-weight: 600;
}

/* Login page */

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #0f0f1a;
}

.login-container {
    width: 100%;
    max-width: 380px;
    padding: 0 16px;
}

.login-card {
    background: #1a1a2e;
    border: 1px solid #2d2d4e;
    border-radius: 8px;
    padding: 32px 28px;
}

.login-header {
    font-size: 20px;
    font-weight: 600;
    color: #a0a8d0;
    letter-spacing: 0.05em;
    text-align: center;
    margin-bottom: 24px;
}

.login-error {
    background: #2a1a1a;
    border: 1px solid #7a3030;
    border-radius: 4px;
    color: #e06060;
    font-size: 13px;
    padding: 8px 12px;
    margin-bottom: 16px;
}

.login-field {
    margin-bottom: 16px;
}

.login-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #8890b0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.login-input {
    width: 100%;
    background: #12121e;
    border: 1px solid #3a3a60;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 14px;
    padding: 8px 12px;
    outline: none;
    transition: border-color 0.15s;
}

.login-input:focus {
    border-color: #6677dd;
}

.login-btn {
    width: 100%;
    background: #2a2a50;
    border: 1px solid #4a4a70;
    border-radius: 4px;
    color: #a8b4ff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 0;
    margin-top: 8px;
    transition: background 0.15s, border-color 0.15s;
}

.login-btn:hover {
    background: #3a3a60;
    border-color: #6677dd;
}

/* Sidebar footer */

.sidebar-footer {
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid #2d2d4e;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-user {
    color: #8890b0;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout {
    background: none;
    border: 1px solid #3a3a60;
    border-radius: 4px;
    color: #8890b0;
    cursor: pointer;
    font-size: 12px;
    padding: 5px 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar-logout:hover {
    background: #2a1a1a;
    border-color: #7a3030;
    color: #e06060;
}
