/* ============================================================
   Kalandország 2.0 — alap komponens-készlet ("akta" skin)
   ============================================================ */

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

body {
  background: var(--k2-paper);
  background-image: var(--k2-texture);
  color: var(--k2-ink);
  font-family: var(--k2-font-body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

#app {
  max-width: var(--k2-maxw);
  margin: 0 auto;
  padding: 0 14px 96px;
  min-height: 100dvh;
}

/* ---------- állapotsáv ---------- */
.k2-statusbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  background: var(--k2-paper);
  background-image: var(--k2-texture);
  border-bottom: 1px solid var(--k2-line);
  font-family: var(--k2-font-ui);
  font-size: 13px;
  color: var(--k2-ink-soft);
}
.k2-statusbar .k2-progress {
  flex: 1;
  display: flex;
  gap: 4px;
  align-items: center;
}
.k2-progress i {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--k2-line);
  transition: background var(--k2-t-fast);
}
.k2-progress i.done { background: var(--k2-success); }
.k2-progress i.now { background: var(--k2-accent); }

/* útvonal-térkép haladásjelző: állomás-pöttyök összekötő vonallal (docs/06) */
.k2-route {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
  height: 20px;
}
.k2-route::before {
  content: "";
  position: absolute;
  left: 4px; right: 4px; top: 50%;
  height: 2px;
  background: var(--k2-line);
  transform: translateY(-50%);
}
.k2-route i {
  flex: 1;
  position: relative;
  height: 100%;
}
.k2-route i::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--k2-paper);
  border: 2px solid var(--k2-line);
  transform: translate(-50%, -50%);
  transition: all var(--k2-t-fast);
}
.k2-route i.done::after {
  background: var(--k2-success);
  border-color: var(--k2-success);
}
.k2-route i.now::after {
  width: 12px; height: 12px;
  background: var(--k2-accent);
  border-color: var(--k2-accent);
  animation: k2-pulse 1.6s ease-in-out infinite;
}
@keyframes k2-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(140, 47, 36, .4); }
  50% { box-shadow: 0 0 0 6px rgba(140, 47, 36, 0); }
}

.k2-mute {
  background: none;
  border: 0;
  font-size: 15px;
  cursor: pointer;
  padding: 2px;
}

/* "akta megnyitása…" betöltőképernyő */
.k2-loading {
  min-height: 70dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.k2-loading-stamp {
  width: 84px; height: 84px;
  display: flex; align-items: center; justify-content: center;
  border: 5px solid var(--k2-accent);
  border-radius: 12px;
  color: var(--k2-accent);
  font-family: var(--k2-font-display);
  font-size: 52px; font-weight: 700;
  transform: rotate(-8deg);
  animation: k2-pulse 1.6s ease-in-out infinite;
}
.k2-offline {
  display: none;
  color: var(--k2-danger);
  font-weight: 700;
}
body.is-offline .k2-offline { display: inline; }

/* ---------- akta-kártya ---------- */
.k2-sheet {
  background: var(--k2-surface);
  border: 1px solid var(--k2-line);
  border-radius: var(--k2-radius);
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
  padding: 20px 18px;
  margin: 16px 0;
  animation: k2-page-in var(--k2-t-page) ease-out;
}
@keyframes k2-page-in {
  from { opacity: 0; transform: translateY(10px) rotate(.2deg); }
  to { opacity: 1; transform: none; }
}
.k2-sheet > h2 {
  font-family: var(--k2-font-display);
  font-size: 21px;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--k2-line);
}
.k2-story { font-size: 17px; }
.k2-story p { margin: 0 0 12px; }
.k2-kicker {
  font-family: var(--k2-font-ui);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--k2-ink-soft);
  margin-bottom: 6px;
}

