:root {
  --color-bg: #f7efe7;
  --color-bg-dark: #e4d2bf;
  --color-primary: #7b4a2d;
  --color-primary-light: #b77b4f;
  --color-accent: #e0b878;
  --color-text: #2a1b12;
  --shadow-soft: 0 20px 40px rgba(0, 0, 0, 0.08);
  --radius-lg: 18px;
  --radius-xl: 26px;
}

/* =========================
   ALAP BEÁLLÍTÁSOK
========================= */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  /* EZ A SOR JAVÍTJA A HIBÁT: */
  scroll-padding-top: 90px; 
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top, #fef8f0, var(--color-bg));
  color: var(--color-text);
  line-height: 1.6;
}

/* =========================
   NAVBAR
========================= */

header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(247, 239, 231, 0.95);
  border-bottom: 1px solid rgba(123, 74, 45, 0.1);
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-primary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.logo-badge {
  width: 32px;
  height: 32px;
  border-radius: 40%;
  background: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-primary-light)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fdf7ef;
  font-size: 0.8rem;
  box-shadow: var(--shadow-soft);
}

.nav-links-wrapper {
  display: flex;
  justify-content: flex-end;
  flex: 1;
}

nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

nav a {
  text-decoration: none;
  font-size: 0.95rem;
  color: var(--color-text);
  position: relative;
  padding-bottom: 0.15rem;
}

nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--color-primary),
    var(--color-accent)
  );
  transition: width 0.2s ease-out;
}

nav a:hover::after {
  width: 100%;
}

.btn-nav-primary {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-primary-light)
  );
  color: #fdf7ef;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(123, 74, 45, 0.35);
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out,
    opacity 0.15s;
}

.btn-nav-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(123, 74, 45, 0.45);
  opacity: 0.98;
}

.btn-nav-primary:active {
  transform: translateY(0);
  box-shadow: 0 6px 15px rgba(123, 74, 45, 0.35);
}

/* Mobil menü gomb */

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 4px 0;
  background: var(--color-primary);
  border-radius: 999px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

@media (max-width: 768px) {
  nav ul {
    position: absolute;
    left: 0;
    right: 0;
    top: 56px;
    padding: 0.75rem 1rem 1.25rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    background: rgba(247, 239, 231, 0.98);
    border-bottom: 1px solid rgba(123, 74, 45, 0.15);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
  }

  nav ul.open {
    max-height: 260px;
  }

  .btn-nav-primary {
    width: 100%;
    text-align: center;
  }

  .nav-toggle {
    display: block;
  }

  .nav-links-wrapper {
    position: relative;
  }
}

/* =========================
   MAIN LAYOUT
========================= */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1rem 4rem;
}

/* =========================
   HERO / KEZDŐLAP
========================= */

.hero {
  min-height: calc(100vh - 60px);
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2.5fr);
  gap: 2.5rem;
  align-items: center;
}

.hero-text {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero-kicker {
  font-size: 0.9rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-primary-light);
  font-weight: 600;
}

.hero-title {
  font-size: clamp(2.1rem, 4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--color-primary);
}

.hero-highlight {
  background: linear-gradient(
    90deg,
    var(--color-primary),
    var(--color-accent)
  );
  -webkit-background-clip: text;
  color: transparent;
}

.hero-subtitle {
  font-size: 1rem;
  max-width: 32rem;
  color: #574132;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 0.5rem;
}

.btn-main {
  border-radius: 999px;
  border: none;
  padding: 0.85rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-primary-light)
  );
  color: #fdf7ef;
  box-shadow: 0 18px 40px rgba(123, 74, 45, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease,
    opacity 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 50px rgba(123, 74, 45, 0.45);
  opacity: 0.98;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.75);
  color: var(--color-primary);
  border: 1px solid rgba(123, 74, 45, 0.25);
  backdrop-filter: blur(6px);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.05);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
}

