:root { --navy:#102D50; --gold:#D5AD60; --blue:#102D50; --green:#0e9f6e; --red:#e02424; --bg:#f7f5f0; --card:#fff; --ink:#1f2937; }
* { box-sizing: border-box; margin: 0; }
body { font-family: 'Cairo', 'Inter', 'Segoe UI', Tahoma, sans-serif; background: var(--bg); color: var(--ink); min-height: 100vh; display: flex; flex-direction: column; }
[dir="ltr"] body, body.ltr { direction: ltr; }
.topbar { background: var(--navy); border-bottom: 3px solid var(--gold); color: #fff; padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; }
.brand { font-size: 18px; font-weight: 700; }
.top-actions { display: flex; gap: 8px; }
main { flex: 1; max-width: 860px; width: 100%; margin: 18px auto; padding: 0 14px; }
.foot { text-align: center; color: #6b7280; font-size: 12px; padding: 14px; }
.card { background: var(--card); border-radius: 14px; padding: 18px; margin-bottom: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.btn { background: var(--blue); color: #fff; border: 0; border-radius: 10px; padding: 11px 20px; font-size: 15px; cursor: pointer; font-family: inherit; }
.btn.ghost { background: rgba(255,255,255,.18); }
.btn.small { padding: 7px 14px; font-size: 13px; }
.btn.green { background: var(--green); }
.btn.gold { background: var(--gold); color: #102D50; }
.feedback.neutral { background: #e8eef5; color: #374151; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; margin-top: 10px; }
.hidden { display: none !important; }
.loading { text-align: center; padding: 60px; color: #6b7280; }
input[type=text], input[type=password], input[type=tel], input[type=number], textarea { width: 100%; padding: 12px; border: 1.5px solid #d1d5db; border-radius: 10px; font-size: 15px; margin-top: 6px; font-family: inherit; }
label { font-size: 14px; font-weight: 600; display: block; margin-top: 12px; }
.error { background: #fde8e8; color: var(--red); padding: 10px 14px; border-radius: 10px; margin-top: 12px; font-size: 14px; }
.notice { background: #fdf6b2; color: #8a6d00; padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; line-height: 1.6; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tile { background: var(--card); border-radius: 14px; padding: 18px; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.08); transition: transform .12s; border: 2px solid transparent; }
.tile:hover { transform: translateY(-2px); border-color: var(--blue); }
.tile h3 { font-size: 16px; margin-bottom: 6px; }
.tile .meta { font-size: 13px; color: #6b7280; }
.back { background: none; border: 0; color: var(--blue); font-size: 14px; cursor: pointer; margin-bottom: 10px; font-family: inherit; }
.passage { background: #eef4ff; border-radius: 10px; padding: 14px; margin: 10px 0; line-height: 1.9; font-size: 15px; direction: ltr; text-align: left; }
.qtext { font-size: 16px; font-weight: 600; margin: 12px 0 8px; direction: ltr; text-align: left; line-height: 1.7; }
.opt { display: block; width: 100%; text-align: left; direction: ltr; background: #f9fafb; border: 1.5px solid #e5e7eb; border-radius: 10px; padding: 11px 14px; margin: 6px 0; font-size: 15px; cursor: pointer; font-family: inherit; }
.opt.sel { border-color: var(--blue); background: #eef4ff; }
.opt.correct { border-color: var(--green); background: #def7ec; }
.opt.wrong { border-color: var(--red); background: #fde8e8; }
.feedback { border-radius: 10px; padding: 12px 14px; margin-top: 10px; font-size: 14px; line-height: 1.8; }
.feedback.good { background: #def7ec; }
.feedback.bad { background: #fde8e8; }
.dialogue-line { direction: ltr; text-align: left; padding: 4px 0; font-size: 15px; }
.progressbar { background: #e5e7eb; border-radius: 8px; height: 10px; overflow: hidden; margin-top: 8px; }
.progressbar > div { background: var(--green); height: 100%; }
.score-big { font-size: 34px; font-weight: 800; text-align: center; margin: 14px 0; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tab { padding: 8px 16px; border-radius: 20px; border: 1.5px solid #d1d5db; background: #fff; cursor: pointer; font-size: 14px; font-family: inherit; }
.tab.on { background: var(--navy); color: #fff; border-color: var(--gold); border-bottom: 3px solid var(--gold); }
.timer { font-weight: 700; color: var(--red); }
.badge { display: inline-block; background: #eef4ff; color: var(--blue); border-radius: 8px; padding: 2px 10px; font-size: 12px; margin-inline-start: 6px; }
.gap-in { width: 130px; display: inline-block; padding: 4px 8px; margin: 0 4px; border: 0; border-bottom: 2px solid var(--blue); border-radius: 4px; background: #eef4ff; font-size: 14px; }
.gap-in { width: 140px !important; max-width: 40%; }
.tile.pending { opacity: .75; cursor: default; border-style: dashed; }
.tile.pending h3 { color: #5a6b80; }
.rowline { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #eee; }
.rowline:last-child { border-bottom: 0; }
.btn.danger { background: #a33; }
bdir { direction: ltr; unicode-bidi: embed; }
.row{display:flex;align-items:center;gap:10px;justify-content:space-between}
.row.spread{margin-bottom:10px}
.center{text-align:center}
.big{font-size:2rem;font-weight:700;color:#102D50}
.qprompt{font-weight:600;margin:8px 0 12px;color:#102D50}
.opts{display:flex;flex-direction:column;gap:8px}
.opt:disabled{opacity:1;cursor:default;color:#33415c;background:#f4f6f9}
select.gap-sel { max-width: 180px; padding: 3px 6px; border: 1.5px solid #102D50; border-radius: 8px; background: #fff; font-family: inherit; }
.library-filters { display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:10px; }
.library-filters select,input[type=search] { width:100%;padding:10px;border:1.5px solid #d1d5db;border-radius:10px;font:inherit;background:#fff; }
.library-check { display:flex;align-items:center;gap:8px; }
.library-actions { display:flex;gap:8px;flex-wrap:wrap;margin:12px 0; }
.library-word { display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin:12px 0; }
.library-word h3 { font-size:23px; }
.library-meaning { font-size:21px;line-height:1.9;margin:14px 0; }
.library-match { display:grid;grid-template-columns:1fr 1fr;gap:10px;direction:ltr; }
.library-match .opt { min-height:65px;word-break:break-word;text-align:center;padding:8px; }
.authoring select { width:100%;max-width:100%;padding:10px;border:1.5px solid #d1d5db;border-radius:10px;background:#fff;font:inherit;margin-top:6px; }
.authoring input[type=number] { width:100%;padding:12px;border:1.5px solid #d1d5db;border-radius:10px;font:inherit;margin-top:6px; }
.author-form { border-top:2px solid #D5AD60;padding-top:18px;margin-top:18px; }
.author-form textarea { resize:vertical;min-height:100px; }
.author-row { flex-wrap:wrap;overflow-wrap:anywhere; }
.author-row > div { min-width:0;flex:1 1 170px; }