/* ---------- gombok ---------- */
.k2-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--k2-tap);
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--k2-radius);
  background: var(--k2-accent);
  color: var(--k2-accent-ink);
  font-family: var(--k2-font-ui);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: filter var(--k2-t-fast), transform var(--k2-t-fast);
  touch-action: manipulation;
}
.k2-btn:active { transform: scale(.98); }
.k2-btn:disabled { opacity: .45; cursor: not-allowed; }
.k2-btn.block { display: flex; width: 100%; }
.k2-btn.ghost {
  background: transparent;
  color: var(--k2-ink);
  border-color: var(--k2-line);
}
.k2-btn.quiet {
  background: var(--k2-paper-deep);
  color: var(--k2-ink);
}
.k2-btn:focus-visible,
input:focus-visible,
.k2-opt:focus-visible {
  outline: 3px solid var(--k2-focus);
  outline-offset: 2px;
}

/* ---------- űrlap ---------- */
.k2-input {
  width: 100%;
  min-height: var(--k2-tap);
  padding: 10px 12px;
  font-family: var(--k2-font-display);
  font-size: 18px;
  text-align: center;
  color: var(--k2-ink);
  background: var(--k2-paper);
  border: 1px solid var(--k2-line);
  border-radius: var(--k2-radius);
}
.k2-field-error {
  color: var(--k2-danger);
  font-family: var(--k2-font-ui);
  font-size: 14px;
  margin-top: 6px;
  display: none;
}
.k2-field-error.show { display: block; }

/* ---------- válaszsáv (alul rögzített) ---------- */
.k2-answerbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  background: var(--k2-paper-deep);
  border-top: 1px solid var(--k2-line);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
}
.k2-answerbar .inner {
  max-width: var(--k2-maxw);
  margin: 0 auto;
  display: flex;
  gap: 8px;
}
.k2-answerbar .k2-input { flex: 1; text-align: left; }
.k2-answerbar .k2-btn { flex: none; }
.k2-toolrow {
  max-width: var(--k2-maxw);
  margin: 0 auto 8px;
  display: flex;
  gap: 8px;
}
.k2-toolrow .k2-btn {
  flex: 1;
  min-height: 38px;
  padding: 6px;
  font-size: 13px;
}

/* ---------- modal ---------- */
.k2-modal-back {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(20, 14, 8, .55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: k2-fade var(--k2-t-fast) ease-out;
}
@keyframes k2-fade { from { opacity: 0; } to { opacity: 1; } }
.k2-modal {
  width: 100%;
  max-width: var(--k2-maxw);
  max-height: 88dvh;
  overflow: auto;
  background: var(--k2-surface);
  border: 1px solid var(--k2-line);
  border-radius: 12px 12px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: k2-sheet-up var(--k2-t-page) ease-out;
}
@keyframes k2-sheet-up {
  from { transform: translateY(24px); opacity: .6; }
  to { transform: none; opacity: 1; }
}
.k2-modal h3 {
  font-family: var(--k2-font-display);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0 0 12px;
}
.k2-modal .k2-modal-actions { margin-top: 16px; display: grid; gap: 8px; }

/* siker/hiba pecsét */
.k2-stamp {
  display: block;
  width: fit-content;
  margin: 6px auto 14px;
  padding: 8px 22px;
  border: 3px solid var(--k2-success);
  border-radius: 8px;
  color: var(--k2-success);
  font-family: var(--k2-font-display);
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  transform: rotate(-6deg);
  animation: k2-stamp-in 380ms cubic-bezier(.2, 1.6, .4, 1);
}
.k2-stamp.bad { border-color: var(--k2-danger); color: var(--k2-danger); transform: rotate(4deg); }
@keyframes k2-stamp-in {
  from { transform: rotate(-6deg) scale(2.1); opacity: 0; }
  to { transform: rotate(-6deg) scale(1); opacity: 1; }
}
.k2-stamp.bad { animation-name: k2-stamp-in-bad; }
@keyframes k2-stamp-in-bad {
  from { transform: rotate(4deg) scale(2.1); opacity: 0; }
  to { transform: rotate(4deg) scale(1); opacity: 1; }
}
.k2-stats { list-style: none; margin: 0; padding: 0; font-family: var(--k2-font-ui); font-size: 15px; }
.k2-stats li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--k2-line); }