.hero-meta {
  font-size: 0.85rem;
  color: #7a6452;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 0.75rem;
}

.hero-meta span {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent);
}

/* Hero kártya */

.hero-card {
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.9),
      rgba(255, 246, 233, 0.95)
    ),
    url("https://www.transparenttextures.com/patterns/white-wall.png");
  border-radius: var(--radius-xl);
  padding: 1.75rem 1.6rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(123, 74, 45, 0.08);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.hero-card-title {
  font-weight: 700;
  color: var(--color-primary);
}

.hero-badge {
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(224, 184, 120, 0.2);
  color: #7b4a2d;
  border: 1px solid rgba(224, 184, 120, 0.7);
}

.hero-card-list {
  display: grid;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.hero-card-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.hero-card-bullet {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(123, 74, 45, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--color-primary);
  flex-shrink: 0;
}

.hero-card-footer {
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(123, 74, 45, 0.22);
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #8a715e;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 1.5rem;
  }

  .hero-card {
    order: -1;
  }
}

/* =========================
   SZEKCIÓK
========================= */

.section {
  margin-top: 3rem;
}

.section-card {
  border-radius: var(--radius-xl);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(123, 74, 45, 0.08);
}

.section-card-light {
  background: rgba(255, 255, 255, 0.9);
}

.section-card-alt {
  background: linear-gradient(
    135deg,
    rgba(244, 228, 210, 0.96),
    rgba(255, 250, 243, 0.98)
  );
}

.section-title {
  font-size: 1.6rem;
  margin-bottom: 0.75rem;
  color: var(--color-primary);
}

.section-lead {
  font-size: 0.98rem;
  color: #5f4939;
  max-width: 42rem;
  margin-bottom: 1.5rem;
}

/* =========================
   ZH GENERÁTOR
========================= */

.section-zh-card {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.94),
    rgba(255, 246, 233, 0.98)
  );
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.badge-soft {
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: rgba(224, 184, 120, 0.18);
  color: #7b4a2d;
  border: 1px dashed rgba(224, 184, 120, 0.9);
  white-space: nowrap;
}

.zh-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.75fr);
  gap: 2rem;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .zh-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Form */

.zh-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.field-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.field-group {
  flex: 1;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field-group-inline {
  max-width: 260px;
}

.field-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #6b5241;
}

input[type="number"],
select {
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  border: 1px solid rgba(123, 74, 45, 0.25);
  background: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  outline: none;
  transition: border 0.15s ease, box-shadow 0.15s ease;
}

input[type="number"]:focus,
select:focus {
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 2px rgba(183, 123, 79, 0.35);
}

#task-count {
  font-size: 1.05rem;
  text-align: center;
  padding: 0.6rem 0.75rem;
}

.field-hint {
  display: block;
  font-size: 0.8rem;
  color: #7b6454;
  margin-top: 0.15rem;
}

.buttons-row {
  flex-wrap: wrap;
}

.buttons-row .btn-main {
  flex-shrink: 0;
}

.note-small {
  font-size: 0.8rem;
  color: #7b6454;
  margin-top: 0.3rem;
}

/* Output – egy oszlop, párok egymás alatt */

.zh-output {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.zh-output-column h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
  color: var(--color-primary);
}

.zh-output-div {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-lg);
  padding: 0.85rem 0.9rem;
  border: 1px solid rgba(123, 74, 45, 0.2);
  font-size: 0.95rem;
}

.zh-output-div p {
  margin: 0.25rem 0;
}

/* feladat+megoldás párok */

.zh-pair + .zh-pair {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(123, 74, 45, 0.2);
}

/* ZH-fejléc – alapból rejtve, csak nyomtatásban látszik */
.zh-exam-header {
  display: none;
}

/* Megoldás blokk – weben „faltól falig” háttérrel */

