/* vzhled. Pracovní nástroj: klidná plocha, barvu nesou bloky diagramu a stavy. */
:root {
  --bg: #f3f1ec;
  --panel: #fffdf9;
  --sunk: #ebe8e1;
  --ink: #1c2026;
  --ink-2: #3c434d;
  --muted: #646b75;
  --line: #d9d4ca;
  --line-strong: #bfb8ab;
  --accent: #0d6b5e;
  --accent-hover: #0a5a4f;
  --accent-soft: #dcefe9;
  --accent-ink: #fff;
  --ok: #18733a;
  --ok-soft: #e1f3e6;
  --warn: #8f5a00;
  --warn-soft: #fbeed3;
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --info-soft: #e3ebf7;
  --radius: 8px;
  --mono: 'Cascadia Mono', 'Cascadia Code', Consolas, ui-monospace, monospace;
  --sans: 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --shadow-pop: 0 12px 32px -8px rgba(28, 32, 38, .28), 0 2px 6px rgba(28, 32, 38, .08);
  --ease: cubic-bezier(.16, 1, .3, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel); border-radius: 7px; padding: 6px 12px; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
button:hover { border-color: var(--line-strong); background: #fff; }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger { color: var(--bad); }
button.danger:hover { background: var(--bad-soft); border-color: #e9b9b5; }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--sunk); }
button.icon { padding: 6px; }
button:disabled { opacity: .45; cursor: default; transform: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select, textarea { border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: #80868f; }
textarea { font-family: var(--mono); font-size: 13px; line-height: 1.55; }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 14px 0 5px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; font-size: 14px; color: var(--ink); margin: 12px 0 0; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 26px; letter-spacing: -.02em; }
h2 { font-size: 19px; letter-spacing: -.01em; }
h3 { font-size: 15px; }
code { font-family: var(--mono); font-size: .92em; background: var(--sunk); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.hidden { display: none !important; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--sunk); color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: #1f4e8c; }
.badge svg.i { width: 12px; height: 12px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #b5b0a6; flex: none; }
.dot.work { background: #23a24d; box-shadow: 0 0 0 3px #23a24d22; }
.dot.idle { background: #d49a00; }
.dot.away { background: var(--bad); box-shadow: 0 0 0 3px #b3261e22; }
.dot.offline { background: #a3a8b0; }
.dot.done { background: #2f67b8; }

/* ---- Značka ---- */
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.brand svg { width: 22px; height: 22px; }

/* ---- Přihlášení ---- */
.join { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, 440px) 1fr; }
.join-form { background: var(--panel); border-right: 1px solid var(--line); padding: 48px 44px; display: flex; flex-direction: column; }
.join-form .brand { font-size: 18px; margin-bottom: 56px; }
.join-form h1 { margin-bottom: 6px; }
.join-form p.lead { color: var(--muted); margin: 0 0 26px; max-width: 34ch; }
.join-form input { width: 100%; }
.join-form .foot { margin-top: auto; padding-top: 32px; font-size: 13px; color: var(--muted); }
.join-art { display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 40px;
  background: radial-gradient(circle, #d5d0c5 1px, transparent 1.2px) 0 0/18px 18px; }
.join-art svg.fl-svg { max-width: 100%; height: auto; max-height: 86vh; }
.code-input { font-family: var(--mono); font-size: 24px; letter-spacing: .3em; text-transform: uppercase; text-align: center; padding: 10px; }
.err { color: var(--bad); min-height: 20px; margin-top: 8px; font-size: 13.5px; }
.center-card { max-width: 400px; margin: 12vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 32px; }
.center-card .brand { font-size: 18px; margin-bottom: 28px; }
.center-card input { width: 100%; }
@media (max-width: 820px) {
  .join { grid-template-columns: 1fr; }
  .join-art { display: none; }
  .join-form { border-right: 0; padding: 32px 22px; }
  .join-form .brand { margin-bottom: 32px; }
}


/* ---- Diagram ----
   Tvary a barvy podle Flowgorithmu: vstup modrý a výstup zelený rovnoběžník, deklarace a přiřazení
   žlutý obdélník, podmínka růžový kosočtverec, cykly oranžový šestiúhelník. Obrys je tmavší odstín výplně. */
.fl-svg { font-family: var(--sans); font-size: 13.5px; overflow: visible; }
.fl-line { stroke: #5d6670; stroke-width: 1.5; stroke-linejoin: round; }
.fl-arrhead { fill: #5d6670; }
.fl-dot { fill: #5d6670; }
.fl-txt { fill: #1a1e24; font-size: 13.5px; pointer-events: none; }
.fl-lab { fill: #6b717a; font-size: 11.5px; font-weight: 600; pointer-events: none; }
.fl-shape { stroke: #4a525e; stroke-width: 1.5; stroke-linejoin: round; transition: stroke .12s, filter .12s; }
.fl-inner { stroke: #a8902a; stroke-width: 1; fill: none; pointer-events: none; }
.fl-term .fl-shape { fill: #ebe7df; stroke: #7a7366; }
.fl-term .fl-txt { font-weight: 600; fill: #3c434d; }
.fl-input .fl-shape { fill: #b5dcf2; stroke: #3a7fa6; }
.fl-output .fl-shape { fill: #c0eab8; stroke: #43913d; }
.fl-declare .fl-shape, .fl-assign .fl-shape { fill: #fdf6c3; stroke: #a8902a; }
.fl-if .fl-shape { fill: #f8c6d0; stroke: #bf5670; }
.fl-while .fl-shape, .fl-for .fl-shape, .fl-do .fl-shape { fill: #fbd7a5; stroke: #bd7a22; }
.fl-comment .fl-shape { fill: #f8f7f4; stroke: #9a958c; stroke-dasharray: 5 3; }
.fl-comment .fl-txt { fill: #5c6168; font-style: italic; }

.fl-node { outline: none; }
.editable .fl-node:not(.fl-term) { cursor: pointer; }
.editable .fl-node:not(.fl-term):hover .fl-shape { stroke: var(--accent); stroke-width: 2.4; }
.editable .fl-node:focus-visible .fl-shape,
.fl-node.sel .fl-shape { stroke: var(--accent); stroke-width: 2.6; filter: drop-shadow(0 0 4px rgba(13, 107, 94, .45)); }
/* běží: výrazný oranžový obrys se září, aby byl vidět i na oranžovém cyklu */
.fl-node.active .fl-shape { stroke: #f76707; stroke-width: 3.5; filter: drop-shadow(0 0 7px rgba(247, 103, 7, .8)); }
.fl-node.active .fl-txt { font-weight: 700; }
.fl-node.errnode .fl-shape { fill: #ffd4d4; stroke: #b80f0f; stroke-width: 3.5; filter: drop-shadow(0 0 6px rgba(201, 42, 42, .55)); }
.fl-node.errnode .fl-txt { fill: #7f1d1d; font-weight: 700; }

.fl-ins { cursor: pointer; outline: none; transform-box: fill-box; transform-origin: center; transition: transform .12s var(--ease); }
.fl-ins-hit { fill: transparent; }
.fl-ins-btn { fill: #fff; stroke: #a3a9b1; stroke-width: 1.3; transition: fill .12s, stroke .12s; }
.fl-ins path { stroke: #737a84; stroke-width: 1.8; stroke-linecap: round; transition: stroke .12s; }
.fl-ins:hover, .fl-ins:focus-visible, .fl-ins.sel { transform: scale(1.18); }
.fl-ins:hover .fl-ins-btn, .fl-ins:focus-visible .fl-ins-btn, .fl-ins.sel .fl-ins-btn { fill: var(--accent); stroke: var(--accent); }
.fl-ins:hover path, .fl-ins:focus-visible path, .fl-ins.sel path { stroke: #fff; }
.fl-ins:focus-visible .fl-ins-btn { stroke: #fff; stroke-width: 2; filter: drop-shadow(0 0 0 var(--accent)) drop-shadow(0 0 2px var(--accent)); }
@media (prefers-reduced-motion: reduce) { .fl-ins, .fl-shape { transition: none; } }

/* ---- Paleta bloků (otevře se z + na šipce) ---- */
.palette { position: fixed; z-index: 50; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 10px 10px 8px; width: max-content; max-width: calc(100vw - 20px); max-height: calc(100vh - 20px); overflow: auto; animation: pop .16s var(--ease); }
.pal-grid { display: grid; grid-template-columns: repeat(4, auto); gap: 0 6px; }
.pal-col { display: flex; flex-direction: column; gap: 2px; min-width: 92px; }
.pal-col + .pal-col { border-left: 1px solid var(--sunk); padding-left: 6px; }
.pal-col h4 { margin: 0 0 4px; padding: 0 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.palette .pal-item { flex-direction: column; gap: 3px; border: 1px solid transparent; background: transparent; padding: 7px 8px 5px; border-radius: 8px; font-size: 12.5px; color: var(--ink-2); }
.palette .pal-item:hover, .palette .pal-item:focus-visible { background: var(--sunk); border-color: var(--line); color: var(--ink); }
.palette .pal-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.pal-item svg, .modal-head svg.pv { display: block; overflow: visible; }
.pal-item svg { width: 72px; height: 32px; }
.pal-item:hover .fl-shape { stroke-width: 1.8; }
.palette .pal-paste { width: 100%; justify-content: flex-start; margin-top: 8px; border: 1px dashed var(--line-strong); background: transparent; color: var(--ink-2); font-size: 13px; padding: 7px 10px; }
.palette .pal-paste:hover, .palette .pal-paste:focus-visible { background: var(--sunk); color: var(--ink); }
@media (max-width: 480px) { .pal-grid { grid-template-columns: repeat(2, auto); gap: 8px 6px; } .pal-col:nth-child(3) { border-left: 0; padding-left: 0; } }

/* ---- Popup / modal ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(23, 27, 32, .38); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 9vh 12px 12px; animation: fade .15s ease-out; }
.modal { background: var(--panel); border-radius: 12px; padding: 22px 24px; width: min(520px, 94vw); box-shadow: var(--shadow-pop); max-height: 86vh; overflow: auto; animation: pop .2s var(--ease); }
.modal.wide { width: min(1040px, 96vw); }
.modal input[type=text], .modal select, .modal textarea { width: 100%; }
.modal .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.modal .actions { display: flex; gap: 8px; margin-top: 20px; align-items: center; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.modal-head h2, .modal-head h3 { margin: 0; flex: 1; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .palette, .modal, .modal-bg { animation: none; } }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 90; box-shadow: var(--shadow-pop); }


/* ---- Učitel ---- */
.t-app { display: grid; grid-template-columns: 216px 1fr; height: 100vh; }
.t-nav { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; }
.t-nav .brand { padding: 2px 10px 20px; font-size: 17px; }
.t-nav button { justify-content: flex-start; background: transparent; border: 0; padding: 8px 10px; border-radius: 7px; color: var(--ink-2); gap: 10px; }
.t-nav button:hover { background: var(--sunk); }
.t-nav button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.t-main { overflow: auto; padding: 24px 30px 60px; }
.t-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.t-head h2 { margin: 0; font-size: 22px; }
.t-head .sub { color: var(--muted); }
.lead { color: var(--muted); max-width: 72ch; margin: 0 0 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--panel); position: sticky; top: 0; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.click:hover td { background: #f7f4ee; cursor: pointer; }
table.list td.n { font-variant-numeric: tabular-nums; }
.code-big { font-family: var(--mono); font-size: 19px; font-weight: 700; letter-spacing: .12em; }
.summary { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; font-size: 13.5px; color: var(--ink-2); }
.summary span { display: inline-flex; align-items: center; gap: 7px; }
.summary b { font-variant-numeric: tabular-nums; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.scard { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; cursor: pointer; transition: border-color .15s, box-shadow .15s; text-align: left; display: block; width: 100%; font: inherit; color: inherit; }
.scard:hover { border-color: var(--line-strong); box-shadow: 0 4px 14px -6px rgba(28,32,38,.18); background: var(--panel); }
.scard.away { background: #fff6f5; border-color: #efc4bf; }
.scard.offline { opacity: .7; }
.scard .top { display: flex; align-items: center; gap: 8px; }
.scard .name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scard .st { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.scard .st.status { color: var(--ink-2); }
.scard.away .st.status { color: var(--bad); font-weight: 600; }
.scard .tasks { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.scard .tk { font-size: 11.5px; padding: 1px 7px; border-radius: 5px; background: var(--sunk); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.scard .tk.ok { background: var(--ok-soft); color: var(--ok); }
.scard .tk.part { background: var(--warn-soft); color: var(--warn); }
.timeline { max-height: 52vh; overflow: auto; font-size: 13px; }
.timeline div { padding: 5px 0; border-bottom: 1px solid var(--sunk); display: grid; grid-template-columns: 64px 1fr; gap: 8px; }
.timeline time { color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .w { color: var(--bad); }
.sus-list { font-size: 13px; display: grid; gap: 3px; }
.sus-list div { display: flex; justify-content: space-between; gap: 10px; }
.codes-print { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.codes-print div { border: 1px dashed #999; padding: 12px; text-align: center; }
.codes-print .c { font-family: var(--mono); font-size: 24px; letter-spacing: .15em; font-weight: 700; margin: 4px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 7px; padding: 5px 10px; background: #fff; font-size: 13.5px; cursor: pointer; margin: 0; font-weight: 400; color: var(--ink); }
.chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pick { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; margin: 5px 0; background: #fff; font-size: 14px; font-weight: 400; color: var(--ink); cursor: pointer; }
.pick.on { border-color: var(--accent); background: var(--accent-soft); }
.pick .ord { width: 22px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.variant-box { border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; margin-top: 12px; background: #fbf9f5; }
.viewer { overflow: auto; max-height: 58vh; border: 1px solid var(--line); border-radius: 9px; padding: 12px;
  background: radial-gradient(circle, #ddd8ce 1px, transparent 1.2px) 0 0/18px 18px, #faf8f4; }
.projector { text-align: center; padding: 10px 0 6px; }
.projector .code { font-family: var(--mono); font-size: clamp(64px, 13vw, 132px); font-weight: 800; letter-spacing: .14em; line-height: 1.05; margin: 10px 0 14px; }
.empty { padding: 26px; text-align: center; color: var(--muted); }

@media print {
  .t-nav, .noprint { display: none !important; }
  .t-app { display: block; }
  .t-main { overflow: visible; padding: 0; }
  .card { border: 0; }
}
@media (max-width: 900px) {
  .t-app { grid-template-columns: 1fr; height: auto; }
  .t-nav { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); }
  .t-nav .brand { padding: 6px 10px; }
  .t-main { padding: 18px 14px 40px; }
}


/* ---- Sjednocení: záhlaví panelů, stránkové formuláře, šířka obsahu ---- */
.t-main > * { max-width: 1240px; margin-left: auto; margin-right: auto; }
.page-form form { display: block; }
.page-form .card { padding: 18px 20px; }
.page-form .variant-box { background: var(--panel); margin-top: 0; }
.form-bar { position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; gap: 10px; margin: 18px -30px -60px; padding: 12px 30px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(6px); border-top: 1px solid var(--line); }
.form-bar .err { margin: 0; min-height: 0; }
@media (max-width: 900px) { .form-bar { margin: 18px -14px -40px; padding: 12px 14px; } }
.page-form input[type=text], .page-form textarea, .page-form select { width: 100%; }

.chip.absent { border-color: #efc4bf; background: var(--bad-soft); color: var(--bad); text-decoration: line-through; text-decoration-color: #b3261e88; }
.chip.has { opacity: .6; cursor: default; }
select.vsel { padding: 2px 4px; font-size: 12.5px; border-radius: 5px; }
details > summary { list-style: revert; }
.name-list { display: grid; gap: 4px; max-height: 46vh; overflow: auto; margin-top: 4px; }
.name-list button { justify-content: flex-start; text-align: left; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--sunk); gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 6px; }
.seg button:hover { background: #fff8; }
.seg button.on { background: var(--panel); box-shadow: 0 1px 3px rgba(28,32,38,.15); font-weight: 600; }
.groups { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .groups { grid-template-columns: 1fr; } }

.confirm-bg { z-index: 85; align-items: center; padding-top: 0; }
.modal.confirm { width: min(420px, 94vw); padding: 22px 22px 18px; }
.modal.confirm p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink); text-wrap: pretty; }
.modal.confirm .actions { margin-top: 22px; }
button.danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 600; }
button.danger-solid:hover { background: #962019; border-color: #962019; }

.live-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.live-log { position: sticky; top: 0; padding: 14px 14px 8px; }
.live-log .timeline { max-height: calc(100vh - 220px); }
.live-log .timeline div { grid-template-columns: 58px 1fr; font-size: 12.5px; }
@media (max-width: 1100px) { .live-layout { grid-template-columns: 1fr; } .live-log { position: static; } }

.form-grid { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: flex-start; }
.form-grid input[type=date], .form-grid input[type=time], .form-grid select { width: auto; min-width: 140px; }
.student-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; padding: 10px 12px; background: var(--sunk); border-radius: 9px; font-size: 13.5px; }

/* ---- Okno úpravy bloku ---- */
.block-modal { padding: 20px 22px 18px; }
.block-modal .modal-head { gap: 12px; padding-bottom: 12px; margin-bottom: 2px; border-bottom: 1px solid var(--sunk); }
.block-modal .modal-head svg.pv { width: 44px; height: 22px; flex: none; }
.block-modal .modal-head h3 { font-size: 16px; font-weight: 600; color: var(--ink-2); }
.block-modal .bm-type { color: var(--ink); font-weight: 700; }
.block-modal input[data-expr]:not([name=text]) { font-family: var(--mono); font-size: 14px; }
.block-modal .hint code { font-size: 12px; padding: 0 4px; }
.block-modal .actions { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--sunk); }
.block-modal .err:empty { display: none; }
.block-modal .err { margin-top: 10px; padding: 7px 10px; border-radius: 7px; background: var(--bad-soft); min-height: 0; }

.live-table td { font-size: 13.5px; }
.live-table .badge svg.i { width: 11px; height: 11px; }
table.list.hub { table-layout: fixed; }

.date-wrap { position: relative; display: inline-block; }
.date-btn { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); padding: 4px; }
.cal { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; width: 272px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 10px; animation: pop .15s var(--ease); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-head b { font-size: 14px; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-grid i { font-style: normal; font-size: 11.5px; color: var(--muted); text-align: center; padding: 4px 0; }
.cal-grid button { border: 0; background: transparent; padding: 0; height: 34px; border-radius: 7px; font-variant-numeric: tabular-nums; }
.cal-grid button:hover { background: var(--sunk); }
.cal-grid button.past { color: #a3a8b0; }
.cal-grid button.today { box-shadow: inset 0 0 0 1px var(--accent); }
.cal-grid button.sel { background: var(--accent); color: #fff; font-weight: 600; }
.cal-foot { display: flex; justify-content: flex-end; margin-top: 6px; }
.cal-foot button { padding: 4px 10px; font-size: 13px; }

/* ==== Aplikace studenta ====
   Tři sloupce: zadání jako karta, plátno, běh programu. Klidné plochy, barvu nesou bloky a stavy. */
.app { display: grid; grid-template-rows: auto 1fr; height: 100vh; }
.topbar { position: relative; z-index: 6; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 14px 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar .title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30ch; }
.topbar .title:empty { display: none; }
.topbar .tabs { display: flex; flex-wrap: nowrap; gap: 2px; padding: 3px; background: var(--sunk); border-radius: 10px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.topbar .tabs:empty { display: none; }
.topbar .tabs:has(select) { background: none; padding: 0; }
.topbar .tabs button { gap: 8px; border: 0; padding: 6px 13px; border-radius: 7px; background: transparent; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.topbar .tabs button:hover { background: #ffffffa0; color: var(--ink); }
.topbar .tabs button.active { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(28, 32, 38, .14), 0 0 0 1px rgba(28, 32, 38, .05); }
.topbar .tabs button .dot { width: 8px; height: 8px; background: transparent; box-shadow: inset 0 0 0 1.5px #aaa498; }
.topbar .tabs button .dot.ok { background: #2fb350; box-shadow: none; }
.topbar .tabs button .dot.part { background: #e0a100; box-shadow: none; }
.task-select { max-width: 300px; font-weight: 500; }
.topbar .who { display: inline-flex; align-items: center; height: 28px; padding-left: 14px; border-left: 1px solid var(--line); color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.topbar .who:empty { display: none; }

/* Časovač: tmavá pilulka, pod 5 min červená, poslední minuta pulzuje */
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 16px; padding: 3px 10px; border-radius: 6px; background: var(--sunk); }
.timer.low { background: var(--bad); color: #fff; }
.timer.last { animation: timer-pulse 1s ease-in-out infinite; }
@keyframes timer-pulse { 50% { opacity: .55; } }
.topbar .timer { display: inline-flex; align-items: baseline; justify-content: center; gap: 9px; min-width: 128px; padding: 8px 14px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 21px; line-height: 1; letter-spacing: .01em; }
.topbar .timer::before { content: 'Zbývá'; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #ffffffa6; }
.topbar .timer.low { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.topbar .timer.low::before { color: #ffffffd0; }
@media (prefers-reduced-motion: reduce) { .timer.last { animation: none; } }

.main { display: grid; grid-template-columns: clamp(290px, 23vw, 390px) minmax(0, 1fr) clamp(300px, 24vw, 400px); min-height: 0; }
.side { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side.right { border-right: 0; border-left: 1px solid var(--line); }

/* -- Zadání -- */
.task-scroll { flex: 1; min-height: 0; overflow: auto; padding: 20px 20px 24px; }
.task-kicker { font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.task-kicker:empty { display: none; }
.task-scroll > h2 { font-size: 19px; margin-bottom: 12px; }
.task-text { white-space: pre-wrap; position: relative; overflow: hidden; font-size: 15px; line-height: 1.65; text-wrap: pretty; }
.task-text.protect { user-select: none; -webkit-user-select: none; }
.watermark { position: absolute; inset: 0; pointer-events: none; opacity: .07; font-size: 13px; overflow: hidden; line-height: 2.4; transform: rotate(-18deg) scale(1.3); white-space: normal; word-break: break-all; }
.note { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; line-height: 1.55; }

.help-wrap { white-space: normal; }
.help-wrap h4 { margin: 0 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.help { display: grid; grid-template-columns: auto 1fr; margin: 0 0 20px; font-size: 13.5px; line-height: 1.4; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.help dt, .help dd { margin: 0; padding: 7px 12px; border-top: 1px solid var(--sunk); }
.help dt:first-of-type, .help dd:first-of-type { border-top: 0; }
.help dt { background: #faf8f4; border-right: 1px solid var(--sunk); white-space: nowrap; }
.help dt code { background: none; padding: 0; color: var(--accent); font-weight: 600; }
.help dd { color: var(--ink-2); }
.fn-list { display: flex; flex-wrap: wrap; gap: 5px; }
.fn-list code { font-size: 12.5px; padding: 2px 7px; border-radius: 5px; color: var(--ink-2); }

.example { margin-top: 18px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: 13px; }
.example .ex-head { padding: 6px 12px; font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); background: #faf8f4; border-bottom: 1px solid var(--line); }
.example .ex-cols { display: grid; grid-template-columns: 1fr 1fr; }
.example .ex-col { padding: 9px 12px 11px; min-width: 0; }
.example .ex-col + .ex-col { border-left: 1px solid var(--line); }
.example .ex-col > span { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.example .vals { display: flex; flex-wrap: wrap; gap: 4px; }
.example .vals code { font-size: 13px; padding: 2px 7px; border-radius: 5px; color: var(--ink); word-break: break-word; }
.example .vals .none { color: var(--muted); font-style: italic; }

.result-box { margin-top: 18px; font-size: 13px; }
.result-box:empty { display: none; }
.res-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.res-head .badge { font-size: 12.5px; padding: 3px 10px; }
.res-head .res-ok { color: var(--ok); font-weight: 600; }
.res-bar { display: flex; gap: 3px; margin: 10px 0 12px; }
.res-bar i { flex: 1; height: 6px; border-radius: 3px; background: #4cb56b; }
.res-bar i.bad { background: #e0675e; }
.res-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.res-list li { border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; background: var(--panel); }
.res-list li.bad { border-color: #efc4bf; background: #fff8f7; }
.res-list .rt { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.res-list .ri { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); flex: none; }
.res-list li.bad .ri { background: var(--bad-soft); color: var(--bad); }
.res-list .ri svg.i { width: 12px; height: 12px; stroke-width: 2.8; }
.res-list .rs { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--muted); }
.res-list li.bad .rs { color: var(--bad); }
.res-list dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 7px 0 1px 28px; font-size: 12.5px; }
.res-list dt { color: var(--muted); }
.res-list dd { margin: 0; font-family: var(--mono); white-space: pre-wrap; word-break: break-word; color: var(--ink); }
.res-list .rerr { margin: 6px 0 1px 28px; font-size: 12.5px; color: var(--bad); white-space: pre-wrap; }

.task-actions { display: grid; gap: 8px; padding: 14px 20px 16px; border-top: 1px solid var(--line); background: #faf8f4; }
.task-actions button { width: 100%; padding: 9px 14px; font-size: 14.5px; }
.task-actions button:not(.primary) { font-weight: 600; border-color: var(--line-strong); }

/* -- Plátno -- */
.canvas-wrap { overflow: auto; position: relative; background: radial-gradient(circle, #d9d4ca 1px, transparent 1.2px) 0 0/20px 20px, #f6f4ef; }
.canvas { padding: 8px 40px 96px; display: flex; justify-content: center; }
.canvas-tools { position: sticky; top: 12px; left: 12px; z-index: 5; display: inline-flex; align-items: center; gap: 2px; margin: 12px; padding: 4px; background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 6px 16px -8px rgba(28, 32, 38, .22), 0 1px 2px rgba(28, 32, 38, .06); }
.canvas-tools button { padding: 6px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); }
.canvas-tools button:hover { background: var(--sunk); color: var(--ink); }
.canvas-tools .zlab { min-width: 54px; padding: 6px 4px; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.canvas-tools .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.canvas-tools #clear:hover { background: var(--bad-soft); color: var(--bad); }
.empty-hint { position: absolute; left: 50%; top: 236px; transform: translateX(-50%); width: max-content; max-width: 290px; margin: 0; padding: 10px 14px; text-align: center; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 16px -10px rgba(28, 32, 38, .25); }
.empty-hint b { display: inline-grid; place-items: center; width: 19px; height: 19px; margin: 0 1px; border-radius: 50%; border: 1.3px solid #a3a9b1; background: #fff; color: #5d6670; font-size: 14px; line-height: 1; vertical-align: -4px; }

/* -- Běh programu -- */
.run-bar { display: grid; gap: 12px; padding: 14px 14px 12px; border-bottom: 1px solid var(--line); }
.run-btns { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; }
.run-btns button { padding: 8px 12px; }
.run-btns #run { font-size: 14.5px; }
.run-btns #stop:not(:disabled) { color: var(--bad); border-color: #e9b9b5; }
.run-btns #stop:not(:disabled):hover { background: var(--bad-soft); }
.run-bar .speed { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.run-bar .speed input[type=range] { flex: 1; min-width: 60px; padding: 0; border: 0; accent-color: var(--accent); background: transparent; }
.run-bar .speed input[type=range]:focus { box-shadow: none; }
.run-bar .speed-val { min-width: 6.6em; text-align: right; color: var(--ink-2); font-weight: 600; }

.pane-head { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 6px 10px 6px 14px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--panel); border-bottom: 1px solid var(--line); }
.pane-head .ph-title { font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.pane-head.dark { background: #1f252c; color: #aeb6bf; border-bottom-color: #2b323a; }
.pane-head.dark button { color: #aeb6bf; padding: 5px; }
.pane-head.dark button:hover { background: #2c343d; color: #fff; }
.run-state { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: #c7cdd4; background: #ffffff12; }
.run-state:empty { display: none; }
.run-state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.run-state[data-s=run], .run-state[data-s=step] { color: #7ee2a8; background: #7ee2a81a; }
.run-state[data-s=run]::before { animation: timer-pulse 1s ease-in-out infinite; }
.run-state[data-s=wait] { color: #ffd27a; background: #ffd27a1a; }
.run-state[data-s=error] { color: #ff9b91; background: #ff9b911a; }
@media (prefers-reduced-motion: reduce) { .run-state::before { animation: none !important; } }

.console { flex: 1; min-height: 140px; overflow: auto; padding: 12px 14px; background: #171b20; color: #e4e6e9; font-family: var(--mono); font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.console .sys { color: #8d96a1; }
.console .in { color: #8fe3a4; }
.console .in::before { content: ''; display: inline-block; width: 3px; height: 1.05em; margin-right: 8px; border-radius: 2px; background: #8fe3a466; vertical-align: -3px; }
.console .er { display: block; margin: 8px 0 4px; padding: 7px 10px; border: 1px solid #ff8a8055; border-radius: 7px; background: #ff6b5e1c; color: #ffb4ab; }
.console .er:first-child { margin-top: 0; }
.console .end { display: block; margin-top: 10px; padding-top: 6px; border-top: 1px dashed #343d47; font-family: var(--sans); font-size: 12px; }

.inputline { padding: 10px 12px 12px; background: #1f252c; border-top: 1px solid #2b323a; animation: fade .15s ease-out; }
.inputline .in-label { display: flex; align-items: center; gap: 7px; margin: 0 0 7px; font-size: 12.5px; font-weight: 500; color: #c7cdd4; }
.inputline .in-label b { color: #fff; font-family: var(--mono); font-weight: 600; }
.inputline .in-key { font-size: 11px; font-weight: 600; color: #8d96a1; border: 1px solid #3a424c; border-radius: 4px; padding: 0 5px; }
.inputline .in-row { display: flex; gap: 6px; }
.inputline input { flex: 1; min-width: 0; background: #101317; color: #fff; border-color: #ffd27a80; font-family: var(--mono); font-size: 14px; }
.inputline input:focus { border-color: #ffd27a; box-shadow: 0 0 0 3px #ffd27a2e; }

.vars { max-height: 34vh; overflow: auto; padding: 0 0 8px; font-size: 13px; }
.vars table { width: 100%; border-collapse: collapse; }
.vars th { position: sticky; top: 0; padding: 7px 14px 5px; text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--panel); border-bottom: 1px solid var(--line); }
.vars td { padding: 6px 14px; border-bottom: 1px solid var(--sunk); vertical-align: middle; }
.vars td:first-child { font-weight: 600; color: var(--ink); }
.vars td.v { font-family: var(--mono); font-variant-numeric: tabular-nums; word-break: break-word; }
.vars .t { text-align: right; white-space: nowrap; }
.vars tr.chg td { animation: var-chg 1.2s ease-out; }
@keyframes var-chg { from { background: #ffe9a8; } to { background: transparent; } }
.vars .empty-row td { padding: 12px 14px; border: 0; color: var(--muted); font-weight: 400; }
.ty { display: inline-block; padding: 1px 7px; border-radius: 5px; font-family: var(--sans); font-size: 11px; font-weight: 600; line-height: 1.6; background: var(--sunk); color: var(--ink-2); }
.ty-int { background: #e1ecf8; color: #245a8f; }
.ty-real { background: #ece5f7; color: #5b3d8f; }
.ty-string { background: #fbefd5; color: #7a5200; }
.ty-bool { background: #fbe3e8; color: #8f2f48; }
.inputline .ty { margin-left: 2px; }

/* -- Kód od učitele -- */
.join-modal { width: min(400px, 94vw); padding: 22px 24px 22px; }
.join-modal .modal-head h3 { font-size: 18px; }
.join-modal .code-input { width: 100%; margin-top: 14px; padding: 12px 10px 12px calc(10px + .35em); font-size: 28px; font-weight: 600; letter-spacing: .35em; border-width: 1.5px; border-radius: 10px; background: #faf8f4; }
.join-modal .code-input:focus { background: #fff; }
.join-modal .join-sub { margin: 4px 0 8px; color: var(--muted); }
.join-modal .name-q { width: 100%; }
.join-modal .name-list { margin-top: 8px; }
.join-modal .name-list button { padding: 8px 12px; }
.join-modal .err:empty { min-height: 0; margin: 0; }
.join-modal .actions { margin-top: 16px; }
.join-modal .actions button { flex: 1; padding: 10px; font-size: 15px; }

/* -- Překryvy testu -- */
.overlay-block { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; text-align: center; color: #fff; background: rgba(23, 27, 32, .94); }
.overlay-block .box { width: 100%; max-width: 460px; padding: 34px 36px 30px; background: #1f252c; border: 1px solid #ffffff14; border-radius: 16px; box-shadow: 0 24px 60px -24px #000c; animation: pop .2s var(--ease); }
.overlay-block .box.bare { width: auto; padding: 0; background: none; border: 0; box-shadow: none; }
.overlay-block h2 { font-size: 26px; margin-bottom: 10px; }
.overlay-block p { color: #d7dbe0; margin: 10px 0 0; }
.overlay-block .muted { color: #a9b2bc; font-size: 13.5px; line-height: 1.6; }
.overlay-block .rules { text-align: left; background: #ffffff10; border-radius: 10px; padding: 14px 18px; margin: 18px 0; font-size: 13.5px; color: #cfd5dc; line-height: 1.6; }
.overlay-block .ov-act { margin-top: 24px; }
.overlay-block .box.bare .ov-act { margin: 0; }
.overlay-block button.primary { font-size: 16px; padding: 12px 30px; border-radius: 10px; }
.overlay-block .ov-icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 50%; background: #2fb35026; color: #7ee2a8; }
.overlay-block .ov-icon svg.i { width: 28px; height: 28px; stroke-width: 2.4; }
.overlay-block .ov-name { display: inline-block; margin: 0 0 14px; padding: 3px 12px; border-radius: 999px; background: #ffffff12; font-size: 13.5px; font-weight: 600; }
.overlay-block .wait-left { margin-top: 14px; font-size: 44px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; color: #fff; }
@media (prefers-reduced-motion: reduce) { .overlay-block .box { animation: none; } }

@media (max-width: 1100px) {
  .topbar { gap: 10px; padding-left: 14px; }
  .topbar .title { max-width: 18ch; }
  .topbar .timer { min-width: 0; }
  .topbar .timer::before { display: none; }
}
@media (max-width: 900px) {
  .app { height: auto; min-height: 100vh; }
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; }
  .main { grid-template-columns: 1fr; }
  .side, .side.right { border: 0; border-bottom: 1px solid var(--line); }
  .canvas-wrap { min-height: 60vh; border-bottom: 1px solid var(--line); }
  .console { min-height: 160px; }
}
