:root {
    --bg: #09090b;
    --panel: rgba(24, 24, 27, 0.5);
    --border: #27272a;
    --border-soft: rgba(39, 39, 42, 0.5);
    --row-hover: rgba(39, 39, 42, 0.3);
    --text-strong: #f4f4f5;
    --text: #d4d4d8;
    --text-muted: #a1a1aa;
    --text-faint: #71717a;
    --text-fainter: #52525b;
    --accent: #7c3aed;
    --accent-hover: #8b5cf6;
    --accent-fg: #a78bfa;
    --amber: #fbbf24;
    --emerald: #34d399;
    --blue: #60a5fa;
    --red: #f87171;
    --radius-card: 12px;
    --radius-box: 8px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: "DM Sans", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.mono {
    font-family: "JetBrains Mono", ui-monospace, monospace;
}

.page {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.page-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.brand-logo {
    height: 40px;
    width: auto;
    flex-shrink: 0;
}

.page-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-strong);
}

.title-sep {
    margin: 0 0.5rem;
    font-weight: 400;
    color: var(--text-fainter);
}

.title-game {
    color: var(--accent-fg);
}

.page-subtitle {
    margin: 4px 0 0;
    font-size: 0.875rem;
    color: var(--text-faint);
}

.state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 16rem;
    text-align: center;
}

.state-text {
    font-size: 0.875rem;
    color: var(--text-faint);
}

.state-subtext {
    font-size: 0.8125rem;
    color: var(--text-fainter);
}

.empty-icon {
    font-size: 2rem;
    color: var(--text-faint);
    line-height: 1;
}

.spinner {
    width: 2rem;
    height: 2rem;
    border: 2px solid rgba(167, 139, 250, 0.25);
    border-top-color: var(--accent-fg);
    border-radius: 9999px;
    animation: spin 0.7s linear infinite;
}

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

.error-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: var(--radius-box);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.error-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 9999px;
    background: rgba(239, 68, 68, 0.2);
    color: var(--red);
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.error-title {
    margin: 0;
    color: var(--red);
    font-size: 0.875rem;
    font-weight: 600;
}

.error-detail {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.table-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-box);
    overflow: hidden;
    background: var(--panel);
}

.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead tr {
    border-bottom: 1px solid var(--border);
}

th {
    height: 2.5rem;
    padding: 0 0.5rem;
    text-align: left;
    vertical-align: middle;
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

td {
    padding: 0.5rem;
    vertical-align: middle;
    font-size: 0.75rem;
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border-soft);
    transition: background 0.15s;
}

tbody tr:last-child {
    border-bottom: 0;
}

tbody tr:hover {
    background: var(--row-hover);
}

.num {
    text-align: right;
    font-family: "JetBrains Mono", ui-monospace, monospace;
}

.cell-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.cell-id {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.75rem;
    color: var(--text-faint);
    cursor: pointer;
}

.cell-id:hover {
    color: var(--text-strong);
}

.cell-id.copied {
    color: var(--emerald);
}

.cell-id.user {
    color: var(--text);
}

.amount-bet {
    color: var(--amber);
}

.amount-win {
    color: var(--emerald);
}

.amount-zero {
    color: var(--text-faint);
}

.amount-balance {
    color: var(--text-muted);
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 500;
}

.pill--on {
    color: var(--emerald);
    background: rgba(16, 185, 129, 0.1);
}

.pill--off {
    color: var(--text-muted);
    background: rgba(63, 63, 70, 0.4);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: "JetBrains Mono", ui-monospace, monospace;
}

.btn-replay {
    padding: 0.1875rem 0.625rem;
    border-radius: 6px;
    border: 1px solid rgba(59, 130, 246, 0.5);
    background: rgba(59, 130, 246, 0.15);
    color: var(--blue);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-replay:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: #3b82f6;
}

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.row-count {
    font-size: 0.75rem;
    color: var(--text-faint);
}

.btn-primary {
    padding: 0.375rem 0.875rem;
    border-radius: 6px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: default;
}
