/* ══════════════════════════════════════════════
   MANGO GAMES — style.css
   Gen Z Minimalist  ·  RTL/LTR bilingual
══════════════════════════════════════════════ */

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

:root {
    --pink:        #FF6B9D;
    --pink-soft:   #FFD6E8;
    --teal:        #4ECDC4;
    --teal-soft:   #C8F9F6;
    --yellow:      #FFD93D;
    --yellow-soft: #FFF5C0;
    --purple:      #A29BFE;
    --purple-soft: #EAE8FF;
    --green:       #6BCB77;
    --green-soft:  #D4F7D8;
    --orange:      #FFA07A;
    --orange-soft: #FFE4D4;
    --bg:          #FEFCFF;
    --card:        #FFFFFF;
    --text:        #1E1E2E;
    --muted:       #6B7280;
    --border:      #F0EAFF;
    --shadow:      0 4px 24px rgba(162,155,254,.13);
    --shadow-lg:   0 12px 40px rgba(162,155,254,.22);
    --r:           20px;
    --r-sm:        12px;
}

/* ── Typography: Arabic = Tajawal, English = Space Grotesk ── */
html[lang="ar"] body { font-family: 'Tajawal', system-ui, sans-serif; }
html[lang="en"] body { font-family: 'Space Grotesk', system-ui, sans-serif; }
body { background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }

html, body { height: 100%; overflow: hidden; }

/* ════════════════════════════════════════════
   LANGUAGE SWITCHER
════════════════════════════════════════════ */
/* مبدّل اللغة — الأساس بدون تثبيت */
.lang-switcher {
    display: flex;
    gap: 3px;
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 100px;
    padding: 4px;
    box-shadow: 0 2px 14px rgba(0,0,0,.1);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

/* في شاشتي الدخول ونهاية اللعبة: يُثبَّت أعلى يمين الشاشة */
.lang-abs {
    position: absolute;
    top: 14px;
    inset-inline-end: 18px;
    z-index: 10;
}
.lang-btn {
    padding: 5px 13px;
    border-radius: 100px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    color: var(--muted);
    transition: all .2s;
    line-height: 1;
}
.lang-btn.active {
    background: var(--purple);
    color: #fff;
    box-shadow: 0 2px 8px rgba(162,155,254,.4);
}
.lang-btn:not(.active):hover { color: var(--purple); }

/* ── Screens ──────────────────────────────── */
.screen {
    display: none;
    position: fixed;
    inset: 0;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
}
.screen.active { display: flex; }

/* ── Blobs ───────────────────────────────── */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
    z-index: 0;
}
.login-bg-blobs   .b1 { width:320px;height:320px;background:var(--pink-soft);  top:-80px; inset-inline-start:-60px; }
.login-bg-blobs   .b2 { width:260px;height:260px;background:var(--purple-soft);bottom:-40px;inset-inline-end:-50px; }
.login-bg-blobs   .b3 { width:200px;height:200px;background:var(--teal-soft);  bottom:60px;inset-inline-start:20%; }
.dash-bg-blobs    .b1 { width:400px;height:400px;background:var(--pink-soft);  top:-120px;inset-inline-end:-80px;opacity:.7; }
.dash-bg-blobs    .b2 { width:300px;height:300px;background:var(--teal-soft);  bottom:-80px;inset-inline-start:-60px;opacity:.6; }
.gameover-bg-blobs .b1 { width:280px;height:280px;background:var(--yellow-soft);top:-60px;inset-inline-start:-50px; }
.gameover-bg-blobs .b3 { width:240px;height:240px;background:var(--purple-soft);bottom:-40px;inset-inline-end:-40px; }
.admin-bg-blobs   .b2 { width:350px;height:350px;background:var(--orange-soft);top:-80px;inset-inline-end:-60px;opacity:.7; }
.admin-bg-blobs   .b3 { width:280px;height:280px;background:var(--purple-soft);bottom:-60px;inset-inline-start:-50px;opacity:.6; }