/* ---------- feladat-vezérlők ---------- */

/* tárcsák (counter) */
.k2-dials { display: flex; justify-content: center; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.k2-dial { display: grid; justify-items: center; gap: 4px; }
.k2-dial button {
  width: var(--k2-tap); height: var(--k2-tap);
  border: 1px solid var(--k2-line);
  border-radius: var(--k2-radius);
  background: var(--k2-paper-deep);
  color: var(--k2-ink);
  font-size: 20px;
  cursor: pointer;
}
.k2-dial .val {
  font-family: var(--k2-font-display);
  font-size: 30px;
  font-weight: 700;
  min-width: var(--k2-tap);
  text-align: center;
}
.k2-dial-sep { align-self: center; font-size: 30px; font-weight: 700; }

/* opciórács (choice / betűzet) */
.k2-optgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 12px 0; }
.k2-optgrid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.k2-optgrid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.k2-opt {
  min-height: var(--k2-tap);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: 1px solid var(--k2-line);
  border-radius: var(--k2-radius);
  background: var(--k2-paper);
  font-family: var(--k2-font-display);
  font-size: 17px;
  cursor: pointer;
  user-select: none;
  transition: background var(--k2-t-fast), border-color var(--k2-t-fast);
  text-align: center;
}
.k2-opt.sel { border-color: var(--k2-accent); background: var(--k2-danger-soft); font-weight: 700; }
.k2-opt.good { border-color: var(--k2-success); background: var(--k2-success-soft); }
.k2-opt img { max-width: 100%; border-radius: 4px; }

/* lista-választó */
.k2-optlist { display: grid; gap: 8px; margin: 12px 0; text-align: left; }
.k2-optlist .k2-opt { justify-content: flex-start; font-family: var(--k2-font-body); }

/* cellás beírás (char-grid) */
.k2-cells { display: flex; gap: 8px; justify-content: center; margin: 14px 0; flex-wrap: wrap; }
.k2-cell { display: grid; gap: 6px; justify-items: center; width: 72px; }
.k2-cell img { width: 100%; border-radius: 4px; border: 1px solid var(--k2-line); }
.k2-cell input {
  width: 100%; height: var(--k2-tap);
  text-align: center;
  font-family: var(--k2-font-display);
  font-size: 24px; font-weight: 700;
  border: 1px solid var(--k2-line);
  border-radius: var(--k2-radius);
  background: var(--k2-paper);
  color: var(--k2-ink);
}
.k2-cell input.good { background: var(--k2-success-soft); border-color: var(--k2-success); }

/* fotó-sorozat */
.k2-photo-stage { display: grid; grid-template-columns: var(--k2-tap) 1fr var(--k2-tap); gap: 8px; align-items: center; margin: 12px 0; }
.k2-photo-stage img { width: 100%; max-width: 240px; margin: 0 auto; display: block; border: 1px solid var(--k2-line); border-radius: var(--k2-radius); }
.k2-photo-stage .k2-btn { min-width: var(--k2-tap); padding: 8px; }
.k2-photo-topbot { display: flex; justify-content: center; margin: 8px 0; }

/* időzített kvíz */
.k2-timer { width: 100%; height: 10px; border-radius: 5px; background: var(--k2-line); overflow: hidden; margin: 10px 0; }
.k2-timer i { display: block; height: 100%; width: 100%; background: var(--k2-accent); transition: width 1s linear; }
.k2-quiz-q { text-align: left; margin: 14px 0; }
.k2-quiz-q .q { font-weight: 700; margin-bottom: 6px; }

/* memória-felvillantás */
.k2-flash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.k2-flash-item { position: relative; cursor: pointer; }
.k2-flash-item img { width: 100%; border-radius: var(--k2-radius); border: 1px solid var(--k2-line); }
.k2-flash-item ul {
  position: absolute; inset: 0;
  margin: 0; padding: 10px 10px 10px 26px;
  background: var(--k2-surface);
  border: 1px solid var(--k2-accent);
  border-radius: var(--k2-radius);
  font-size: 14px;
  text-align: left;
  overflow: auto;
  display: none;
}
.k2-flash-item.revealed ul { display: block; }

