:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --accent: #f76100;
    --accent-dark: #dd5300;
    --border: #e5e7eb;
    --ok: #15803d;
    --danger: #b91c1c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.bg-shape { display: none; }
.container { width: 100%; margin: 0; padding: 0; }

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    background: #fafafa;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    height: 72px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 22px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
}

.logo-box {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.05rem;
}

.sidebar-nav { padding: 14px 10px; display: grid; gap: 6px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #374151;
    font-weight: 600;
    font-size: 0.95rem;
}

.nav-link.active {
    background: #fff3ea;
    color: var(--accent);
    border: 1px solid #ffd7bf;
}

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #d1d5db;
}

.nav-link.active .nav-dot { background: var(--accent); }

.sidebar-foot {
    margin-top: auto;
    padding: 14px 20px;
    color: #9ca3af;
    font-size: 0.84rem;
    border-top: 1px solid var(--border);
}

.main { min-width: 0; }

.topbar {
    height: 72px;
    border-bottom: 1px solid var(--border);
    background: #fafafa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.topbar h1 {
    margin: 0;
    font-size: 1.5rem;
}

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

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0.88rem;
    font-weight: 700;
}

.page-content {
    padding: 20px;
    display: grid;
    gap: 16px;
}

.hero {
    background: linear-gradient(135deg, #f76100 0%, #f05a00 100%);
    color: #fff;
    border-radius: 14px;
    padding: 24px;
}

.hero h2 { margin: 0; font-size: 2rem; }
.hero p { margin: 8px 0 14px; color: #ffe4d1; }

.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.btn {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-muted { background: #f3f4f6; color: #374151; }
.hero .btn-primary { background: #fff; color: #e55300; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.stats-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card, .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}

.stat-title { color: #6b7280; margin: 0 0 6px; font-size: 0.92rem; }
.stat-value { margin: 0; font-size: 2rem; line-height: 1.1; }
.stat-sub { margin: 4px 0 0; color: var(--accent); font-size: 0.88rem; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.card-header h2, .card-header h3 { margin: 0; }
.subtle { color: var(--muted); margin: 0; }

form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 0.92rem; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 11px;
    background: #fff;
    font-size: 0.95rem;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(247, 97, 0, 0.2);
    border-color: var(--accent);
}

.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

.alert {
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.92rem;
}
.alert-danger { background: #fef2f2; border: 1px solid #fecaca; color: var(--danger); }
.alert-success { background: #ecfdf3; border: 1px solid #bbf7d0; color: var(--ok); }
.alert-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    border-bottom: 1px solid var(--border);
    padding: 9px 8px;
    text-align: left;
    font-size: 0.92rem;
    vertical-align: middle;
}
th { color: #4b5563; font-weight: 700; }

.inline-form { display: inline-flex; gap: 8px; margin: 0; }

td .btn {
    padding: 7px 10px;
    font-size: 0.84rem;
}

.question-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    padding: 12px;
}

.progress-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.35);
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
    background: #fff;
    transition: width 0.2s ease;
}

.score-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.score-slider {
    width: 100%;
}

.score-badge {
    min-width: 34px;
    text-align: center;
    border-radius: 999px;
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
    font-weight: 700;
    padding: 3px 8px;
}

.chip-row {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip-btn {
    border: 1px solid #d1d5db;
    background: #f9fafb;
    border-radius: 999px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 0.84rem;
}

.chip-btn:hover {
    border-color: #fb923c;
    background: #fff7ed;
}

.game-hud {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hud-pill {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.86rem;
    color: #fff;
}

.hud-pill strong {
    font-size: 0.92rem;
    margin-left: 4px;
}

.badge-zone {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.badge-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid #fdba74;
    background: #fff7ed;
    color: #9a3412;
    padding: 4px 10px;
    font-size: 0.82rem;
    font-weight: 700;
}

.live-results {
    margin: -4px 0 4px;
}

.live-results-list {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    display: grid;
    gap: 0;
    overflow: hidden;
}

.live-result-item {
    border: 0;
    border-bottom: 1px solid var(--border);
    background: #fff;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    color: #1f2937;
    font-size: 0.9rem;
}

.live-result-item:last-child {
    border-bottom: 0;
}

.live-result-item:hover {
    background: #fff7ed;
}

.login-wrap {
    width: min(520px, 92vw);
    margin: 80px auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
}

.brand { margin: 0; }
.brand .accent { color: var(--accent); }

@media (max-width: 1080px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
    .stats-grid, .row, .row-3 { grid-template-columns: 1fr; }
    .topbar { height: auto; padding: 12px; gap: 8px; flex-wrap: wrap; }
    .page-content { padding: 12px; }
}
