/* Fixed header: logo, navigation, online count, language switch and account entry. */
.hdr {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  background: #0d2240 var(--tex-stone) 0 0 / 96px 96px; background-blend-mode: soft-light;
  box-shadow: 0 1px 0 var(--gold-line), 0 2px 0 var(--night-deep), 0 10px 26px #0009;
}
.hdr-in {
  max-width: 1400px; height: var(--header-h); margin: 0 auto; padding: 0 20px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-rows: var(--header-h);
  align-items: center; gap: 24px;
}

/* The crest: continues the bar's navy, hangs below it and carries the logo. */
.hlogo {
  grid-column: 2; grid-row: 1; align-self: start; position: relative; display: block;
  width: 280px; height: 168px; margin-top: -1px; z-index: 1;
  filter: drop-shadow(0 10px 14px #000a);
  transition: transform .3s var(--ease);
}
.hlogo .crest { position: absolute; inset: 0; width: 100%; height: 100%; }
.hlogo img { position: absolute; left: 12px; top: 32px; width: calc(100% - 24px); height: auto; }
.hlogo:hover { transform: translateY(2px); }
.hlogo:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }

.hnav { grid-column: 1; grid-row: 1; display: flex; align-items: center; gap: 2px; justify-self: start; white-space: nowrap; }
.hnav a { position: relative; padding: 8px 12px; font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: .04em; color: #f1e6cc; text-decoration: none; text-shadow: 0 2px 2px #000; }
.hnav a::before { content: ''; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; background: var(--gold); transform: scaleX(0); transition: transform .25s var(--ease); }
.hnav a:hover, .hnav a[aria-current] { color: #ffd96a; }
.hnav a:hover::before, .hnav a[aria-current]::before { transform: scaleX(1); }

.hside { grid-column: 3; grid-row: 1; display: flex; align-items: center; gap: 14px; justify-self: end; white-space: nowrap; }
.hdr .online { display: inline-flex; align-items: center; gap: 7px; color: var(--ice); font: 700 12px var(--font-game); text-decoration: none; }
.lang { display: inline-flex; padding: 2px; background: var(--night-deep); border: 1px solid #c99a3e66; border-radius: 4px; }
.lang a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 3px; color: #c8d6ea; font: 700 12px var(--font-game); text-decoration: none; }
.lang a:hover { color: #fff; }
.lang a[aria-current] { background: var(--gold); color: #3a2400; }
.lang svg { display: block; border-radius: 2px; box-shadow: 0 0 0 1px #0006; }
.hdr .ghost { color: #f1e6cc; font-weight: 800; font-size: 14.5px; text-decoration: none; }
.hdr .ghost:hover { color: #ffd96a; }
.hdr .btn { min-height: 40px; padding: 0 16px; border-radius: 3px; }

@media (max-width: 1320px) { .hnav a { padding: 8px 9px; font-size: 14px; } .hside { gap: 10px; } .hdr .online { display: none; } }
/* without the navigation the crest moves to the left edge and the account side keeps the rest */
@media (max-width: 1100px) {
  .hnav { display: none; }
  .hdr-in { grid-template-columns: auto minmax(0, 1fr); }
  .hlogo { grid-column: 1; width: 210px; height: 126px; }
  .hside { grid-column: 2; }
}
@media (max-width: 640px) {
  :root { --header-h: 112px; }
  /* Explicit rows keep the play button inside the header even at 320px. */
  .hdr-in { height: var(--header-h); grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 44px 44px; gap: 4px 8px; padding: 6px 10px 10px; }
  .hlogo { width: 100%; max-width: 98px; height: 44px; margin-top: 0; filter: none; }
  .hlogo .crest { display: none; }
  .hlogo img { position: static; width: 100%; height: 44px; object-fit: contain; transform: none; }
  .hside { display: contents; }
  .hdr .online, .hdr .ghost { display: none; }
  .lang { grid-column: 2; grid-row: 1; }
  .lang a { min-height: 38px; padding: 5px 6px; white-space: nowrap; }
  .hdr .btn { grid-column: 1 / -1; grid-row: 2; width: 100%; min-height: 44px; white-space: normal; }
}

/* Keep the crest within the sticky navigation while reading the page. */
.hlogo{transform-origin:top center}
.hdr.is-scrolled .hlogo,.hdr.is-scrolled .hlogo:hover{transform:scale(.54)}
@media (min-width:641px) and (max-width:1100px){.hdr.is-scrolled .hlogo,.hdr.is-scrolled .hlogo:hover{transform:scale(.72);transform-origin:top left}}
@media (max-width:640px){.hdr.is-scrolled .hlogo,.hdr.is-scrolled .hlogo:hover{transform:scale(.85);transform-origin:left center}}
@media (prefers-reduced-motion:reduce){.hlogo{transition:none}}
