/* Opakování ZŠ – školní sešit a tabule */

@font-face {
  font-family: "Lexend";
  src: url("/fonts/lexend-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  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";
  src: url("/fonts/lexend-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  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: "Caveat";
  src: url("/fonts/caveat-latin-ext-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
  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: "Caveat";
  src: url("/fonts/caveat-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
  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 {
  --paper: #fcfdff;
  --grid: #dde6f3;
  --line: #bccfea;
  --margin: #e9a3a0;
  --ink: #1d2b4f;
  --ink-soft: #4f5d7c;
  --pen: #1c3faa;
  --pen-dark: #142e80;
  --red: #c4302a;
  --green: #23824a;
  --green-bg: #dcf3e3;
  --red-bg: #fce3e1;
  --marker: #ffd94a;
  --marker-soft: #fff4c4;
  --board: #23453b;
  --board-deep: #1b382f;
  --chalk: #f2f5ee;
  --chalk-dim: #c9d6cc;
  --frame: #8a5a35;
  --frame-dark: #6b4428;
  --focus: #f2a900;
  --hand: "Caveat", "Segoe Print", "Comic Sans MS", cursive;
  --text: "Lexend", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
}

a { color: var(--pen); }
h1, h2, h3 { line-height: 1.2; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.hand { font-family: var(--hand); font-weight: 600; }
.muted { color: var(--ink-soft); }

/* ------------------------------------------------------------ horní lišta */

.topbar {
  background: var(--board);
  border-bottom: 6px solid var(--frame);
  color: var(--chalk);
}
.topbar-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  font-family: var(--hand);
  font-weight: 600;
  font-size: 2rem;
  color: var(--chalk);
  text-decoration: none;
  line-height: 1.1;
}
#topbar-right { display: flex; align-items: center; gap: 10px; }
.who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--chalk);
  text-decoration: none;
  font-weight: 600;
}
.who:hover { background: rgba(255, 255, 255, 0.18); }
.who.ghostly { padding: 6px 14px; }
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
}

.page {
  flex: 1;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}
.page:focus { outline: none; }

.foot {
  text-align: center;
  padding: 18px 20px 28px;
  font-size: 0.95rem;
}
.foot a { color: var(--ink-soft); }

.loading { text-align: center; color: var(--ink-soft); padding: 60px 0; }

/* ------------------------------------------------------------ obecné bloky */

.hero { margin: 8px 0 24px; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 3.6rem); margin: 0; }
.hero.row { display: flex; align-items: center; gap: 20px; }
.lead { font-size: 1.15rem; color: var(--ink-soft); margin: 4px 0 0; }

.page-title { font-size: clamp(2.4rem, 5vw, 3.2rem); margin: 4px 0 20px; }

.crumbs { font-size: 0.95rem; color: var(--ink-soft); }
.crumbs .sep { margin: 0 0.45em; color: #9aa6bf; }

.paper {
  background: #fff;
  border: 1px solid #d3dcea;
  border-radius: 6px;
  padding: 22px 24px;
  box-shadow: 0 3px 0 #d3dcea;
}
.paper + .paper, .paper + .actions, .tiles + .paper { margin-top: 18px; }
.paper.narrow, .board.narrow { max-width: 520px; margin: 24px auto; }
.paper.center { text-align: center; }

/* linkovaný papír s okrajem */
.lined {
  background:
    linear-gradient(90deg, transparent 46px, var(--margin) 46px, var(--margin) 48px, transparent 48px),
    #fff;
  padding-left: 64px;
}

.empty { text-align: center; padding: 36px 24px 36px 64px; }
.empty .big { font-size: 2rem; margin: 0 0 6px; }

.board {
  position: relative;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(255, 255, 255, 0.05), transparent 55%),
    radial-gradient(ellipse at 80% 70%, rgba(255, 255, 255, 0.04), transparent 50%),
    var(--board);
  color: var(--chalk);
  border: 12px solid var(--frame);
  border-bottom-width: 18px;
  border-radius: 8px;
  padding: 26px 30px;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.35), 0 4px 0 var(--frame-dark);
}
.chalk-kicker { margin: 0; color: var(--chalk-dim); font-size: 1rem; }
.chalk-title { font-family: var(--hand); font-weight: 600; font-size: clamp(2.4rem, 5.5vw, 3.4rem); margin: 0 0 8px; line-height: 1.05; }
.chalk-text { font-size: 1.2rem; margin: 0 0 10px; color: var(--chalk); max-width: 60ch; }
.chalk-meta { margin: 0; color: var(--chalk-dim); font-size: 0.95rem; }
.chalk-best { margin: 10px 0 0; color: var(--chalk-dim); }
.chalk-best .star.on { color: var(--marker); }