/* ════════════════════════════════════════════
   LOGIN SCREEN
════════════════════════════════════════════ */
#screen-login {
    justify-content: center;
    padding: 24px;
    background: linear-gradient(145deg,#FFF5FA 0%,#F5F0FF 55%,#F0FAFF 100%);
}
.login-card {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    margin-top: 40px; /* space for lang switcher */
}
.logo-emoji {
    font-size: 80px;
    display: block;
    animation: float 3.2s ease-in-out infinite;
    filter: drop-shadow(0 10px 20px rgba(255,107,157,.35));
}
@keyframes float {
    0%,100% { transform: translateY(0) rotate(-4deg); }
    50%      { transform: translateY(-12px) rotate(4deg); }
}
.title-main {
    font-size: clamp(36px, 8vw, 52px);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -1px;
}
html[lang="en"] .title-main { letter-spacing: -2.5px; }
.title-main span { color: var(--pink); }
.login-sub { font-size: 15px; color: var(--muted); font-weight: 400; margin-top: -6px; }

/* ── Input & Buttons ─────────────────────── */
.input-group { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.input-group input {
    width: 100%;
    padding: 15px 18px;
    border: 2px solid var(--border);
    border-radius: var(--r-sm);
    font-family: inherit;
    font-size: 16px;
    background: var(--card);
    color: var(--text);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    text-align: start;
}
.input-group input::placeholder { color: #C4B5D4; }
.input-group input:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 4px var(--purple-soft);
}
.input-group input.shake { animation: shake .4s ease; border-color: var(--pink); }
@keyframes shake {
    0%,100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(4px); }
}

.btn-primary {
    width: 100%;
    padding: 15px;
    background: var(--pink);
    color: #fff;
    border: none;
    border-radius: var(--r-sm);
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(255,107,157,.4); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    width: 100%;
    padding: 13px;
    background: transparent;
    color: var(--muted);
    border: 2px solid var(--border);
    border-radius: var(--r-sm);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}
.btn-secondary:hover { border-color: var(--purple); color: var(--purple); transform: translateY(-2px); }

.btn-ghost {
    padding: 8px 14px;
    background: transparent;
    color: var(--muted);
    border: 1.5px solid var(--border);
    border-radius: 100px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.btn-ghost:hover { border-color: var(--purple); color: var(--purple); }

.scores-preview { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; min-height: 28px; }
.score-chip {
    padding: 5px 14px;
    background: rgba(255,255,255,.85);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: var(--shadow);
    white-space: nowrap;
    backdrop-filter: blur(8px);
}

/* ════════════════════════════════════════════
   DASHBOARD SCREEN
════════════════════════════════════════════ */
#screen-dashboard {
    background: linear-gradient(145deg,#FFF5FA 0%,#F5F0FF 55%,#F0FAFF 100%);
    align-items: stretch;
    padding: 0;
}
.dash-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: rgba(255,255,255,.78);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 8px;
}
.player-badge { display: flex; align-items: center; gap: 10px; min-width: 0; }
.player-avatar {
    width: 36px; height: 36px;
    background: var(--pink-soft);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.player-name-text {
    font-weight: 700;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}
.header-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.dash-body {
    flex: 1;
    padding: 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    max-width: 760px;
    width: 100%;
    align-self: center;
    position: relative;
    z-index: 1;
}
.section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    display: block;
}
html[lang="ar"] .section-label { letter-spacing: .5px; font-size: 12px; }

/* ── Game Cards ──────────────────────────── */
.game-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .game-cards { grid-template-columns: 1fr; } }

.game-card {
    background: var(--card);
    border-radius: var(--r);
    padding: 22px;
    cursor: pointer;
    transition: transform .25s, box-shadow .25s;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    user-select: none;
}
.game-card::before {
    content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity .25s;
}
.catch-card::before { background: linear-gradient(135deg,var(--yellow-soft),var(--pink-soft)); }
.grow-card::before  { background: linear-gradient(135deg,var(--green-soft), var(--teal-soft)); }
.game-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.game-card:hover::before { opacity: 1; }
.game-card:active { transform: translateY(-2px); }
.game-card > * { position: relative; z-index: 1; }