.zh-solution {
  margin-top: 0.5rem;

  /* a .zh-output-div vízszintes paddingje 0.9rem,
     ezt ellensúlyozzuk, hogy a háttér a kártya széléig érjen */
  margin-left: -0.9rem;
  margin-right: -0.9rem;

  padding: 0.65rem 0.9rem;
  border-left: none;
  border-radius: 12px;
  background: rgba(244, 228, 210, 0.6);
  font-size: 0.94rem;
  display: none;
}

body.solutions-visible .zh-solution {
  display: block;
}

/* MathJax display képletek balra igazítása a megoldásblokkban */
.zh-solution mjx-container[jax="SVG"][display="true"] {
  text-align: left !important;
}

/* =========================
   FOOTER
========================= */

.site-footer {
  margin-top: 3rem;
  border-top: 1px solid rgba(123, 74, 45, 0.18);
  background: linear-gradient(
    180deg,
    rgba(244, 228, 210, 0.96),
    rgba(231, 209, 187, 0.98)
  );
  color: #4b3526;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 1.2rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-main {
  max-width: 360px;
}

.footer-brand {
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.9rem;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.footer-credit {
  font-size: 0.9rem;
  color: #5f4837;
}

.footer-credit strong {
  font-weight: 700;
}

.footer-credit span {
  font-size: 0.85rem;
  color: #7b6454;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.footer-link {
  font-size: 0.88rem;
  text-decoration: none;
  color: #5b4332;
  position: relative;
  padding-bottom: 0.08rem;
}

.footer-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    var(--color-primary),
    var(--color-accent)
  );
  transition: width 0.18s ease-out;
}

.footer-link:hover::after {
  width: 100%;
}

.footer-bottom {
  border-top: 1px solid rgba(123, 74, 45, 0.18);
  padding: 0.6rem 1rem 0.9rem;
  font-size: 0.78rem;
  color: #7a6454;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-small-note {
  opacity: 0.9;
}

/* =========================
   PRINT STÍLUS (PDF)
========================= */

@media print {

  /* 1. FIZIKAI PAPÍRMARGÓ BEÁLLÍTÁSA */
  
  /* Általános beállítás minden oldalra (pl. 2., 3. oldal) */
  @page {
    margin: 20mm; 
  }

  /* KIVÉTEL: Az első oldal */
  @page :first {
    /* Itt kisebbre vesszük a felső margót, hogy feljebb csússzon a fejléc */
    margin-top: -5mm; 
    
    /* A többi margó maradhat normális */
    margin-bottom: 20mm;
    margin-left: 20mm;
    margin-right: 20mm;
  }

  /* Fekete–fehér, fehér háttér */
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  body,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  span,
  strong,
  em,
  li,
  a {
    color: #000000 !important;
  }

  /* Fejléc, hero, footer, .no-print rejtése */
  .no-print,
  header,
  .site-footer,
  .hero {
    display: none !important;
  }

  main {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  /* ZH-szekció eredeti címe + lead + "ZH feladatok" alcím NE látszódjon */
  #zh-generator .section-header-row,
  #zh-generator .zh-output-column h3 {
    display: none !important;
  }

  /* Kártyák, boxok: keret, árnyék nélkül, sima fehér */
  .section-card,
  .section-zh-card,
  .zh-output-div {
    background: #ffffff !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  /* ZH-fejléc (Miskolci Egyetem stb.) – csak nyomtatásban látszik */
  .zh-exam-header {
    display: block !important;
    font-size: 0.95rem;
    margin-bottom: 1.2rem;
  }

  .zh-exam-header-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.6rem;
  }

  .zh-exam-header-right {
    text-align: right;
  }

  .zh-exam-header-center {
    text-align: center;
    margin-top: 1.4rem;
    font-size: 0.95rem;
  }

  .zh-exam-subject {
    font-variant: small-caps;
  }

  /* Megoldások nyomtatása:
     - tasks PDF-ben rejtve
     - all PDF-ben látszanak, fehér háttérrel, normál margóval */
  .zh-solution {
    display: none !important;
  }

  body.print-mode-all .zh-solution {
    display: block !important;
    border-left: none !important;
    background: #ffffff !important;
    border-radius: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* párok egymás alatt, de oldaltörések */
  .zh-output {
    display: block !important;
  }

  /* Csak feladatok PDF:
     minden feladat+megoldás-pár új oldal (megoldás itt nem látszik) */
  body.print-mode-tasks .zh-pair {
    page-break-after: always;
  }

  body.print-mode-tasks .zh-pair:last-child {
    page-break-after: auto;
  }

  /* Feladat + megoldás PDF:
     minden pár (fejléc + feladat + saját megoldás) egy oldalon */
  body.print-mode-all .zh-pair {
    page-break-after: always;
  }

  body.print-mode-all .zh-pair:last-child {
    page-break-after: auto;
  }

  /* Eltünteti a szaggatott vonalat a feladatok közül nyomtatásban */
  .zh-pair + .zh-pair {
    border-top: none !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
  }
}

/* =========================
   GYAKORLÓ GOMBOK (5-ösre készülök)
========================= */

.practice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.practice-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: white;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  text-decoration: none;
  color: var(--color-primary);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  border: 1px solid rgba(123, 74, 45, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.practice-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(123, 74, 45, 0.15);
  border-color: var(--color-primary-light);
}

.practice-icon {
  width: 40px;
  height: 40px;
  background: var(--color-primary);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  flex-shrink: 0;
}

/* Kattintható logó stílusa az aloldalakon */
a.logo-link {
  text-decoration: none;
  color: inherit; /* Megtartja az eredeti színeket */
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: opacity 0.2s ease;
}

a.logo-link:hover {
  opacity: 0.8;
}

/* =========================
   MÁTRIX BEVITELI UI
========================= */

.app-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: center;
  width: 100%;
}

