/*
 * Shared player-facing shell.
 *
 * Wide screens keep the six destinations centered on the viewport.  At the
 * widths where the brand and account controls would collide with that center
 * line, every route switches to the same two-row header instead.
 */

@media (min-width: 1181px) {
  .player-header.app-header,
  .shop-selected .shop-library-header.app-header,
  .quest-header.app-header,
  .ranking-header.app-header,
  .ticket-header.app-header,
  .legal-header.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .shop-selected .shop-library-header.app-header,
  .quest-header.app-header,
  .ranking-header.app-header,
  .ticket-header.app-header,
  .legal-header.app-header { position: relative; }

  .app-header .app-primary-nav {
    position: absolute;
    z-index: 2;
    top: 0;
    bottom: 0;
    left: 50%;
    display: flex;
    width: max-content;
    max-width: calc(100% - 520px);
    height: 100%;
    min-width: 0;
    align-items: stretch;
    justify-content: center;
    gap: clamp(24px, 2.35vw, 40px);
    margin: 0;
    transform: translateX(-50%);
  }

  .app-header .player-brand,
  .app-header .shop-library-brand,
  .app-header .quest-brand,
  .app-header .ranking-brand,
  .app-header .ticket-brand,
  .app-header .legal-brand,
  .app-header .app-header-actions {
    position: relative;
    z-index: 3;
  }

  .app-header .app-header-actions { margin-left: auto; }
}

.app-header .app-primary-nav a,
.app-header .app-primary-nav button {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 100%;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #d4cdbc;
  cursor: pointer;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--app-text-nav, 16px);
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.app-header .app-primary-nav a::after,
.app-header .app-primary-nav button::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: transparent;
  content: "";
}

