/* Мудрица portal: the cover in front of the workbooks. Same notebook as the math workbook
   (squared paper, red margin, blue ink, red pen, yellow marker, sticky notes), laid out as a
   long page whose content hangs off the red margin line. The red margin notes say who a
   section is for. One loud element: the solvable problem sheet in the hero. */

/* Tokens (colours, fonts, --margin), the papers and the header come from /mudrica/mudrica.css (shared/). */

:root { --measure: 40rem; --radius: 12px; } /* portal-only */

/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-padding-top: 88px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body { font-size: 1.125rem; line-height: 1.55; } /* the paper itself: <body class="paper-grid"> */

h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg { display: block; }
button, input { font: inherit; color: inherit; }

a { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--ink-deep); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 20;
  padding: 8px 14px; background: var(--ink); color: var(--on-ink); border-radius: 8px;
}
.skip:focus { top: 12px; }

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 8px 20px;
  border: 2px solid var(--ink); border-radius: 999px;
  font-weight: 800; text-decoration: none; cursor: pointer;
  transition: transform 120ms ease, background-color 120ms ease;
}
.btn:active { transform: translateY(1px); }
.btn-ink { background: var(--ink); color: var(--on-ink); }
.btn-ink:hover { background: var(--ink-deep); border-color: var(--ink-deep); color: var(--on-ink); }
.btn-plain { background: var(--paper-raised); color: var(--ink); }
.btn-plain:hover { background: var(--marker-soft); }

/* ------------------------------------------------------------------ the page's own links inside the shared header */

.top-nav { display: flex; gap: 22px; }
.top-nav a { color: var(--text); font-weight: 600; text-decoration: none; }
.top-nav a:hover { color: var(--ink); text-decoration: underline; }

/* ------------------------------------------------------------------ layout: everything hangs off the margin */

main { padding: 0 24px 0 calc(var(--margin) + 24px); }

.block { position: relative; max-width: 64rem; padding: 88px 0 0; }
.block h2 { font-size: 1.875rem; line-height: 1.2; font-weight: 800; color: var(--ink-deep); }
.section-lead { max-width: var(--measure); margin-top: 12px; }

/* Red-pen note in the margin: who the section is for. */
.margin-note {
  position: absolute; left: calc(-1 * var(--margin) - 24px + 10px); top: 92px;
  width: calc(var(--margin) - 24px);
  font-family: var(--font-hand); font-size: 1.5rem; line-height: 1.05; font-weight: 700;
  color: var(--red); text-align: right; transform: rotate(-4deg);
}

/* ------------------------------------------------------------------ hero */

.hero {
  display: grid; grid-template-columns: minmax(0, 26rem) minmax(0, 36rem);
  gap: 48px; align-items: start; max-width: 66rem;
  padding: 72px 0 24px;
}
.hero h1 { font-size: clamp(2.25rem, 4.2vw, 3.25rem); line-height: 1.08; font-weight: 800; letter-spacing: -0.01em; color: var(--ink-deep); }
.lead { margin-top: 18px; font-size: 1.25rem; max-width: 26rem; }
.hero-try { margin-top: 28px; font-family: var(--font-hand); font-size: 1.75rem; font-weight: 700; color: var(--red); }

/* The sheet: a torn-out notebook page with the problem, pinned slightly askew. */
.sheet {
  position: relative; margin-top: 8px;
  padding: 26px 28px 28px;
  background-color: var(--paper-raised);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
  border: 1px solid var(--grid-strong);
  border-radius: 4px;
  box-shadow: var(--shadow);
  transform: rotate(0.8deg);
}
.sheet::before {           /* tape */
  content: ""; position: absolute; top: -12px; left: 50%; width: 92px; height: 24px;
  transform: translateX(-50%) rotate(-3deg);
  background: rgba(255, 255, 255, 0.6); border: 1px solid rgba(0, 0, 0, 0.06);
}
.sheet .tag { margin-bottom: 8px; }
.sheet-num { font-family: var(--font-hand); font-size: 1.75rem; font-weight: 700; color: var(--red); line-height: 1; }
.sheet-title { margin-top: 6px; font-size: 1.375rem; color: var(--ink-deep); }
.sheet-text { margin-top: 10px; font-size: 1.1875rem; max-width: 30rem; }

