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

:root {
    --green-950: #042f25;
    --green-900: #064534;
    --green-800: #0b6b4f;
    --green-600: #15956e;
    --green-100: #e8f5ef;
    --gold: #d6af4b;
    --cream: #fbfaf4;
    --ink: #17362d;
    --muted: #6b7d77;
    --danger: #b53535;
    --shadow: 0 24px 70px rgba(4, 47, 37, .14);
}
* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; font-family: "Tajawal", Tahoma, Arial, sans-serif; color: var(--ink); background: var(--cream); }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px clamp(20px, 5vw, 72px); background: rgba(255,255,255,.92); border-bottom: 1px solid rgba(11,107,79,.12); position: sticky; top: 0; z-index: 50; backdrop-filter: blur(15px); }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 800; font-size: 1.1rem; }
.brand-mark, .hero-mark { display: grid; place-items: center; color: white; background: linear-gradient(145deg, var(--green-600), var(--green-950)); border: 2px solid rgba(214,175,75,.8); box-shadow: 0 10px 30px rgba(4,47,37,.25); }
.brand-mark { width: 42px; height: 42px; border-radius: 14px; }
.top-actions { display: flex; align-items: center; gap: 18px; }
.top-actions > a { text-decoration: none; font-weight: 700; }
.page-shell { min-height: calc(100vh - 76px); }
.hero { min-height: 68vh; display: grid; justify-items: center; align-content: center; text-align: center; padding: 70px 20px; color: white; background: radial-gradient(circle at 20% 10%, rgba(214,175,75,.18), transparent 25%), radial-gradient(circle at 85% 80%, rgba(255,255,255,.10), transparent 25%), linear-gradient(145deg, var(--green-800), var(--green-950)); }
.hero-mark { width: 112px; height: 112px; border-radius: 34px; font-size: 3.5rem; margin-bottom: 24px; }
.hero-mark-large { width: 150px; height: 150px; font-size: 5rem; }
.eyebrow { letter-spacing: .18em; text-transform: uppercase; color: var(--gold); font-weight: 800; font-size: .78rem; }
.hero h1 { max-width: 850px; margin: 8px 0 14px; font-size: clamp(2.5rem, 7vw, 5.8rem); line-height: 1.05; }
.hero > p:last-of-type { max-width: 680px; margin: 0 0 30px; color: rgba(255,255,255,.78); font-size: clamp(1rem, 2vw, 1.35rem); }
.hero-actions, .draw-controls, .control-grid { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.button { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 14px; padding: 12px 20px; text-decoration: none; font-weight: 800; transition: transform .2s, box-shadow .2s, background .2s; }
.button:hover { transform: translateY(-2px); }
.button-primary { background: var(--gold); color: var(--green-950); box-shadow: 0 12px 30px rgba(214,175,75,.22); }
.button-secondary { background: var(--green-800); color: white; }
.button-ghost { padding: 9px 14px; background: var(--green-100); color: var(--green-900); }
.button-danger { background: #fee7e7; color: var(--danger); }
.button-small { padding: 8px 12px; color: white; background: var(--green-800); }
.button-wide { width: 100%; min-height: 54px; font-size: 1.05rem; }
.feature-grid, .stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; width: min(1120px, calc(100% - 40px)); margin: -52px auto 70px; position: relative; z-index: 2; }
.feature-grid article, .stat-grid article { padding: 30px; background: white; border: 1px solid rgba(11,107,79,.1); border-radius: 24px; box-shadow: var(--shadow); text-align: center; }
.feature-grid article > span { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; color: var(--green-800); background: var(--green-100); font-size: 1.4rem; }
.feature-grid h2 { margin: 14px 0 4px; }
.feature-grid p { color: var(--muted); }
.content-card, .success-card { width: min(920px, calc(100% - 32px)); margin: 42px auto; padding: clamp(22px, 5vw, 48px); background: white; border-radius: 28px; box-shadow: var(--shadow); }
.section-heading { margin-bottom: 30px; text-align: center; }
.section-heading h1 { font-size: clamp(2rem, 5vw, 3.4rem); margin: 6px 0 14px; }
.section-heading p { color: var(--muted); line-height: 1.8; }
.question-card { border: 1px solid #dfe9e5; border-radius: 20px; padding: 22px; margin: 0 0 18px; }
.question-card legend { width: 100%; font-size: 1.2rem; font-weight: 800; line-height: 1.7; }
.question-card legend > span { color: var(--green-600); margin-inline-end: 8px; }
.options { display: grid; gap: 10px; margin-top: 14px; }
.options label { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid #dae7e2; border-radius: 14px; cursor: pointer; }
.options label:has(input:checked) { border-color: var(--green-600); background: var(--green-100); }
.option-letter { width: 34px; height: 34px; display: grid; place-items: center; background: white; border-radius: 10px; font-weight: 800; }
.participant-card { margin: 28px 0; padding: 24px; border-radius: 20px; background: #f4f8f6; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
label { display: grid; gap: 7px; font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid #ccdcd6; border-radius: 12px; padding: 12px 14px; color: var(--ink); background: white; }
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(21,149,110,.16); border-color: var(--green-600); }
.success-card, .empty-state { min-height: 440px; display: grid; place-items: center; align-content: center; text-align: center; }
.success-icon { width: 92px; height: 92px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green-600); font-size: 3rem; }
.language-overlay { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(4,47,37,.82); backdrop-filter: blur(12px); z-index: 1000; }
.language-overlay[hidden] { display: none; }
.language-card { width: min(680px, 100%); padding: 34px; border-radius: 26px; background: white; position: relative; text-align: center; }
.modal-close { position: absolute; inset-inline-end: 18px; top: 14px; border: 0; background: transparent; font-size: 2rem; color: var(--muted); }
.language-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 24px; }
.language-grid a { display: flex; align-items: center; gap: 12px; padding: 16px; border: 2px solid transparent; border-radius: 15px; background: #f3f8f5; text-decoration: none; font-weight: 800; }
.language-grid a.active { border-color: var(--green-600); }
.language-grid span { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--green-800); color: white; font-size: .75rem; }
.modal-open { overflow: hidden; }
.notice { width: min(920px, calc(100% - 32px)); margin: 18px auto; padding: 14px 18px; border-radius: 12px; background: #eef3f1; }
.notice-success { background: #def6e9; color: #0b6949; }
.notice-error { background: #fee7e7; color: #8d2525; }
.display-stage, .winner-stage { min-height: calc(100vh - 76px); display: grid; place-items: center; position: relative; overflow: hidden; color: white; background: radial-gradient(circle at center, #0b7555, var(--green-950) 72%); }
.display-home { text-align: center; display: grid; justify-items: center; }
.display-home h1 { font-size: clamp(3rem, 9vw, 8rem); margin: 10px; }
.display-home > p:last-child { font-size: clamp(1.2rem, 3vw, 2.4rem); color: rgba(255,255,255,.75); }
.fullscreen-button { position: absolute; top: 20px; inset-inline-end: 20px; z-index: 4; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.12); color: white; padding: 10px 16px; border-radius: 12px; }
.winner-content { position: relative; z-index: 2; text-align: center; }
.winner-content > h1 { font-size: clamp(2rem, 5vw, 4rem); }
.rolling-name { font-size: clamp(3rem, 9vw, 8rem); font-weight: 900; color: var(--gold); }
.winner-card { min-width: min(680px, 90vw); padding: 42px; border: 2px solid rgba(214,175,75,.6); border-radius: 32px; background: rgba(255,255,255,.1); backdrop-filter: blur(16px); }
.winner-card[hidden] { display: none; }
.winner-card h2 { font-size: clamp(3rem, 9vw, 7rem); margin: 8px 0; }
.winner-card strong { color: var(--gold); font-size: clamp(1.5rem, 4vw, 3rem); }
.trophy { color: var(--gold); font-size: 5rem; }
.confetti { position: absolute; top: -30px; width: 10px; height: 18px; z-index: 6; animation: fall 4.5s linear forwards; }
@keyframes fall { to { top: 110%; transform: rotate(720deg); } }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(145deg, var(--green-800), var(--green-950)); }
.auth-card { width: min(460px, 100%); display: grid; gap: 16px; justify-items: stretch; padding: 34px; border-radius: 26px; background: white; box-shadow: var(--shadow); text-align: center; }
.auth-card .hero-mark { margin: 0 auto; width: 78px; height: 78px; font-size: 2.4rem; }
.auth-card .notice { width: 100%; margin: 0; }
.admin-body { background: #f3f6f4; }
.admin-sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 250px; padding: 24px 18px; color: white; background: var(--green-950); overflow-y: auto; }
.admin-sidebar .brand { margin-bottom: 30px; }
.admin-sidebar nav { display: grid; gap: 7px; }
.admin-sidebar nav a { padding: 12px 14px; border-radius: 11px; text-decoration: none; color: rgba(255,255,255,.78); }
.admin-sidebar nav a:hover { background: rgba(255,255,255,.09); color: white; }
.admin-main { min-height: 100vh; margin-inline-start: 250px; padding: 26px; }
.admin-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.admin-top h1 { margin: 0; }
.admin-main .notice { width: 100%; margin: 0 0 18px; }
.stat-grid { width: 100%; margin: 0 0 22px; grid-template-columns: repeat(4, 1fr); }
.stat-grid article { display: grid; gap: 7px; padding: 22px; text-align: start; }
.stat-grid strong { color: var(--green-800); font-size: 2.2rem; }
.admin-card { margin-bottom: 22px; padding: 24px; border-radius: 20px; background: white; box-shadow: 0 12px 35px rgba(4,47,37,.06); }
.admin-card h2 { margin-top: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px; border-bottom: 1px solid #e4ebe8; text-align: start; white-space: nowrap; }
th { color: var(--muted); font-size: .86rem; }
.inline-form { display: flex; gap: 10px; align-items: end; }
.inline-form label { min-width: 220px; }
.code-field { direction: ltr; text-align: left; font-family: Consolas, monospace; }
.helper { color: var(--muted); font-size: .9rem; }
.status { display: inline-block; padding: 5px 9px; border-radius: 999px; background: #edf1ef; }
.status-active { background: #def6e9; color: #096546; }
.draw-controls { justify-content: flex-start; margin-top: 20px; }
@media (max-width: 900px) {
    .top-actions > a { display: none; }
    .feature-grid, .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-sidebar { position: static; width: 100%; }
    .admin-sidebar nav { grid-template-columns: repeat(2, 1fr); }
    .admin-main { margin-inline-start: 0; padding: 18px; }
}
@media (max-width: 620px) {
    .topbar { padding: 12px 16px; }
    .feature-grid, .stat-grid, .form-grid, .language-grid { grid-template-columns: 1fr; }
    .feature-grid { margin-top: 24px; }
    .hero { min-height: 74vh; }
    .brand > span:last-child { display: none; }
    .admin-sidebar nav { grid-template-columns: 1fr 1fr; }
    .admin-top { align-items: flex-start; gap: 12px; }
}