.control-panel {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(123, 74, 45, 0.1);
}

.input-sm {
  width: 80px;
  text-align: center;
  font-weight: bold;
}

.hidden {
  display: none !important;
}

.instruction-text {
  margin-bottom: 1rem;
  color: #6b5241;
  font-size: 0.95rem;
}

/* Mátrix rács */
.matrix-input-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 0.4s ease-out;
}

.matrix-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 1.5rem;
  padding: 15px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  border: 1px solid rgba(123, 74, 45, 0.15);
}

/* Egy cella inputja */
.matrix-cell {
  width: 60px;
  height: 50px;
  text-align: center;
  font-size: 1.1rem;
  border: 1px solid #dcbfa8;
  border-radius: 8px;
  background: white;
  color: var(--color-text);
  outline: none;
  transition: all 0.2s;
}

.matrix-cell:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(123, 74, 45, 0.1);
}

.matrix-display-area {
  margin-top: 1rem;
  text-align: center;
  width: 100%;
  animation: fadeIn 0.4s ease-out;
}

.math-display {
  font-size: 1.2rem;
  margin-top: 1rem;
  padding: 1.5rem;
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  display: inline-block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================
   SZÁM MEZŐK STÍLUSA (Nyilak eltüntetése)
========================= */

/* Chrome, Safari, Edge, Opera esetén */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox esetén */
input[type="number"] {
  -moz-appearance: textfield;
}

/* =========================
   INTERAKTÍV MÁTRIX (KATTINTHATÓ)
========================= */

.interactive-matrix-container {
  display: inline-block;
  padding: 10px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  margin-top: 1rem;
}

.interactive-matrix {
  border-collapse: collapse;
  margin: 0 auto;
}

/* A mátrix "zárójelei" (bal és jobb szegély) */
.interactive-matrix {
  border-left: 2px solid var(--color-text);
  border-right: 2px solid var(--color-text);
  border-radius: 8px; /* Kicsit ívelt zárójel hatás */
  padding: 5px;
}

.interactive-cell {
  padding: 10px 15px;
  text-align: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 6px;
  user-select: none; /* Ne lehessen kijelölni a szöveget kattintáskor */
}

.interactive-cell:hover {
  background-color: rgba(123, 74, 45, 0.1); /* Halvány barna hover */
  transform: scale(1.1);
}

/* A kiválasztott pivot cella */
.interactive-cell.selected {
  background-color: var(--color-primary);
  color: white;
  font-weight: bold;
  transform: scale(1.15);
  box-shadow: 0 4px 10px rgba(123, 74, 45, 0.3);
}

/* =========================
   HIBAÜZENETEK
========================= */

.error-banner {
  background-color: #fde8e8;
  border: 1px solid #f8b4b4;
  color: #c53030;
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  animation: fadeIn 0.3s ease-out;
}

.error-banner strong {
  font-weight: 700;
}

/* =========================
   INVERZ MÁTRIX STÍLUSOK
========================= */

/* Konténer a két mátrixnak */
.augmented-matrix-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0; /* Nincs rés, a szegély választja el */
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  padding: 15px 25px;
  margin: 1rem auto;
  display: inline-flex;
}

