/* Království 0.10.25a13 – společná responzivita, dotykové ovládání a přístupnost */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-wrap: break-word;
}

img,
svg,
canvas,
video {
  max-width: 100%;
}

button,
input,
select,
textarea {
  max-width: 100%;
}

main,
.page-shell,
.account-page,
.page-shell > *,
.account-page > * {
  min-width: 0;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid rgba(241, 201, 109, .9);
  outline-offset: 3px;
}

:where(.k-button, button, input, select, textarea) {
  min-height: 42px;
}

:where(
  .chronicle-hero,
  .account-hero,
  .achievements-hero,
  .admin-hero,
  .auth-hero,
  .bestiary-hero,
  .bosses-hero,
  .chronicles-hero,
  .classes-hero,
  .hall-hero,
  .hunter-hero,
  .items-hero,
  .profile-hero,
  .quest-hero,
  .smith-hero,
  .tavern-hero,
  .village-hero,
  .world-hero,
  .alchemy-hero
) {
  isolation: isolate;
  background-position: center;
}

:where(
  .chronicle-hero,
  .account-hero,
  .achievements-hero,
  .admin-hero,
  .auth-hero,
  .bestiary-hero,
  .bosses-hero,
  .chronicles-hero,
  .classes-hero,
  .hall-hero,
  .hunter-hero,
  .items-hero,
  .profile-hero,
  .quest-hero,
  .smith-hero,
  .tavern-hero,
  .village-hero,
  .world-hero,
  .alchemy-hero
) > * {
  min-width: 0;
}

:where(
  .chronicle-hero,
  .account-hero,
  .achievements-hero,
  .admin-hero,
  .auth-hero,
  .bestiary-hero,
  .bosses-hero,
  .chronicles-hero,
  .classes-hero,
  .hall-hero,
  .hunter-hero,
  .items-hero,
  .profile-hero,
  .quest-hero,
  .smith-hero,
  .tavern-hero,
  .village-hero,
  .world-hero,
  .alchemy-hero
) h1 {
  text-wrap: balance;
  overflow-wrap: normal;
}

:where(.hero-text, .hero-copy > p:not(.eyebrow), .chronicle-hero__copy > p:not(.eyebrow)) {
  max-width: 72ch;
  text-wrap: pretty;
}

:where(.hero-actions, .final-cta__actions, .detail-actions) {
  align-items: stretch;
}

:where(.search-row, .token-row, .confirm-actions) > * {
  min-width: 0;
}

:where(.collection-bar, .visitor-bar, .player-bar, .profile-search) {
  min-width: 0;
}

:where(.collection-owner, .visitor-owner, .chronicle-owner, .current-journey) {
  max-width: 100%;
}

:where(.inventory-slot, .item-card, .achievement-card, .bestiary-card, .location-card, .quest-card, .service-card, .chronicle-card) {
  min-width: 0;
}

:where(.inventory-slot img, .item-icon img, .card-image img, .card-art img, .service-card img, .location-card img) {
  image-rendering: pixelated;
}

/*
 * Modální překryvy musí vždy pokrýt celý viewport. Původní max-width na
 * `.detail-modal` zúžil samotný overlay a ukotvil dialog k levému okraji.
 * Rozměrové omezení proto patří jen vnitřnímu dialogu, ne překryvu.
 */
:where(.detail-modal, .confirm-modal) {
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
}

:where(.detail-panel, .confirm-dialog, dialog, .modal-card, .overlay-card) {
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
}

:where(.detail-panel, .confirm-dialog) {
  margin: auto;
}

@media (max-width: 1180px) {
  :where(
    .chronicle-hero,
    .achievements-hero,
    .admin-hero,
    .bestiary-hero,
    .bosses-hero,
    .chronicles-hero,
    .classes-hero,
    .hall-hero,
    .hunter-hero,
    .items-hero,
    .profile-hero,
    .quest-hero,
    .smith-hero,
    .tavern-hero,
    .village-hero,
    .world-hero,
    .alchemy-hero
  ) {
    background-position: 60% center;
  }
}

