@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

:root {
    --green-dark: #0b3d24;
    --green: #16803c;
    --green-light: #1fae52;
    --gold: #f4b731;
    --gold-dark: #d99b0f;
    --bg: #0e1712;
    --card: #142b1e;
    --text: #eef7ee;
    --muted: #9db8a8;
    --danger: #e14848;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Cairo', sans-serif;
    background: radial-gradient(circle at top, #123321 0%, var(--bg) 60%);
    color: var(--text);
    min-height: 100vh;
    direction: rtl;
}

.wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px 60px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0 28px;
}

.logo {
    font-weight: 800;
    font-size: 28px;
    color: var(--gold);
    letter-spacing: 1px;
}
.logo span { color: var(--text); }

.user-chip {
    background: var(--card);
    border: 1px solid rgba(244,183,49,.25);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 14px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.card {
    background: var(--card);
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 10px 30px rgba(0,0,0,.35);
    border: 1px solid rgba(255,255,255,.05);
    margin-bottom: 20px;
}

h1, h2, h3 { margin-top: 0; }

.subtitle { color: var(--muted); margin-bottom: 24px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--gold);
    color: #1a1400;
    border: none;
    padding: 14px 22px;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
    text-decoration: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(244,183,49,.25); }
.btn.secondary { background: transparent; border: 2px solid var(--green-light); color: var(--text); }
.btn.danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform:none; box-shadow:none; }
.btn.block { width: 100%; }

.mode-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width:520px){ .mode-grid{grid-template-columns:1fr;} }

.mode-card {
    background: linear-gradient(160deg, var(--green) 0%, var(--green-dark) 100%);
    border-radius: 18px;
    padding: 26px 20px;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .15s ease, transform .15s ease;
}
.mode-card:hover { border-color: var(--gold); transform: translateY(-3px); }
.mode-card .icon { font-size: 44px; margin-bottom: 10px; }
.mode-card h3 { color: var(--gold); margin-bottom: 6px; }
.mode-card p { color: var(--muted); font-size: 14px; margin: 0; }