/* A bal oldali mátrix (A) */
.matrix-left {
  padding-right: 15px;
  border-right: 2px solid #7b4a2d; /* A választóvonal */
}

/* A jobb oldali mátrix (I) */
.matrix-right {
  padding-left: 15px;
}

/* A jobb oldali cellák kicsit halványabbak, mert azok nem kattinthatók */
.matrix-right .interactive-cell {
  background-color: #f9f9f9;
  cursor: default; /* Nem kéz kurzor */
  color: #666;
}

.matrix-right .interactive-cell:hover {
  transform: none;
  background-color: #f9f9f9;
}

/* =========================
   MŰVELETI PANEL (CREATE MATRIX)
========================= */

.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.op-card {
  background: #fff;
  border: 1px solid rgba(123, 74, 45, 0.15);
  border-radius: 10px;
  padding: 1rem;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

/* Aktív állapot: Kiemelve */
.op-card.active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(123, 74, 45, 0.2);
  transform: translateY(-2px);
  z-index: 2;
  opacity: 1 !important;
}

/* Inaktív állapot: Elhalványítva */
.ops-grid.has-active .op-card:not(.active) {
  opacity: 0.4;
  filter: grayscale(0.5);
  transform: scale(0.98);
}

.op-title {
  font-weight: 700;
  color: var(--color-primary);
  font-size: 0.9rem;
  margin-bottom: 0.8rem;
  text-align: center;
}

.op-inputs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.op-inputs-complex {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
  font-size: 0.85rem;
}

.op-inputs-complex div {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.op-input {
  width: 50px;
  padding: 4px;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.btn-op-exec {
  width: 100%;
  padding: 0.5rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  /* display: none; /* Alapból rejtve, csak aktívnál látszik */*/
}

.op-card.active .btn-op-exec {
  display: block;
  animation: fadeIn 0.3s;
}

/* Kategória címek a gyakorló kártyán */
.grid-category-title {
  color: var(--color-primary);
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-left: 0.5rem;
  border-left: 4px solid var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Az első címnél ne legyen nagy margó */
.grid-category-title:first-of-type {
  margin-top: 1.5rem;
}

/* =========================
   ZH GENERÁTOR CHECKBOXOK (MODERN STÍLUS)
========================= */

.hidden-field {
  display: none !important;
}

/* A konténer elrendezése */
#zh-form .field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.5rem;
}

/* Maga a gomb (label) alapállapota */
#zh-form .field-row label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.2rem;
  background-color: #ffffff;
  border: 1px solid rgba(123, 74, 45, 0.2);
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: #6b5241;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 2px 5px rgba(0,0,0,0.03);
  user-select: none;
}

/* Hover effekt (ha ráviszed az egeret) */
#zh-form .field-row label:hover {
  background-color: #fffbf7;
  border-color: var(--color-primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(123, 74, 45, 0.1);
}

/* KIVÁLASZTOTT ÁLLAPOT (Amikor be van pipálva) */
/* A :has() szelektor modern böngészőkben működik */
#zh-form .field-row label:has(input:checked) {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  color: white;
  border-color: transparent;
  box-shadow: 0 6px 12px rgba(123, 74, 45, 0.25);
  transform: translateY(-1px);
}