@media (max-width: 760px) {
  :where(.page-shell, .account-page) {
    width: min(100% - 18px, 1600px) !important;
    padding-top: 14px !important;
    padding-bottom: 42px !important;
  }

  :where(
    .chronicle-hero,
    .account-hero,
    .achievements-hero,
    .admin-hero,
    .auth-hero,
    .bestiary-hero,
    .bosses-hero,
    .chronicles-hero,
    .classes-hero,
    .hall-hero,
    .hunter-hero,
    .items-hero,
    .profile-hero,
    .quest-hero,
    .smith-hero,
    .tavern-hero,
    .village-hero,
    .world-hero,
    .alchemy-hero
  ) {
    min-height: 0 !important;
    grid-template-columns: 1fr !important;
    padding: 22px 18px !important;
    background-position: 70% center;
  }

  :where(
    .chronicle-hero,
    .account-hero,
    .achievements-hero,
    .admin-hero,
    .auth-hero,
    .bestiary-hero,
    .bosses-hero,
    .chronicles-hero,
    .classes-hero,
    .hall-hero,
    .hunter-hero,
    .items-hero,
    .profile-hero,
    .quest-hero,
    .smith-hero,
    .tavern-hero,
    .village-hero,
    .world-hero,
    .alchemy-hero
  ) h1 {
    font-size: clamp(2.35rem, 13vw, 4.25rem) !important;
    line-height: .94 !important;
    letter-spacing: -.035em !important;
  }

  :where(.hero-actions, .final-cta__actions, .detail-actions) {
    width: 100%;
    flex-direction: column;
  }

  :where(.hero-actions, .final-cta__actions, .detail-actions) .k-button,
  :where(.hero-actions, .final-cta__actions, .detail-actions) button {
    width: 100%;
  }

  :where(.search-row, .token-row, .confirm-actions) {
    align-items: stretch !important;
    flex-direction: column !important;
  }

  :where(.search-row, .token-row, .confirm-actions) .k-button,
  :where(.search-row, .token-row, .confirm-actions) button,
  :where(.search-row, .token-row, .confirm-actions) input,
  :where(.search-row, .token-row, .confirm-actions) select {
    width: 100%;
  }

  :where(.section-heading, .panel-heading, .quest-line-heading) {
    align-items: flex-start !important;
    flex-direction: column !important;
  }

  :where(.collection-owner, .visitor-owner, .chronicle-owner, .current-journey) {
    min-width: 0 !important;
    width: 100%;
  }

  .k-frame::before,
  .k-frame::after {
    width: 22px;
    height: 22px;
    opacity: .48;
  }

  .k-panel-title {
    padding-bottom: 15px;
  }

  .k-panel-title::after {
    height: 11px;
    background-size: min(100%, 512px) 11px;
  }
}

@media (max-width: 480px) {
  :where(.page-shell, .account-page) {
    width: min(100% - 12px, 1600px) !important;
  }

  :where(
    .chronicle-hero,
    .account-hero,
    .achievements-hero,
    .admin-hero,
    .auth-hero,
    .bestiary-hero,
    .bosses-hero,
    .chronicles-hero,
    .classes-hero,
    .hall-hero,
    .hunter-hero,
    .items-hero,
    .profile-hero,
    .quest-hero,
    .smith-hero,
    .tavern-hero,
    .village-hero,
    .world-hero,
    .alchemy-hero
  ) {
    padding: 19px 15px !important;
    background-position: 73% center;
  }

  :where(.k-button, button) {
    min-height: 44px;
  }

  .k-pill {
    line-height: 1.2;
    white-space: normal;
  }
}

@media (hover: none) {
  button:hover:not(:disabled),
  .k-button:hover,
  .portal-card:hover,
  .command-link:hover,
  .k-tab:hover,
  .site-nav__link:hover {
    transform: none !important;
    filter: none !important;
  }
}

@media (prefers-contrast: more) {
  .k-frame,
  .k-button,
  input,
  select,
  textarea {
    border-color: rgba(241, 201, 109, .62) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* 0.10.25a13a – NPC hero používá celoplošný banner; odsazení patří textové vrstvě, ne headeru. */
@media (max-width: 760px) {
  body.npc-page .npc-hero {
    min-height: 0 !important;
    grid-template-columns: 1fr !important;
    padding: 0 !important;
    background-position: center !important;
  }

  body.npc-page .npc-hero__copy {
    padding: 34px 22px 28px !important;
  }
}

@media (max-width: 480px) {
  body.npc-page .npc-hero {
    padding: 0 !important;
    background-position: center !important;
  }

  body.npc-page .npc-hero__copy {
    min-height: 455px;
    padding: 30px 16px 22px !important;
  }
}

/* Stabilní modální vrstva: bez posunu stránky a bez hover animace pozadí. */
html { scrollbar-gutter: stable; }

:where(.detail-modal, .confirm-modal) > :where(.modal-backdrop, .confirm-backdrop) {
  transform: none !important;
  filter: none !important;
}
