/*
 * Společný základ vzhledu všech aplikací chemialudus.org: tvary, rozložení, velikosti a chování prvků.
 *
 * PRAVIDLO: v tomto souboru nejsou žádné konkrétní barvy, obrázky ani efekty – jen proměnné (var(--…)).
 * Hodnoty dodává téma aplikace (apps/<hra>/public/css/theme.css), seznam proměnných je v docs/temata.md.
 * Výjimkou jsou jen tiskové kartičky s QR kódy (papír je vždy bílý).
 */

@font-face { font-family: 'Lexend'; font-weight: 400; font-display: swap; src: url('/core/fonts/lexend-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Lexend'; font-weight: 400; font-display: swap; src: url('/core/fonts/lexend-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Lexend'; font-weight: 600; font-display: swap; src: url('/core/fonts/lexend-latin-ext-600-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Lexend'; font-weight: 600; font-display: swap; src: url('/core/fonts/lexend-latin-600-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Lexend'; font-weight: 700; font-display: swap; src: url('/core/fonts/lexend-latin-ext-700-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Lexend'; font-weight: 700; font-display: swap; src: url('/core/fonts/lexend-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* Strukturální hodnoty – stejné ve všech aplikacích (téma je nemění). */
  --footer-h: 44px;
  --font-body: 'Lexend', system-ui, sans-serif;
  --font-heading: var(--font-body);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--bg-image);
  background-size: var(--bg-size);
  background-repeat: var(--bg-repeat);
  background-attachment: fixed;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
button { font: inherit; }
sub, sup { font-size: 0.7em; line-height: 0; }
code { font-family: ui-monospace, Consolas, monospace; }
.site-footer { min-height: var(--footer-h); padding: 12px 16px; font-size: 13px; line-height: 20px; text-align: center; color: var(--muted); }
.site-footer span { white-space: nowrap; }
/* Na užších displejích se patička zalomí do dvou nebo tří řádků. */
@media (max-width: 660px) { :root { --footer-h: 64px; } }
@media (max-width: 460px) { :root { --footer-h: 84px; } }

/* ---------- Přepínač jazyka ---------- */

.lang-bar { display: flex; justify-content: flex-end; max-width: 1200px; margin: 0 auto; padding: 10px 16px 0; }
.lang-switch { margin: 0; }
.lang-switch label { display: inline-flex; align-items: center; gap: 6px; }
.lang-icon { font-size: 1rem; line-height: 1; }
.lang-switch select {
  padding: 5px 28px 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--edge);
  background: var(--field-bg) var(--select-arrow) no-repeat right 11px center;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  appearance: none;
  cursor: pointer;
}
.lang-switch select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lang-switch button { margin-left: 6px; }
.lang-switch option { background: var(--bg); color: var(--text); }
/* Pod lištou s přepínačem (≈ 44 px) se úvodní a chybové stránky vejdou na výšku okna bez posouvání. */
.lang-bar + .screen.center, .lang-bar + #app .screen.center { min-height: calc(100vh - var(--footer-h) - 44px); padding-top: 8px; }

/* ---------- Rozložení a pomocné třídy ---------- */

.screen { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; }
.screen.center { min-height: calc(100vh - var(--footer-h)); display: grid; place-items: center; }
.loading { text-align: center; color: var(--muted); }
.center-text { text-align: center; }
.hint { color: var(--muted); font-size: 0.9em; }
.accent { color: var(--accent); }
.ok { color: var(--ok); }
.late { color: var(--late); }
.wrong { color: var(--bad); }

/* ---------- Nadpisy ---------- */

.headline {
  margin: 0.2em 0 0.4em;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--headline-color);
  text-shadow: var(--headline-effect);
  letter-spacing: 0.01em;
  line-height: 1.15;
}
.page-title { text-align: center; font-size: clamp(1.9rem, 5vw, 3.4rem); }
.headline.warn { color: var(--headline-warn-color); text-shadow: var(--headline-warn-effect); }

/* ---------- Panely ---------- */

.pane {
  background: var(--surface);
  border: 1.5px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--surface-effect);
  backdrop-filter: var(--surface-blur);
  -webkit-backdrop-filter: var(--surface-blur);
  padding: 20px 22px;
}
.pane.narrow { max-width: 640px; margin: 0 auto; }

/* ---------- Tlačítka ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 24px;
  border-radius: 999px;
  border: 1.5px solid var(--edge);
  background: var(--btn-bg);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}
.btn:hover { box-shadow: var(--btn-hover-effect); }
.btn:active { transform: scale(0.98); }
.btn.primary {
  background: var(--btn-primary-bg);
  border-color: var(--btn-primary-border);
  color: var(--btn-primary-text);
  text-shadow: var(--btn-primary-text-shadow);
  box-shadow: var(--btn-primary-effect);
}
.btn.big { min-height: 60px; padding: 12px 56px; font-size: 1.35rem; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center; margin-top: 16px; }

/* ---------- Úvodní stránka ---------- */

.intro-card { text-align: center; }
.landing { display: grid; gap: 20px; width: 100%; }
.landing .pane.narrow { width: 100%; }

/* ---------- Žádost učitele o třídu ---------- */

.request { width: 100%; }
.request-title { font-size: clamp(1.4rem, 4vw, 2.1rem); }
.request-form { display: grid; gap: 14px; margin-top: 18px; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; color: var(--heading); }
.field small { font-weight: 400; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 9em; gap: 14px; }
@media (max-width: 460px) { .field-row { grid-template-columns: 1fr; } }
.request-form input[type='text'], .request-form input[type='email'], .request-form input[type='number'] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--edge);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
}
.request-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.request-form input::placeholder { color: var(--placeholder); }
.consent { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.consent input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
.request-form .hint { margin: 0; }
.request-form .actions { margin-top: 4px; }
.form-errors { margin: 14px 0 0; padding: 12px 16px; border-radius: 14px; background: var(--error-bg); border: 1.5px solid var(--bad); }
.form-errors ul { margin: 6px 0 0; padding-left: 1.2em; }

/* ---------- Zpětná vazba ---------- */

.shake { animation: shake 0.4s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- Modální okno a hlášky ---------- */

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: var(--overlay); }
.modal-backdrop[hidden] { display: none; }
.modal { max-width: 520px; width: 100%; background: var(--modal-bg); }
.modal .headline { font-size: 1.8rem; text-align: center; }
.toast { position: fixed; left: 50%; bottom: 20px; z-index: 60; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: var(--toast-bg); border: 1px solid var(--bad); }
.toast[hidden] { display: none; }

/* ---------- Administrace a stránka učitele ---------- */

.admin-body { background-image: none; background: var(--bg); font-size: 15px; }
.admin-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 16px; background: var(--bar-bg); border-bottom: 1px solid var(--edge); }
.admin-user { color: var(--muted); }
.admin-tools { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.print-toolbar .lang-switch { margin-left: auto; }
.admin { max-width: 1240px; margin: 0 auto; padding: 16px; }
.admin h1 { font-family: var(--font-heading); }
.admin h1 small { font-size: 0.55em; font-weight: 400; color: var(--muted); font-family: var(--font-body); }
.card { background: var(--card-bg); border: 1px solid var(--edge); border-radius: 14px; padding: 16px 18px; margin-bottom: 18px; }
.card h2 { margin-top: 0; font-size: 1.2rem; color: var(--heading); }
.admin form { margin: 10px 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.inline-form label { display: grid; gap: 4px; font-size: 0.9em; color: var(--muted); }
.admin input[type='text'], .admin input[type='number'] {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--edge);
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
}
.admin input[type='number'] { width: 7em; }
.admin select { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--edge); background: var(--field-bg); color: var(--text); font: inherit; max-width: 100%; }
.admin [hidden] { display: none !important; }
.card.attention { border-color: var(--late); }
.field-label { margin: 12px 0 4px; font-size: 0.9em; color: var(--muted); }
.data.details { width: auto; }
.data.details th { padding-right: 24px; }
.data.details td { white-space: normal; }
.admin button { padding: 8px 16px; border-radius: 8px; border: 1px solid var(--edge); background: var(--action-bg); color: var(--action-text); font-weight: 600; cursor: pointer; }
.admin button.danger { background: var(--danger-bg); border-color: var(--danger-border); }
.admin button.secondary { background: transparent; color: var(--heading); }
.admin a.button { display: inline-block; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--edge); background: transparent; color: var(--heading); font-weight: 600; text-decoration: none; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.copy-row { display: flex; gap: 10px; align-items: center; }
.copy-row input.links { flex: 1; min-width: 0; }
.csv-link { margin-left: 10px; font-size: 0.9em; }
details summary { cursor: pointer; }
.summary-title { display: inline; }
.school-list { padding-left: 1.2em; }
.school-list li { margin: 6px 0; }
.school-list .hint { margin-left: 8px; }
.links { width: 100%; padding: 10px; border-radius: 8px; border: 1px solid var(--edge); background: var(--field-bg); color: var(--text); font: 13px/1.5 ui-monospace, Consolas, monospace; resize: vertical; }
.table-wrap { overflow-x: auto; }
.data { width: 100%; border-collapse: collapse; font-size: 0.92em; }
.data th, .data td { padding: 6px 8px; border-bottom: 1px solid var(--divider); text-align: left; white-space: nowrap; }
.data th { color: var(--heading); font-weight: 600; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.85em; border: 1px solid currentColor; }
.tag.ok { color: var(--ok); }
.tag.late { color: var(--late); }
.tag.run { color: var(--accent); }
.tag.muted { color: var(--muted); }
.crumbs a { color: var(--heading); }
.class-off { color: var(--muted); }
.class-state.on { border-color: var(--ok); }
.class-state.off { border-color: var(--late); }
.class-state h2 { margin-bottom: 4px; }
.class-state p { margin: 0; }
.private-notice { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; padding: 12px 18px; border-radius: 14px; background: var(--notice-bg); border: 1.5px solid var(--highlight); font-weight: 600; }
.private-notice p { margin: 0; }
.private-icon { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--highlight); color: var(--on-highlight); font-size: 1.25rem; font-weight: 700; }
.button-row .inline-form, .data .inline-form { margin: 0; }
.results tr.flash { animation: row-flash 2.5s ease-out; }
@keyframes row-flash { 0%, 30% { background: var(--flash-bg); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .results tr.flash { animation: none; outline: 1px solid var(--highlight); } }

/* ---------- QR kódy k tisku (A4, 3 × 4 kartičky na list) – papír je vždy bílý, barvy jsou proto pevné ---------- */

@page { size: A4; margin: 10mm; }
.print-body { background-image: none; background: #dfe4e8; color: #111; color-scheme: light; font-size: 15px; }
.print-toolbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 12px 16px; background: var(--bar-bg); color: var(--text); }
.print-toolbar a { color: var(--heading); }
.print-body .site-footer { color: #555; }
.print-toolbar .hint { flex-basis: 100%; margin: 0; color: var(--muted); }
.print-toolbar button { padding: 8px 16px; border-radius: 8px; border: 1px solid var(--edge); background: var(--action-bg); color: var(--action-text); font: inherit; font-weight: 600; cursor: pointer; }
.sheets { padding: 16px; overflow-x: auto; }
.sheet { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 69mm; width: 190mm; background: #fff; }
.qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 3mm 2mm;
  border-right: 0.3mm dashed #888;
  border-bottom: 0.3mm dashed #888;
  text-align: center;
  line-height: 1.25;
}
.qr-card:nth-child(3n + 1) { border-left: 0.3mm dashed #888; }
.qr-card:nth-child(-n + 3) { border-top: 0.3mm dashed #888; }
.qr-card > div { max-width: 100%; }
.qr-game { font-size: 8pt; color: #555; }
.qr-student { font-size: 16pt; font-weight: 700; }
.qr-class { font-size: 8pt; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qr { width: 40mm; height: 40mm; margin: 1.5mm 0; fill: #000; }
/* URL (bez https://, doména přesměruje http na https) se nezalamuje – zalomení uprostřed tokenu nebylo na výtisku poznat; 41 znaků se vejde i s širším monospace fontem. */
.qr-url { font: 6.5pt/1.3 ui-monospace, Consolas, monospace; color: #555; white-space: nowrap; }
@media screen {
  .sheet { box-sizing: content-box; min-height: 277mm; padding: 10mm; margin: 0 auto 16px; align-content: start; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25); }
}
@media print {
  .print-body { background: #fff; }
  .print-toolbar, .site-footer { display: none; }
  .sheets { padding: 0; overflow: visible; }
  .sheet:not(:last-child) { break-after: page; }
}