.owl-spot { position: absolute; right: -36px; top: -64px; }

.answer { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 20px; }
.answer-label { font-weight: 800; }
.answer-box {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 12px; min-height: 48px;
  background: var(--paper); border: 2px solid var(--ink-soft); border-radius: 10px;
}
.answer-box:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px var(--marker-soft); }
.answer-box input {
  width: 5.5ch; border: 0; background: transparent; outline: none;
  font-family: var(--font-hand); font-size: 1.875rem; font-weight: 700; color: var(--ink);
}
.answer-unit { color: var(--pencil); font-weight: 600; }

.feedback { min-height: 2.2rem; margin-top: 10px; font-family: var(--font-hand); font-size: 1.625rem; font-weight: 700; line-height: 1.2; }
.feedback[data-state="right"] { color: var(--red); }
.feedback[data-state="wrong"] { color: var(--pencil); }

/* Help: the sticky note, as in the workbook. */
.note {
  margin-top: 16px; padding: 16px 18px 14px;
  background: var(--note); color: var(--note-ink);
  border: 1px solid var(--note-edge); border-radius: 2px;
  box-shadow: var(--shadow); transform: rotate(-1deg);
  max-width: 30rem;
}
.strip { width: 100%; max-width: 296px; margin-top: 12px; }
.strip-outline { fill: none; stroke: var(--red); stroke-width: 3; }
.strip-joints { fill: none; stroke: var(--ink); stroke-width: 2; }

.solution { margin-top: 18px; padding-top: 14px; border-top: 2px dashed var(--grid-strong); }
.solution-title { font-weight: 800; color: var(--ink-deep); }
.steps { margin-top: 8px; counter-reset: step; display: grid; gap: 6px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 1.75rem 1fr; column-gap: 6px; }
.steps li::before { content: counter(step) "."; grid-row: span 2; font-family: var(--font-hand); font-size: 1.5rem; font-weight: 700; line-height: 1.1; color: var(--red); }
.steps b { font-family: var(--font-hand); font-size: 1.5rem; font-weight: 700; color: var(--ink); line-height: 1.2; }
.show-solution { margin-top: 14px; }

/* ------------------------------------------------------------------ shelf */

.shelf { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 24px; }
.cover {
  position: relative; display: flex; flex-direction: column; gap: 16px;
  width: 14rem; min-height: 19rem; padding: 22px 18px 18px 32px;
  border-radius: 6px 14px 14px 6px;
  background: var(--cover); color: #ffffff;
  box-shadow: var(--shadow), inset 12px 0 0 rgba(0, 0, 0, 0.2);
  text-decoration: none;
}
a.cover { transition: transform 160ms ease; }
a.cover:hover { transform: translateY(-4px) rotate(-0.6deg); color: #ffffff; }
.cover-label {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 14px; background: var(--paper-raised); color: var(--text);
  border-radius: 6px; border: 2px solid rgba(0, 0, 0, 0.08);
}
.cover-subject { font-family: var(--font-hand); font-size: 1.875rem; font-weight: 700; line-height: 1; color: var(--cover); }
.cover-grade { font-size: 0.9375rem; font-weight: 600; color: var(--pencil); }
.cover-facts { display: flex; flex-direction: column; gap: 4px; font-size: 1rem; }
.cover-open {
  margin-top: auto; align-self: flex-start;
  padding: 6px 14px; border-radius: 999px; background: var(--marker); color: #2b2a1c; font-size: 1rem; font-weight: 800; white-space: nowrap;
}
/* A subject in preparation: the same notebook, faded, with its name written on the paper. */
.cover-soon {
  justify-content: flex-end;
  background: color-mix(in srgb, var(--cover) 14%, var(--paper-raised));
  border: 2px dashed color-mix(in srgb, var(--cover) 45%, transparent);
  box-shadow: none; color: var(--text);
}
.cover-soon .cover-subject { font-size: 1.875rem; }
/* the workbook's paper shows on the cover of a subject in preparation: squared (math) or lined (languages) */
.cover-soon.cover-papir-kockice {
  background-image: linear-gradient(color-mix(in srgb, var(--cover) 22%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--cover) 22%, transparent) 1px, transparent 1px);
  background-size: 14px 14px;
}
.cover-soon.cover-papir-linije {
  background-image: linear-gradient(transparent 19px, color-mix(in srgb, var(--cover) 30%, transparent) 19px);
  background-size: 100% 20px;
}
.cover-soon-note { font-size: 1rem; font-weight: 700; color: var(--pencil); }

