:root { --bg:#f3f5f9; --card:#fff; --ink:#1c2430; --muted:#6b7686; --line:#dde2ea; --pri:#2457d6; --ok:#17803d; --bad:#c62828; --warn:#b26a00; }
* { box-sizing: border-box; }
body { margin:0; background:var(--bg); color:var(--ink); font:16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.wrap { max-width: 860px; margin: 0 auto; padding: 16px; }
.wrap.wide { max-width: 1180px; }
h1 { font-size: 1.4rem; margin: 0 0 12px; } h2 { font-size: 1.15rem; margin: 0 0 10px; } h3 { margin: 0 0 8px; }
.card { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:16px; margin-bottom:14px; }
.hidden { display:none !important; }
.muted { color:var(--muted); } .msg { min-height:1.2em; margin:8px 0 0; } .msg.bad { color:var(--bad); } .msg:not(.bad) { color:var(--ok); }
label { display:block; margin:10px 0; font-weight:600; }
input, select, textarea { width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:8px; font:inherit; background:#fff; color:var(--ink); margin-top:4px; }
input[type=radio], input[type=checkbox] { width:auto; margin:0 8px 0 0; }
textarea.code, .mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size:14px; line-height:1.45; tab-size:4; white-space:pre; }
button { padding:10px 16px; border:1px solid var(--line); border-radius:8px; background:#fff; font:inherit; cursor:pointer; color:var(--ink); }
button:hover { background:#f0f3f8; } button:disabled { opacity:.5; cursor:not-allowed; }
button.primary { background:var(--pri); border-color:var(--pri); color:#fff; } button.primary:hover { background:#1c47b3; }
button.danger { color:var(--bad); border-color:#e7b4b4; } button.small { padding:5px 10px; font-size:.9rem; }
.radio { display:flex; align-items:flex-start; font-weight:400; padding:8px 10px; border:1px solid var(--line); border-radius:8px; margin:6px 0; cursor:pointer; }
.namelist { max-height:320px; overflow:auto; margin:8px 0 12px; }
.topbar { position:sticky; top:0; z-index:5; display:flex; justify-content:space-between; align-items:center; background:#fff; border:1px solid var(--line); border-radius:12px; padding:10px 14px; margin-bottom:14px; }
.topright { text-align:right; } .timer { font-size:1.5rem; font-weight:700; font-variant-numeric:tabular-nums; } .timer.warn { color:var(--bad); }
.q .qhead { display:flex; justify-content:space-between; color:var(--muted); margin-bottom:6px; } .qtext { white-space:pre-wrap; margin-bottom:10px; user-select:none; }
.overlay { position:fixed; inset:0; background:rgba(15,20,30,.78); display:flex; align-items:center; justify-content:center; z-index:50; padding:16px; } .overlay .card { max-width:480px; }
.result { text-align:center; } .bigGrade { font-size:4rem; font-weight:800; color:var(--pri); line-height:1.1; }
hr { border:0; border-top:1px solid var(--line); margin:16px 0; }

/* Paneli i profesorit */
.nav { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; align-items:center; } .nav .sp { flex:1; }
.nav button.active { background:var(--pri); color:#fff; border-color:var(--pri); }
table { width:100%; border-collapse:collapse; background:#fff; } th, td { text-align:left; padding:8px 10px; border-bottom:1px solid var(--line); vertical-align:top; } th { background:#f7f9fc; font-size:.9rem; }
tr.click { cursor:pointer; } tr.click:hover { background:#f5f8ff; }
.chip { display:inline-block; padding:2px 9px; border-radius:999px; font-size:.82rem; background:#eef1f6; } .chip.ok { background:#e2f4e8; color:var(--ok); } .chip.bad { background:#fbe3e3; color:var(--bad); } .chip.warn { background:#fff0d9; color:var(--warn); }
.row { display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end; } .row > * { flex:1; min-width:140px; } .row > .fit { flex:0 0 auto; min-width:0; }
.qedit { border:1px solid var(--line); border-radius:10px; padding:12px; margin-bottom:12px; background:#fbfcfe; }
.case { border-left:4px solid var(--line); padding:6px 10px; margin:6px 0; background:#fafbfc; } .case.ok { border-color:var(--ok); } .case.no { border-color:var(--bad); }
pre { margin:4px 0; padding:8px; background:#f1f4f9; border-radius:6px; overflow:auto; white-space:pre-wrap; font-size:13px; }
.pointsbox { width:90px; display:inline-block; }
canvas#card { max-width:100%; height:auto; border:1px solid var(--line); border-radius:8px; }
@media (max-width:600px) { .wrap { padding:10px; } .timer { font-size:1.2rem; } }

.codeblk { background:#f1f4f9; border:1px solid var(--line); border-radius:8px; padding:10px 12px; margin:8px 0; overflow:auto; white-space:pre; tab-size:4;
  font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size:14px; line-height:1.45; }
.livebox { border-left:4px solid var(--warn); }
.thread { margin:6px 0; padding:8px 10px; border-radius:8px; background:#f7f9fc; white-space:pre-wrap; }
.thread.reply { background:#e8f3ff; margin-left:24px; }

/* Pyetje interaktive */
.slotcode { white-space:pre; line-height:2; }
.slot { display:inline-block; min-width:64px; padding:0 8px; border:2px dashed #8aa0d6; border-radius:6px; background:#f3f6ff; color:#8a96ab; cursor:pointer; text-align:center; white-space:pre; }
.slot.filled { border-style:solid; border-color:var(--pri); background:#e8efff; color:var(--ink); }
.slot.over { background:#d6e4ff; }
.bank { display:flex; flex-wrap:wrap; gap:8px; margin:10px 0 4px; }
.chipx { padding:6px 12px; border:1px solid #9bb0e6; border-radius:8px; background:#fff; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size:14px; cursor:grab; user-select:none; }
.chipx.sel { outline:3px solid var(--pri); background:#e8efff; }
.chipx.used { opacity:.28; cursor:default; }
.matchrows .mrow { display:flex; align-items:center; gap:10px; margin:6px 0; flex-wrap:wrap; } .mleft { font-weight:600; min-width:140px; } .arr { color:var(--muted); }
.inlcode { white-space:pre-wrap; line-height:2.2; }
input.inl { display:inline-block; width:auto; min-width:70px; margin:0 2px; padding:2px 6px; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size:14px; border:2px solid var(--pri); border-radius:6px; }
.ordl { list-style:none; padding:0; margin:6px 0; }
.ordl li { display:flex; justify-content:space-between; align-items:center; gap:8px; padding:6px 10px; margin:4px 0; border:1px solid var(--line); border-radius:8px; background:#fbfcfe; cursor:grab; }
.ordtxt { white-space:pre; overflow:auto; }
.ordbtn { white-space:nowrap; }

/* ===== Pamje më e gjallë ===== */
:root { --bg:#eef2fb; --pri:#5b3fd6; --pri2:#2b7bf0; --acc:#ff8a3d; --ok:#12915a; --bad:#d63b3b; }
body { background: linear-gradient(160deg,#eaf1ff 0%,#f6efff 45%,#fff3e8 100%) fixed; }
h1, h2 { color:#2a2370; }
.card { border:1px solid #e1e6f6; box-shadow:0 2px 10px rgba(60,50,150,.07); border-radius:14px; }
button { transition:transform .08s, box-shadow .15s, background .15s; }
button:active { transform:scale(.97); }
button.primary { background:linear-gradient(135deg,var(--pri),var(--pri2)); border:0; color:#fff; box-shadow:0 3px 10px rgba(70,70,220,.3); }
button.primary:hover { background:linear-gradient(135deg,#4a30c0,#1f68dc); }
.topbar { background:linear-gradient(135deg,#5b3fd6,#2b7bf0); color:#fff; border:0; box-shadow:0 4px 14px rgba(60,60,200,.3); }
.topbar small { color:#dfe6ff; } .timer { color:#fff; } .timer.warn { color:#ffe08a; animation:pulse 1s infinite; }
@keyframes pulse { 50% { opacity:.55; } }
.q { border-left:6px solid var(--pri); }
.q.t-mcq { border-left-color:#2b7bf0; } .q.t-tf { border-left-color:#17a2b8; } .q.t-fill { border-left-color:#12915a; }
.q.t-open { border-left-color:#8e5bd6; } .q.t-code { border-left-color:#e0562f; } .q.t-drag { border-left-color:#ff8a3d; }
.q.t-inline { border-left-color:#d6409f; } .q.t-order { border-left-color:#c79a00; } .q.t-match { border-left-color:#0aa37f; }
.qnum { display:inline-flex; align-items:center; justify-content:center; width:2rem; height:2rem; border-radius:50%; background:var(--pri); color:#fff; margin-right:6px; }
.ttag { display:inline-block; padding:2px 10px; border-radius:999px; background:#ece8ff; color:#4a30c0; font-size:.82rem; font-weight:600; }
.q .pts { background:#fff1e3; color:#b85a00; padding:2px 10px; border-radius:999px; font-weight:600; font-size:.85rem; height:fit-content; }
.howto { background:#fff9e0; border:1px solid #f1dc8a; color:#6b5300; border-radius:8px; padding:7px 11px; margin:0 0 10px; font-size:.92rem; }
.guide { background:#f3f0ff; border:1px solid #d9d0ff; border-radius:12px; padding:10px 16px; margin:12px 0; }
.guide ul { padding-left:18px; } .guide li { margin:6px 0; }
.radio:hover { background:#f1f5ff; border-color:#9bb5f5; }
.radio:has(input:checked) { background:#e6eeff; border-color:var(--pri2); box-shadow:inset 0 0 0 1px var(--pri2); }
.nav button.active { background:linear-gradient(135deg,var(--pri),var(--pri2)); border:0; }
th { background:#efeaff; color:#3a2d99; }
tr.click:hover { background:#f3efff; }
.chip.ok { background:#d8f5e6; } .chip.warn { background:#ffe9c7; }
#overlay .card { border-top:6px solid var(--bad); }
.bigGrade { background:linear-gradient(135deg,var(--pri),var(--acc)); -webkit-background-clip:text; background-clip:text; color:transparent; }

/* ===== Përgjigjet e nxënësit dhe shenjat e profesorit ===== */
.ans { white-space:pre-wrap; color:#1a4fd1; background:#f3f7ff; border:1px solid #d3e0ff; border-radius:8px; padding:8px 10px; margin:4px 0; user-select:text; cursor:text; line-height:1.7; }
.ans.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size:14px; }
.ans .bad { text-decoration:underline; text-decoration-color:#d32f2f; text-decoration-thickness:3px; text-underline-offset:3px; background:rgba(211,47,47,.10); }
.m-hy { background:#fff176 !important; } .m-hg { background:#a5e8b5 !important; } .m-ho { background:#ffcc80 !important; } .m-hb { background:#a9d1ff !important; }
.m-ul { text-decoration:underline; text-decoration-color:#d32f2f; text-decoration-thickness:3px; text-underline-offset:3px; }
.m-st { text-decoration:line-through; text-decoration-color:#d32f2f; text-decoration-thickness:2px; }
.m-ul.m-st { text-decoration:underline line-through; }
.annbar { position:sticky; top:0; z-index:6; display:flex; gap:6px; flex-wrap:wrap; align-items:center; background:#fff; border:1px solid var(--line); border-radius:10px; padding:8px 10px; margin-bottom:12px; box-shadow:0 2px 8px rgba(0,0,0,.08); }
.annbtn.on { outline:3px solid var(--pri); }
button.annbtn.m-ul, button.annbtn.m-st { background:#fff; }


/* Organizimi i temave dhe kontrollet e tabelave */
.topic-select { min-width: 150px; max-width: 220px; }
.topic-item:last-child { border-bottom: 0 !important; }
@media (max-width: 760px) {
  .topic-select { min-width: 120px; width: 100%; }
  .topic-item .row { align-items: flex-start; flex-wrap: wrap; }
}

/* Sesionet: variante me titull dhe metadhenat e temes */
.radio small { display:block; font-size:.82rem; margin-top:2px; }
#s-sync-msg { margin-bottom:8px; }

@media print { body * { display: none !important; } body::before { content: "Printimi është i ndaluar."; display: block; font: 700 24px Arial; padding: 40px; } }
#s-test { -webkit-touch-callout: none; }

/* ===== Ridizajn: ndërfaqe e pastër, e qëndrueshme dhe responsive ===== */
:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --card: #ffffff;
  --ink: #172338;
  --muted: #64748b;
  --line: #dce4ef;
  --pri: #2457c5;
  --pri2: #3975e8;
  --acc: #e88932;
  --ok: #16845b;
  --bad: #c13b46;
  --warn: #a96b12;
  --shadow: 0 8px 24px rgba(27, 48, 83, .07);
}
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}
.wrap { max-width: 900px; padding: clamp(12px, 2.4vw, 28px); }
.wrap.wide { max-width: 1280px; }
h1, h2, h3 { color: #182c4d; letter-spacing: -.025em; line-height: 1.25; }
h1 { font-size: clamp(1.35rem, 2.4vw, 1.8rem); }
h2 { font-size: 1.2rem; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: clamp(14px, 2.3vw, 24px); margin-bottom: 16px; box-shadow: var(--shadow);
}
input, select, textarea {
  border: 1px solid #cbd6e5; border-radius: 10px; background: #fff; color: var(--ink);
  padding: 11px 12px; transition: border-color .15s, box-shadow .15s;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 3px solid rgba(57, 117, 232, .25); outline-offset: 2px; border-color: var(--pri2);
}
button {
  min-height: 42px; border-radius: 10px; border-color: #cbd6e5; font-weight: 650;
  transition: background .15s, border-color .15s, transform .1s;
}
button:active { transform: translateY(1px); }
button.primary { background: var(--pri); border: 1px solid var(--pri); box-shadow: none; }
button.primary:hover { background: #1d489f; }
button.danger { color: var(--bad); }
.nav { gap: 7px; margin-bottom: 18px; }
.nav button { background: #fff; border-color: var(--line); }
.nav button.active { background: var(--pri); color: #fff; border-color: var(--pri); }
.topbar {
  top: 8px; border-radius: 14px; padding: 14px 18px; gap: 16px;
  background: #17355f; box-shadow: 0 8px 22px rgba(19, 48, 89, .18);
}
.topbar small { color: #d7e5fb; }
.timer { font-size: clamp(1.2rem, 3vw, 1.65rem); font-variant-numeric: tabular-nums; }
.q { border-left-width: 4px; }
.q .qhead { align-items: center; gap: 8px; }
.qtext { line-height: 1.7; }
.qnum { flex: 0 0 auto; }
.radio { padding: 10px 12px; border-color: #dbe4f0; background: #fff; }
.radio:has(input:checked) { background: #eef4ff; border-color: var(--pri2); box-shadow: inset 0 0 0 1px var(--pri2); }
.guide { background: #f5f8ff; border-color: #dce7fb; }
.ttag { background: #eaf1ff; color: #234b9d; }
table { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
th { background: #edf3fb; color: #29446d; }
th, td { padding: 10px 12px; }
pre, .codeblk { background: #f5f7fb; border-color: #dfe6f0; border-radius: 10px; }
.msg { font-size: .93rem; }
.overlay { backdrop-filter: blur(4px); }
.overlay .card { width: min(100%, 520px); }
#cp-out { min-height: 64px; max-height: 300px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .wrap, .wrap.wide { padding: 10px; }
  .card { border-radius: 13px; padding: 14px; }
  .topbar { top: 4px; padding: 10px 12px; }
  .row { align-items: stretch; }
  .row > * { min-width: min(100%, 160px); }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav button { width: 100%; }
  .bank { gap: 6px; }
  .chipx { max-width: 100%; overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.chk { display:inline-flex; align-items:center; gap:6px; margin:0 12px 6px 0; font-weight:400; }
.chk input { width:auto; }
#ws-sel { width:auto; min-width:150px; }

#s-test { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
#s-test textarea, #s-test input, #s-test .cm-editor { -webkit-user-select: text; user-select: text; }
