/* Layout: where the cards sit over the full-screen map. Centred, simple:
   - .centered     screen cards (login, intro, summary, profile) in the middle; on phones anchored to the bottom
   - #hud          question card at the top centre
   - #cards        result card docked at the bottom centre (touch: the "Potvrdit tip" button before it)
   - #accountBar   account chip in the top right corner, only with the intro
   - #tools        zoom group at the right edge (touch only, game.js); #attrib along the bottom edge
   - #cornerBar    "Napiš nám" and "Podpoř nás" in the bottom left corner, on the attribution's line under the cards;
                   on phones the top right corner, during a game the left edge opposite the zoom (the bottom belongs
                   to the cards); "Podpoř nás" never during a game (README → Podpora hry) */

.centered {   /* the attribution keeps its lines under the card (--dock-gap) */
  position: absolute; left: 50%; top: 50%; z-index: var(--z-card); transform: translate(-50%, -50%);
  max-height: calc(100% - 2 * var(--dock-gap)); overflow-y: auto; overscroll-behavior: contain;
  animation: rise-center var(--dur-enter) var(--ease-out) both;
}
@keyframes rise-center { from { transform: translate(-50%, calc(-50% + 18px)); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }
@keyframes rise { from { transform: translateY(18px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

#hud {
  position: absolute; left: 50%; top: var(--gutter); z-index: var(--z-overlay); transform: translateX(-50%);
  width: min(var(--hud-w), 100% - 2 * var(--gutter));
  padding: var(--space-4) var(--space-6) var(--space-5); gap: var(--space-2); pointer-events: none;
}

#cards {
  position: absolute; left: 50%; bottom: var(--dock-gap); z-index: var(--z-card); transform: translateX(-50%);
  width: min(var(--dock-w), 100% - 2 * var(--gutter)); pointer-events: none;
}
#cards > .sheet { width: 100%; pointer-events: auto; animation: rise var(--dur-enter) var(--ease-out) both; }
#cards > .confirm-dock { display: flex; justify-content: center; animation: rise var(--dur-enter) var(--ease-out) both; }
#cards > .confirm-dock[hidden] { display: none; }
.confirm-dock .btn { pointer-events: auto; min-width: 220px; }

#accountBar { position: absolute; top: var(--gutter); right: var(--gutter); z-index: var(--z-menu); }
body:has(#intro[hidden]) #accountBar { display: none; }

#tools { position: absolute; right: var(--gutter); top: 50%; z-index: var(--z-overlay); transform: translateY(-50%); }

#attrib {   /* on a quiet tint, readable over a bright orthophoto too */
  position: absolute; right: var(--space-3); bottom: calc(var(--space-2) + env(safe-area-inset-bottom)); z-index: var(--z-overlay);
  max-width: 60vw; padding: 1px var(--space-2); border-radius: var(--radius-inner);
  font-size: var(--text-xs); line-height: 1.35; text-align: right;
  color: var(--overlay-text); text-shadow: var(--overlay-shadow); background: var(--overlay-bg); pointer-events: none;
}
#cornerBar { position: absolute; left: var(--space-3); bottom: calc(var(--space-2) + env(safe-area-inset-bottom)); z-index: var(--z-overlay); }
body:has(#hud:not([hidden])) #supportFab { display: none; }

#attrib a { pointer-events: auto; white-space: nowrap; text-decoration-color: currentColor; }   /* the only clickable part, the map stays under the text */

@media (max-width: 640px) {
  .centered {
    left: var(--gutter); right: var(--gutter); top: auto; bottom: calc(var(--gutter) + env(safe-area-inset-bottom));
    width: auto; max-height: calc(100% - 2 * var(--gutter)); transform: none; animation-name: rise;
  }
  .confirm-dock .btn { flex: 1; }   /* the main button across the width, as on the other cards */
  #hud { padding: var(--space-3) var(--space-4) 14px; }
  #cards { left: var(--gutter); right: var(--gutter); bottom: calc(var(--gutter) + env(safe-area-inset-bottom)); width: auto; transform: none; }
  #accountBar { left: var(--gutter); right: auto; }
  #tools { top: auto; bottom: 46%; transform: none; }
  #attrib { left: var(--gutter); right: var(--gutter); bottom: calc(var(--gutter) + env(safe-area-inset-bottom)); max-width: none; font-size: 10px; }   /* wholly under a card, not a sliver below it */
  #cornerBar { left: auto; right: var(--gutter); top: var(--gutter); bottom: auto; }   /* the account chip is top left */
  body:has(#hud:not([hidden])) #cornerBar { left: var(--gutter); right: auto; top: auto; bottom: 46%; }   /* opposite #tools */
}
/* phone in landscape: the question card on the left, the result card (or "Potvrdit tip") on the right, zoom at the
   bottom left; the toast moves to the top right (placeToast leaves it alone) */
@media (orientation: landscape) and (max-height: 500px) {
  #hud { left: var(--gutter); transform: none; width: min(420px, 46%); padding: var(--space-3) var(--space-4) 14px; }
  #cards { left: auto; right: var(--gutter); top: var(--gutter); width: min(420px, 48%); transform: none; display: flex; flex-direction: column; justify-content: flex-end; }
  #cards > .sheet { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  #tools { right: auto; left: var(--gutter); top: auto; bottom: var(--dock-gap); transform: none; }
  #attrib { max-width: 48%; font-size: 10px; }
  #toast { left: auto; right: var(--gutter); top: var(--gutter); bottom: auto; transform: translateY(-10px); max-width: min(420px, 48%); }
  #toast.show { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .centered, #cards > .sheet, #cards > .confirm-dock { animation: none; }
}
