:root {
  --bg: #f4efe4;
  --bg2: #ebe3d1;
  --card: #fffdf7;
  --ink: #2b2340;
  --muted: #6d6585;
  --line: #ddd3bd;
  --brand: #5b3fd1;
  --brand-2: #7c63ea;
  --brand-ink: #ffffff;
  --gold: #e3a21a;
  --gold-soft: #fbefcf;
  --ok: #1f9d55;
  --ok-soft: #dcf5e6;
  --bad: #d13c3c;
  --bad-soft: #fde2e2;
  --warn: #c77700;
  --warn-soft: #fff0d6;
  --boss: #8f1d2c;
  --k-red: #e21b3c;
  --k-blue: #1368ce;
  --k-yellow: #d89e00;
  --k-green: #26890c;
  --shadow: 0 2px 0 rgba(43, 35, 64, .08), 0 8px 24px rgba(43, 35, 64, .08);
  --radius: 16px;
  --font: 'Open Sans', Arial, Helvetica, sans-serif;
  --display: 'Montserrat', 'Open Sans', Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17142a; --bg2: #1f1b38; --card: #262143; --ink: #f1edff; --muted: #a9a2c6; --line: #3a3460;
    --brand: #8f7bff; --brand-2: #a796ff; --gold: #f2b93b; --gold-soft: #3d3218; --ok: #3ccf7a; --ok-soft: #173826;
    --bad: #ff6b6b; --bad-soft: #43212a; --warn: #ffb547; --warn-soft: #3d2f17; --boss: #ff5d73;
    --shadow: 0 2px 0 rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17142a; --bg2: #1f1b38; --card: #262143; --ink: #f1edff; --muted: #a9a2c6; --line: #3a3460;
  --brand: #8f7bff; --brand-2: #a796ff; --gold: #f2b93b; --gold-soft: #3d3218; --ok: #3ccf7a; --ok-soft: #173826;
  --bad: #ff6b6b; --bad-soft: #43212a; --warn: #ffb547; --warn-soft: #3d2f17; --boss: #ff5d73;
  --shadow: 0 2px 0 rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; min-height: 100vh; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
.display { font-family: var(--display); letter-spacing: -.01em; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 10px 18px;
  background: var(--brand); color: var(--brand-ink); font-weight: 800; cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.18);
  transition: transform .08s, filter .15s; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.18); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.gold { background: var(--gold); color: #2b1d00; }
.btn.ok { background: var(--ok); }
.btn.danger { background: var(--bad); }
.btn.sm { padding: 6px 12px; font-size: .875rem; border-radius: 10px; }
.btn.icon { padding: 6px 10px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--bg2); font-size: .8rem; font-weight: 700; white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.gold { background: var(--gold-soft); color: var(--warn); }
.chip.brand { background: var(--brand); color: #fff; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 700; font-size: .875rem; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=email], input[type=datetime-local], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--line); background: var(--card); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
textarea { min-height: 100px; resize: vertical; }

.bar { height: 10px; background: var(--bg2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: inherit; transition: width .4s; }
.bar.gold > i { background: linear-gradient(90deg, var(--gold), #f7d36b); }
.bar.ok > i { background: var(--ok); }

/* toast + modal */
#toasts { position: fixed; z-index: 100; left: 50%; top: 16px; transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-weight: 700; box-shadow: var(--shadow); animation: pop .25s ease-out; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.gold { background: var(--gold); color: #2b1d00; }
@keyframes pop { from { transform: translateY(-10px) scale(.96); opacity: 0; } }
.modal-bg { position: fixed; inset: 0; background: rgba(15, 10, 30, .55); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { width: min(760px, 100%); background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 24px; animation: pop .2s ease-out; position: relative; }
.modal.wide { width: min(980px, 100%); }
.modal .close { position: absolute; right: 14px; top: 14px; }
/* súgó: kérdőjel gomb + lapozható lépések */
.help-btn { display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 2px solid var(--brand);
  background: transparent; color: var(--brand); font: 800 15px/1 var(--font); cursor: pointer; vertical-align: middle;
  margin-left: 8px; flex-shrink: 0; transition: background .15s, color .15s; }
.help-btn:hover, .help-btn:focus-visible { background: var(--brand); color: #fff; }
h1 .help-btn, h2 .help-btn { position: relative; top: -2px; }
.modal.help-modal { width: min(460px, 100%); padding-top: 20px; }
.help-title { font-weight: 800; color: var(--muted); margin-right: 40px; text-transform: uppercase; letter-spacing: .04em; }
.help-step { min-height: 190px; text-align: center; padding: 6px 4px 0; }
.help-step .help-ic { font-size: 2.8rem; line-height: 1; margin: 12px 0 8px; }
.help-step h3 { margin: 0 0 8px; }
.help-step .help-txt { color: var(--ink); line-height: 1.55; }
.help-step .help-txt p { margin: 0 0 8px; }
.help-dots { display: flex; justify-content: center; gap: 8px; margin: 14px 0 12px; }
.help-dots button { width: 9px; height: 9px; border-radius: 50%; border: 0; padding: 0; background: var(--line); cursor: pointer; transition: width .2s, background .2s; }
.help-dots button.on { width: 24px; border-radius: 6px; background: var(--brand); }
.help-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* markdown */
.md h1 { font-family: var(--display); font-size: 1.7rem; }
.md h2 { font-size: 1.25rem; margin-top: 1.2em; }
.md h3 { font-size: 1.05rem; margin-top: 1em; }
.md p { margin: .6em 0; }
.md code { background: var(--bg2); padding: 1px 6px; border-radius: 6px; font-size: .95em; }
.md blockquote { margin: 1em 0; padding: 10px 14px; background: var(--gold-soft); border-left: 4px solid var(--gold); border-radius: 8px; }
.md table { border-collapse: collapse; margin: .8em 0; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 14px; }
.md th { background: var(--bg2); }
.md img { max-width: 100%; border-radius: 10px; }
.md ul, .md ol { padding-left: 1.4em; }

/* login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(circle at 20% 10%, rgba(124,99,234,.25), transparent 40%), radial-gradient(circle at 90% 90%, rgba(227,162,26,.22), transparent 40%), var(--bg); }
.login-card { width: min(460px, 100%); }
.logo { font-family: var(--display); font-size: 2.1rem; font-weight: 800; letter-spacing: -.02em; text-align: center; margin-bottom: 4px; }
.logo span { color: var(--gold); }
.tabs { display: flex; gap: 4px; background: var(--bg2); padding: 4px; border-radius: 12px; margin-bottom: 18px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.err { color: var(--bad); font-weight: 700; min-height: 1.5em; }
.demo { margin-top: 16px; font-size: .85rem; background: var(--bg2); border-radius: 12px; padding: 10px 14px; }
.demo button { border: 0; background: none; color: var(--brand); font-weight: 800; cursor: pointer; padding: 0; text-decoration: underline; }

@media (max-width: 640px) {
  .card { padding: 16px; }
  .modal { padding: 18px; }
}

/* ================================================================
   Megjelenítés-választó (világos / rendszer / sötét)
   ================================================================ */
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font-weight: 800; font-size: .875rem; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.login-top { position: fixed; top: calc(12px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); left: calc(12px + env(safe-area-inset-left));
  display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; z-index: 5; }
@media (max-width: 640px) {
  .login-top { position: static; justify-content: center; margin-bottom: 12px; }
  .login-page { align-content: start; }
  .seg button span:last-child { display: none; }
  .modal .seg button span:last-child { display: inline; }
}

/* ================================================================
   Platform- és eszközfüggő elrendezés (a boot.js állítja be:
   data-platform = macos | windows | ios | android | linux | other,
   data-device = phone | tablet | desktop, data-input = touch | mouse)
   ================================================================ */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { min-height: 100vh; min-height: 100dvh; }
.login-page { min-height: 100vh; min-height: 100dvh;
  padding: calc(24px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)); }
.wrap { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
#toasts { top: calc(16px + env(safe-area-inset-top)); }

/* Apple: finomabb betűsimítás */
html[data-platform="macos"] body, html[data-platform="ios"] body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* Windows (és Linux): a vastag rendszer-görgetősávok helyett vékony, témához illő sávok */
html[data-platform="windows"], html[data-platform="linux"] { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
html[data-platform="windows"] ::-webkit-scrollbar, html[data-platform="linux"] ::-webkit-scrollbar { width: 10px; height: 10px; }
html[data-platform="windows"] ::-webkit-scrollbar-thumb, html[data-platform="linux"] ::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 2px solid var(--bg); }
html[data-platform="windows"] ::-webkit-scrollbar-track { background: transparent; }

/* Érintőképernyő: nagyobb érintési felületek (iOS: 44pt, Android: 48dp), nincs „ragadós” hover */
html[data-input="touch"] .btn { min-height: 44px; }
html[data-input="touch"] .btn.sm { min-height: 40px; }
html[data-platform="android"] .btn { min-height: 48px; }
html[data-platform="android"] .btn.sm { min-height: 40px; }
html[data-input="touch"] input[type=text], html[data-input="touch"] input[type=password], html[data-input="touch"] input[type=number],
html[data-input="touch"] select { min-height: 46px; }
/* iOS-en a 16px alatti beviteli mező ráközelít – ezt elkerüljük */
html[data-platform="ios"] input, html[data-platform="ios"] select, html[data-platform="ios"] textarea { font-size: max(16px, 1em); }
@media (hover: none) {
  .btn:hover { filter: none; }
}

/* Telefonon az ablakok alulról felcsúszó lapként jelennek meg */
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
@media (max-width: 640px) {
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-height: 92vh; max-height: 92dvh; overflow-y: auto; border-radius: 22px 22px 0 0;
    padding: 26px max(18px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    animation: sheet .25s ease-out; }
  .modal::before { content: ''; position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
  html[data-platform="android"] .modal { border-radius: 28px 28px 0 0; }
}

/* Alsó navigációs sáv (diák és tanár) – telefonon és keskeny ablakban */
.ni { font-size: 1.05em; }
@media (max-width: 640px) {
  .bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; justify-content: space-around; gap: 2px;
    padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 20px rgba(0,0,0,.08); }
  .bottom-nav a { flex: 1; display: flex !important; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px !important;
    font-size: .72rem; font-weight: 800; border-radius: 12px; color: var(--muted) !important; background: none !important; min-height: 52px; justify-content: center; }
  .bottom-nav a .ni { font-size: 1.35rem; line-height: 1.2; padding: 2px 16px; border-radius: 16px; transition: background .2s; }
  .bottom-nav a.on { color: var(--brand) !important; }
  /* iOS: áttetsző, elmosott sáv (mint a natív tab bar) */
  html[data-platform="ios"] .bottom-nav { background: color-mix(in srgb, var(--card) 78%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); box-shadow: none; }
  /* Android (Material): kiemelő „pirula” az aktív ikon mögött */
  html[data-platform="android"] .bottom-nav { min-height: 72px; box-shadow: 0 -1px 0 var(--line); }
  html[data-platform="android"] .bottom-nav a.on { color: var(--ink) !important; }
  html[data-platform="android"] .bottom-nav a.on .ni { background: color-mix(in srgb, var(--brand) 28%, transparent); }
  html:not([data-platform="ios"]):not([data-platform="android"]) .bottom-nav a.on .ni { background: color-mix(in srgb, var(--brand) 18%, transparent); }
  body.has-bottom-nav main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  body.has-bottom-nav #toasts { top: calc(16px + env(safe-area-inset-top)); }
}
.nav a, .t-nav a { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 640px) {
  .btn { white-space: normal; text-align: center; }
}

/* ================================================================
   Beágyazott dokumentumok (viewer.js)
   ================================================================ */
.embed { margin: 18px 0; }
.embed-box { border: 1px solid var(--line); border-radius: 14px; background: var(--card); overflow: hidden; box-shadow: var(--shadow); }
.embed-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line); background: var(--bg2); }
.embed-title { flex: 1; min-width: 0; font-weight: 800; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.embed-actions { display: flex; gap: 6px; flex-shrink: 0; }
.embed-body { position: relative; }
.embed-loading, .embed-missing { padding: 22px; text-align: center; color: var(--muted); font-weight: 700; }
.embed-img { display: block; max-width: 100%; margin: 0 auto; }
.embed-body video { display: block; width: 100%; max-height: 70vh; background: #000; }
.embed-body audio { display: block; width: calc(100% - 24px); margin: 14px 12px; }
@media (max-width: 640px) { .nl-sm { display: none; } }

/* teljes képernyő (valódi vagy – iPhone-on – ablakon belüli) */
.embed-box:fullscreen, .embed-box.pseudo-full { display: flex; flex-direction: column; border-radius: 0; background: var(--bg); }
.embed-box:-webkit-full-screen { display: flex; flex-direction: column; border-radius: 0; background: var(--bg); }
.embed-box.pseudo-full { position: fixed; inset: 0; z-index: 90; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.embed-box:fullscreen .embed-body, .embed-box.pseudo-full .embed-body { flex: 1; overflow: auto; display: flex; flex-direction: column; justify-content: center; }
.embed-box:fullscreen .slide, .embed-box.pseudo-full .slide { max-height: calc(100vh - 140px); max-height: calc(100dvh - 140px); width: auto; margin: 0 auto; }

/* PDF */
.pdf-pages { display: grid; gap: 10px; padding: 12px; background: #525659; max-height: 80vh; overflow-y: auto; }
.pdf-page { display: block; width: 100%; height: auto; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.pdf-meta { padding: 6px 14px; }
.pdf-frame { display: block; width: 100%; height: 75vh; border: 0; }
.embed-box:fullscreen .pdf-pages, .embed-box.pseudo-full .pdf-pages { max-height: none; flex: 1; }

/* Diavetítés (PowerPoint) */
.deck { outline: none; padding: 12px; background: #2b2b33; }
.deck:focus-visible { box-shadow: inset 0 0 0 3px var(--brand); }
.deck-stage { display: grid; gap: 14px; }
.slide { position: relative; width: 100%; overflow: hidden; container-type: inline-size; box-shadow: 0 4px 18px rgba(0,0,0,.4); color: #000; line-height: 1.15;
  font-family: Calibri, Carlito, 'Segoe UI', 'Open Sans', Arial, sans-serif; cursor: pointer; user-select: text; }
.slide > div { position: absolute; box-sizing: border-box; }
.sl-sp { display: flex; flex-direction: column; overflow: hidden; }
.sl-sp p { margin: 0 0 0.35cqw; display: flex; gap: .5em; overflow-wrap: anywhere; }
.sl-sp p > .bu { flex-shrink: 0; }
.sl-pic { overflow: hidden; }
.sl-tbl { overflow: hidden; }
.sl-tbl table { width: 100%; height: 100%; border-collapse: collapse; }
.sl-tbl th, .sl-tbl td { border: 0.1cqw solid #9aa3b5; padding: .3em .5em; text-align: left; }
.sl-tbl th { background: #5b6b8a; color: #fff; }
.sl-tbl tr:nth-child(even) td { background: #eef1f7; }
.sl-chart { display: grid; place-items: center; background: #f2f2f2; border: 0.15cqw dashed #aaa; color: #666; font-size: 2cqw; }
.deck-nav { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: #fff; }
.deck-nav .btn.ghost { color: #fff; box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
.deck-count { font-weight: 800; min-width: 64px; text-align: center; }
.deck-notes { margin-top: 8px; color: #d8d8e0 !important; }
.deck-thumb { display: grid; gap: 4px; }
.deck-thumb .muted { color: #c9c9d4; }
.deck-thumb .slide { cursor: default; }

/* Word-dokumentum */
.doc-page { padding: 22px 28px; max-height: 80vh; overflow-y: auto; }
.doc-page img { max-width: 100%; height: auto; }
.doc-page .doc-gap { margin: .3em 0; }
.doc-page li { margin: .15em 0; }
.doc-table { overflow-x: auto; }
.doc-table td { border: 1px solid var(--line); padding: 6px 10px; vertical-align: top; }
.doc-table tr:first-child td { background: var(--bg2); font-weight: 700; }
.doc-text { margin: 0; padding: 18px 22px; white-space: pre-wrap; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; max-height: 70vh; overflow: auto; }
.embed-box:fullscreen .doc-page, .embed-box.pseudo-full .doc-page { max-height: none; }
@media (max-width: 640px) { .doc-page { padding: 16px; } }

/* Munkalapok */
.sheet-tabs { display: flex; gap: 4px; padding: 8px 10px 0; flex-wrap: wrap; }
.sheet-tabs button { border: 1px solid var(--line); border-bottom: 0; background: var(--bg2); padding: 6px 12px; border-radius: 8px 8px 0 0; font-weight: 700; cursor: pointer; color: var(--muted); }
.sheet-tabs button.on { background: var(--card); color: var(--ink); }
.sheet-wrap { overflow: auto; max-height: 70vh; }
table.sheet { border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
table.sheet th, table.sheet td { border: 1px solid var(--line); padding: 5px 10px; white-space: nowrap; }
table.sheet th { background: var(--bg2); position: sticky; top: 0; text-align: left; }

/* Külső beágyazás (YouTube, Google Diák, OneDrive…) */
.link-embed { position: relative; width: 100%; background: #000; }
.link-embed.tall { height: 75vh; background: var(--card); }
.link-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Tanári szerkesztő: beágyazás-helyőrző az előnézetben */
.embed-ph { display: flex; align-items: center; gap: 8px; margin: 12px 0; padding: 12px 14px; border: 2px dashed var(--brand); border-radius: 12px; font-weight: 700; color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }

/* ================================================================
   Oldalfejléc (cím + alcím, kellő távolságra a felső sávtól)
   ================================================================ */
.page-head { margin: 8px 0 22px; }
.page-head .crumb { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 800; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.page-head h1 { font-family: var(--display); font-size: clamp(1.5rem, 4vw, 2rem); margin: 0 0 6px; }
.page-head p { margin: 0; max-width: 70ch; }
.page-head input[type=search] { margin-top: 14px; width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); outline: none; }
.page-head input[type=search]:focus { border-color: var(--brand); }

/* Osztálylista (diák és tanár) */
.class-list { display: grid; gap: 8px; margin: 10px 0 6px; }
.class-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); cursor: pointer; color: var(--ink); }
.class-row:hover { border-color: var(--brand-2); }
.class-row.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--card)); }
.class-row .ic { font-size: 1.6rem; }
.class-row .t { flex: 1; min-width: 0; }
.class-row small { display: block; color: var(--muted); font-weight: 700; }
.list-head { margin: 18px 0 0; text-transform: uppercase; letter-spacing: .04em; }
.join-form { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.join-form h3 { margin: 0 0 4px; }
.page-head { padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
/* A .wrap oldalsó térköze ne írja felül a fő tartalom felső/alsó térközét */
main.wrap { padding-top: 36px; padding-bottom: 60px; }
@media (max-width: 640px) { main.wrap { padding-top: 24px; } }
.modal.confirm-box { width: min(460px, 100%); }
.modal.confirm-box h2 { font-size: 1.15rem; line-height: 1.4; }

/* ================================================================
   Üzenetek (chat.js)
   ================================================================ */
.nbadge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--bad); color: #fff; font-size: .72rem; font-weight: 900; line-height: 1; }
.toast.clickable { cursor: pointer; }
.toast.clickable:hover { filter: brightness(1.05); }
.chat-page { max-width: 860px; margin: 0 auto; }
.empty-msgs { text-align: center; color: var(--muted); padding: 28px 20px; }
.thread-list { display: grid; gap: 10px; }
.thread-item { display: flex; gap: 12px; align-items: center; padding: 14px 16px; text-decoration: none; color: var(--ink); transition: transform .12s; }
.thread-item:hover { transform: translateY(-2px); border-color: var(--brand-2); }
.thread-item.unread { border-left: 5px solid var(--brand); }
.thread-item.unread .ti-title { font-weight: 900; }
.thread-item .av { font-size: 1.8rem; flex-shrink: 0; }
.ti-main { flex: 1; min-width: 0; }
.ti-top { display: flex; gap: 6px; align-items: baseline; }
.ti-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ti-prev { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ti-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.thread-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 14px; }
.thread-head .av { font-size: 2.2rem; }
.thread-head h1 { font-family: var(--display); font-size: clamp(1.15rem, 3.4vw, 1.5rem); margin: 0; overflow-wrap: anywhere; }
.ctx-card { margin-bottom: 16px; border-left: 5px solid var(--gold); }
.ctx-card .md p { margin: .3em 0; }
.ctx-q { margin-top: 6px; }
.ctx-insight { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); display: grid; gap: 6px; }
.ctx-insight ul { margin: 4px 0 0; padding-left: 4px; list-style: none; display: grid; gap: 2px; }
.ctx-insight summary { cursor: pointer; font-weight: 700; color: var(--brand); }
.msgs { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.msg { max-width: min(640px, 88%); padding: 10px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); align-self: flex-start; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: color-mix(in srgb, var(--brand) 14%, var(--card)); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); border-bottom-right-radius: 4px; }
.msg.them { border-bottom-left-radius: 4px; }
.msg.them.from-teacher { border-left: 4px solid var(--gold); }
.msg-meta { font-size: .78rem; color: var(--muted); margin-bottom: 4px; }
.msg-body p { margin: .35em 0; }
.msg-body .embed { margin: 10px 0 4px; }
.msg-files { display: grid; gap: 8px; margin-top: 8px; }
.msg-img img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; }
.msg-file { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.msg-file .embed { width: 100%; margin: 4px 0 0; }
.composer { display: grid; gap: 8px; }
.composer textarea, #ask-form textarea { min-height: 90px; }
#ask-form { display: grid; gap: 8px; }
.att-list { display: flex; flex-wrap: wrap; gap: 6px; }
.att-list:empty { display: none; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--bg2); font-size: .85rem; font-weight: 700; }
.att-chip button { border: 0; background: none; cursor: pointer; color: var(--muted); font-weight: 900; padding: 2px 6px; }
.cmp-tools { gap: 8px; }
.msg-alert { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; text-decoration: none; color: var(--ink); border-left: 5px solid var(--gold); }
@media (max-width: 640px) {
  .cmp-hint { display: none; }
  .msg { max-width: 94%; }
}

/* Kilógó szövegek javítása: a rács/flex elemek zsugorodhassanak, hogy a hosszú, egysoros szöveg rövidüljön (…) */
.thread-list { grid-template-columns: minmax(0, 1fr); }
.thread-item, .ti-main, .ti-top { min-width: 0; }
.ti-top > b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ti-top > span { white-space: nowrap; }
.th-title { flex: 1 1 220px; min-width: 0; }
@media (max-width: 640px) {
  /* telefonon az állapotjelző a szöveg alá kerül, hogy a név és a tárgy kiférjen */
  .thread-item { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; row-gap: 6px; }
  .thread-item .av { grid-row: span 2; align-self: start; }
  .ti-side { flex-direction: row; align-items: center; justify-content: flex-start; }
}
.form-intro { margin: 0 0 12px; }
.form-intro .help-btn { width: 22px; height: 22px; font-size: 13px; margin-left: 4px; }

/* ================================================================
   Osztálychat: fülek az Üzenetek oldal tetején, üzenet törlése
   ================================================================ */
.chat-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; padding: 4px; border-radius: 14px; background: var(--bg2); border: 1px solid var(--line); }
.chat-tab { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 12px; border-radius: 10px;
  text-decoration: none; color: var(--muted); font-weight: 800; font-size: .9rem; white-space: nowrap; }
.chat-tab:hover { color: var(--ink); }
.chat-tab.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.msg-del { border: 0; background: none; cursor: pointer; padding: 0 2px; margin-left: 4px; font-size: .85rem; opacity: .45; }
.msg-del:hover, .msg-del:focus-visible { opacity: 1; }
.room-empty { padding: 40px 20px; }
@media (max-width: 640px) {
  .chat-tab { flex: 1 1 0; min-width: 0; padding: 8px 6px; font-size: .8rem; white-space: normal; text-align: center; line-height: 1.2; }
}

/* ================================================================
   Házi feladat (homework.js)
   ================================================================ */
.chat-page > .back { display: inline-flex; margin-bottom: 14px; }
.hw-group { font-size: 1.1rem; margin: 22px 0 10px; }
.hw-note { margin: -4px 0 10px; }
.hw-list { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.hw-item { display: flex; gap: 12px; align-items: center; padding: 14px 16px; text-decoration: none; color: var(--ink); transition: transform .12s; border-left: 5px solid var(--line); }
.hw-item:hover { transform: translateY(-2px); border-color: var(--brand-2); }
.hw-item.st-todo { border-left-color: var(--gold); }
.hw-item.st-missing { border-left-color: var(--bad); }
.hw-item.st-done { border-left-color: var(--ok); }
.hw-item.st-late { border-left-color: var(--warn); }
.hw-item.past { opacity: .85; }
.hw-ic { font-size: 1.8rem; flex-shrink: 0; }
.hw-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.hw-title { font-weight: 800; overflow-wrap: anywhere; }
.hw-side { flex-shrink: 0; }
.hw-item .go { font-size: 1.4rem; font-weight: 800; color: var(--brand); }
.hw-counts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.hw-due { font-weight: 700; }
.hw-due .hw-left { color: var(--muted); font-weight: 600; }
.hw-due.soon, .hw-due.soon .hw-left { color: var(--warn); }
.hw-due.past .hw-left { color: var(--bad); }
.hw-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.hw-detail h1 { font-family: var(--display); font-size: clamp(1.25rem, 3.6vw, 1.6rem); margin: 4px 0 10px; overflow-wrap: anywhere; }
.hw-meta { gap: 8px; }
.hw-body { margin-top: 12px; }
.hw-detail h3 { margin: 18px 0 8px; font-size: 1rem; }
.hw-sub { display: grid; gap: 10px; border-left: 5px solid var(--line); }
.hw-sub.done { border-left-color: var(--ok); }
.hw-sub.late { border-left-color: var(--warn); }
.hw-sub.missing { border-left-color: var(--bad); }
.hw-sub .hw-body { margin-top: 0; }
.hw-links { display: grid; gap: 6px; }
.hw-link { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 8px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line);
  text-decoration: none; color: var(--ink); overflow-wrap: anywhere; }
.hw-link:hover { border-color: var(--brand); }
.hw-link .muted { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.hw-form .field { margin-bottom: 0; }
.hw-form textarea { min-height: 110px; }
.hw-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hw-chips:empty { display: none; }
.hw-chips .att-chip { max-width: 100%; overflow-wrap: anywhere; }
.att-chip.removed { opacity: .55; text-decoration: line-through; }
.hw-link-row { gap: 8px; flex-wrap: nowrap; }
.hw-link-row input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 2px solid var(--line); background: var(--card); color: var(--ink); outline: none; }
.hw-link-row input:focus { border-color: var(--brand); }
.hw-due-row { gap: 14px; align-items: flex-start; }
.hw-due-row .field { flex: 1 1 200px; margin: 0; }
.hw-due-row .archive-toggle { flex: 1 1 240px; margin: 0; }
.hw-seg { margin-bottom: 12px; flex-wrap: wrap; }
.hw-seg button b { color: var(--ink); }
.hw-roster { display: grid; gap: 8px; }
.hw-st { padding: 0; border-left: 5px solid var(--line); }
.hw-st.st-done { border-left-color: var(--ok); }
.hw-st.st-late { border-left-color: var(--warn); }
.hw-st.st-missing { border-left-color: var(--bad); }
.hw-st summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; cursor: pointer; list-style: none; }
.hw-st summary::-webkit-details-marker { display: none; }
.hw-st summary .av { font-size: 1.5rem; }
.hw-st-name { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.hw-st > :not(summary) { padding: 0 14px 14px; }
.hw-sub-body { display: grid; gap: 10px; }
@media (max-width: 640px) {
  .hw-item { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; row-gap: 6px; }
  .hw-item .hw-side { grid-column: 2; }
  .hw-item .go { display: none; }
  .hw-link-row { flex-wrap: wrap; }
  .hw-link-row input { flex-basis: 100%; }
}

/* ================================================================
   Belépés és fiók (login.js, account.js)
   ================================================================ */
.login-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; margin-top: 12px; font-size: .875rem; }
.login-links a { color: var(--brand); font-weight: 700; text-decoration: none; }
.login-links a:hover { text-decoration: underline; }
.or { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--muted); font-size: .8rem; font-weight: 700; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.google-btn { width: 100%; justify-content: center; gap: 10px; }
.g-logo { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: #4285f4;
  font: 800 15px/1 Arial, sans-serif; border: 1px solid var(--line); flex-shrink: 0; }
.panel-title { font-size: 1.25rem; margin: 4px 0 10px; }
.panel-msg p { margin: 8px 0; }
.recovery-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 800; font-size: clamp(1.1rem, 5vw, 1.5rem); letter-spacing: .06em;
  text-align: center; padding: 14px 10px; margin: 12px 0; border-radius: 12px; background: var(--bg2); border: 2px dashed var(--gold); user-select: all; overflow-wrap: anywhere; }
.warn-text { color: var(--warn); }
.settings-sec { margin: 18px 0 8px; font-size: 1rem; }
.acct-sec { padding: 14px 0; border-top: 1px solid var(--line); }
.acct-sec:first-child { border-top: 0; padding-top: 0; }
.acct-sec h3 { margin: 0 0 8px; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.acct-line { margin: 4px 0 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; overflow-wrap: anywhere; }
.acct-sec details { margin-top: 8px; }
.acct-sec summary { cursor: pointer; font-weight: 700; color: var(--brand); }
.acct-form { margin-top: 10px; }
.acct-form .field { margin-bottom: 10px; }
.acct-note { margin: 12px 0 0; }
.tfa-steps { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 12px; }
.tfa-qr { margin: 10px 0; }
.tfa-qr svg { width: 180px; height: 180px; background: #fff; border-radius: 8px; padding: 4px; display: block; }
.tfa-key { overflow-wrap: anywhere; user-select: all; }
.backup-codes { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.backup-codes code { display: block; text-align: center; padding: 6px; border-radius: 8px; background: var(--bg2); font-weight: 700; user-select: all; }