.app-header .app-primary-nav a:hover,
.app-header .app-primary-nav button:hover,
.app-header .app-primary-nav a:focus-visible,
.app-header .app-primary-nav button:focus-visible,
.app-header .app-primary-nav .active { color: #f7f2e7; }

.app-header .app-primary-nav .active::after {
  background: var(--guide-olive-bright, #a8ba38);
}

@media (min-width: 1181px) and (max-width: 1500px) {
  .app-header .shop-header-tier,
  .app-header .shop-header-account {
    width: var(--app-header-control-height, 48px);
    min-width: var(--app-header-control-height, 48px);
    padding: 5px;
  }

  .app-header .shop-header-tier { grid-template-columns: 1fr; }
  .app-header .shop-header-tier-copy,
  .app-header .shop-header-tier-chevron,
  .app-header .shop-header-account > span,
  .app-header .shop-header-account > i:last-child { display: none; }
}

@media (max-width: 1180px) {
  :root {
    --app-header-height: 132px;
    --app-header-gutter: clamp(14px, 2.4vw, 28px);
    --app-header-control-height: 48px;
    --app-brand-icon-size: 52px;
  }

  .player-header.app-header,
  .shop-selected .shop-library-header.app-header,
  .quest-header.app-header,
  .ranking-header.app-header,
  .ticket-header.app-header,
  .legal-header.app-header {
    position: relative;
    display: grid !important;
    width: 100%;
    height: var(--app-header-height) !important;
    min-height: var(--app-header-height) !important;
    max-height: var(--app-header-height) !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-rows: 78px 54px !important;
    align-items: center;
    gap: 0 12px !important;
    padding: 0 var(--app-header-gutter) !important;
    overflow: hidden;
  }

  .app-header .player-brand,
  .app-header .shop-library-brand,
  .app-header .quest-brand,
  .app-header .ranking-brand,
  .app-header .ticket-brand,
  .app-header .legal-brand {
    min-width: 0;
    grid-column: 1;
    grid-row: 1;
    overflow: hidden;
  }

  .app-header .app-header-actions {
    min-width: 0;
    grid-column: 2 !important;
    grid-row: 1 !important;
    justify-self: end;
    margin: 0;
  }

  .app-header .app-primary-nav {
    position: relative !important;
    inset: auto !important;
    display: grid !important;
    width: 100%;
    max-width: none;
    height: 54px !important;
    min-width: 0;
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: stretch;
    gap: 0 !important;
    margin: 0 !important;
    border-top: 1px solid rgba(231, 220, 197, .1);
    transform: none !important;
  }

  .app-header .app-primary-nav a,
  .app-header .app-primary-nav button {
    width: 100%;
    min-height: 54px;
    padding: 0 7px;
    font-size: clamp(12px, 1.45vw, 15px);
  }

  .app-header .shop-header-tier,
  .app-header .shop-header-account {
    width: var(--app-header-control-height);
    min-width: var(--app-header-control-height);
    padding: 5px;
  }
  .app-header .shop-header-tier { grid-template-columns: 1fr; }
  .app-header .shop-header-tier-copy,
  .app-header .shop-header-tier-chevron,
  .app-header .shop-header-account > span,
  .app-header .shop-header-account > i:last-child { display: none; }

  .player-mobile-nav { display: none !important; }

  .shop-selected,
  .ranking-workspace,
  .quest-workspace,
  .ticket-workspace,
  .legal-workspace {
    grid-template-rows: var(--app-header-height) minmax(0, 1fr) !important;
  }

  .shop-selected .shop-section {
    min-height: calc(100dvh - var(--app-header-height)) !important;
  }
}

@media (max-width: 820px) {
  :root {
    --app-header-height: 112px;
    --app-header-gutter: 10px;
    --app-header-control-height: 42px;
    --app-brand-icon-size: 42px;
  }

  html { scroll-padding-top: var(--app-header-height); }

  .player-header.app-header,
  .shop-selected .shop-library-header.app-header,
  .quest-header.app-header,
  .ranking-header.app-header,
  .ticket-header.app-header,
  .legal-header.app-header {
    grid-template-rows: 64px 48px !important;
    gap: 0 7px !important;
    padding: 0 var(--app-header-gutter) !important;
  }

  .app-header .app-primary-nav { height: 48px !important; }
  .app-header .app-primary-nav a,
  .app-header .app-primary-nav button {
    min-height: 48px;
    padding: 0 2px;
    font-size: clamp(10px, 2.45vw, 12px);
    letter-spacing: .01em;
  }

  .app-header .player-brand,
  .app-header .shop-library-brand,
  .app-header .quest-brand,
  .app-header .ranking-brand,
  .app-header .ticket-brand,
  .app-header .legal-brand { gap: 9px; }

  .app-header .player-brand img,
  .app-header .shop-library-brand img,
  .app-header .quest-brand img,
  .app-header .ranking-brand img,
  .app-header .ticket-brand img,
  .app-header .legal-brand img {
    width: var(--app-brand-icon-size) !important;
    height: var(--app-brand-icon-size) !important;
    flex-basis: var(--app-brand-icon-size) !important;
  }

  .app-header .player-brand strong,
  .app-header .shop-library-brand strong,
  .app-header .quest-brand strong,
  .app-header .ranking-brand strong,
  .app-header .ticket-brand strong,
  .app-header .legal-brand strong {
    font-size: clamp(17px, 4.8vw, 22px);
  }

  .app-header .shop-library-brand span,
  .app-header .quest-brand span,
  .app-header .ranking-brand span,
  .app-header .ticket-brand span,
  .app-header .legal-brand span { display: none; }

  .app-header .app-header-actions { gap: 4px; }

  .player-header-actions .language-toggle,
  .player-header-actions .admin-trigger,
  .shop-selected .shop-library-actions > button,
  .shop-selected .shop-library-actions .language-toggle,
  .quest-header-actions > button,
  .quest-header-actions .language-toggle,
  .ranking-header-actions > button,
  .ranking-header-actions .language-toggle,
  .ticket-header-actions > button,
  .ticket-header-actions .language-toggle,
  .legal-header-actions > *,
  .legal-header-actions .language-toggle {
    width: var(--app-header-control-height) !important;
    min-width: var(--app-header-control-height) !important;
    height: var(--app-header-control-height) !important;
    min-height: var(--app-header-control-height) !important;
    max-height: var(--app-header-control-height) !important;
    padding: 0 !important;
  }

  .player-header-actions .admin-trigger span,
  .shop-selected .shop-library-close span,
  .quest-header-actions .quest-account-button span,
  .ranking-close span,
  .ticket-close span,
  .legal-back-button span { display: none; }
}

@media (max-width: 380px) {
  .shop-selected .shop-library-brand strong { display: none; }
}

/* One account/session entry point across every player-facing route. */
.site-session-trigger {
  display: inline-grid;
  width: var(--app-header-control-height, 48px);
  min-width: var(--app-header-control-height, 48px);
  height: var(--app-header-control-height, 48px);
  min-height: var(--app-header-control-height, 48px);
  place-items: center;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(231, 220, 197, .2);
  border-radius: 6px;
  background: #11150f;
  color: #d6de8b;
  cursor: pointer;
}
.site-session-trigger:hover,
.site-session-trigger:focus-visible { border-color: #a8ba38; background: #1c2214; color: #f0f4c4; }
.site-session-trigger > i { font-size: 19px; }
.site-session-trigger > img { width: 31px; height: 31px; border-radius: 50%; object-fit: cover; }
.site-session-trigger[data-has-avatar="true"] > i { display: none; }

.site-session-dialog {
  width: min(560px, calc(100vw - 28px));
  max-width: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(187, 205, 75, .42);
  border-radius: 12px;
  background: #0d110c;
  box-shadow: 0 34px 100px rgba(0, 0, 0, .72);
  color: #f1eee5;
}
.site-session-dialog::backdrop { background: rgba(3, 5, 3, .82); backdrop-filter: blur(10px); }
.site-session-panel { position: relative; padding: clamp(24px, 4vw, 38px); }
.site-session-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(231, 220, 197, .18);
  border-radius: 6px;
  background: #151a12;
  color: #d9ddcf;
  cursor: pointer;
}
.site-session-close:hover,
.site-session-close:focus-visible { border-color: #a8ba38; color: #f4f6dc; }
.site-session-profile { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 18px; padding-right: 48px; }
.site-session-avatar { display: grid; width: 72px; height: 72px; place-items: center; overflow: hidden; border: 1px solid rgba(187, 205, 75, .36); border-radius: 50%; background: #1d2514; color: #c8d45d; font-size: 29px; }
.site-session-avatar img { width: 100%; height: 100%; object-fit: cover; }
.site-session-avatar[data-has-avatar="true"] > i { display: none; }
.site-session-profile p { margin: 0 0 6px; color: #aeb94b; font-size: 10px; font-weight: 900; letter-spacing: .11em; }
.site-session-profile h2 { margin: 0; color: #f5f1e7; font: 700 clamp(29px, 5vw, 39px)/1 "Oswald", sans-serif; }
.site-session-profile strong { display: block; margin-top: 8px; color: #d7ddc9; font-size: 16px; overflow-wrap: anywhere; }
.site-session-details { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 28px; }
.site-session-details > div { display: grid; min-width: 0; grid-template-columns: 30px minmax(0, 1fr); gap: 3px 9px; padding: 15px; border: 1px solid rgba(231, 220, 197, .14); border-radius: 7px; background: #141912; }
.site-session-details i { grid-row: 1 / span 2; align-self: center; color: #aeb94b; font-size: 20px; }
.site-session-details span { color: #9da493; font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.site-session-details strong { min-width: 0; overflow: hidden; color: #edf0e6; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.site-session-note { display: flex; align-items: flex-start; gap: 10px; margin: 18px 0 0; padding: 14px 15px; border-left: 3px solid #aeb94b; background: rgba(174, 185, 75, .08); color: #bdc3b4; font-size: 13px; line-height: 1.55; }
.site-session-note i { flex: 0 0 auto; margin-top: 2px; color: #bfc95b; }
.site-session-actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: 10px; margin-top: 22px; }
.site-session-actions button { display: inline-flex; min-height: 52px; align-items: center; justify-content: center; gap: 9px; padding: 0 14px; border: 1px solid rgba(231, 220, 197, .2); border-radius: 6px; background: #171c14; color: #eef0e8; cursor: pointer; font-size: 12px; font-weight: 900; }
.site-session-actions button:last-child { border-color: rgba(193, 92, 60, .62); background: #672f22; color: #fff1e9; }
.site-session-actions button:hover,
.site-session-actions button:focus-visible { border-color: #a8ba38; }
.site-session-actions button:last-child:hover,
.site-session-actions button:last-child:focus-visible { border-color: #e18162; background: #7b3828; }
.site-session-actions button:disabled { cursor: wait; opacity: .68; }

@media (max-width: 560px) {
  .site-session-panel { padding: 24px 18px 20px; }
  .site-session-profile { grid-template-columns: 58px minmax(0, 1fr); gap: 13px; padding-right: 36px; }
  .site-session-avatar { width: 58px; height: 58px; font-size: 24px; }
  .site-session-profile h2 { font-size: 29px; }
  .site-session-details { grid-template-columns: 1fr; }
  .site-session-actions { grid-template-columns: 1fr; }
  .site-session-actions button { width: 100%; }
}
