:root { --indigo:#4f46e5; --emerald:#10b981; --amber:#f59e0b; --rose:#ec4899; --slate:#64748b; }
* { box-sizing:border-box; margin:0; padding:0; }
body { font-family:'Vazirmatn',Tahoma,sans-serif; background:linear-gradient(180deg,#f5f3ff 0%,#f8fafc 240px,#f8fafc 100%); color:#1e293b; line-height:1.8; min-height:100vh; }

/* Hero */
.hero { background:linear-gradient(135deg,#4f46e5,#7c3aed 55%,#ec4899); color:#fff; padding:40px 16px 56px; text-align:center; }
.hero-inner { max-width:760px; margin:0 auto; }
.logo { font-size:42px; display:block; margin-bottom:8px; }
.hero h1 { font-size:clamp(22px,4.5vw,32px); font-weight:900; margin-bottom:8px; }
.hero p { font-size:14px; opacity:.92; max-width:560px; margin:0 auto; }

/* Container */
.container { max-width:760px; margin:-36px auto 40px; padding:0 16px; }

/* Stats */
.stats { display:flex; gap:12px; background:#fff; border-radius:18px; padding:18px; box-shadow:0 8px 30px rgba(79,70,229,.12); margin-bottom:16px; }
.stat { flex:1; text-align:center; }
.stat b { font-size:26px; font-weight:900; color:var(--indigo); display:block; }
.stat span { font-size:11px; color:var(--slate); }

.chips { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:20px; }
.chip { font-size:11px; font-weight:700; background:#eef2ff; color:#4338ca; padding:5px 12px; border-radius:999px; border:1px solid #e0e7ff; }

/* Konkur structure */
.structure { margin-bottom:20px; }
.struct-head { font-size:13px; font-weight:900; color:#334155; margin-bottom:10px; }
.struct-booklets { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:10px; }
.booklet { background:#fff; border:1px solid #e2e8f0; border-radius:12px; padding:12px; }
.booklet-name { font-size:12px; font-weight:900; color:var(--indigo); margin-bottom:8px; padding-bottom:6px; border-bottom:1px dashed #e2e8f0; }
.booklet-name span { font-size:10px; font-weight:700; color:var(--slate); }
.booklet-subj { display:flex; justify-content:space-between; font-size:11px; padding:3px 0; color:#475569; }
.booklet-subj b { color:var(--emerald); font-weight:800; }
.struct-note { font-size:11px; color:var(--slate); margin-top:10px; font-style:italic; }

/* Loading */
.loading { display:flex; align-items:center; justify-content:center; gap:10px; color:var(--slate); padding:30px; font-weight:600; }
.spinner { width:18px; height:18px; border:3px solid #e2e8f0; border-top-color:var(--indigo); border-radius:50%; animation:spin .8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* Search */
.ready { background:#fff; border-radius:20px; padding:22px; box-shadow:0 4px 20px rgba(0,0,0,.05); }
.hint { font-size:13px; font-weight:700; color:#334155; margin-bottom:10px; }
textarea { width:100%; padding:14px; border:2px solid #e2e8f0; border-radius:14px; font-family:inherit; font-size:15px; resize:vertical; direction:rtl; transition:border-color .2s; }
textarea:focus { outline:none; border-color:var(--indigo); }
button#btn { width:100%; margin-top:12px; padding:14px; background:linear-gradient(135deg,var(--indigo),#7c3aed); color:#fff; border:none; border-radius:14px; font-family:inherit; font-size:15px; font-weight:800; cursor:pointer; transition:transform .1s; }
button#btn:active { transform:scale(.98); }
.tip { font-size:11px; color:var(--slate); text-align:center; margin-top:8px; }

/* Headline */
.headline { margin:18px 0 6px; padding:14px 16px; background:linear-gradient(135deg,#ecfdf5,#f0fdf4); border:1px solid #bbf7d0; border-radius:14px; font-size:14px; font-weight:700; color:#15803d; }
.headline:empty { display:none; }

/* Results */
.results { display:flex; flex-direction:column; gap:12px; margin-top:8px; }
.result-card { border:1px solid #e2e8f0; border-radius:16px; padding:16px; background:#fff; }
.result-card.strong { border-color:#bbf7d0; background:#f0fdf4; }
.result-card.medium { border-color:#fde68a; background:#fffbeb; }
.result-card.weak { border-color:#fecaca; background:#fef2f2; opacity:.92; }
.result-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; }
.rank { font-size:12px; font-weight:900; color:#fff; background:var(--indigo); padding:2px 10px; border-radius:999px; }
.conf { font-size:11px; font-weight:800; }
.conf.strong { color:#15803d; } .conf.medium { color:#b45309; } .conf.weak { color:#b91c1c; }
.result-meta { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:10px; }
.badge { font-size:11px; font-weight:800; padding:4px 10px; border-radius:8px; }
.badge.year { background:#eef2ff; color:#4338ca; }
.badge.subj { background:#fef3c7; color:#92400e; }
.badge.field { background:#fce7f3; color:#9d174d; }
.result-q { font-size:14px; color:#334155; font-weight:600; margin-bottom:8px; }
.options { list-style:none; padding:0; margin:6px 0; display:flex; flex-direction:column; gap:5px; }
.options li { font-size:13px; padding:7px 12px; background:#f8fafc; border-radius:8px; border:1px solid #f1f5f9; }
.options li.correct { background:#dcfce7; border-color:#bbf7d0; color:#15803d; font-weight:800; }
.explain { font-size:12px; color:var(--slate); margin-top:8px; padding-top:8px; border-top:1px dashed #e2e8f0; }

.empty { padding:30px; text-align:center; color:var(--slate); background:#f8fafc; border-radius:14px; font-weight:600; }
.empty.notfound span { font-size:12px; color:#94a3b8; }

/* Footer */
.foot { text-align:center; padding:24px 16px; color:var(--slate); font-size:12px; }

/* Question bank page */
.back-link { display:inline-block; margin-top:10px; color:#fff; background:rgba(255,255,255,.18); padding:6px 16px; border-radius:999px; font-size:12px; font-weight:700; text-decoration:none; }
.back-link:hover { background:rgba(255,255,255,.3); }
.struct-panel { background:#fff; border-radius:18px; padding:18px; box-shadow:0 8px 30px rgba(79,70,229,.10); margin-bottom:16px; }
.struct-tabs { display:flex; gap:6px; margin-bottom:12px; }
.sttab { flex:1; padding:8px; border:1px solid #e2e8f0; background:#f8fafc; border-radius:10px; font-family:inherit; font-size:12px; font-weight:800; color:#475569; cursor:pointer; }
.sttab.active { background:var(--indigo); color:#fff; border-color:var(--indigo); }
.struct-total { font-size:13px; font-weight:800; color:#334155; margin-bottom:10px; }
.filter-bar { background:#fff; border-radius:18px; padding:16px; box-shadow:0 4px 18px rgba(0,0,0,.05); margin-bottom:18px; }
.filter-row { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-bottom:10px; }
.fsel { padding:10px; border:2px solid #e2e8f0; border-radius:12px; font-family:inherit; font-size:13px; font-weight:700; background:#fff; }
.fsel:focus { outline:none; border-color:var(--indigo); }
.fsearch { width:100%; padding:11px 14px; border:2px solid #e2e8f0; border-radius:12px; font-family:inherit; font-size:13px; }
.fsearch:focus { outline:none; border-color:var(--indigo); }
.filter-foot { display:flex; justify-content:space-between; align-items:center; margin-top:10px; }
.clear-btn { background:#fee2e2; color:#b91c1c; border:none; padding:7px 16px; border-radius:10px; font-family:inherit; font-size:12px; font-weight:800; cursor:pointer; }
.count-label { font-size:12px; color:#475569; font-weight:700; }
.count-label b { color:var(--indigo); }
.qlist { display:flex; flex-direction:column; gap:12px; }
.qcard { background:#fff; border:1px solid #e2e8f0; border-radius:16px; padding:16px; }
.qhead { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin-bottom:8px; }
.qnum { font-size:12px; font-weight:900; color:#fff; background:var(--indigo); width:24px; height:24px; border-radius:8px; display:inline-flex; align-items:center; justify-content:center; }
.qtext { font-size:14px; color:#1e293b; font-weight:600; margin-bottom:8px; }
.opts { list-style:none; padding:0; display:flex; flex-direction:column; gap:5px; }
.opts li { font-size:13px; padding:7px 12px; background:#f8fafc; border-radius:8px; border:1px solid #f1f5f9; }
.opts li.correct { background:#dcfce7; border-color:#bbf7d0; color:#15803d; font-weight:800; }
.ans { font-size:13px; color:#15803d; font-weight:700; margin-top:8px; }
.exp { font-size:12px; color:var(--slate); margin-top:6px; padding-top:6px; border-top:1px dashed #e2e8f0; }

/* Practice/quiz mode */
.card-box { background:#fff; border-radius:18px; padding:24px; box-shadow:0 8px 30px rgba(79,70,229,.10); margin-bottom:18px; }
.card-title { font-size:18px; font-weight:900; color:#1e293b; margin-bottom:16px; }
.count-label { display:block; font-size:13px; font-weight:700; color:#334155; margin:14px 0 8px; }
.primary-btn { width:100%; margin-top:14px; padding:14px; background:linear-gradient(135deg,var(--indigo),#7c3aed); color:#fff; border:none; border-radius:14px; font-family:inherit; font-size:15px; font-weight:800; cursor:pointer; }
.primary-btn:active { transform:scale(.98); }
.progress { font-size:12.5px; font-weight:800; color:var(--indigo); margin-bottom:10px; }
.qsource { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:12px; }
.badge.diff { background:#fef3c7; color:#92400e; }
.badge.type { background:#ede9fe; color:#5b21b6; }
.qtext { font-size:16px; font-weight:700; color:#1e293b; line-height:1.9; margin-bottom:16px; }
.qoptions { display:flex; flex-direction:column; gap:9px; }
.opt { text-align:right; padding:13px 16px; border:2px solid #e2e8f0; border-radius:13px; background:#fff; font-family:inherit; font-size:14px; font-weight:600; color:#334155; cursor:pointer; transition:all .12s; }
.opt:hover:not(:disabled) { border-color:var(--indigo); background:#f5f3ff; }
.opt:disabled { cursor:default; }
.opt.correct { border-color:var(--emerald); background:#dcfce7; color:#15803d; font-weight:800; }
.opt.wrong { border-color:#ef4444; background:#fee2e2; color:#b91c1c; }
.reveal { margin-top:16px; padding:16px; background:#f8fafc; border-radius:14px; border:1px solid #e2e8f0; }
.reveal-head { font-size:14px; font-weight:800; margin-bottom:10px; }
.reveal-head .ok { color:var(--emerald); }
.reveal-head .no { color:#ef4444; }
.reveal-body { font-size:13px; }
.meta-row { display:flex; justify-content:space-between; padding:4px 0; border-bottom:1px dashed #e2e8f0; color:#475569; }
.meta-row b { color:#1e293b; }
.expl { font-size:12.5px; color:var(--slate); margin-top:8px; padding-top:8px; border-top:1px dashed #e2e8f0; }
.score-text { font-size:16px; text-align:center; font-weight:800; color:#1e293b; margin:14px 0; line-height:2; }
.score-text .msg { display:block; font-size:14px; color:var(--emerald); }
.src-link { display:inline-block; margin-top:8px; font-size:12.5px; font-weight:700; color:var(--indigo); text-decoration:none; padding:7px 14px; background:#eef2ff; border-radius:10px; border:1px solid #c7d2fe; }
.src-link:hover { background:#e0e7ff; }
.ai-box { margin-top:12px; }
.ai-btn { padding:10px 16px; background:#1e293b; color:#fff; border:none; border-radius:11px; font-family:inherit; font-size:13px; font-weight:800; cursor:pointer; }
.ai-btn:disabled { opacity:.6; }
.ai-out { margin-top:10px; }
.ai-loading { font-size:12.5px; color:#475569; font-weight:700; }
.ai-result { font-size:13px; color:#1e293b; line-height:1.9; background:#f0fdf4; border:1px solid #bbf7d0; border-radius:11px; padding:12px; white-space:pre-wrap; }
.ai-error { font-size:12px; color:#b91c1c; background:#fef2f2; border:1px solid #fecaca; border-radius:10px; padding:10px; }

/* Bulk import */
.import-box { background:#fff; border:2px dashed #c7d2fe; border-radius:18px; padding:20px; margin-bottom:24px; }
.import-head { font-size:15px; font-weight:900; color:var(--indigo); margin-bottom:8px; }
.import-note { font-size:11.5px; color:#475569; margin-bottom:12px; line-height:1.9; }
.import-note code { background:#f1f5f9; padding:1px 5px; border-radius:5px; font-size:10.5px; direction:ltr; display:inline-block; }
.import-file { font-size:11px; margin-bottom:10px; }
#importText { width:100%; padding:12px; border:2px solid #e2e8f0; border-radius:12px; font-family:inherit; font-size:13px; resize:vertical; direction:rtl; }
#importText:focus { outline:none; border-color:var(--indigo); }
#importBtn { margin-top:10px; padding:11px; background:var(--emerald); color:#fff; border:none; border-radius:12px; font-family:inherit; font-size:14px; font-weight:800; cursor:pointer; }
#importBtn:active { transform:scale(.98); }
.import-msg { margin-top:10px; font-size:12.5px; font-weight:700; min-height:18px; }
.foot a { color:var(--indigo); text-decoration:none; }
.foot a:hover { text-decoration:underline; }
