/* Záhada strateného obrazu – štýl podľa referenčných slajdov. */

@font-face {
  font-family: 'Baloo 2';
  src: url('../assets/fonts/Baloo2-Variable.ttf') format('truetype');
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --paper: #FFFCF8;
  --ink: #111111;
  --blue: #2450FF;
  --lime: #D7FF38;
  --lavender: #D8CCFF;
  --coral: #FF765F;
  --white: #ffffff;
  --outline: 3px solid var(--ink);
  --radius-panel: 28px;
  --radius-control: 20px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 1rem;
  line-height: 1.55;
}

h1, h2, h3, .game-title {
  font-family: 'Baloo 2', system-ui, sans-serif;
  font-weight: 800;
  line-height: 1.12;
  margin: 0 0 .5em;
}

h1 { font-size: clamp(1.9rem, 5vw, 3rem); }
h2 { font-size: clamp(1.4rem, 3.5vw, 2rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; }

button, .btn {
  font-family: 'Baloo 2', system-ui, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  border: var(--outline);
  border-radius: var(--radius-control);
  background: var(--white);
  color: var(--ink);
  padding: .55rem 1.1rem;
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  transition: transform .1s ease;
}
button:hover { transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: not-allowed; transform: none; }

button.primary { background: var(--lime); }
button.accent { background: var(--blue); color: var(--white); }
button.coral { background: var(--coral); }
button.lavender { background: var(--lavender); }
button.ghost { background: transparent; }

button[aria-pressed="true"], button.selected {
  background: var(--blue);
  color: var(--white);
}

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

a { color: var(--blue); }

img { max-width: 100%; height: auto; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.loading { padding: 3rem; text-align: center; }

/* ---------- štruktúra ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1rem;
  border-bottom: var(--outline);
  background: var(--white);
}
.topbar .logo { width: 120px; height: auto; }
.topbar .spacer { flex: 1; }
.topbar button { padding: .35rem .8rem; min-height: 40px; font-size: .95rem; }
.topbar .progress { font-family: 'Baloo 2', sans-serif; font-weight: 700; }

main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 1rem; }

.footer {
  border-top: var(--outline);
  padding: .8rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  background: var(--white);
}

.panel {
  border: var(--outline);
  border-radius: var(--radius-panel);
  background: var(--white);
  padding: 1.2rem;
  margin-bottom: 1rem;
}
.panel.lime { background: var(--lime); }
.panel.lavender { background: var(--lavender); }
.panel.coral { background: var(--coral); }

.badge {
  display: inline-block;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: .1rem .7rem;
  background: var(--lime);
  font-size: .9rem;
}
.badge.locked { background: var(--lavender); }
.badge.done { background: var(--blue); color: var(--white); }

.feedback {
  border: var(--outline);
  border-radius: var(--radius-control);
  padding: .8rem 1rem;
  margin: .8rem 0;
  background: var(--lavender);
  font-weight: 600;
}
.feedback.ok { background: var(--lime); }
.feedback.err { background: var(--coral); }

.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .8rem; }

.detective { width: clamp(90px, 18vw, 160px); height: auto; display: block; }
.detective-row { display: flex; gap: 1rem; align-items: flex-start; }
.detective-row .bubble { flex: 1; }

/* ---------- úlohy: obraz + zóny ---------- */
.painting-wrap {
  position: relative;
  width: 100%;
  border: var(--outline);
  border-radius: var(--radius-control);
  overflow: hidden;
  background: #efe9df;
}
.painting-wrap img.painting { display: block; width: 100%; height: 100%; object-fit: contain; }
.painting-wrap.constrained img.painting { max-height: 70vh; }

.region-btn {
  position: absolute;
  border: 3px dashed var(--blue);
  background: rgba(36, 80, 255, .10);
  border-radius: 12px;
  min-height: 24px; min-width: 24px;
  padding: 0;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  color: var(--blue);
}
.region-btn .region-label {
  position: absolute; top: -14px; left: -3px;
  background: var(--blue); color: var(--white);
  border-radius: 8px; padding: 0 8px; font-size: .85rem;
  white-space: nowrap;
}
.region-btn.selected { border-style: solid; background: rgba(215, 255, 56, .45); }
.region-btn.found { border-color: var(--lime); background: rgba(215, 255, 56, .35); border-style: solid; }
.region-btn .mark-dot {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--coral); border: 3px solid var(--ink);
}
.point-mark {
  position: absolute;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--coral); border: 3px solid var(--ink);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.zoom-controls { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0; }
.zoom-scroll { overflow: auto; max-height: 80vh; }
.zoom-inner { position: relative; }

.two-col { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 768px) {
  .two-col { grid-template-columns: 1.4fr 1fr; }
  .two-col.reverse { grid-template-columns: 1fr 1.4fr; }
}

/* ---------- puzzle ---------- */
.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  border: var(--outline);
  border-radius: var(--radius-control);
  padding: 6px;
  background: var(--white);
}
.puzzle-slot {
  aspect-ratio: 0.9565; /* pomer dielika Aténskej školy 3840x2677 -> (3840/3)/(2677/2) = 1280/1338.5 */
  border: 2px dashed var(--ink);
  border-radius: 8px;
  background: var(--paper);
  position: relative;
  overflow: hidden;
}
.puzzle-slot.filled { border-style: solid; }
.puzzle-piece {
  display: block;
  width: 100%; height: 100%;
  background-repeat: no-repeat;
  background-size: 300% 200%;
  border-radius: 6px;
}
.puzzle-tray {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: .8rem;
}
.puzzle-tray .tray-cell {
  aspect-ratio: 0.9565;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--white);
  overflow: hidden;
}
.puzzle-piece-wrap { width: 100%; height: 100%; padding: 0; background: none; border: none; display: block; }
.puzzle-piece-wrap.selected { outline: 4px solid var(--blue); outline-offset: -4px; }
.slot-btn { position: absolute; inset: 0; width: 100%; height: 100%; background: none; border: none; padding: 0; display: block; text-align: left; }

