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

html, body { height: 100%; }
body {
  background: #0d0d1a;
  overscroll-behavior: none;
  color: #ccc;
  font-family: 'Courier New', monospace;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 12px;
}

#game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  width: var(--sirka-hry, 800px);
  max-width: 100%;
  padding: 4px 0;
}

h1 {
  color: #f0c040;
  font-size: 22px;
  letter-spacing: 2px;
}

#controls-hint {
  display: flex;
  gap: 20px;
  font-size: 13px;
}

.p1 { color: #5599ff; }
.p2 { color: #ff5555; }

#sound-widget {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 16px;
}
#sound-icon {
  background: transparent;
  border: 1px solid #555;
  color: #f0c040;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
}
#sound-icon:hover { background: #1a1a2a; border-color: #f0c040; }
#sound-vol {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #333;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
#sound-vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px; height: 12px;
  background: #f0c040;
  border-radius: 2px;
  cursor: pointer;
}
#sound-vol::-moz-range-thumb {
  width: 10px; height: 12px;
  background: #f0c040;
  border: none;
  border-radius: 2px;
  cursor: pointer;
}

#canvas-wrapper {
  position: relative;
  display: block;
}

#gameCanvas {
  border: 3px solid #444;
  display: block;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

/* CRT efekt — scanlines + vignette nad canvasem.
   Použijeme dva pseudo-elementy na canvas-wrapperu (nepřekrýt dialog/host-invite). */
#canvas-wrapper::before,
#canvas-wrapper::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px; right: 3px; bottom: 3px;  /* uvnitř borderu canvasu */
  pointer-events: none;
  z-index: 5;  /* pod dialogem (z-index 10) i host-invite (20) */
}
#canvas-wrapper::before {
  /* Scanlines */
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.18) 3px,
    rgba(0, 0, 0, 0.18) 3px
  );
  mix-blend-mode: multiply;
}
#canvas-wrapper::after {
  /* Vignette — radiální tmavé rohy */
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0) 55%,
    rgba(0, 0, 0, 0.55) 100%
  );
}

/* Síťová pozvánka */
#host-invite {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 10, 20, 0.92);
  border: 1px solid #f0c040;
  border-radius: 6px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 20;
  white-space: nowrap;
  font-size: 13px;
}

#host-invite.hidden { display: none; }

#host-invite-label { color: #f0c040; font-size: 12px; }

#host-invite-url {
  background: #111;
  border: 1px solid #555;
  color: #aaddff;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 3px;
  width: 320px;
  cursor: text;
}

#host-invite-copy {
  background: #1e3a1e;
  border: 1px solid #44aa44;
  color: #88ff88;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
}
#host-invite-copy:hover { background: #2a4e2a; }

#host-invite-status { color: #44ff88; font-size: 11px; min-width: 70px; }

/* Dialog overlay */
#dialog {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#dialog.hidden {
  display: none;
}

#dialog-box {
  background: #111820;
  border: 2px solid #f0c040;
  border-radius: 8px;
  padding: 28px 32px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 0 40px rgba(240, 192, 64, 0.3);
}

#dialog-title {
  color: #f0c040;
  font-size: 18px;
  margin-bottom: 14px;
  letter-spacing: 1px;
}

#dialog-story {
  color: #cccccc;
  line-height: 1.6;
  margin-bottom: 20px;
  font-size: 14px;
}

#dialog-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice-btn {
  background: #1e2a38;
  border: 1px solid #5599ff;
  color: #aaccff;
  padding: 10px 14px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.choice-btn:hover {
  background: #2a3d55;
  color: #ffffff;
}

#inventory-panel {
  background: #111122;
  border: 2px solid #444;
  padding: 10px 20px;
  width: var(--sirka-hry, 800px);
  max-width: 100%;
  border-radius: 4px;
  font-size: 18px;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
}

#inventory-label {
  color: #f0c040;
  white-space: nowrap;
  font-size: 18px;
}

#inventory-items {
  color: #aaa;
}