/* A kis négyzet (input) elrejtése vagy átformázása */
#zh-form .field-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #dcbfa8; /* Halvány keret alapból */
  border-radius: 6px;
  background-color: white;
  display: grid;
  place-content: center;
  transition: all 0.2s;
  margin: 0;
}

/* Ha a szülő aktív, a checkbox kerete legyen fehér */
#zh-form .field-row label:has(input:checked) input[type="checkbox"] {
  border-color: rgba(255,255,255,0.8);
  background-color: rgba(255,255,255,0.2);
}

/* Pipa a checkboxban */
#zh-form .field-row input[type="checkbox"]::before {
  content: "";
  width: 10px;
  height: 10px;
  transform: scale(0); /* Alapból nem látszik */
  transition: 0.15s transform ease-in-out;
  background-color: var(--color-primary); /* Pipa színe alapból */
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); /* Pipa alak */
}

/* Ha be van pipálva, jelenjen meg a pipa */
#zh-form .field-row input[type="checkbox"]:checked::before {
  transform: scale(1);
  background-color: white; /* Fehér pipa a barna háttéren */
}

/* LÁTOGATÓ SZÁMLÁLÓ */
.visitor-counter {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 0.2rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  display: inline-block;
  font-family: monospace; /* Hogy olyan "számlálós" legyen */
}

/* =========================
   GENERÁLÁS VISSZAJELZŐ ÜZENET
========================= */

.generation-result {
  margin-top: 1.5rem;      /* Távolság a gomboktól */
  margin-bottom: 1rem;     /* Távolság a lenti szövegtől */
  padding: 1rem;
  background-color: #f0f9ff; /* Halványkék háttér */
  border: 1px solid #bae6fd; /* Kék keret */
  border-radius: 8px;      /* Lekerekített sarkok */
  color: #0369a1;          /* Sötétkék szöveg */
  font-size: 1rem;
  font-weight: 500;
  text-align: center;      /* Középre igazítás */
  
  /* Kis animáció, hogy szépen jelenjen meg */
  animation: slideIn 0.5s ease-out;
}

.generation-result strong {
  font-size: 1.2rem;
  color: #0284c7;        /* A szám legyen feltűnőbb kék */
}

.gen-icon {
  font-size: 1.4rem;     /* A konfetti ikon mérete */
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* Ez az osztály tünteti el, amíg nem kattintasz */
.hidden {
  display: none !important;
}

/* Animáció definíciója */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================
   PDF MODAL (ELMÉLET)
========================= */

/* A theory-btn gombok resetelése, hogy úgy nézzenek ki, mint az a tag-es kártyák */
button.practice-card {
  width: 100%;
  text-align: left;
  background: white;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  outline: none;
}

.pdf-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.pdf-modal.hidden {
  display: none !important;
  opacity: 0;
}

.pdf-modal-content {
  background: #fff;
  width: 90%;
  max-width: 1000px;
  height: 85vh;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: slideIn 0.3s ease-out;
}

.pdf-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(123, 74, 45, 0.1);
  background: #fdf7ef;
}

.pdf-modal-header h3 {
  margin: 0;
  color: var(--color-primary);
  font-size: 1.2rem;
}

#pdf-viewer {
  flex: 1;
  width: 100%;
  background-color: #525659; /* Általános PDF olvasó háttérszín */
  border: none;
}