.game-card-icon { font-size: 44px; display: block; margin-bottom: 12px; }
.game-card h3 { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.game-card p  { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 16px; }
.game-card-footer { display: flex; align-items: center; justify-content: space-between; }
.tag { padding: 4px 12px; border-radius: 100px; font-size: 12px; font-weight: 700; }
.tag-time { background: var(--yellow-soft); color: #92660A; }
.card-best { font-size: 13px; font-weight: 700; color: var(--purple); }

/* ── Leaderboard ─────────────────────────── */
.leaderboard-card { background: var(--card); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow); }
.lb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}
.leaderboard-tabs { display: flex; gap: 6px; }
.tab-btn {
    padding: 7px 14px;
    border-radius: 100px;
    border: 2px solid var(--border);
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    color: var(--muted);
}
.tab-btn.active { background: var(--purple); border-color: var(--purple); color: #fff; }
.tab-btn:not(.active):hover { border-color: var(--purple); color: var(--purple); }
.leaderboard-list { display: flex; flex-direction: column; gap: 6px; }
.lb-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--r-sm);
    background: #F9F7FF;
}
.lb-item.is-me { background: var(--purple-soft); }
.lb-rank  { width: 26px; text-align: center; font-size: 17px; flex-shrink: 0; }
.lb-name  { flex: 1; font-weight: 600; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-weight: 800; font-size: 16px; flex-shrink: 0; }
.lb-empty { text-align: center; color: var(--muted); font-size: 14px; padding: 28px 0; }