/* ------------------------------------------------------------ tlačítka */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  padding: 11px 22px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.primary { background: var(--pen); border-color: var(--pen-dark); color: #fff; box-shadow: 3px 3px 0 var(--pen-dark); }
.btn.small { padding: 6px 12px; font-size: 0.92rem; box-shadow: 2px 2px 0 var(--ink); }
.btn.primary.small { box-shadow: 2px 2px 0 var(--pen-dark); }
.btn.big { font-size: 1.25rem; padding: 14px 30px; }
.btn.danger { color: var(--red); border-color: var(--red); box-shadow: 2px 2px 0 var(--red); }
.btn.danger.armed { background: var(--red); color: #fff; }
.btn:disabled { opacity: 0.55; cursor: default; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.actions.center { justify-content: center; }

/* ------------------------------------------------------------ sešity (úrovně, předměty) */

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 26px;
}
.shelf.levels { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }

.notebook {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 250px;
  padding: 30px 22px 26px 40px;
  border-radius: 4px 12px 12px 4px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.22) 0 14px, rgba(255, 255, 255, 0.12) 14px 16px, transparent 16px),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 6px),
    var(--cover, var(--pen));
  box-shadow: 0 6px 0 -2px rgba(0, 0, 0, 0.18), 0 10px 18px -10px rgba(29, 43, 79, 0.5);
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.notebook:hover { transform: translateY(-4px) rotate(-0.6deg); box-shadow: 0 10px 0 -2px rgba(0, 0, 0, 0.15), 0 18px 24px -12px rgba(29, 43, 79, 0.55); }
.notebook.small { min-height: 200px; }
.label {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fff;
  border-radius: 8px;
  padding: 14px 16px 12px;
  box-shadow: inset 0 0 0 2px rgba(29, 43, 79, 0.12);
}
.label-icon { font-size: 1.7rem; line-height: 1; }
.label-title { font-family: var(--hand); font-weight: 600; font-size: 2.1rem; line-height: 1.05; border-bottom: 2px dotted #c2cde0; padding-bottom: 4px; }
.label-text { font-size: 0.95rem; color: var(--ink-soft); line-height: 1.4; }
.label-meta { font-size: 0.88rem; font-weight: 600; color: var(--ink-soft); }
.ribbon {
  position: absolute;
  top: 12px;
  right: -6px;
  background: var(--marker);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 4px 12px;
  border-radius: 4px 0 0 4px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

/* ------------------------------------------------------------ seznam cvičení */

.task-list { list-style: none; margin: 0; padding: 6px 12px 6px 64px; }
.task-list li + li { border-top: 1px solid var(--line); }
.task {
  display: grid;
  grid-template-columns: 44px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 8px;
  text-decoration: none;
  color: var(--ink);
  border-radius: 6px;
}
.task:hover { background: var(--marker-soft); }
.task-icon { font-size: 1.6rem; text-align: center; }
.task-body { display: flex; flex-direction: column; min-width: 0; }
.task-title { font-weight: 600; font-size: 1.15rem; }
.task-desc { color: var(--ink-soft); font-size: 0.95rem; }

.diff { display: inline-flex; gap: 4px; }
.pip { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--ink-soft); }
.pip.on { background: var(--ink-soft); }

.stars { display: inline-flex; gap: 1px; font-size: 1.3rem; line-height: 1; white-space: nowrap; }
.star { color: #b9c3d6; }
.star.on { color: #e3a200; }

/* ------------------------------------------------------------ úvod cvičení: režimy */

.intro { margin-top: 12px; }
.modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 22px;
}
.mode {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  padding: 18px 20px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
.mode:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.mode-practice, .mode-match { background: var(--marker-soft); }
.mode-label { font-size: 1.45rem; font-weight: 700; }
.mode-hint { color: var(--ink-soft); font-size: 0.98rem; }

/* ------------------------------------------------------------ hra */

.game { max-width: 820px; margin: 0 auto; }
.game-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; }
.progress { flex: 1; }
.dots { display: flex; flex-wrap: wrap; gap: 6px; }
.dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #9aa6bf; background: #fff; }
.dot.current { border-color: var(--pen); box-shadow: 0 0 0 3px rgba(28, 63, 170, 0.2); }
.dot.ok { background: var(--green); border-color: var(--green); }
.dot.bad { background: var(--red); border-color: var(--red); }
.timebar { height: 14px; border-radius: 7px; background: #e1e8f3; overflow: hidden; border: 2px solid var(--ink); }
.timebar-fill { height: 100%; width: 100%; background: var(--pen); transition: width 0.1s linear; }
.time-row { display: flex; justify-content: space-between; font-weight: 700; margin-top: 4px; }
.quit { flex: none; }

.play-board {
  margin: 14px 0 20px;
  min-height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.play-board.slim { min-height: 0; padding: 14px 24px; }
.prompt { margin: 0; font-size: clamp(1.6rem, 4.6vw, 2.5rem); font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.prompt.math { font-size: clamp(2.2rem, 7.5vw, 3.6rem); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; white-space: nowrap; }
.prompt.item { font-size: clamp(2rem, 6vw, 3rem); font-weight: 600; }
.prompt.small { font-size: 1.15rem; color: var(--chalk-dim); }
.gap { display: inline-block; min-width: 1.3em; border-bottom: 5px solid var(--marker); margin: 0 0.06em; line-height: 1.05; }
.gap.filled-ok { color: #a6ecbf; }
.gap.filled-bad { color: #ffc3bd; }
.speak {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.3rem;
  cursor: pointer;
}

.options { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.options.n2, .options.n4 { grid-template-columns: repeat(2, 1fr); }
.options.n3 { grid-template-columns: repeat(3, 1fr); }
.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 14px 18px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 1.4rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
.opt:not(:disabled):active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.opt .key {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid #b9c3d6;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 700;
}
.opt.sym { justify-content: center; font-size: 2.4rem; font-weight: 700; }
.opt.sym .key { display: none; }
.opt.bucket { justify-content: center; font-weight: 700; min-height: 84px; background: var(--marker-soft); }
.opt.bucket .key { display: none; }
.opt:disabled { cursor: default; opacity: 0.5; }
.opt.right { opacity: 1; background: var(--green-bg); border-color: var(--green); box-shadow: 3px 3px 0 var(--green); }
.opt.wrong { opacity: 1; background: var(--red-bg); border-color: var(--red); box-shadow: 3px 3px 0 var(--red); }
.opt.wrong .opt-text { text-decoration: line-through 3px var(--red); }

.input-row { display: flex; gap: 12px; max-width: 560px; margin: 0 auto; }
.answer-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 2rem;
  font-weight: 600;
  text-align: center;
  padding: 10px 14px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
.answer-input:focus { outline: none; border-color: var(--pen); box-shadow: 0 0 0 4px rgba(28, 63, 170, 0.2); }
.answer-input.right { border-color: var(--green); background: var(--green-bg); }
.answer-input.wrong { border-color: var(--red); background: var(--red-bg); text-decoration: line-through 3px var(--red); }

.feedback { min-height: 64px; margin-top: 18px; text-align: center; }
.fb { margin: 0 0 8px; }
.fb.ok { font-family: var(--hand); font-weight: 600; font-size: 2.3rem; color: var(--green); line-height: 1; }
.fb.bad { font-size: 1.3rem; }
.fb.bad strong { color: var(--green); font-size: 1.45rem; }
.explain { font-family: var(--hand); font-weight: 600; font-size: 1.7rem; color: var(--red); margin: 0 0 12px; line-height: 1.15; }

/* řazení */
.order-line {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 72px;
  margin: 0;
  padding: 12px;
  border: 2px dashed #9aa6bf;
  border-radius: 12px;
  background: #fff;
  counter-reset: pos;
}
.order-line li { counter-increment: pos; display: flex; align-items: center; gap: 4px; }
.order-line li::before { content: counter(pos) "."; color: var(--ink-soft); font-weight: 700; font-size: 0.9rem; }
.order-line .slot { width: 70px; height: 44px; border-bottom: 3px solid #b9c3d6; }
.order-pool { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 18px 0; min-height: 56px; }
.chip {
  padding: 10px 18px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  font-size: 1.3rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}
.chip.placed { background: var(--marker-soft); }
.chip.right { background: var(--green-bg); border-color: var(--green); }
.chip.wrong { background: var(--red-bg); border-color: var(--red); }
.order-actions { text-align: center; }

/* dvojice */
.pairs-status { margin: 0; font-weight: 700; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.col { display: grid; gap: 10px; align-content: start; }
.card-btn {
  min-height: 58px;
  padding: 10px 14px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 1.25rem;
  font-weight: 500;
  cursor: pointer;
}
.card-btn.selected { background: var(--marker); }
.card-btn.right { background: var(--green-bg); border-color: var(--green); box-shadow: none; opacity: 0.75; cursor: default; }
.card-btn.wrong { background: var(--red-bg); border-color: var(--red); animation: shake 0.35s; }

.memory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.memo {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--board);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}
.memo-back, .memo-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 6px;
  transition: opacity 0.18s;
}
.memo-back { font-family: var(--hand); font-size: 2.4rem; color: var(--chalk-dim); }
.memo-face { opacity: 0; background: #fff; font-size: 1.15rem; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.memo.open .memo-face, .memo.matched .memo-face { opacity: 1; }
.memo.open .memo-back, .memo.matched .memo-back { opacity: 0; }
.memo.matched { border-color: var(--green); cursor: default; }
.memo.matched .memo-face { background: var(--green-bg); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ------------------------------------------------------------ výsledek */

.result { text-align: center; padding-top: 30px; max-width: 640px; margin: 0 auto; }
.stamp {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 196px;
  height: 196px;
  border-radius: 50%;
  border: 7px double var(--red);
  color: var(--red);
  transform: rotate(-12deg);
  margin: 0 auto 14px;
  font-family: var(--hand);
  font-weight: 600;
  background: radial-gradient(circle, rgba(196, 48, 42, 0.05), transparent 70%);
}
.stamp.s0 { border-color: var(--pen); color: var(--pen); background: none; }
.stamp-stars { font-family: var(--text); font-size: 2.3rem; line-height: 1; letter-spacing: 0.06em; }
.ss { opacity: 0.2; }
.ss.on { opacity: 1; }
.stamp-word { font-size: 2.2rem; line-height: 1.05; }
.stamp-in { animation: stamp 0.42s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
@keyframes stamp {
  from { transform: scale(1.9) rotate(-32deg); opacity: 0; }
  to { transform: scale(1) rotate(-12deg); opacity: 1; }
}
.result-score { font-size: 1.6rem; margin: 6px 0; }
.points { font-family: var(--hand); font-weight: 600; font-size: 2.2rem; color: var(--green); margin: 0; line-height: 1.1; }
.record { display: inline-block; background: var(--marker); padding: 2px 10px; font-weight: 700; margin: 8px 0 0; }
.note { color: var(--ink-soft); margin: 8px 0 0; }
.result .actions { justify-content: center; }

.corrections { max-width: 640px; margin-left: auto; margin-right: auto; }
.corrections h2 { font-size: 2rem; margin: 0 0 8px; }
.corrections ul { list-style: none; margin: 0; padding: 0; }
.corrections li { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.c-given { color: var(--red); text-decoration: line-through; }
.c-right { color: var(--green); font-weight: 700; }

/* ------------------------------------------------------------ profily */

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.45rem;
  line-height: 1;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px rgba(29, 43, 79, 0.15);
}
.avatar.sm { width: 32px; height: 32px; font-size: 1.1rem; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6); }
.avatar.lg { width: 84px; height: 84px; font-size: 2.8rem; }
.avatar.xl { width: 110px; height: 110px; font-size: 3.7rem; }

.profiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 180px)); justify-content: center; gap: 20px; }
.profile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 22px 12px 18px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 16px;
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
}
.profile:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.profile-name { font-size: 1.3rem; font-weight: 700; }
.lock { position: absolute; top: 10px; right: 12px; font-size: 1rem; }

.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(20, 30, 52, 0.55); padding: 16px; }
.pinpad { width: min(340px, 100%); background: #fff; border-radius: 18px; padding: 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pinpad.shake { animation: shake 0.35s; }
.pin-title { font-weight: 700; font-size: 1.2rem; margin: 0; }
.pin-dots { display: flex; gap: 10px; justify-content: center; min-height: 20px; }
.pd { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); }
.pd.on { background: var(--ink); }
.pin-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.pin-key { padding: 12px 0; font-size: 1.6rem; font-weight: 700; border: 2px solid var(--ink); border-radius: 12px; background: #fff; cursor: pointer; }
.pin-key.ok { background: var(--pen); color: #fff; border-color: var(--pen-dark); font-size: 1.2rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.tile { background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: 12px 16px; display: flex; flex-direction: column; }
.tile-value { font-family: var(--hand); font-weight: 600; font-size: 3rem; line-height: 1; color: var(--pen); }
.tile-label { color: var(--ink-soft); }

.history { list-style: none; margin: 0; padding: 0; }
.history li { display: grid; grid-template-columns: 1fr auto auto auto; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.h-score, .h-date { color: var(--ink-soft); font-size: 0.95rem; }

/* ------------------------------------------------------------ formuláře */

.form-error { color: var(--red); font-weight: 600; min-height: 1.3em; margin: 4px 0; }
.stack { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.big-input { font: inherit; font-size: 1.4rem; padding: 12px 14px; border: 2px solid var(--ink); border-radius: 10px; width: 100%; }
.board .big-input { border-color: var(--chalk-dim); }

.form .field { display: grid; gap: 6px; margin-bottom: 14px; align-content: start; }
.field-label { font-weight: 600; }
.field-hint { font-size: 0.9rem; color: var(--ink-soft); }
.form input[type="text"], .form input[type="password"], .form input[type="number"], .form select, .form textarea, .admin .big-input {
  font: inherit;
  font-size: 1rem;
  padding: 9px 12px;
  border: 2px solid #b8c4d8;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
.form textarea { font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace; font-size: 0.95rem; line-height: 1.5; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--pen); box-shadow: 0 0 0 3px rgba(28, 63, 170, 0.18); }
.form h2 { font-size: 2rem; margin: 0 0 12px; }
.form.wide { max-width: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
.check { display: inline-flex; align-items: center; gap: 6px; margin-right: 18px; cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 0; }
.range { display: flex; align-items: center; gap: 8px; }
.range input { width: 100% !important; }
.icon-input { max-width: 120px; font-size: 1.4rem !important; }
.preview { font-weight: 600; margin: 8px 0 0; }
.preview.ok { color: var(--green); }
.preview.bad { color: var(--red); }

.avatar-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-opt { width: 50px; height: 50px; border-radius: 50%; border: 2px solid transparent; background: #eef2f9; font-size: 1.6rem; cursor: pointer; }
.avatar-opt.on { border-color: var(--pen); background: #dfe7fb; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px #c9d2e3; cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 3px var(--ink); }

/* ------------------------------------------------------------ administrace */

.admin-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.admin-head .page-title { margin: 0; }
.admin-head-actions { display: flex; gap: 8px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid var(--ink); margin: 14px 0 20px; }
.tab {
  padding: 9px 16px;
  border: 2px solid transparent;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  margin-bottom: -2px;
}
.tab:hover { background: rgba(255, 255, 255, 0.7); }
.tab.on { background: #fff; border-color: var(--ink); }
.toolbar { margin-bottom: 16px; }
.rows { list-style: none; margin: 0; padding: 0; }
.paper.rows { padding-top: 6px; padding-bottom: 6px; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 12px 0; }
.row + .row { border-top: 1px solid #e5ebf4; }
.row-main { flex: 1; min-width: 200px; display: flex; flex-direction: column; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.is-hidden .row-main, .is-hidden .subject-head h2 { opacity: 0.55; }
.subject-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.subject-head h2 { margin: 0; flex: 1; font-size: 1.4rem; }
.badges { display: flex; gap: 6px; }
.badge { font-size: 0.8rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: #eef2f8; color: var(--ink-soft); }
.badge.warn { background: var(--marker-soft); color: #7a5b00; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip-link { padding: 7px 14px; border: 2px solid var(--ink); border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 600; background: #fff; }
.chip-link.on { background: var(--ink); color: #fff; }
.alert { border-color: var(--red); background: #fff6f5; }
.alert h2 { margin-top: 0; color: var(--red); font-size: 1.2rem; }

.child { overflow-x: auto; }
.child-head { display: flex; align-items: center; gap: 16px; }
.child-name { margin: 0; font-size: 1.6rem; }
.child-head p { margin: 0; }
.child h3 { margin: 18px 0 6px; font-size: 1.1rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 16px 0 0; }
.stats dt { font-size: 0.85rem; color: var(--ink-soft); }
.stats dd { margin: 0; font-size: 1.3rem; font-weight: 700; }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid #e5ebf4; vertical-align: top; }
.table th { color: var(--ink-soft); font-weight: 600; }
.table .bad { color: var(--red); }
.table .good { color: var(--green); font-weight: 700; }
.history-box { margin-top: 12px; }
.small-print { font-size: 0.85rem; margin-top: 24px; }

/* ------------------------------------------------------------ oznámení */

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red); }

/* ------------------------------------------------------------ mobil */

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .page { padding: 16px 14px 32px; }
  .brand { font-size: 1.7rem; }
  .who-name { display: none; }
  .board { border-width: 8px; border-bottom-width: 12px; padding: 18px 16px; }
  .lined, .task-list { padding-left: 40px; }
  .lined { background: linear-gradient(90deg, transparent 26px, var(--margin) 26px, var(--margin) 28px, transparent 28px), #fff; }
  .task { grid-template-columns: 34px 1fr auto; gap: 10px; }
  .task .diff { display: none; }
  .options.n3 { grid-template-columns: 1fr; }
  .options.n4 { grid-template-columns: 1fr 1fr; }
  .opt { font-size: 1.2rem; min-height: 60px; padding: 12px; }
  .opt .key { display: none; }
  .match { gap: 12px; }
  .card-btn { font-size: 1.05rem; }
  .memory { gap: 6px; }
  .memo-face { font-size: 0.95rem; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .corrections li { grid-template-columns: 1fr 1fr; }
  .corrections .c-q { grid-column: 1 / -1; }
  .history li { grid-template-columns: 1fr auto; }
  .h-date { display: none; }
  .empty { padding-left: 40px; }
  .stamp { width: 168px; height: 168px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
