:root {
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #1e293b;
    --border: #2a374a;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --portable: #f59e0b;
    --installer: #0ea5e9;
    --android: #10b981;
    --danger: #ef4444;
    --radius: 14px;
}

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

body {
    font-family: 'Cairo', system-ui, -apple-system, sans-serif;
    background: radial-gradient(circle at top right, #172554 0%, var(--bg) 45%);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
}

.brand h1 {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.2;
}

.brand p {
    font-size: 0.88rem;
    color: var(--muted);
}

.brand p a {
    color: #60a5fa;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Main */
.main-content {
    flex: 1;
    padding-top: 28px;
    padding-bottom: 48px;
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.stats-pill {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-pill strong {
    color: #60a5fa;
    font-size: 1.1rem;
}

.search-form {
    display: flex;
    gap: 8px;
    flex: 1;
    max-width: 440px;
}

.search-form input {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 16px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
}

.search-form input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Cards */
.card {
    background: rgba(17, 24, 39, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
}

.server-limit {
    font-size: 0.85rem;
    color: var(--muted);
    background: var(--surface-2);
    padding: 4px 12px;
    border-radius: 8px;
}

/* Table */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.games-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
}

.games-table th {
    background: var(--surface-2);
    color: #cbd5e1;
    font-weight: 700;
    font-size: 0.92rem;
    padding: 15px 16px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.games-table td {
    padding: 16px;
    border-bottom: 1px solid rgba(42, 55, 74, 0.65);
    vertical-align: middle;
}

.games-table tbody tr {
    transition: background 0.2s ease;
}

.games-table tbody tr:hover {
    background: rgba(30, 41, 59, 0.55);
}

.row-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--muted);
    font-weight: 700;
    font-size: 0.85rem;
}

.game-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 1.05rem;
}

.version-badge {
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
}

.game-notes {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

.dedication-badge {
    display: inline-block;
    background: rgba(139, 92, 246, 0.14);
    border: 1px solid rgba(139, 92, 246, 0.35);
    color: #ddd6fe;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
}

/* Download Buttons */
.dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    transition: transform 0.15s ease, filter 0.15s ease;
    white-space: nowrap;
}

.dl-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.dl-portable {
    background: rgba(245, 158, 11, 0.16);
    border: 1px solid rgba(245, 158, 11, 0.45);
    color: #fcd34d;
}

.dl-installer {
    background: rgba(14, 165, 233, 0.16);
    border: 1px solid rgba(14, 165, 233, 0.45);
    color: #7dd3fc;
}

.dl-android {
    background: rgba(16, 185, 129, 0.16);
    border: 1px solid rgba(16, 185, 129, 0.45);
    color: #6ee7b7;
}

.file-size {
    display: block;
    font-size: 0.72rem;
    opacity: 0.85;
    font-weight: 600;
}

.not-available {
    color: #64748b;
    font-size: 0.85rem;
}

/* Buttons */
.btn-primary, .btn-outline, .btn-ghost, .btn-danger-outline, .btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: #93c5fd;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

.btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.15);
}

.btn-ghost {
    background: var(--surface-2);
    color: var(--muted);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.82rem;
    border-radius: 8px;
}

.btn-edit {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.btn-delete {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* Admin Forms */
.login-wrapper {
    max-width: 420px;
    margin: 50px auto;
}

.login-card {
    padding: 28px;
}

.login-card h2 {
    margin-bottom: 6px;
}

.muted {
    color: var(--muted);
    font-size: 0.9rem;
}

.admin-form {
    padding: 22px;
}

.form-stack, .admin-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

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

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #cbd5e1;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group input[type="file"] {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.92rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.hint {
    font-size: 0.78rem;
    color: var(--muted);
}

.upload-boxes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 6px;
}

.upload-box {
    background: rgba(30, 41, 59, 0.55);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.upload-box h3 {
    font-size: 0.95rem;
    color: #e2e8f0;
}

.current-file-info {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.82rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.remove-check {
    color: #fca5a5;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.divider-or {
    text-align: center;
    font-size: 0.8rem;
    color: var(--muted);
    position: relative;
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 6px;
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-weight: 600;
    font-size: 0.95rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: #fecaca;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.45);
    color: #a7f3d0;
}

/* Admin Mini Badges */
.mini-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.mini-badge {
    font-size: 0.78rem;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
}

.mini-badge.ok {
    background: rgba(16, 185, 129, 0.18);
    color: #6ee7b7;
}

.mini-badge.off {
    background: rgba(100, 116, 139, 0.2);
    color: #64748b;
    text-decoration: line-through;
}

.row-actions {
    display: flex;
    gap: 8px;
}

/* Empty State & Footer */
.empty-state {
    text-align: center;
    padding: 54px 20px;
    color: var(--muted);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.site-footer {
    border-top: 1px solid var(--border);
    padding: 18px 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.88rem;
}

.site-footer a {
    color: #60a5fa;
}

/* Responsive */
@media (max-width: 960px) {
    .form-grid-3,
    .upload-boxes-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .games-table thead {
        display: none;
    }
    .games-table, .games-table tbody, .games-table tr, .games-table td {
        display: block;
        width: 100%;
    }
    .games-table tr {
        border-bottom: 2px solid var(--border);
        padding: 12px 0;
    }
    .games-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        border-bottom: 1px dashed rgba(42, 55, 74, 0.5);
        padding: 10px 16px;
        text-align: left;
    }
    .games-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--muted);
        font-size: 0.85rem;
        text-align: right;
    }
}
