@font-face { font-family: "Tajawal"; src: url("/fonts/Tajawal/Tajawal-Regular.ttf"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Tajawal"; src: url("/fonts/Tajawal/Tajawal-Bold.ttf"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Cairo"; src: url("/fonts/Cairo/Cairo-Bold.ttf"); font-weight: 700; font-display: swap; }

:root {
  --bg: #f6f7fb; --card: #ffffff; --text: #1b2333; --muted: #6b7280; --primary: #1f6f8b; --accent: #e76f51;
  --ok: #2e9e5b; --warn: #b7791f; --err: #d64545; --line: #e5e7eb; --radius: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Tajawal", "Geeza Pro", Tahoma, Arial, sans-serif; font-size: 17px; line-height: 1.6; }
h1, h2, h3 { font-family: "Cairo", "Tajawal", Tahoma, sans-serif; margin: 0 0 .5em; }
a { color: var(--primary); text-decoration: none; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; font-size: 1.2rem; color: var(--text); }
.top nav { display: flex; gap: 18px; align-items: center; }
.inline { display: inline; }
button.link { background: none; border: 0; color: var(--primary); font: inherit; cursor: pointer; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; box-shadow: 0 2px 10px rgba(16,24,40,.04); }
.hero h1 { font-size: 1.6rem; }
.hero p { color: var(--muted); margin-top: 0; }
.drop { border: 2px dashed #c7d2e0; border-radius: var(--radius); padding: 22px; text-align: center; background: #fbfcff; cursor: pointer; transition: .2s; }
.drop:hover, .drop.over { border-color: var(--primary); background: #eef6fa; }
.drop input { display: none; }
.drop .big { font-size: 2.2rem; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.files .chip { background: #eef2f7; border-radius: 999px; padding: 4px 12px; font-size: .9rem; }
textarea, input[type=text], input[type=password] { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font: inherit; background: #fff; }
textarea { min-height: 80px; resize: vertical; }
.btn { display: inline-block; background: var(--primary); color: #fff; border: 0; border-radius: 12px; padding: 12px 22px; font: inherit; font-weight: 700; cursor: pointer; }
.btn.secondary { background: #eef2f7; color: var(--text); }
.btn.accent { background: var(--accent); }
.btn.danger { background: #fff; color: var(--err); border: 1px solid var(--err); }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.space { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .85rem; background: #eef2f7; }
.badge.ok { background: #e6f6ec; color: var(--ok); }
.badge.err { background: #fdeaea; color: var(--err); }
.badge.run { background: #fff5e6; color: var(--warn); }
.lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.lesson { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--text); }
.lesson h3 { font-size: 1.05rem; margin-bottom: 4px; }
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; }
.msg.user { background: #e8f1f5; align-self: flex-start; border-bottom-right-radius: 4px; }
.msg.assistant { background: #f3f4f6; align-self: flex-end; border-bottom-left-radius: 4px; }
.progress { display: flex; align-items: center; gap: 12px; padding: 14px; background: #fff8ec; border-radius: 12px; }
.spinner { width: 22px; height: 22px; border: 3px solid #f1c27d; border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.thumbs img { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.prep-preview img { width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.downloads { display: flex; gap: 12px; flex-wrap: wrap; margin: 10px 0 4px; }
.warn { background: #fff8ec; border-right: 4px solid var(--warn); padding: 8px 12px; border-radius: 8px; font-size: .92rem; }
.error { background: #fdeaea; border-right: 4px solid var(--err); padding: 10px 14px; border-radius: 8px; }
.login { max-width: 420px; margin: 60px auto; }
.pages-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.pages-strip img { height: 110px; border-radius: 8px; border: 1px solid var(--line); }
details summary { cursor: pointer; color: var(--primary); }
pre.json { direction: ltr; text-align: left; font-size: .8rem; background: #f8fafc; padding: 12px; border-radius: 8px; overflow: auto; max-height: 420px; }
@media (max-width: 600px) { body { font-size: 16px; } .wrap { padding: 12px 10px 50px; } .msg { max-width: 100%; } }
