/* =====================================================================
   ZIMNÍ PRAHA – vzhled stránky kolem hry
   ===================================================================== */
:root {
  --gold: #f2c96a;
  --gold-dim: #9c7948;
  --ink: #f3e6c8;
  --muted: #b8a888;
  --panel: rgba(18, 14, 22, 0.82);
}

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

html, body {
  height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  color: var(--ink);
  font-family: 'Alegreya', Georgia, serif;
  background:
    radial-gradient(1px 1px at 12% 18%, rgba(255, 250, 230, 0.7) 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 12%, rgba(255, 250, 230, 0.6) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 64% 32%, rgba(255, 250, 230, 0.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 30% 70%, rgba(255, 250, 230, 0.4) 50%, transparent 51%),
    radial-gradient(1px 1px at 90% 80%, rgba(255, 250, 230, 0.5) 50%, transparent 51%),
    radial-gradient(ellipse at top, #1d2446 0%, #0b0c16 55%, #050508 100%);
  background-attachment: fixed;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Šířka se řídí i výškou okna, aby se hra vešla na obrazovku celá */
.game-wrapper {
  /* margin: auto centruje, ale když je stránka vyšší než okno, nic se neusekne nahoře */
  margin: auto;
  width: 100%;
  max-width: min(980px, calc((100vh - 150px) * 1.6));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.top-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.brand-title {
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.16em;
  color: var(--gold);
  text-shadow: 0 2px 14px rgba(242, 180, 60, 0.45);
  white-space: nowrap;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  font-family: 'Alegreya', Georgia, serif;
  font-weight: 700;
  font-size: 0.92rem;
  color: #fae6b8;
  background: linear-gradient(180deg, #3e2c20 0%, #20160f 100%);
  border: 1px solid var(--gold-dim);
  border-radius: 999px;
  padding: 6px 15px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 230, 170, 0.12);
  transition: filter 0.15s, border-color 0.15s, transform 0.1s, opacity 0.15s;
}

.btn:hover {
  filter: brightness(1.2);
  border-color: var(--gold);
}

.btn:active {
  transform: translateY(1px);
}

.btn[aria-pressed="false"] {
  opacity: 0.55;
}

.btn:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* Rám obrazu – zlacené dřevo */
.canvas-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 800 / 500;
  padding: 6px;
  border-radius: 14px;
  background: linear-gradient(145deg, #7a5a30 0%, #2b1d12 35%, #5e4426 65%, #24180e 100%);
  box-shadow:
    0 0 0 1px #000,
    inset 0 0 0 1px rgba(255, 220, 150, 0.25),
    0 24px 60px rgba(0, 0, 0, 0.8),
    0 0 80px rgba(242, 180, 60, 0.1);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 9px;
  background: #000;
  touch-action: none;
  cursor: pointer;
}

.controls-panel {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  padding: 10px 16px;
  background: var(--panel);
  border: 1px solid rgba(156, 121, 72, 0.45);
  border-radius: 12px;
  font-size: 0.95rem;
  color: var(--muted);
}

.ctrl-item {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

kbd {
  font-family: 'Alegreya', Georgia, serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: #f8d882;
  background: #2a2430;
  border: 1px solid #7d6445;
  border-bottom-width: 3px;
  border-radius: 5px;
  padding: 0 7px;
}

/* Dotykové ovládání */
.touch-controls {
  display: none;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 4px 2px env(safe-area-inset-bottom);
}

.touch-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.touch-btn {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: linear-gradient(180deg, #3e3128 0%, #1e1713 100%);
  border: 2px solid #8c6c42;
  color: #fae3b0;
  font-family: 'Alegreya', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 230, 170, 0.15);
}

.touch-btn.wide {
  width: 74px;
  font-size: 0.95rem;
}

.touch-btn.jump {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border-color: var(--gold);
}

.touch-btn.active {
  background: #6b4e2f;
  transform: scale(0.94);
}

/* Patička s podpisem AIdventu (styl převzatý ze snippetu projektu Aidvent) */
.site-footer {
  width: 100%;
  display: flex;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
}

a.aidvent-signature {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  max-inline-size: 100%;
  min-block-size: 2.65rem;
  box-sizing: border-box;
  padding: 0.3rem 0.65rem;
  border: 1px solid #d2c8b6;
  border-radius: 0.35rem;
  background: #f3ecdc;
  color: #1c1a17;
  font: 600 0.8125rem/1.2 system-ui, sans-serif;
  letter-spacing: normal;
  text-align: left;
  text-decoration: none;
  text-transform: none;
  vertical-align: middle;
  -webkit-user-select: auto;
  user-select: auto;
}

.aidvent-signature__mark {
  flex: none;
  color: #c4301c;
  font: italic 700 1.45rem/1 Caveat, "Segoe Print", "Bradley Hand", cursive;
  transform: rotate(-8deg);
}

.aidvent-signature__credit {
  display: block;
  margin-top: 0.12rem;
  color: #52473d;
  font-size: 0.75rem;
  font-weight: 400;
}

a.aidvent-signature:hover .aidvent-signature__title {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

a.aidvent-signature:focus-visible {
  outline: 2px solid #c4301c;
  outline-offset: 2px;
}

.rotate-hint {
  display: none;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--muted);
  text-align: center;
}

@media (pointer: coarse) {
  .touch-controls { display: flex; }
  .controls-panel { display: none; }
  .game-wrapper { max-width: min(980px, calc((100vh - 200px) * 1.6)); }
}

@media (max-width: 560px) {
  body { padding: 10px; }
  .brand-title { font-size: 0.95rem; }
  .btn { font-size: 0.8rem; padding: 5px 10px; }
}

/* Telefon na výšku: tlačítka se zmenší, aby se vešla do jedné řady */
@media (pointer: coarse) and (orientation: portrait) {
  .game-wrapper { max-width: 980px; }
  .rotate-hint { display: block; }
  .touch-controls { gap: 2vw; }
  .touch-group { gap: 2vw; }
  .touch-btn { width: min(60px, 12vw); height: min(60px, 14vw); font-size: 1.1rem; }
  .touch-btn.wide { width: min(74px, 14vw); font-size: 0.85rem; }
  .touch-btn.jump { width: min(72px, 16vw); height: min(72px, 16vw); }
}

/* Telefon na šířku: obraz uprostřed, ovládání po stranách pod palci */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  body { padding: 6px 10px; }
  /* Hra vyplní první obrazovku, podpis je až pod ní (odscrolluje se) */
  .game-wrapper {
    max-width: none;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    grid-template-areas: "top top top" "left game right" "foot foot foot";
    gap: 6px 12px;
    align-items: center;
  }
  .top-bar { grid-area: top; }
  .brand-title { font-size: 0.9rem; }
  .btn { font-size: 0.78rem; padding: 4px 10px; }
  .canvas-frame {
    grid-area: game;
    justify-self: center;
    width: min(100%, calc((100vh - 64px) * 1.6));
    padding: 4px;
  }
  .site-footer { grid-area: foot; padding-top: 10px; }
  .touch-controls { display: contents; }
  .touch-group {
    display: grid;
    grid-template-columns: repeat(2, auto);
    justify-items: center;
    gap: 10px;
    /* Svisle uprostřed: v pravém dolním rohu sedí odznak Netlify */
    align-self: center;
  }
  .touch-group:first-child { grid-area: left; }
  .touch-group:last-child { grid-area: right; }
  .touch-btn { width: 56px; height: 56px; }
  .touch-btn.wide { width: 56px; font-size: 0.85rem; }
  /* Krok a skok zabírají celou spodní řadu své skupiny */
  .touch-group:first-child .touch-btn.wide,
  .touch-btn.jump { grid-column: span 2; }
  .touch-group:first-child .touch-btn.wide { width: 122px; }
  .touch-btn.jump { width: 72px; height: 72px; }
}