/* ===== 25. 11. 2026: hlavička, dotyk, gamepad ===== */
#gameCanvas { touch-action: none; image-rendering: auto; }
.hlavicka-btn {
  background: transparent; border: 1px solid #555; color: #f0c040; font-family: inherit;
  font-size: 13px; padding: 3px 8px; border-radius: 3px; cursor: pointer; line-height: 1.2; margin-left: 6px;
}
.hlavicka-btn:hover, .hlavicka-btn:focus-visible { background: #1a1a2a; border-color: #f0c040; outline: none; }
#sound-icon:focus-visible, #sound-vol:focus-visible { outline: 2px solid #f0c040; outline-offset: 2px; }
#controls-hint { flex-wrap: wrap; gap: 4px 20px; }
.pad { color: #aaa; }

/* Dotyk (telefon, tablet): hra přes celou obrazovku, páčka vlevo, tlačítka vpravo */
.dotyk body { padding: 0; align-items: center; justify-content: center; overflow: hidden; }
.dotyk #game-container { gap: 0; }
.dotyk #header { position: fixed; top: 6px; right: 6px; width: auto; z-index: 40; padding: 0; }
.dotyk #header h1, .dotyk #controls-hint, .dotyk #sound-vol { display: none; }
.dotyk #gameCanvas { border: 0; }
.dotyk #inventory-panel {
  position: fixed; bottom: max(8px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: auto; min-height: 0;
  padding: 4px 12px; font-size: 13px; z-index: 30; pointer-events: none; background: rgba(17,17,34,.8); border-width: 1px;
}
.dotyk #inventory-label { font-size: 13px; }
#dotyk { display: none; }
.dotyk.dotyk-hra #dotyk { display: block; }
#dotyk { position: fixed; inset: 0; z-index: 25; pointer-events: none; -webkit-user-select: none; user-select: none; }
.dotyk__packa { position: absolute; left: 0; bottom: 0; width: 45%; height: 60%; pointer-events: auto; touch-action: none; }
.dotyk__kruh, .dotyk__palec { position: absolute; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; opacity: 0; transition: opacity .15s; }
.dotyk__kruh { width: 120px; height: 120px; border: 2px solid rgba(240,192,64,.6); background: rgba(0,0,0,.25); }
.dotyk__palec { width: 54px; height: 54px; margin: -27px 0 0 -27px; transform: none; background: rgba(240,192,64,.55); }
.dotyk__packa.je-aktivni .dotyk__kruh, .dotyk__packa.je-aktivni .dotyk__palec { opacity: 1; }
.dotyk__packa::after {
  content: 'Táhni prstem pro pohyb'; position: absolute; left: 16px; bottom: 16px; color: rgba(255,255,255,.45); font-size: 12px;
}
.dotyk__packa.je-aktivni::after { display: none; }
.dotyk__tlacitka {
  position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(2, 64px); gap: 12px; pointer-events: auto;
}
.dotyk__btn, .dotyk__pauza {
  width: 64px; height: 64px; border-radius: 50%; border: 2px solid rgba(240,192,64,.7);
  background: rgba(17,17,34,.72); color: #fff; font-size: 26px; line-height: 1; touch-action: none;
}
.dotyk__btn--utok { grid-column: 2; grid-row: 1 / span 2; width: 64px; height: 140px; border-radius: 32px; border-color: #ff6644; font-size: 32px; }
.dotyk__btn.je-stisknuto, .dotyk__pauza.je-stisknuto { background: rgba(240,192,64,.5); transform: scale(.94); }
.dotyk__pauza { position: absolute; top: max(8px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left)); width: 44px; height: 44px; font-size: 18px; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .dotyk__kruh, .dotyk__palec { transition: none; } }

.dotyk .hlavicka-btn, .dotyk #sound-icon { font-size: 16px; padding: 6px 9px; margin-left: 4px; background: rgba(17,17,34,.8); }
.dotyk #header { top: calc(max(8px, env(safe-area-inset-top)) + 54px); bottom: auto; left: max(8px, env(safe-area-inset-left)); right: auto; flex-direction: column; }
.dotyk #inventory-label { display: none; }
.dotyk #sound-widget { flex-direction: column; gap: 8px; margin: 0; }
