:root {
  --wall: #e9dcc3;
  --wall-2: #dccaa7;
  --board: #2e4a3a;
  --board-2: #263f31;
  --wood: #8a5a2b;
  --wood-2: #6b4220;
  --chalk: #f4f1e8;
  --chalk-dim: #c9d3c6;
  --paper: #fffbea;
  --ink: #2b2b2b;
  --hand: "Caveat", "Segoe Print", "Comic Sans MS", cursive;
  --print: "Patrick Hand", "Segoe Print", "Comic Sans MS", cursive;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  font-family: var(--print);
  color: var(--chalk);
  background:
    repeating-linear-gradient(90deg, transparent 0 118px, #0000000a 118px 120px),
    linear-gradient(180deg, var(--wall), var(--wall-2));
}

.room { padding: 28px 24px 18px; max-width: 1280px; margin: 0 auto; }

/* ---------- a tábla ---------- */
.board {
  position: relative;
  padding: 26px 34px 70px;
  border-radius: 10px;
  border: 18px solid var(--wood);
  border-image: linear-gradient(135deg, #a06a35, var(--wood) 30%, var(--wood-2) 70%, #93602f) 1;
  box-shadow: 0 18px 40px #0005, inset 0 0 80px #0007;
  background:
    radial-gradient(ellipse at 20% 15%, #ffffff10, transparent 45%),
    radial-gradient(ellipse at 80% 70%, #ffffff0c, transparent 50%),
    radial-gradient(ellipse at 55% 40%, #ffffff08, transparent 35%),
    linear-gradient(160deg, var(--board), var(--board-2));
  overflow: hidden;
}
/* kréta-maszat */
.board::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(60px 18px at 30% 62%, #ffffff0d, transparent),
    radial-gradient(90px 22px at 70% 22%, #ffffff0b, transparent),
    radial-gradient(120px 30px at 15% 88%, #ffffff09, transparent);
  filter: blur(2px);
}

.board-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; position: relative; z-index: 1; }
.top-end { display: flex; align-items: flex-start; gap: 10px; }
.date-corner { font-family: var(--hand); font-size: 1.5rem; line-height: 1.1; display: flex; flex-direction: column; color: var(--chalk-dim); }
.lang {
  font-family: var(--hand); font-size: 1.6rem; background: none; border: 0; cursor: pointer; padding: 0 8px;
  color: var(--chalk); outline: 2px solid #f4f1e8aa; outline-offset: -2px; border-radius: 40% 55% 45% 60%;
}
.lang:hover { color: #fff; }

/* ---------- fejléc ---------- */
.hero { position: relative; display: flex; align-items: center; gap: 22px; margin: 6px 0 22px; min-height: 170px; }
.hero h1 {
  font-family: var(--hand); font-weight: 700; margin: 0;
  font-size: clamp(3.2rem, 9vw, 6.2rem); line-height: .9; letter-spacing: 1px;
  text-shadow: 0 0 2px #fff8, 2px 2px 0 #ffffff14, -1px 1px 3px #fff3;
  transform: rotate(-2deg);
}
.topic { font-family: var(--hand); font-size: clamp(1.3rem, 3vw, 1.9rem); margin: 10px 0 0; color: var(--chalk-dim); }
.topic u { text-decoration-color: #ffd43b; text-decoration-thickness: 2px; text-underline-offset: 5px; color: var(--chalk); }


.doodle { position: absolute; color: var(--chalk-dim); opacity: .55; pointer-events: none; font-family: var(--hand); }
.throw { width: 92px; right: 6%; top: 0; transform: rotate(12deg); }
.throw path, .throw circle { fill: none; stroke: var(--chalk-dim); stroke-width: 3; stroke-linejoin: round; }
.formula { font-size: 1.8rem; }
.f1 { right: 20%; top: 8px; transform: rotate(-8deg); }
.f2 { right: 3%; bottom: -6px; transform: rotate(3deg); font-size: 1.5rem; }
.f3 { right: 40%; top: 0; transform: rotate(6deg); font-size: 1.5rem; }

.pin {
  position: absolute; top: -9px; left: 50%; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff8a8a, #d6332f 60%, #8f1d1a);
  box-shadow: 1px 3px 4px #0006;
}

/* ---------- cetlik ---------- */
.extras { display: grid; grid-template-columns: 1.3fr 1fr; gap: 26px; margin-top: 40px; align-items: start; }
.note {
  position: relative; color: var(--ink); padding: 20px 18px 16px;
  box-shadow: 0 8px 16px #0005;
}
.note h3 { font-family: var(--hand); font-size: 1.9rem; margin: 0 0 6px; line-height: 1; }
.note p, .note li { font-size: 1.12rem; line-height: 1.35; }
.note p { margin: 0 0 10px; }
.note ol { margin: 0; padding-left: 22px; }
.joke { background: #fff3bf; transform: rotate(-1.5deg); }
.rules { background: #d0ebff; transform: rotate(1.2deg); }
#joke { min-height: 3em; }
#joke.write { animation: write .5s ease-out; }
@keyframes write { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.chalk-btn {
  font-family: var(--hand); font-size: 1.4rem; cursor: pointer;
  background: var(--board); color: var(--chalk); border: 0; border-radius: 6px; padding: 4px 14px;
  box-shadow: 0 3px 0 #1a2c22;
}
.chalk-btn:hover { background: #355743; }
.chalk-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #1a2c22; }

/* ---------- krétatartó ---------- */
.tray {
  position: absolute; left: -18px; right: -18px; bottom: -18px; height: 26px;
  background: linear-gradient(180deg, #a06a35, var(--wood-2));
  box-shadow: 0 -2px 6px #0004;
}
.chalk { position: absolute; bottom: 14px; height: 10px; border-radius: 3px; background: #f8f9fa; box-shadow: inset -3px 0 0 #dee2e6; }
.c1 { left: 12%; width: 54px; }
.c2 { left: 18%; width: 30px; background: #ffd8a8; transform: rotate(-4deg); }
.c3 { left: 64%; width: 40px; background: #a5d8ff; }
.eraser {
  position: absolute; bottom: 14px; right: 14%; width: 86px; height: 24px; border-radius: 4px;
  background: linear-gradient(180deg, #c08a4e 0 55%, #495057 55%);
  box-shadow: 0 2px 3px #0005;
}

.foot { text-align: center; color: #6b5435; font-size: 1.05rem; margin-top: 30px; }
.foot .back { display: block; width: fit-content; margin: 6px auto 0; color: #4a3820; font-size: 1.25rem; }
.foot .back:hover { color: #2b1f10; }

/* ---------- értesítés ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 140%);
  background: var(--board); color: var(--chalk); font-family: var(--hand); font-size: 1.6rem;
  padding: 8px 20px; border-radius: 10px; border: 3px solid var(--wood);
  box-shadow: 0 10px 24px #0006; transition: transform .3s ease, opacity .3s ease; pointer-events: none;
  opacity: 0;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 860px) {
  .extras { grid-template-columns: 1fr; }
  .doodle.f1, .doodle.f3 { display: none; }
}
@media (max-width: 560px) {
  .room { padding: 12px 8px; }
  .board { padding: 16px 16px 60px; border-width: 12px; }
  .hero { flex-direction: column; align-items: flex-start; gap: 6px; min-height: 0; padding-right: 78px; }
  .throw, .doodle.f2 { display: none; }
  .date-corner { font-size: 1.2rem; }
}

.throw path { stroke-dasharray: 6 7; }
.throw circle { fill: var(--chalk-dim); }

/* ---------- Környezetismeret óra: a fejléc rajza ---------- */
.leaf { width: 100px; flex: none; transform: rotate(-8deg); transform-origin: 20px 100px; animation: sway 4s ease-in-out infinite; }
.leaf .blade { fill: #69db7c; opacity: .4; stroke: var(--chalk); stroke-width: 3.5; stroke-linejoin: round; }
.leaf .vein { fill: none; stroke: var(--chalk); stroke-width: 2.4; stroke-linecap: round; }
@keyframes sway { 50% { transform: rotate(4deg); } }
.sun { width: 70px; right: 6%; top: 0; }
.sun circle, .sun path { fill: none; stroke: var(--chalk-dim); stroke-width: 3; stroke-linecap: round; }
@media (max-width: 620px) { .leaf { width: 66px; position: absolute; right: 0; top: 0; } .sun { display: none; } }
@media (prefers-reduced-motion: reduce) { .leaf { animation: none; } }

/* ---------- (a matek tábla grafikonja, itt nem használt) ---------- */
.graph { width: 130px; flex: none; transform: rotate(-3deg); overflow: visible; }
.graph .axes { fill: none; stroke: var(--chalk); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.graph .wave {
  fill: none; stroke: #ffd43b; stroke-width: 4; stroke-linecap: round;
  stroke-dasharray: 260; stroke-dashoffset: 260; animation: draw 3.2s ease-in-out infinite alternate;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (max-width: 620px) {
  .graph { width: 80px; position: absolute; right: 0; top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .graph .wave { animation: none; stroke-dashoffset: 0; }
}
.hero .f3 { right: 27%; top: -22px; }

/* ---------- vissza egy szinttel feljebb (a suli előterébe) – minden oldalon egyforma ---------- */
.board-back {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 13px 0 10px; border-radius: 10px;
  font: 600 .9rem/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: inherit; text-decoration: none; white-space: nowrap;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  background: color-mix(in srgb, currentColor 6%, transparent);
  transition: border-color .15s, background .15s;
}
.board-back:hover, .board-back:focus-visible {
  border-color: color-mix(in srgb, currentColor 55%, transparent);
  background: color-mix(in srgb, currentColor 11%, transparent); outline: none;
}
.board-back .bb-arrow { font-size: 1.1rem; }
html[lang="en"] .board-back .bb-hu, html:not([lang="en"]) .board-back .bb-en { display: none; }
@media (max-width: 560px) {
  .board-back { padding: 0 11px; }
  .board-back .bb-label { display: none; }
}
/* a táblán: bal felül, mellette a dátum, jobbra a nyelvváltó */
/* krétával rajzolt, mint az EN/HU gomb: kézírás, kissé szabálytalan körvonal */
.board-top .board-back {
  height: auto; padding: 1px 14px 3px 10px; gap: 6px;
  font: 400 1.6rem/1.15 var(--hand); color: var(--chalk);
  background: none; border: 0;
  outline: 2px solid #f4f1e8aa; outline-offset: -2px;
  border-radius: 40% 55% 45% 60% / 55% 45% 60% 40%;
  transform: rotate(-1.2deg);
  transition: color .15s, outline-color .15s;
}
.board-top .board-back:hover, .board-top .board-back:focus-visible { color: #fff; background: none; outline-color: #f4f1e8; }
.board-top .board-back .bb-arrow { font-size: 1.6rem; }
@media (max-width: 560px) { .board-top .board-back { padding: 1px 10px 3px; } }
.board-top .board-back + .date-corner { margin-right: auto; }

/* ======================= Környezetismeret óra: kereső, két oszlopban az öt terület, polc ======================= */

/* ---------- kereső ---------- */
.search { position: relative; z-index: 5; display: flex; align-items: center; max-width: 760px; margin: 0 auto 28px; }
.search input {
  width: 100%; padding: 13px 52px 13px 50px; border-radius: 30px 26px 32px 24px / 26px 30px 24px 32px;
  font: 1.3rem/1.2 var(--print); color: var(--chalk); background: #ffffff0f;
  border: 2.5px solid #f4f1e8aa; outline: none; transition: border-color .15s, background .15s;
}
.search input::placeholder { color: #c8ced8aa; }
.search input:focus { border-color: var(--chalk); background: #ffffff1a; }
.search input::-webkit-search-cancel-button { filter: invert(1); cursor: pointer; }
.search-icon { position: absolute; left: 16px; font-size: 1.8rem; line-height: 1; color: var(--chalk-dim); pointer-events: none; transform: scaleX(-1); }
.search kbd {
  position: absolute; right: 18px; padding: 0 7px; border-radius: 5px; border: 1.5px solid #c8ced888;
  font: .9rem/1.4 var(--print); color: var(--chalk-dim); pointer-events: none;
}
.search input:focus ~ kbd, .search input:not(:placeholder-shown) ~ kbd { display: none; }
.vs-list { font-family: var(--print); font-size: 1.12rem; }
.no-match { text-align: center; font-family: var(--hand); font-size: 1.6rem; color: var(--chalk-dim); margin: -6px 0 18px; }

/* ---------- a tábla három része: két oszlop területekkel, mellette a polc ---------- */
.classroom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 250px; gap: 0 34px; align-items: start; position: relative; z-index: 1; }
.col + .col { position: relative; }
.col + .col::before {   /* krétavonal a két oszlop között */
  content: ""; position: absolute; left: -18px; top: 4px; bottom: 0; width: 2px;
  background: repeating-linear-gradient(180deg, #f4f1e855 0 14px, transparent 14px 20px);
}
.area + .area { margin-top: 34px; }
/* minden területnek saját krétaszíne: aláhúzás és a szálak címe */
.area { --ac: #ffd43b; --ah: #ffe8a3; }
#area-elettelen { --ac: #74c0fc; --ah: #a5d8ff; }
#area-elo { --ac: #69db7c; --ah: #b2f2bb; }
#area-ember { --ac: #ff8787; --ah: #ffc9c9; }
#area-tajekozodas { --ac: #ffd43b; --ah: #ffe8a3; }
#area-hazank { --ac: #da77f2; --ah: #eebefa; }
.area h2 {
  margin: 0; font-family: var(--hand); font-size: 2.5rem; font-weight: 700; line-height: 1;
  text-decoration: underline; text-decoration-color: var(--ac); text-decoration-thickness: 2px; text-underline-offset: 7px;
}
.area-sub { margin: 6px 0 4px; color: var(--chalk-dim); font-size: 1rem; }
.area-empty { font-family: var(--hand); font-size: 1.4rem; color: var(--chalk-dim); }

.strand { margin-top: 18px; }
.strand h3 { margin: 0 0 4px; font-family: var(--hand); font-size: 1.55rem; font-weight: 500; color: var(--ah); }
.rows { display: flex; flex-direction: column; }

/* ---------- egy témakör sora ---------- */
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 5px 8px; margin: 0 -8px; border-radius: 8px; box-sizing: content-box;
  font: 1.18rem/1.2 var(--print); color: var(--chalk); text-align: left; text-decoration: none;
  background: none; border: 0; cursor: pointer; transition: background .15s, opacity .2s;
}
.row-title { min-width: 0; }
.row.ready .row-title { font-weight: 400; }
.row.ready .row-title::after { content: " →"; color: #ffd43b; opacity: 0; transition: opacity .15s; }
.row.ready:hover, .row.ready:focus-visible { background: #ffffff14; outline: none; }
.row.ready:hover .row-title::after, .row.ready:focus-visible .row-title::after { opacity: 1; }
.row.soon { color: #c8ced8b0; }
.row.soon:hover { color: var(--chalk-dim); }
.row .ref { margin-right: 4px; color: var(--chalk-dim); }
/* interaktív eszköz (függvényrajzoló, számológép…): krétával bekeretezve, ikonnal */
.row.tool { margin-top: 2px; margin-bottom: 2px; outline: 1.5px dashed #f4f1e866; outline-offset: -1px; }
.row.tool:hover, .row.tool:focus-visible { outline-color: #f4f1e8cc; }
.tool-icon { display: inline-block; min-width: 1.4em; margin-right: 4px; text-align: center; font-family: system-ui, "Segoe UI Emoji", sans-serif; }
/* kész témakör: krétával aláhúzva, hogy elsőre feltűnjön */
.row.ready:not(.book, .tool) .row-title { text-decoration: underline; text-decoration-color: #ffd43b99; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.row.dim { opacity: .28; }
.row.hit { background: #ffd43b26; }
.row.shake { animation: nudge .45s ease; }
@keyframes nudge { 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-2px); } 80% { transform: translateX(2px); } }

/* évfolyamsáv: 12 cella, négyesével */
.gbar { flex: none; display: inline-flex; gap: 4px; }
.gg { display: inline-flex; gap: 1px; }
.gbar i {
  width: 16px; height: 18px; border-radius: 4px; font: 700 10px/15px system-ui, -apple-system, "Segoe UI", sans-serif;
  font-style: normal; text-align: center; color: var(--gc); background: #ffffff0d; border: 1.5px solid transparent;
}
/* mint az évfolyam-szűrő gombjai: a szakasz színével körvonalas, a szűrőben választott kitöltve */
.gbar i.on { background: color-mix(in srgb, var(--gc) 12%, transparent); border-color: color-mix(in srgb, var(--gc) 50%, transparent); }
.gbar i.s1 { --gc: #69db7c; --gf: #2f9e44; } .gbar i.s2 { --gc: #74c0fc; --gf: #1c7ed6; } .gbar i.s3 { --gc: #e599f7; --gf: #9c36b5; }
.gbar i.sel { background: var(--gf); border-color: var(--gf); color: #fff; }
.row.soon .gbar i.on { opacity: .55; }
/* az évfolyam-jelölések a táblán csak nyitott évfolyam-szűrőnél látszanak (vmm-grades.js data-sticky → html.vg-open);
   a helyük megmarad, így nyitáskor semmi nem ugrik el */
.gbar, .book .vc-chips, .vs-list .vc-chips { transition: opacity .25s ease, visibility 0s; }
html:not(.vg-open) :is(.gbar, .book .vc-chips, .vs-list .vc-chips) { opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility 0s .25s; }

/* ---------- a polc: kiegészítők, egymásra fektetett könyvek ---------- */
.shelf { position: relative; padding: 14px 12px 0; border-radius: 10px; background: #00000022; box-shadow: inset 0 0 0 2px #f4f1e822; }
.shelf h2 { margin: 0 0 10px; font-family: var(--hand); font-size: 2rem; line-height: 1; text-align: center; }
.books { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.book {
  width: var(--w); margin: 0; min-height: 40px; padding: 4px 10px; box-sizing: border-box; gap: 6px;
  justify-content: flex-start; border-radius: 4px 7px 7px 4px; color: #fff; font-size: 1.02rem;
  background:
    linear-gradient(90deg, #0000 0 12px, #ffffff40 12px 14px, #0000 14px calc(100% - 14px), #ffffff40 calc(100% - 14px) calc(100% - 12px), #0000 0),
    linear-gradient(180deg, color-mix(in srgb, var(--b) 85%, white), var(--b) 45%, color-mix(in srgb, var(--b) 75%, black));
  box-shadow: 0 2px 0 #0004;
}
.book .book-title { flex: 1; min-width: 0; text-align: left; }
.book.ready:hover, .book.ready:focus-visible { transform: translateX(6px); background-color: transparent; }
.book.soon { color: #fffc; filter: saturate(.45) brightness(.8); }
.book.soon:hover { color: #fff; filter: saturate(.7) brightness(.9); }
.book .vc-chips { flex: none; }
.book .vc-chip { --vc-dark: 1; background: #0004; font-size: .62rem; }
.book .vc-chips.range .vc-chip:first-child::after { content: ""; }
.book .vc-chips.range { gap: 0; }
.book .vc-chips.range .vc-chip:first-child { border-radius: 6px 0 0 6px; border-right: 0; }
.book .vc-chips.range .vc-chip:last-child { border-radius: 0 6px 6px 0; border-left: 1px dashed #fff8; }
.book .vc-chip.on { background: var(--vc-c); }
.book.dim { opacity: .3; }
.book.hit { outline: 3px solid #ffd43b; outline-offset: 1px; }
.plank { height: 12px; margin: 6px -12px 0; border-radius: 0 0 8px 8px; background: linear-gradient(180deg, #a06a35, var(--wood-2)); box-shadow: 0 4px 6px #0005; }

@media (max-width: 1100px) {
  .classroom { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .shelf { grid-column: 1 / -1; margin-top: 30px; }
  .books { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 12px; }
  .book { width: 100%; }
}
@media (max-width: 760px) {
  .classroom { grid-template-columns: minmax(0, 1fr); }
  .col + .col { margin-top: 34px; }
  .col + .col::before { left: 0; right: 0; top: -18px; bottom: auto; width: auto; height: 2px; background: repeating-linear-gradient(90deg, #f4f1e855 0 14px, transparent 14px 20px); }
  .search input { font-size: 1.1rem; padding-left: 44px; }
}
@media (max-width: 420px) {
  .row { flex-wrap: wrap; gap: 2px 10px; }
  .gbar i { width: 13px; }
}