/* jelölőnégyzetes lista */
.k2-checks { display: grid; gap: 6px; text-align: left; margin: 12px 0; font-family: var(--k2-font-ui); font-size: 15px; }
.k2-checks label {
  display: flex; gap: 10px; align-items: center;
  min-height: var(--k2-tap);
  padding: 4px 10px;
  border: 1px solid var(--k2-line);
  border-radius: var(--k2-radius);
  background: var(--k2-paper);
}
.k2-checks input { width: 22px; height: 22px; accent-color: var(--k2-accent); }

/* staged-choice számtábla */
.k2-marktable { width: 100%; border-collapse: collapse; margin: 12px 0; }
.k2-marktable td { border: 1px solid var(--k2-line); padding: 8px; vertical-align: middle; text-align: left; font-size: 15px; }
.k2-marktable .digits { white-space: nowrap; }
.k2-digit {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; margin-right: 6px;
  border: 1px solid var(--k2-line); border-radius: 6px;
  font-family: var(--k2-font-display); font-size: 20px; font-weight: 700;
  cursor: pointer; user-select: none;
}
.k2-digit.mark { border-color: var(--k2-accent); background: var(--k2-danger-soft); }
.k2-digit.good { border-color: var(--k2-success); background: var(--k2-success-soft); }

/* Playfair */
.k2-pf-table { display: grid; gap: 3px; width: fit-content; margin: 12px auto; }
.k2-pf-row { display: flex; gap: 3px; }
.k2-pf-cell {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--k2-line); border-radius: 4px;
  font-family: var(--k2-font-display); font-weight: 700;
  cursor: pointer; user-select: none;
}
.k2-pf-cell.coded { background: var(--k2-line); }
.k2-pf-cell.decoded { background: var(--k2-success-soft); border-color: var(--k2-success); }
.k2-pf-coded {
  font-family: var(--k2-font-display); font-size: 19px; letter-spacing: .05em;
  margin: 10px 0; line-height: 1.9; word-break: break-word;
}
.k2-pf-coded .pair { padding: 2px 4px; border-radius: 4px; }
.k2-pf-coded .pair.selpair { background: var(--k2-danger-soft); color: var(--k2-accent); font-weight: 700; }
.k2-pf-coded .pair.donepair { color: var(--k2-success); }

/* dosszié-accordion */
.k2-acc { border: 1px solid var(--k2-line); border-radius: var(--k2-radius); overflow: hidden; margin: 8px 0; }
.k2-acc > button {
  width: 100%; min-height: var(--k2-tap);
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  background: var(--k2-paper-deep); color: var(--k2-ink);
  border: 0; font-family: var(--k2-font-ui); font-size: 15px; font-weight: 700;
  cursor: pointer;
}
.k2-acc > div { padding: 12px 14px; display: none; text-align: left; }
.k2-acc.open > div { display: block; }

/* térkép */
.k2-map { width: 100%; height: 62dvh; border: 1px solid var(--k2-line); border-radius: var(--k2-radius); }

/* segéd */
.k2-center { text-align: center; }
.k2-note { font-family: var(--k2-font-ui); font-size: 14px; color: var(--k2-ink-soft); }
.k2-alert {
  padding: 10px 12px; border-radius: var(--k2-radius);
  font-family: var(--k2-font-ui); font-size: 14px;
  background: var(--k2-danger-soft); color: var(--k2-danger);
  margin: 10px 0;
}
.k2-alert.info { background: var(--k2-success-soft); color: var(--k2-success); }
.hidden { display: none !important; }

/* írógép-effekt kurzor */
.k2-type::after { content: "▌"; animation: k2-blink 1s steps(1) infinite; }
.k2-type.done::after { content: ""; }
@keyframes k2-blink { 50% { opacity: 0; } }
