/* ============================================================
   ÚTĚK DOMÁCNOSTÍ – styly
   Mobile-first, flat design, sytá veselá paleta.
   DOM overlay (menu + HUD), samotná hra se kreslí do <canvas>.
   ============================================================ */

/* --- Kenney font (UI Pack) --- */
@font-face {
  font-family: "Kenney Future";
  src: url("../assets/ui/KenneyFuture.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Kenney Future Narrow";
  src: url("../assets/ui/KenneyFutureNarrow.ttf") format("truetype");
  font-display: swap;
}

/* --- Paleta – měň tady --- */
:root {
  --c-ink:      #1f2937;
  --c-red:      #ef476f;
  --c-yellow:   #ffd166;
  --c-green:    #06d6a0;
  --c-blue:     #118ab2;
  --c-panel:    rgba(255, 255, 255, 0.92);
  --c-backdrop: rgba(17, 24, 39, 0.55);
  --hud-safe-top: max(10px, env(safe-area-inset-top));
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #111827;
  /* Žádné vlastní scrollování / bounce při hraní na mobilu */
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  font-family: "Kenney Future Narrow", "Trebuchet MS", system-ui, sans-serif;
}

#game {
  position: fixed;
  inset: 0;
  /* dvh = dynamická výška viewportu (řeší mobilní adresní řádek) */
  height: 100dvh;
  width: 100vw;
  touch-action: none;      /* veškeré gesto řešíme sami v JS */
  user-select: none;
  overflow: hidden;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------------- HUD ---------------- */
#hud {
  position: absolute;
  top: var(--hud-safe-top);
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0 12px;
  pointer-events: none;    /* HUD nesmí blokovat tapy do hry… */
}
#hud.hidden { display: none; }

#score-pill {
  background: var(--c-panel);
  color: var(--c-ink);
  font-family: "Kenney Future", sans-serif;
  font-size: clamp(16px, 5vw, 26px);
  line-height: 1;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15), 0 6px 14px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.5px;
}

#laundry-pill {
  position: absolute;
  left: 12px;
  top: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--c-panel);
  color: var(--c-ink);
  font-family: "Kenney Future", sans-serif;
  font-size: clamp(13px, 4vw, 20px);
  line-height: 1;
  padding: 9px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
}
#laundry-pill svg { display: block; }

#btn-sound { right: 66px; }

.icon-btn {
  position: absolute;
  right: 12px;
  top: 0;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 14px;
  background: var(--c-panel);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
  display: grid;
  place-items: center;
  pointer-events: auto;    /* …ale tlačítko pauzy ano */
  cursor: pointer;
}
.icon-btn img { width: 22px; height: 22px; filter: invert(15%); }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15); }

/* ---------------- Toast (nová místnost / zrychlení) ---------------- */
#toast {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translate(-50%, -8px);
  padding: 8px 20px;
  border-radius: 999px;
  font-family: "Kenney Future", sans-serif;
  font-size: clamp(15px, 4.5vw, 22px);
  color: #fff;
  background: rgba(31, 41, 55, 0.82);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
#toast.speed { background: rgba(239, 71, 111, 0.9); }
#toast.room  { background: rgba(17, 138, 178, 0.9); }
#toast.show { animation: toastPop 1.7s ease forwards; }
@keyframes toastPop {
  0%   { opacity: 0; transform: translate(-50%, 8px) scale(0.9); }
  14%  { opacity: 1; transform: translate(-50%, -8px) scale(1); }
  78%  { opacity: 1; transform: translate(-50%, -8px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -18px) scale(1); }
}

/* ---------------- Overlay obrazovky ---------------- */
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--c-backdrop);
  backdrop-filter: blur(2px);
  z-index: 10;
}
.overlay.hidden { display: none; }

.panel {
  background: var(--c-panel);
  border-radius: 24px;
  padding: clamp(20px, 6vw, 40px);
  width: min(92vw, 420px);
  text-align: center;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.12), 0 20px 40px rgba(0, 0, 0, 0.3);
}

.panel h1 {
  font-family: "Kenney Future", sans-serif;
  font-size: clamp(30px, 10vw, 52px);
  color: var(--c-ink);
  line-height: 1.05;
  margin-bottom: 12px;
}
.panel h2 {
  font-family: "Kenney Future", sans-serif;
  font-size: clamp(24px, 8vw, 40px);
  color: var(--c-ink);
  margin-bottom: 18px;
}
.tagline { color: #4b5563; font-size: clamp(14px, 4vw, 18px); margin-bottom: 22px; }

/* Tlačítka – obrázek z UI Packu roztažený jako 9-slice-like pozadí */
.kbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 300px;
  min-height: 60px;
  margin: 8px auto 0;
  padding: 6px 22px 12px;   /* spodní odsazení kvůli "depth" stínu ve spritu */
  border: none;
  background: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  color: #fff;
  font-family: "Kenney Future", sans-serif;
  font-size: clamp(16px, 5vw, 22px);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.05s;
}
.kbtn:active { transform: translateY(3px); }
.kbtn-green  { background-image: url("../assets/ui/button_green.png"); }
.kbtn-yellow { background-image: url("../assets/ui/button_yellow.png"); color: var(--c-ink); text-shadow: none; }
.kbtn-red    { background-image: url("../assets/ui/button_red.png"); }
.kbtn-blue   { background-image: url("../assets/ui/button_blue.png"); }
.kbtn-icon { width: 22px; height: 22px; }

.hint { margin-top: 20px; font-size: clamp(11px, 3.4vw, 14px); color: #6b7280; line-height: 1.5; }
.result {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: "Kenney Future", sans-serif;
  font-size: clamp(22px, 7vw, 34px);
  color: var(--c-ink);
  margin-bottom: 6px;
}
.result-icon { width: 34px; height: 34px; filter: invert(60%) sepia(80%) saturate(500%) hue-rotate(0deg); }
.result-sub { color: #6b7280; font-size: clamp(13px, 4vw, 17px); margin-bottom: 20px; }

/* Přepínání nápovědy podle vstupu (hrubý odhad: touch vs. jemný pointer) */
.hint-desktop { display: none; }
@media (hover: hover) and (pointer: fine) {
  .hint-mobile { display: none; }
  .hint-desktop { display: inline; }
}
