:root {
  --bg: #0f1117;
  --bg-2: #151823;
  --bg-3: #1d2230;
  --fg: #e6e9f0;
  --muted: #8a90a4;
  --accent: #7c5cff;
  --accent-2: #4ec9b0;
  --warn: #f3b95f;
  --bad: #ef5d73;
  --good: #4ade80;
  --border: #262b3b;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
}
:root[data-theme="light"] {
  --bg:     #f5f6fa;
  --bg-2:   #ffffff;
  --bg-3:   #eceef5;
  --fg:     #1d2230;
  --muted:  #5a6273;
  --accent: #5b3bd1;
  --accent-2: #2a9d83;
  --warn:   #c98010;
  --bad:    #d04860;
  --good:   #2e9b52;
  --border: #d6d9e3;
  --shadow: 0 8px 30px rgba(60,80,120,.15);
}
:root[data-theme="light"] body {
  background: radial-gradient(1200px 600px at 10% -10%, #e6e1ff 0%, transparent 60%),
              radial-gradient(900px 500px at 100% 0%, #d8f1e9 0%, transparent 60%),
              var(--bg);
}
:root[data-theme="light"] .topbar { background: rgba(255,255,255,.85); }
:root[data-theme="light"] .nav button { color: var(--fg); }
* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
html, body { overflow-x: hidden; max-width: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #1b1f33 0%, transparent 60%),
              radial-gradient(900px 500px at 100% 0%, #1a2a2e 0%, transparent 60%),
              var(--bg);
  color: var(--fg);
  min-height: 100vh;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px;
  background: rgba(15,17,23,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display:flex; align-items:center; gap:10px; font-weight: 700; letter-spacing: .2px; }
.brand .logo {
  width: 28px; height: 28px; border-radius: 8px;
  background: conic-gradient(from 210deg, var(--accent), var(--accent-2), var(--warn), var(--accent));
  box-shadow: 0 0 24px rgba(124,92,255,.5);
}
.nav { display: flex; gap: 6px; flex-wrap: wrap; margin-left: 12px; }
.nav button {
  background: transparent; color: var(--fg);
  border: 1px solid var(--border); padding: 8px 14px; border-radius: 999px;
  cursor: pointer; font-size: 14px;
}
.nav button.active { background: var(--accent); color: white; border-color: var(--accent); }
.nav button:hover { border-color: var(--accent); }
.spacer { flex: 1; }
.streak { font-size: 13px; color: var(--muted); padding: 4px 10px; border-radius: 999px; background: var(--bg-3); border: 1px solid var(--border); }
.streak strong { color: var(--warn); }

.user-badge { display: flex; align-items: center; gap: 8px; }
.user-badge .user-name { font-size: 13px; color: var(--fg); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-badge .user-name-clickable { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.user-badge .user-name-clickable:hover { color: var(--accent); }
.user-badge .admin-badge {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  background: rgba(243,185,95,.2); color: var(--warn); border: 1px solid rgba(243,185,95,.4);
  text-transform: uppercase; letter-spacing: 1px; font-weight: 700;
}
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; text-decoration: underline; font: inherit; }

main { padding: 24px; max-width: 1200px; margin: 0 auto; }

h1 { font-size: 28px; margin: 8px 0 4px; }
h2 { font-size: 22px; margin: 24px 0 12px; }
.subtitle { color: var(--muted); margin-bottom: 24px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px,1fr));
  gap: 16px;
}
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex; flex-direction: column; gap: 8px;
  transition: transform .15s ease, border-color .15s ease;
  cursor: pointer;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card .num { font-size: 12px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; }
.card h3 { margin: 0; font-size: 18px; }
.card .desc { color: var(--muted); font-size: 14px; }
.card .algos { display:flex; flex-wrap:wrap; gap:6px; margin-top: 6px; }
.tag {
  font-size: 11px; padding: 4px 8px; border-radius: 999px;
  background: var(--bg-3); color: var(--muted); border: 1px solid var(--border);
}
.tag.known { background: rgba(74,222,128,.12); color: var(--good); border-color: rgba(74,222,128,.3); }
.tag.practice { background: rgba(243,185,95,.12); color: var(--warn); border-color: rgba(243,185,95,.3); }
.tag.unknown { background: rgba(239,93,115,.12); color: var(--bad); border-color: rgba(239,93,115,.3); }

.progressbar { height: 6px; background: var(--bg-3); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progressbar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.btn {
  border: 1px solid var(--border); background: var(--bg-3); color: var(--fg);
  padding: 10px 14px; border-radius: 10px; cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.good { background: rgba(74,222,128,.15); border-color: rgba(74,222,128,.4); color: var(--good); }
.btn.warn { background: rgba(243,185,95,.15); border-color: rgba(243,185,95,.4); color: var(--warn); }
.btn.bad  { background: rgba(239,93,115,.15); border-color: rgba(239,93,115,.4); color: var(--bad); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }

.algo-block {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 16px 0;
  overflow: hidden;
}
.algo-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; background: var(--bg-3); border-bottom: 1px solid var(--border);
}
.algo-head .title { display:flex; align-items:center; gap:10px; }
.algo-head .id {
  background: var(--accent); color: white; padding: 4px 10px; border-radius: 8px;
  font-size: 13px; font-family: monospace;
}
.meta-block {
  display: flex; flex-direction: column; gap: 0;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.meta-item {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; gap: 14px; align-items: flex-start;
}
.meta-item:last-child { border-bottom: none; }
.meta-label {
  flex: 0 0 130px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: var(--muted);
  padding-top: 2px;
}
.meta-text { flex: 1; font-size: 14px; line-height: 1.6; color: var(--fg); }
.meta-goal .meta-label    { color: var(--accent-2); }
.meta-runtime .meta-label { color: var(--warn); }
.meta-call .meta-label    { color: var(--accent); }
.meta-call-code {
  flex: 1; display: inline-block;
  background: var(--bg-3); padding: 6px 10px; border-radius: 6px;
  font-family: ui-monospace, Consolas, monospace; font-size: 13px;
  color: var(--accent); border: 1px solid var(--border);
}
@media (max-width: 600px) {
  .meta-item { flex-direction: column; gap: 4px; }
  .meta-label { flex-basis: auto; }
}

.algo-img-wrap {
  position: relative; background: white; padding: 12px;
  display: flex; justify-content: center;
}
.algo-img-wrap img {
  /* Olvasható, de nem foglalja az egész oldalt:
     - desktopon ~860px szélesre megy, így a szöveg is jól olvasható
     - mobilon (max-width: 100%) lekicsinyítjük a viewporthoz */
  max-width: min(100%, 860px);
  width: 100%;
  height: auto;
  display: block;
}
/* Az img + bármi más tartalmat (pl. szöveges pszeudokód az alsohatar/felsohatar
   algoritmusoknál) elmosunk — kivéve az overlay-t, ami a Felfedés gombot tartja. */
.algo-img-wrap.blurred > :not(.reveal-overlay) { filter: blur(14px); }
.reveal-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.reveal-overlay button { pointer-events: auto; }
.algo-actions { display:flex; gap:8px; padding: 12px 18px; flex-wrap: wrap; }

/* ===== Brainrot module — full viewport overlay ===== */
/* A body.brainrot-mode kikapcsolja a topbart, footert, és a main paddinget,
   hogy a brainrot overlay tényleg az egész képernyőt elfoglalja. */
body.brainrot-mode { overflow: hidden; }
body.brainrot-mode .topbar,
body.brainrot-mode footer { display: none; }
body.brainrot-mode main { padding: 0; max-width: none; margin: 0; }
body.brainrot-mode #app { padding: 0; }

.brainrot-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: #000;
  display: grid;
  grid-template-rows: 32px 1fr;
}

.brainrot-banner {
  background: linear-gradient(90deg, #ff007a, #f3b95f, #4ade80, #00d9ff, #7c5cff, #ff007a);
  background-size: 300% 100%;
  animation: brainrotGradient 3s linear infinite;
  color: white; font-weight: 900; padding: 6px 0;
  overflow: hidden; white-space: nowrap;
  letter-spacing: 1px; line-height: 20px;
}
@keyframes brainrotGradient { 0% { background-position: 0% 50%; } 100% { background-position: 300% 50%; } }
.brainrot-marquee {
  display: inline-block; padding-left: 100%;
  animation: brainrotMarquee 22s linear infinite;
  font-size: 14px;
}
@keyframes brainrotMarquee { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }

/* A grid mindig teljesen kitölti a maradék helyet — minden cella egyforma. */
.brainrot-grid {
  display: grid; gap: 2px;
  width: 100%; height: 100%;
  background: #000;
}
/* Cellaszám = videók száma (BRAINROT_FEEDS.length jelenleg 6 → 3x2). */
@media (min-aspect-ratio: 1/1) {
  .brainrot-grid { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); }
}
@media (max-aspect-ratio: 1/1) {
  .brainrot-grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(3, 1fr); }
}

.brainrot-card {
  position: relative; overflow: hidden; background: #000;
  min-width: 0; min-height: 0;
}
/* Az iframe-et függőlegesen oversize-oljuk és eltoljuk, hogy a YouTube
   címsor (felül) és vízjel (jobb alul) a látható területen kívülre essen.
   A controls=0 miatt alulról nincs UI, így csak fent kell vágni. */
.brainrot-iframe-wrap {
  position: absolute;
  left: -6%; right: -6%;
  top: -60px; bottom: -120px;
}
.brainrot-iframe-wrap iframe {
  width: 100%; height: 100%; border: 0; display: block;
  pointer-events: none; /* a YouTube UI ne reagáljon — kivéve az audio kártyán */
}
.brainrot-card-audio .brainrot-iframe-wrap iframe { pointer-events: auto; }
.brainrot-card-audio { box-shadow: inset 0 0 0 3px #4ade80; }
.brainrot-title {
  position: absolute; left: 8px; bottom: 8px; z-index: 2;
  padding: 4px 10px; font-weight: 700; font-size: 12px;
  background: rgba(0,0,0,.55); color: white; border-radius: 6px;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.brainrot-exit {
  position: fixed; top: 8px; right: 8px; z-index: 10001;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,.7); color: white; border: 1px solid rgba(255,255,255,.3);
  font-size: 18px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.brainrot-exit:hover { background: var(--bad); }

.brainrot-audio-hint {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 10001;
  background: rgba(0, 0, 0, .8); color: #4ade80;
  padding: 10px 18px; border-radius: 999px;
  font-weight: 700; font-size: 14px;
  border: 2px solid #4ade80;
  animation: brainrotHintPulse 1.4s ease-in-out infinite;
  pointer-events: none;
  box-shadow: 0 0 20px rgba(74, 222, 128, .5);
}
@keyframes brainrotHintPulse {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.85; }
  50%      { transform: translateX(-50%) scale(1.06); opacity: 1; }
}

.note {
  margin: 16px 0; padding: 12px 16px; border-radius: 10px;
  background: rgba(243,185,95,.1); border: 1px solid rgba(243,185,95,.3); color: var(--warn);
  font-size: 14px;
}

/* Exam simulator */
.exam-box {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; text-align: center;
}
.timer {
  font-size: 48px; font-family: ui-monospace, monospace;
  color: var(--accent-2);
  margin: 16px 0;
}
.timer.danger { color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .5; } }

.huzas-cim { font-size: 32px; font-weight: 700; margin: 8px 0 4px; }

/* Flashcard */
.flashcard {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; max-width: 800px; margin: 0 auto;
}
.flashcard .hint { color: var(--muted); font-size: 13px; }
.flashcard-front { text-align: center; padding: 30px 0; }
.flashcard-front .title { font-size: 24px; font-weight: 700; }
.flashcard-front .meta { color: var(--muted); margin-top: 8px; }

.kbd {
  font-family: monospace; font-size: 11px;
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 6px; color: var(--muted);
}

.stats-row { display: flex; gap: 16px; flex-wrap: wrap; margin: 16px 0; }
.stat {
  flex: 1; min-width: 160px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 4px; }

footer {
  margin-top: 32px; padding: 10px 16px; text-align: center; color: var(--muted); font-size: 12px;
  border-top: 1px solid var(--border);
  line-height: 1.4;
}

.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); margin-bottom: 12px; cursor: pointer; }
.back-link:hover { color: var(--fg); }

/* ===== Practice mode components ===== */
.algo-picker { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin: 16px 0; }
.picker-label { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.picker-row { display: flex; gap: 10px; flex-wrap: wrap; }
.select {
  background: var(--bg-3); color: var(--fg); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; flex: 1; min-width: 280px; font-size: 14px;
}
.select:focus { outline: 2px solid var(--accent); }

.metadata { background: var(--bg-3); padding: 10px 14px; font-size: 14px; line-height: 1.7; border-bottom: 1px solid var(--border); }
.metadata strong { color: var(--accent-2); }

.code-block {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin: 16px 0;
  font-family: ui-monospace, "JetBrains Mono", Consolas, monospace; font-size: 14px;
}
.code-line {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 4px 8px; border-radius: 6px;
  background: transparent; border: 1px solid transparent; color: var(--fg);
  width: 100%; text-align: left; font: inherit; cursor: default;
}
.code-line.clickable { cursor: pointer; }
.code-line.clickable:hover { background: var(--bg-3); border-color: var(--border); }
.code-line.placed { opacity: .25; pointer-events: none; }
.code-line.placed-line { background: rgba(124,92,255,.08); border-color: rgba(124,92,255,.25); }
.code-line.flash-red { background: rgba(239,93,115,.25); border-color: var(--bad); animation: shake .25s; }
.code-line.found { background: rgba(74,222,128,.15); border-color: rgba(74,222,128,.4); }
.code-line.missed { background: rgba(239,93,115,.1); border-color: rgba(239,93,115,.3); }
.code-line.revealed-bug { background: rgba(243,185,95,.15); border-color: rgba(243,185,95,.4); }
.code-line .line-no { color: var(--muted); min-width: 24px; text-align: right; user-select: none; }
.code-line code { font-family: inherit; white-space: pre-wrap; word-break: break-word; }
.fix-hint { color: var(--warn); font-size: 12px; margin-left: 10px; }
@keyframes shake { 0%,100% { transform: translateX(0);} 25% { transform: translateX(-4px);} 75% { transform: translateX(4px);} }

/* Order mode (drag & drop) */
.order-list {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; margin: 16px 0;
}
.order-row {
  display: flex; align-items: stretch; gap: 8px;
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 8px;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
  cursor: grab;
}
.order-row:hover { border-color: var(--accent); }
.order-row.dragging { opacity: .4; cursor: grabbing; }
.order-row.drag-over { border-color: var(--accent); box-shadow: 0 -2px 0 var(--accent) inset; transform: translateY(1px); }
.order-row.correct { background: rgba(74,222,128,.12); border-color: rgba(74,222,128,.5); }
.order-row.wrong   { background: rgba(239,93,115,.12); border-color: rgba(239,93,115,.5); }
.order-row .drag-handle {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); user-select: none; padding: 0 4px; font-weight: 700; letter-spacing: -2px;
}
.order-row .row-buttons { display: flex; flex-direction: column; gap: 2px; justify-content: center; }
.icon-btn {
  background: var(--bg-2); color: var(--fg); border: 1px solid var(--border);
  border-radius: 4px; padding: 0 6px; font-size: 10px; cursor: pointer; line-height: 1.4;
}
.icon-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.icon-btn:disabled { opacity: .3; cursor: not-allowed; }
.order-row .drag-content { flex: 1; cursor: inherit; }
.order-status { text-align: center; padding: 12px; color: var(--muted); }
.hidden { display: none !important; }

/* Fill input */
.fill-input {
  background: var(--bg-3); color: var(--fg); border: 1px solid var(--accent);
  border-radius: 4px; padding: 1px 6px; margin: 0 2px;
  font: inherit; min-width: 30px;
}
.fill-input.ok { border-color: var(--good); background: rgba(74,222,128,.15); }
.fill-input.bad { border-color: var(--bad); background: rgba(239,93,115,.15); }
.fill-input.revealed { border-color: var(--warn); background: rgba(243,185,95,.15); }

/* Blind write */
.blind-input {
  width: 100%; min-height: 280px;
  background: var(--bg-2); color: var(--fg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; font-family: ui-monospace, Consolas, monospace; font-size: 14px; line-height: 1.7;
  resize: vertical;
}
.blind-input.small { min-height: 60px; }
.blind-input:focus { outline: 2px solid var(--accent); }

.diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.diff-grid h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
@media (max-width: 900px) { .diff-grid { grid-template-columns: 1fr; } }

.diff-out { margin-top: 16px; }

.header-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.header-grid .full { grid-column: 1 / -1; }
.header-grid label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 1px; }
@media (max-width: 760px) { .header-grid { grid-template-columns: 1fr; } }

.ref-image { margin-top: 24px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.ref-image summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.ref-image[open] summary { margin-bottom: 10px; }

/* ===== Vizsga checklist ===== */
.checklist-title { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; margin: 18px 0 8px; }
.checklist { display: flex; flex-direction: column; gap: 6px; max-width: 560px; margin: 0 auto; text-align: left; }
.check-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.check-item:hover { border-color: var(--accent); }
.check-item.done { background: rgba(74,222,128,.08); border-color: rgba(74,222,128,.4); }
.check-item.done .check-label { text-decoration: line-through; color: var(--muted); }
.check-item input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.check-num { background: var(--accent); color: white; min-width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.check-item.done .check-num { background: var(--good); }
.check-label { flex: 1; font-size: 14px; }
.checklist-progress { color: var(--muted); font-size: 12px; text-align: right; padding-top: 6px; }

/* ===== Heatmap ===== */
.heatmap { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.heatmap-title { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.heatmap-grid { display: grid; gap: 3px; overflow-x: auto; }
.heatmap-cell {
  width: 12px; height: 12px; border-radius: 2px;
  background: var(--bg-3); border: 1px solid rgba(255,255,255,.04);
}
.heatmap-cell.lvl0 { background: var(--bg-3); }
.heatmap-cell.lvl1 { background: rgba(124,92,255,.25); }
.heatmap-cell.lvl2 { background: rgba(124,92,255,.5); }
.heatmap-cell.lvl3 { background: rgba(124,92,255,.75); }
.heatmap-cell.lvl4 { background: var(--accent); box-shadow: 0 0 6px rgba(124,92,255,.5); }
.heatmap-cell.future { background: transparent; border-style: dashed; }
.heatmap-legend { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); margin-top: 12px; }
.heatmap-legend .heatmap-cell { display: inline-block; }

/* ===== Diff (vakon írás) ===== */
.diff-summary { background: var(--bg-3); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 12px; text-align: center; }
.diff-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; justify-content: center; }
.diff-tag { font-size: 11px; padding: 3px 10px; border-radius: 999px; border: 1px solid; }
.diff-exact   { background: rgba(74,222,128,.15);  border-color: rgba(74,222,128,.5);  color: var(--good); }
.diff-partial { background: rgba(243,185,95,.15);  border-color: rgba(243,185,95,.5);  color: var(--warn); }
.diff-wrong   { background: rgba(239,93,115,.15);  border-color: rgba(239,93,115,.5);  color: var(--bad); }
.diff-missing { background: rgba(239,93,115,.08);  border-color: rgba(239,93,115,.3);  color: var(--bad); font-style: italic; }
.diff-extra   { background: rgba(243,185,95,.08);  border-color: rgba(243,185,95,.3);  color: var(--warn); font-style: italic; }
.code-line.diff-exact   { background: rgba(74,222,128,.12); border-color: rgba(74,222,128,.4); }
.code-line.diff-partial { background: rgba(243,185,95,.12); border-color: rgba(243,185,95,.4); }
.code-line.diff-wrong   { background: rgba(239,93,115,.12); border-color: rgba(239,93,115,.4); }
.code-line.diff-missing,
.code-line.diff-missing-ref { background: rgba(239,93,115,.06); border-color: rgba(239,93,115,.25); font-style: italic; opacity: .8; }
.code-line.diff-extra,
.code-line.diff-extra-user { background: rgba(243,185,95,.06); border-color: rgba(243,185,95,.25); font-style: italic; opacity: .8; }

/* ===== Login / setup form ===== */
.auth-page { text-align: center; }
.auth-page h1 { margin-top: 32px; }
.auth-page .subtitle { max-width: 480px; margin-left: auto; margin-right: auto; }
.auth-page .login-form { text-align: left; }

.login-form {
  display: flex; flex-direction: column; gap: 12px;
  max-width: 420px; margin: 24px auto;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px;
}
.login-form label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px;
}
.login-form input {
  background: var(--bg-3); color: var(--fg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; font-size: 14px;
}
.login-form input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.login-form button[type=submit] { margin-top: 8px; }
.form-error {
  background: rgba(239,93,115,.1); border: 1px solid rgba(239,93,115,.4);
  color: var(--bad); padding: 10px 14px; border-radius: 8px; font-size: 14px;
}
.form-hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

/* ===== Admin oldal ===== */
.admin-add-wrap {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; margin: 16px 0;
}
.admin-add-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin-add-form input {
  background: var(--bg-3); color: var(--fg); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px; font-size: 14px; flex: 1; min-width: 180px;
}
.admin-add-form input:focus { outline: 2px solid var(--accent); }

.admin-users { overflow-x: auto; }
.admin-table {
  width: 100%; border-collapse: collapse; font-size: 14px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.admin-table th, .admin-table td {
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.admin-table th {
  background: var(--bg-3); font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px; font-weight: 600;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover { background: var(--bg-3); }
.admin-table td:last-child { display: flex; gap: 6px; flex-wrap: wrap; }
.btn.bad { background: rgba(239,93,115,.15); border-color: rgba(239,93,115,.4); color: var(--bad); }

.invite-code {
  background: var(--bg-3); color: var(--accent);
  padding: 4px 10px; border-radius: 6px;
  font-family: ui-monospace, Consolas, monospace; font-weight: 700;
  letter-spacing: 1px; cursor: pointer; user-select: all;
  border: 1px solid var(--border);
}
.invite-code:hover { border-color: var(--accent); }
.invite-status {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 1px; font-weight: 700;
}
.invite-status.good { background: rgba(74,222,128,.15); color: var(--good); border: 1px solid rgba(74,222,128,.4); }
.invite-status.bad  { background: rgba(239,93,115,.15); color: var(--bad);  border: 1px solid rgba(239,93,115,.4); }

.invite-code-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.invite-link-row { display: flex; gap: 6px; align-items: center; }
.invite-link-input {
  flex: 1; min-width: 200px; max-width: 380px;
  background: var(--bg-3); color: var(--muted);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 9px; font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
}
.invite-link-input:focus { outline: 1px solid var(--accent); color: var(--fg); }

/* Toast a vágólap-másoláshoz */
.copy-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px);
  background: var(--good); color: #0a1f12;
  padding: 10px 18px; border-radius: 999px;
  font-weight: 700; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  opacity: 0; transition: opacity .25s ease, transform .25s ease;
  z-index: 9999; pointer-events: none;
}
.copy-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Loading screen */
.loading-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 50vh; gap: 16px;
}
.loading-spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--bg-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Admin tables (users, audit log) — saját horizontális scroll, ne tolja az oldalt */
.admin-users { overflow-x: auto; }
.admin-table { width: 100%; }

/* Audit log */
.audit-table { font-size: 13px; min-width: 720px; }
.audit-table td { vertical-align: top; }
.audit-table td:nth-child(5) { max-width: 320px; }
.audit-event-tag {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
  white-space: nowrap;
  border: 1px solid;
}
.audit-event-tag.good {
  background: rgba(74,222,128,.12); color: var(--good);
  border-color: rgba(74,222,128,.4);
}
.audit-event-tag.bad {
  background: rgba(239,93,115,.12); color: var(--bad);
  border-color: rgba(239,93,115,.4);
}
.audit-event-tag.info {
  background: rgba(122,162,247,.12); color: var(--accent);
  border-color: rgba(122,162,247,.4);
}
.audit-event-tag.muted {
  background: var(--bg-3); color: var(--muted);
  border-color: var(--border);
}
.audit-filter-select {
  background: var(--bg-3); color: var(--fg);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; font-size: 14px;
}

/* ===========================================
   MOBIL RESZPONZÍV BLOKK
   =========================================== */
@media (max-width: 900px) {
  main { padding: 16px; }
  h1 { font-size: 24px; }
  h2 { font-size: 18px; }
  .topbar { padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  .nav { order: 10; width: 100%; margin-left: 0; justify-content: flex-start; }
  .nav button { padding: 6px 10px; font-size: 13px; }
  .spacer { display: none; }
  .user-badge .user-name { max-width: 100px; font-size: 12px; }
  .user-badge { margin-left: auto; }
  .btn { padding: 8px 12px; font-size: 13px; }
  .btn.small { padding: 5px 9px; font-size: 11px; }
  /* Grid → 1 oszlop */
  .grid { grid-template-columns: 1fr; }
  /* Stats sor: 2 oszlop */
  .stat { min-width: calc(50% - 8px); }
  /* Algo block fejléc tördelhető */
  .algo-head { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 14px; }
  .meta-item { padding: 10px 14px; }
  /* Order rows */
  .order-row { font-size: 13px; }
  /* Code blocks ne hagyják túlfutni */
  .code-block { font-size: 12px; padding: 10px; }
  .code-line { padding: 3px 6px; }
  .code-line .line-no { min-width: 18px; }
  /* Picker (gyakorlat választó) */
  .select { min-width: 0; width: 100%; }
  /* Admin form */
  .admin-add-form { flex-direction: column; align-items: stretch; }
  .admin-add-form input { width: 100%; min-width: 0; }
  .admin-add-wrap { padding: 14px 14px; }
  /* Admin táblák saját scrollba ne tolja az oldalt */
  .admin-users { width: 100%; }
  .admin-table { font-size: 12px; }
  .admin-table th, .admin-table td { padding: 8px 10px; }
  /* Invite kód sorok */
  .invite-link-input { min-width: 0; max-width: none; }
  .invite-link-row, .invite-code-row { flex-wrap: wrap; }
  /* Vizsga checklist */
  .checklist { max-width: 100%; }
  /* Flashcard */
  .flashcard { padding: 16px; }
  .flashcard-front .title { font-size: 20px; }
  /* Login form */
  .login-form { padding: 18px; margin: 16px auto; max-width: 100%; }
  /* Exam timer kisebb */
  .timer { font-size: 36px; }
  .huzas-cim { font-size: 24px; }
  /* Diff out / blind input */
  .blind-input { min-height: 200px; font-size: 13px; }
  /* Footer */
  footer { font-size: 11px; padding: 10px 12px; }
}

/* Nagyon kicsi képernyő (≤480px) */
@media (max-width: 480px) {
  main { padding: 12px; }
  .topbar { padding: 8px 10px; }
  .brand span { font-size: 14px; }
  .nav button { padding: 5px 8px; font-size: 12px; }
  .user-badge .user-name { max-width: 70px; }
  .stat { min-width: 100%; }
  .audit-table { font-size: 11px; min-width: 600px; }
  .timer { font-size: 30px; }
}