.diff-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.diff-btn {
    padding: 18px;
    border-radius: 14px;
    background: var(--card);
    border: 2px solid rgba(255,255,255,.08);
    color: var(--text);
    font-family: inherit;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
}
.diff-btn[data-diff="easy"]{ border-color:#2ecc71 }
.diff-btn[data-diff="medium"]{ border-color:#f4b731 }
.diff-btn[data-diff="pro"]{ border-color:#ff8a3d }
.diff-btn[data-diff="legend"]{ border-color:#e14848 }
.diff-btn:hover { background: rgba(255,255,255,.06); }

.timer-ring {
    width: 74px; height: 74px;
    border-radius: 50%;
    display:flex; align-items:center; justify-content:center;
    font-size: 24px; font-weight:800;
    border: 5px solid var(--gold);
    margin: 0 auto 18px;
    transition: border-color .3s ease, color .3s ease;
}
.timer-ring.warn { border-color: var(--danger); color: var(--danger); }

.score-row {
    display:flex; justify-content:space-between; align-items:center;
    margin-bottom: 18px; font-weight:700; font-size:18px;
}
.score-row .me { color: var(--gold); }
.progress-track { height:6px; background: rgba(255,255,255,.08); border-radius:6px; margin-bottom: 20px; overflow:hidden;}
.progress-fill { height:100%; background: var(--gold); transition: width .3s ease; }

.question-text { font-size: 19px; font-weight:700; margin-bottom: 22px; line-height:1.7; text-align:center; }

.options { display:flex; flex-direction:column; gap:12px; }
.option-btn {
    padding: 16px;
    border-radius: 12px;
    background: rgba(255,255,255,.04);
    border: 2px solid rgba(255,255,255,.1);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    text-align: right;
    cursor: pointer;
    transition: all .15s ease;
}
.option-btn:hover:not(:disabled) { border-color: var(--gold); }
.option-btn.selected { border-color: var(--gold); background: rgba(244,183,49,.12); }
.option-btn.correct { border-color: #2ecc71; background: rgba(46,204,113,.18); }
.option-btn.wrong { border-color: var(--danger); background: rgba(225,72,72,.18); }
.option-btn:disabled { cursor: default; }

.status-msg { text-align:center; padding: 14px; border-radius: 12px; font-weight:700; margin-bottom: 16px; }
.status-msg.win { background: rgba(46,204,113,.15); color:#2ecc71; }
.status-msg.lose { background: rgba(225,72,72,.15); color: var(--danger); }
.status-msg.neutral { background: rgba(255,255,255,.06); color: var(--muted); }

.spinner {
    width: 46px; height:46px; border-radius:50%;
    border: 5px solid rgba(244,183,49,.2); border-top-color: var(--gold);
    animation: spin 1s linear infinite; margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-group { margin-bottom: 16px; }
.form-group label { display:block; margin-bottom:6px; font-size:14px; color: var(--muted); }
.form-group input {
    width: 100%; padding: 13px 14px; border-radius: 10px;
    border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.05);
    color: var(--text); font-family: inherit; font-size: 15px;
}
.form-group input:focus { outline: none; border-color: var(--gold); }
.error-box { background: rgba(225,72,72,.15); color: var(--danger); padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.link-switch { text-align:center; margin-top: 14px; color: var(--muted); font-size: 14px; }
.link-switch a { color: var(--gold); text-decoration: none; font-weight:700; }

.final-score { text-align:center; }
.final-score .big { font-size: 56px; font-weight:800; color: var(--gold); }

/* ==== لوحة الأدمن ==== */
.admin-body { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.admin-topbar { display:flex; justify-content:space-between; align-items:center; padding: 16px 0 26px; flex-wrap:wrap; gap:10px; }
.admin-topbar nav a { color: var(--text); text-decoration:none; margin-inline-start: 18px; font-size:14px; font-weight:600; }
.admin-topbar nav a:hover { color: var(--gold); }
.stat-grid { display:grid; grid-template-columns: repeat(4,1fr); gap:14px; }
@media (max-width:700px){ .stat-grid{grid-template-columns:1fr 1fr;} }
.stat-box { background: var(--card); border-radius:14px; padding:20px; text-align:center; }
.stat-box .num { font-size:30px; font-weight:800; color: var(--gold); }
.stat-box .label { color: var(--muted); font-size:13px; margin-top:6px; }
table.admin-table { width:100%; border-collapse: collapse; background: var(--card); border-radius:14px; overflow:hidden; }
table.admin-table th, table.admin-table td { padding: 12px 14px; text-align: right; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 14px; }
table.admin-table th { background: rgba(255,255,255,.04); color: var(--gold); }
.badge { padding:3px 10px; border-radius:999px; font-size:12px; font-weight:700; }
.badge.easy{background:rgba(46,204,113,.2);color:#2ecc71}
.badge.medium{background:rgba(244,183,49,.2);color:#f4b731}
.badge.pro{background:rgba(255,138,61,.2);color:#ff8a3d}
.badge.legend{background:rgba(225,72,72,.2);color:#e14848}
.toolbar { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; flex-wrap:wrap; gap:10px; }
.filters { display:flex; gap:10px; flex-wrap:wrap; }
.filters select, .filters input { padding:8px 12px; border-radius:8px; border:1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.05); color: var(--text); font-family: inherit; }
.icon-link { color: var(--muted); text-decoration:none; margin-inline-end:10px; font-size:13px; }
.icon-link.danger { color: var(--danger); }
textarea { width:100%; padding:12px; border-radius:10px; border:1px solid rgba(255,255,255,.15); background:rgba(255,255,255,.05); color:var(--text); font-family:inherit; font-size:14px; min-height:80px; }
select.form-select { width:100%; padding:13px 14px; border-radius:10px; border:1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.05); color: var(--text); font-family: inherit; font-size:15px; }