/* ════════════════════════════════════════════
   GAME SCREEN
════════════════════════════════════════════ */
#screen-game { padding: 0; background: #12121f; align-items: stretch; justify-content: flex-start; }
.game-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: rgba(255,255,255,.04);
    border-bottom: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
    min-height: 60px;
}
.btn-back-game {
    padding: 8px 14px;
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.7);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 100px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    white-space: nowrap;
}
.btn-back-game:hover { background: rgba(255,255,255,.15); }
.hud-center { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.hud-game-name { font-size: 12px; font-weight: 600; color: rgba(255,255,255,.45); letter-spacing:.5px; }
.hud-timer {
    font-size: 30px;
    font-weight: 800;
    color: #fff;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.hud-timer.urgent { color: var(--pink); animation: pulse-t .5s ease infinite alternate; }
@keyframes pulse-t { from { transform: scale(1); } to { transform: scale(1.12); } }
.hud-score { text-align: end; }
.hud-score-label { font-size: 10px; font-weight: 700; color: rgba(255,255,255,.35); text-transform: uppercase; letter-spacing: 1px; }
.hud-score-value { font-size: 26px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; line-height: 1; }

.canvas-wrapper { position: relative; flex: 1; overflow: hidden; }
#game-canvas { display: block; width: 100%; height: 100%; }

.game-overlay {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    background: rgba(18,18,31,.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.game-overlay.hidden { display: none; }
.countdown-num {
    font-size: 96px; font-weight: 800; color: #fff; line-height: 1;
    animation: pop-in .35s cubic-bezier(.68,-.55,.265,1.55);
}
.countdown-num.go { color: var(--yellow); font-size: 72px; }
@keyframes pop-in {
    from { transform: scale(.3); opacity: 0; }
    to   { transform: scale(1);  opacity: 1; }
}
.overlay-msg { font-size: 16px; color: rgba(255,255,255,.5); font-weight: 600; }

/* ════════════════════════════════════════════
   GAME OVER SCREEN
════════════════════════════════════════════ */
#screen-gameover {
    justify-content: center;
    padding: 24px;
    background: linear-gradient(145deg,#FFF5FA 0%,#F5F0FF 55%,#F0FAFF 100%);
}
.gameover-card {
    position: relative; z-index: 1;
    background: var(--card);
    border-radius: var(--r);
    padding: 36px 28px;
    max-width: 380px; width: 100%;
    text-align: center;
    box-shadow: 0 24px 64px rgba(162,155,254,.22);
    margin-top: 40px;
}
.result-emoji {
    font-size: 76px; display: block; margin-bottom: 14px;
    animation: bounce-in .55s cubic-bezier(.68,-.55,.265,1.55);
}
@keyframes bounce-in {
    from { transform: scale(0) rotate(-15deg); opacity: 0; }
    to   { transform: scale(1)  rotate(0deg);  opacity: 1; }
}
.gameover-title { font-size: 28px; font-weight: 800; margin-bottom: 6px; }
.gameover-sub   { font-size: 14px; color: var(--muted); margin-bottom: 24px; line-height: 1.5; }
.score-display-big { background: var(--purple-soft); border-radius: var(--r-sm); padding: 18px; margin-bottom: 14px; }
.score-display-big .label {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
    color: var(--purple); margin-bottom: 4px;
}
.score-display-big .value {
    font-size: 56px; font-weight: 800; color: var(--text); line-height: 1; font-variant-numeric: tabular-nums;
}
.new-best-badge {
    display: inline-block;
    background: var(--yellow); color: #6B4F00;
    font-size: 13px; font-weight: 800;
    padding: 5px 16px; border-radius: 100px; margin-bottom: 20px;
    animation: bounce-in .45s .25s both cubic-bezier(.68,-.55,.265,1.55);
}
.gameover-btns { display: flex; flex-direction: column; gap: 10px; }

/* ════════════════════════════════════════════
   ADMIN SCREEN
════════════════════════════════════════════ */
#screen-admin {
    background: linear-gradient(145deg,#FFF8F0 0%,#FFF0FF 55%,#F0F8FF 100%);
    align-items: stretch;
    padding: 0;
}
.admin-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: rgba(255,255,255,.78);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.admin-title-text { font-size: 16px; font-weight: 800; }
.admin-body {
    flex: 1;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 760px;
    width: 100%;
    align-self: center;
    position: relative;
    z-index: 1;
    padding-bottom: 40px;
}

/* ── Stats Grid ──────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 12px;
}
@media (max-width: 600px) { .stats-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 360px) { .stats-grid { grid-template-columns: 1fr; } }

.stat-card {
    background: var(--card);
    border-radius: var(--r-sm);
    padding: 18px 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
    border-top: 3px solid var(--border);
    transition: transform .2s;
}
.stat-card:hover { transform: translateY(-3px); }
.catch-stat { border-top-color: var(--yellow); }
.grow-stat  { border-top-color: var(--green); }
.total-stat { border-top-color: var(--purple); }

.stat-value { font-size: 36px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-sub   { font-size: 11px; color: var(--purple); font-weight: 600; margin-top: 2px; }

/* ── Admin Table ─────────────────────────── */
.admin-table-wrap {
    background: var(--card);
    border-radius: var(--r);
    padding: 6px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.admin-table th {
    padding: 12px 14px;
    text-align: start;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.admin-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #F9F7FF;
    font-weight: 500;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr.is-me td { background: var(--purple-soft); }
.admin-table tr:hover td { background: #FAFAFA; }
.admin-table tr.is-me:hover td { background: var(--purple-soft); }
.admin-table .col-rank  { width: 36px; font-weight: 800; color: var(--muted); }
.admin-table .col-total { font-weight: 800; font-size: 15px; }
.admin-table .col-del   { width: 50px; text-align: center; }
.admin-table .col-catch { color: #92660A; font-weight: 700; }
.admin-table .col-grow  { color: #276749; font-weight: 700; }

.btn-del-row {
    padding: 4px 10px;
    border-radius: 100px;
    border: 1.5px solid #FECACA;
    background: transparent;
    color: #EF4444;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
}
.btn-del-row:hover { background: #EF4444; color: #fff; border-color: #EF4444; }

.lb-empty { text-align: center; color: var(--muted); font-size: 14px; padding: 28px 0; }

/* ── Danger Zone ─────────────────────────── */
.admin-danger-zone { display: flex; justify-content: center; }

.btn-delete-all {
    padding: 14px 28px;
    background: transparent;
    color: #EF4444;
    border: 2px solid #FECACA;
    border-radius: var(--r-sm);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all .25s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-delete-all:hover { background: #FEF2F2; border-color: #EF4444; }
.btn-delete-all.confirming {
    background: #EF4444;
    color: #fff;
    border-color: #EF4444;
    animation: pulse-danger 1s ease infinite;
}
@keyframes pulse-danger {
    0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
    50%      { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

/* ════════════════════════════════════════════
   CERTIFICATE SCREEN
════════════════════════════════════════════ */
#screen-certificate {
    background: linear-gradient(145deg,#FFFDF0 0%,#F5FFF0 55%,#FFFFF0 100%);
    align-items: stretch;
    padding: 0;
}

.cert-bg-blobs { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.cert-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.cert-header-title { font-size: 16px; font-weight: 800; }

.cert-body {
    flex: 1;
    display: flex;
    gap: 24px;
    padding: 24px 20px;
    max-width: 1160px;
    width: 100%;
    align-self: center;
    align-items: flex-start;
    position: relative;
    z-index: 1;
    overflow-y: auto;
}
@media (max-width: 700px) {
    .cert-body { flex-direction: column; }
}

/* ── Form Card ───────────────────────────── */
.cert-form-card {
    width: 290px;
    flex-shrink: 0;
    background: var(--card);
    border-radius: var(--r);
    padding: 22px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 18px;
}
@media (max-width: 700px) { .cert-form-card { width: 100%; } }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .8px;
}
html[lang="ar"] .form-label { letter-spacing: .3px; font-size: 13px; }

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--r-sm);
    font-family: 'Cairo', 'Tajawal', inherit;
    font-size: 15px;
    background: #FAFAFA;
    color: var(--text);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    text-align: start;
}
.form-input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 4px var(--green-soft);
    background: #fff;
}
.form-select { cursor: pointer; }

.btn-cert-download {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #388E3C, #2E7D32);
    color: #fff;
    border: none;
    border-radius: var(--r-sm);
    font-family: 'Cairo', 'Tajawal', inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
    box-shadow: 0 4px 16px rgba(56,142,60,.3);
}
.btn-cert-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(56,142,60,.4);
}
.btn-cert-download:active { transform: translateY(0); }

.btn-cert-qr {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    background: transparent;
    color: #2E7D32;
    border: 2px solid #6BCB77;
    border-radius: var(--r-sm);
    font-family: 'Cairo', 'Tajawal', inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, transform .2s;
}
.btn-cert-qr:hover {
    background: var(--green-soft);
    transform: translateY(-1px);
}

.cert-hint {
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    line-height: 1.5;
}

/* ── QR Modal ────────────────────────────── */
.qr-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.qr-modal-box {
    background: var(--card);
    border-radius: var(--r);
    padding: 36px 32px 28px;
    max-width: 340px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: var(--shadow-lg);
}
.qr-modal-close {
    position: absolute;
    top: 12px;
    inset-inline-end: 16px;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--muted);
    line-height: 1;
}
.qr-modal-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 6px;
}
.qr-modal-sub {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 20px;
}
.qr-modal-expire {
    font-size: 11px;
    color: var(--muted);
    margin-top: 14px;
}
#qr-canvas-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
}
#qr-canvas-wrap canvas {
    border-radius: 12px;
    border: 3px solid var(--border);
}
.qr-loading {
    font-size: 14px;
    color: var(--muted);
    padding: 32px 0;
}

/* ── Canvas Preview ──────────────────────── */
.cert-preview-wrap { flex: 1; min-width: 0; }

.cert-canvas-box {
    border-radius: var(--r);
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    background: #f5f0e8;
    line-height: 0;
}

#cert-canvas {
    width: 100%;
    height: auto;
    display: block;
}

/* ── Dashboard cert button accent ───────── */
.btn-ghost-cert {
    border-color: var(--green-soft);
    color: #2E7D32;
}
.btn-ghost-cert:hover {
    border-color: var(--green);
    color: var(--green);
    background: var(--green-soft);
}

/* ── Utility ─────────────────────────────── */
.hidden { display: none !important; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