/* Subject colours: covers and tags. */
.cover-plava, .tag-plava { --cover: #1f3d99; }
.cover-crvena, .tag-crvena { --cover: #b42b34; }
.cover-zelena, .tag-zelena { --cover: #2b7a4b; }
.cover-ljubicasta, .tag-ljubicasta { --cover: #6a4aa5; }
.cover-narandzasta, .tag-narandzasta { --cover: #b85a12; }
@media (prefers-color-scheme: dark) {
  .cover-plava, .tag-plava { --cover: #3d5fc4; }
  .cover-crvena, .tag-crvena { --cover: #c5444c; }
  .cover-zelena, .tag-zelena { --cover: #2e8455; } /* white text >= 4.5:1 (test/a11y.test.js) */
  .cover-ljubicasta, .tag-ljubicasta { --cover: #8366c2; }
  .cover-narandzasta, .tag-narandzasta { --cover: #b85a12; }
}
.tag {
  display: inline-block; padding: 1px 10px; border-radius: 999px;
  background: var(--cover); color: #ffffff; font-size: 0.8125rem; font-weight: 800;
}

/* ------------------------------------------------------------------ news: the date sits in the margin, like a diary */

.news { display: grid; gap: 30px; margin-top: 22px; max-width: 44rem; }
.news-item { position: relative; }
.news-date {
  position: absolute; top: 0; left: calc(-1 * var(--margin) - 24px + 8px); width: calc(var(--margin) - 24px);
  font-family: var(--font-hand); font-size: 1.5rem; font-weight: 700; line-height: 1.05; color: var(--red); text-align: right;
}
.news-year { display: block; font-size: 1.125rem; color: var(--pencil); }
.news-body h3 { margin-top: 6px; font-size: 1.25rem; line-height: 1.3; color: var(--ink-deep); }
.news-body p:not(.tag):not(.draft-stamp) { margin-top: 4px; }
.news-link { display: inline-block; margin-top: 6px; font-weight: 800; }
.news-all { margin-top: 26px; font-weight: 800; }
.news-empty { margin-top: 16px; color: var(--pencil); }
.is-draft .news-body { outline: 2px dashed color-mix(in srgb, var(--red) 55%, transparent); outline-offset: 10px; border-radius: 4px; }
.draft-stamp {
  display: inline-block; margin-left: 8px; padding: 0 8px;
  border: 2px solid var(--red); border-radius: 6px; color: var(--red);
  font-family: var(--font-hand); font-size: 1.25rem; font-weight: 700; line-height: 1.2; transform: rotate(-3deg);
}
.archive { padding-bottom: 96px; }
.archive h1 { font-size: 2.25rem; line-height: 1.15; font-weight: 800; color: var(--ink-deep); }

/* ------------------------------------------------------------------ one test */

.test-row { display: flex; gap: 10px; margin-top: 24px; max-width: 40rem; }
.pos {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 6px 10px; background: var(--paper-raised);
  border: 2px solid var(--ink-soft); border-radius: 10px;
}
.pos-n { font-family: var(--font-hand); font-size: 2.25rem; font-weight: 700; line-height: 1; color: var(--ink); }
.pos-kind { font-size: 0.9375rem; font-weight: 600; color: var(--pencil); }
.pos-mid { border-width: 3px; }
.pos-hard { border-width: 3px; border-color: var(--red); }
.pos-hard .pos-n { color: var(--red); }

.rules { display: grid; gap: 14px; margin-top: 28px; max-width: var(--measure); }
.rules div { display: grid; grid-template-columns: 9.5rem 1fr; gap: 16px; }
.rules dt { font-weight: 800; }
.rules dt { background: linear-gradient(transparent 55%, var(--marker-soft) 55%); align-self: start; justify-self: start; padding: 0 2px; }
.rules-wide { max-width: 46rem; }
.rules-wide div { grid-template-columns: 12rem 1fr; }

/* ------------------------------------------------------------------ inside */

.inside { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 48px; margin-top: 24px; max-width: 54rem; }
.inside h3 { font-size: 1.1875rem; font-weight: 800; color: var(--ink-deep); }
.inside p { margin-top: 4px; }

/* ------------------------------------------------------------------ entry */

.entry { padding-bottom: 96px; }
.invite { display: grid; gap: 8px; margin-top: 20px; max-width: 34rem; }
.invite label { font-weight: 800; }
.invite-row { display: flex; flex-wrap: wrap; gap: 10px; }
.invite-row input {
  flex: 1 1 12rem; min-height: 48px; padding: 0 14px;
  background: var(--paper-raised); border: 2px solid var(--ink-soft); border-radius: 10px;
  font-family: var(--font-hand); font-size: 1.75rem; font-weight: 700; color: var(--ink); letter-spacing: 0.04em;
}
.invite-row input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--marker-soft); }
.invite-hint { color: var(--pencil); font-size: 1rem; }
.invite-hint[data-state="error"] { color: var(--red); font-weight: 700; }
.invite select {
  justify-self: start; min-height: 48px; padding: 0 12px; margin-bottom: 8px;
  background: var(--paper-raised); border: 2px solid var(--ink-soft); border-radius: 10px; font-weight: 700;
}
.entry-note { margin-top: 22px; max-width: 34rem; }

/* ------------------------------------------------------------------ footer */

.foot {
  padding: 22px 24px 28px calc(var(--margin) + 24px);
  border-top: 1px solid var(--grid-strong); color: var(--pencil); font-size: 1rem;
}
.foot-name { margin-right: 10px; font-family: var(--font-hand); font-size: 1.5rem; font-weight: 700; color: var(--ink); }

/* ------------------------------------------------------------------ narrow screens: the margin shrinks to the app's 48px */

@media (max-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .owl-spot { right: -8px; top: -76px; }
}

@media (max-width: 720px) {
  /* The page navigation moves to a second row of the header instead of disappearing; it scrolls sideways
     rather than widening the page. */
  mudrica-header:has(.top-nav) { flex-wrap: wrap; row-gap: 2px; }
  mudrica-header:has(.top-nav) .mh-slot { order: 3; flex: 1 0 100%; }
  .top-nav { gap: 18px; overflow-x: auto; padding: 2px 0 4px; font-size: 0.9375rem; white-space: nowrap; }
  .top-nav a { padding: 6px 0; }
  main { padding: 0 16px 0 calc(var(--margin) + 12px); }
  .margin-note { position: static; width: auto; text-align: left; transform: rotate(-2deg); margin-bottom: 4px; }
  .block { padding-top: 64px; }
  .hero { padding-top: 40px; }
  .sheet { margin-top: 56px; padding: 22px 18px 22px; transform: none; }
  .owl-spot { top: -70px; right: 0; }
  .rules div, .rules-wide div { grid-template-columns: 1fr; gap: 2px; }
  .inside { grid-template-columns: 1fr; }
  .test-row { gap: 6px; }
  .pos-kind { font-size: 0.8125rem; }
  .cover { width: 100%; min-height: 0; }
  .news-date { position: static; display: block; width: auto; text-align: left; margin-bottom: 4px; }
  .news-year { display: inline; }
  .foot { padding-left: calc(var(--margin) + 12px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, a.cover { transition: none; }
  a.cover:hover { transform: none; }
}

/* ------------------------------------------------------------------ account pages (prijava, nalog; admin is served by nalog.<domain>/admin/ with this file) */

.account-page h1 { font-size: clamp(2rem, 3.6vw, 2.75rem); line-height: 1.1; font-weight: 800; color: var(--ink-deep); }
.account-page .block:first-child { padding-top: 56px; }
.panel {
  max-width: 38rem; margin-top: 18px; padding: 20px 22px;
  background: var(--paper-raised); border: 1px solid var(--grid-strong); border-radius: 8px; box-shadow: var(--shadow);
}
.panel > * + * { margin-top: 10px; }
.panel-title { font-weight: 800; color: var(--ink-deep); }
.panel summary { cursor: pointer; font-weight: 800; color: var(--ink); }
.field-label { display: block; font-weight: 800; }
.field-hint { color: var(--pencil); font-size: 1rem; }
.field {
  min-height: 48px; width: 100%; max-width: 22rem; padding: 0 14px;
  background: var(--paper); border: 2px solid var(--ink-soft); border-radius: 10px; color: var(--text);
}
.field:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--marker-soft); }
.field-narrow { width: 5.5rem; }
.key-input { font-family: var(--font-hand); font-size: 1.875rem; font-weight: 700; color: var(--ink); letter-spacing: 0.06em; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.btn-small { min-height: 36px; padding: 4px 14px; font-size: 0.9375rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.form-status { min-height: 1.5rem; font-weight: 700; }
.form-status[data-state="error"] { color: var(--red); }
.form-status[data-state="ok"] { color: var(--ink); }
.notice { max-width: 38rem; margin-top: 12px; padding: 10px 14px; background: var(--note); color: var(--note-ink); border: 1px solid var(--note-edge); border-radius: 4px; }
.link-button { border: 0; background: none; padding: 0; color: var(--ink); font-weight: 800; text-decoration: underline; cursor: pointer; }
.muted { color: var(--pencil); }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.tab {
  min-height: 44px; padding: 6px 16px; border: 2px solid var(--ink-soft); border-radius: 999px;
  background: var(--paper-raised); color: var(--ink); font-weight: 800; cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }

.nick-picker { display: grid; gap: 10px; justify-items: start; }
.nick-list { display: flex; flex-wrap: wrap; gap: 10px; }
.nick input { position: absolute; opacity: 0; pointer-events: none; }
.nick span {
  display: inline-block; padding: 6px 16px; border: 2px dashed var(--ink-soft); border-radius: 10px;
  font-family: var(--font-hand); font-size: 1.625rem; font-weight: 700; color: var(--ink); cursor: pointer;
}
.nick input:checked + span { border-style: solid; border-color: var(--ink); background: var(--marker-soft); }
.nick input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 3px; }

.key-line { margin-top: 12px; }
.key-value { font-family: var(--font-hand); font-size: 1.75rem; font-weight: 700; color: var(--ink); letter-spacing: 0.06em; }
.qr { width: 200px; padding: 6px; background: #ffffff; border-radius: 8px; }
.qr svg { width: 100%; height: auto; }
.invite-list, .admin-list { display: grid; gap: 8px; margin-top: 12px; max-width: 44rem; }
.admin-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--grid-strong); }
.sub-title { margin-top: 26px; font-size: 1.1875rem; font-weight: 800; color: var(--ink-deep); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.limit { display: inline-flex; gap: 6px; align-items: center; }
.table-wrap { margin-top: 16px; overflow-x: auto; }
.users { border-collapse: collapse; min-width: 52rem; background: var(--paper-raised); }
.users th, .users td { padding: 8px 10px; border-bottom: 1px solid var(--grid-strong); text-align: left; vertical-align: top; font-size: 1rem; }
.users th { font-weight: 800; color: var(--ink-deep); }
.admin .block { max-width: none; }

/* ------------------------------------------------------------------ achievements of every workbook (/postignuca/) */

.ach-total { margin-top: 10px; font-family: var(--font-hand); font-size: 1.625rem; font-weight: 700; color: var(--red); }
.ach-book { padding-top: 48px; }
.ach-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; }
.ach-subject { padding: 2px 14px; border-radius: 999px; background: var(--cover); color: #ffffff; font-size: 1.25rem; font-weight: 800; }
.ach-count { font-weight: 800; color: var(--ink-deep); }
.ach-open { font-weight: 800; }
.ach-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 14px; margin-top: 18px; max-width: 60rem; }
.ach {
  display: grid; justify-items: center; gap: 4px; padding: 14px 10px 12px; text-align: center;
  background: var(--paper-raised); border: 2px dashed var(--grid-strong); border-radius: 12px;
}
.ach.is-earned { border-style: solid; border-color: var(--star-edge); box-shadow: var(--shadow); }
.ach-icon { font-size: 2.25rem; line-height: 1; filter: grayscale(1); opacity: 0.45; }
.ach.is-earned .ach-icon { filter: none; opacity: 1; }
.ach-title { font-weight: 800; font-size: 0.9375rem; line-height: 1.25; }
.ach-desc { font-size: 0.8125rem; line-height: 1.3; color: var(--text); }
.ach-date { font-size: 0.8125rem; color: var(--pencil); }