/* ---------- osemsmerovka ---------- */
.ws-grid {
  display: grid;
  gap: 4px;
  max-width: 420px;
}
.ws-cell {
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--white);
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: clamp(.9rem, 4vw, 1.3rem);
  padding: 0;
  min-height: 32px; min-width: 32px;
}
.ws-cell.sel { background: var(--lavender); }
.ws-cell.found { background: var(--lime); }
.ws-cell.hint { border-color: var(--coral); border-width: 3px; }
.ws-words { display: flex; gap: .8rem; flex-wrap: wrap; margin: .8rem 0; }
.ws-words .done { text-decoration: line-through; opacity: .7; }

/* ---------- finále ---------- */
.finale-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .finale-grid { grid-template-columns: 1fr 1fr; } }
.finale-card {
  border: var(--outline);
  border-radius: var(--radius-panel);
  background: var(--white);
  padding: .8rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.finale-card.selected { outline: 6px solid var(--blue); }
.finale-card.eliminated { opacity: .45; }
.finale-card .img-box {
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #efe9df;
  display: flex; align-items: center; justify-content: center;
  min-height: 160px;
}
.finale-card img { max-height: 320px; object-fit: contain; }

/* ---------- dialóg ---------- */
dialog {
  border: var(--outline);
  border-radius: var(--radius-panel);
  background: var(--white);
  max-width: min(92vw, 560px);
  padding: 1.4rem;
}
dialog::backdrop { background: rgba(17,17,17,.45); }
dialog.wide { max-width: min(96vw, 900px); }

/* ---------- karty úloh ---------- */
.task-cards { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .task-cards { grid-template-columns: repeat(3, 1fr); } }
.task-card { display: flex; flex-direction: column; gap: .5rem; }

.clue-card {
  border: var(--outline);
  border-radius: var(--radius-panel);
  background: var(--lavender);
  padding: 1rem;
  margin-top: 1rem;
}

input[type="text"], input[type="number"], textarea {
  font-family: inherit;
  font-size: 1rem;
  border: var(--outline);
  border-radius: var(--radius-control);
  padding: .55rem .8rem;
  background: var(--white);
  color: var(--ink);
  width: 100%;
  max-width: 420px;
}

label.field { display: block; font-weight: 600; margin: .8rem 0 .3rem; }

.radio-row, .check-row { display: flex; flex-direction: column; gap: .5rem; margin: .6rem 0; }
.radio-row label, .check-row label {
  display: flex; align-items: center; gap: .6rem;
  border: 2px solid var(--ink); border-radius: var(--radius-control);
  padding: .5rem .8rem; background: var(--white); cursor: pointer;
  min-height: 44px;
}
.radio-row input, .check-row input { width: 1.3rem; height: 1.3rem; }
.radio-row label:has(input:checked), .check-row label:has(input:checked) {
  background: var(--lavender);
}

ul.plain { padding-left: 1.2rem; }

.muted { color: #444; }

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