.game-header {
  --kanami-header-width: calc(100vw - clamp(20px, 6vw, 72px));
  --kanami-header-logo-column: clamp(116px, 18vw, 220px);
  --kanami-header-action-column: clamp(92px, 28vw, 390px);
  position: sticky;
  top: 0;
  z-index: 80;
  display: grid;
  grid-template-columns: minmax(0, var(--kanami-header-logo-column)) minmax(0, 1fr) minmax(44px, var(--kanami-header-action-column));
  align-items: center;
  gap: 16px;
  width: var(--kanami-header-width);
  min-height: 64px;
  margin: 0 auto;
  padding: 10px clamp(14px, 4vw, 34px);
  color: var(--ink, #2f2938);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line, rgba(48, 41, 61, 0.14));
  border-radius: 0 0 8px 8px;
  box-shadow: 0 12px 32px rgba(58, 46, 78, 0.14);
  backdrop-filter: blur(14px);
}

.game-header a {
  color: inherit;
}

.game-logo,
.game-header-link,
.game-header-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid rgba(118, 75, 162, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink, #2f2938);
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.game-logo {
  justify-self: start;
  width: 100%;
  min-width: 0;
  gap: 10px;
  padding: 0 12px 0 8px;
}

.game-logo img {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 6px 18px rgba(118, 75, 162, 0.18);
}

.game-logo span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-header-link,
.game-header-actions a {
  padding: 0 13px;
}

.game-logo:hover,
.game-header-link:hover,
.game-header-actions a:hover {
  transform: translateY(-2px);
  border-color: rgba(102, 126, 234, 0.34);
  box-shadow: 0 10px 24px rgba(102, 126, 234, 0.16);
}

.game-header-copy {
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.game-kicker {
  display: none;
}

.game-header h1 {
  width: max-content;
  max-width: none;
  margin: 0;
  color: var(--ink, #2f2938);
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  line-height: 1.08;
  letter-spacing: 0;
  white-space: nowrap;
}

.game-header-copy p:last-child {
  width: max-content;
  max-width: none;
  margin: 4px 0 0;
  color: var(--muted, #685f73);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.game-header-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  gap: 8px;
}

.game-header-stats {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.game-stat {
  min-width: 72px;
  padding: 7px 10px;
  border: 1px solid rgba(48, 41, 61, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.game-stat span {
  display: block;
  margin: 0;
  color: var(--muted, #685f73);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.15;
}

.game-stat strong {
  display: block;
  margin-top: 2px;
  color: var(--ink, #2f2938);
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.12;
}

.game-stat canvas {
  display: block;
  width: 44px;
  height: 44px;
  margin-top: 3px;
}

.game-header-actions {
  display: flex;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 8px;
}

.kanami-header-menu {
  position: relative;
  justify-self: end;
}

.kanami-header-menu summary {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 40px;
  border: 1px solid rgba(118, 75, 162, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  list-style: none;
}

.kanami-header-menu summary::-webkit-details-marker {
  display: none;
}

.kanami-header-menu summary span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--ink, #2f2938);
}

.kanami-header-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 100;
  display: grid;
  gap: 8px;
  width: min(78vw, 280px);
  padding: 10px;
  border: 1px solid rgba(118, 75, 162, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 46px rgba(58, 46, 78, 0.2);
}

.kanami-header-menu-panel a {
  width: 100%;
}

[data-header-overflow-line="true"] {
  animation: kanamiHeaderTicker 8s ease-in-out infinite alternate;
}

@keyframes kanamiHeaderTicker {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(var(--kanami-marquee-distance, -40px));
  }
}

.game-action-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px;
}

.game-action-bar:empty {
  display: none;
}

.game-action-bar button {
  flex: 0 0 auto;
}

@media (max-width: 980px) {
  .game-header {
    --kanami-header-action-column: clamp(64px, 24vw, 260px);
  }
}

@media (max-width: 620px) {
  .game-header {
    --kanami-header-width: calc(100vw - 16px);
    --kanami-header-logo-column: 46px;
    --kanami-header-action-column: 46px;
    gap: 8px 10px;
    padding: 8px 10px;
  }

  .game-logo {
    padding: 0;
  }

  .game-logo img {
    width: 30px;
    height: 30px;
  }

  .game-logo span {
    display: none;
  }

  .game-header-stats {
    display: none;
  }

  .game-header-copy p:last-child {
    font-size: 0.86rem;
  }

  .game-stat {
    min-width: 68px;
    padding: 6px 8px;
  }

  .game-action-bar {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .game-action-bar button {
    flex: 1 1 140px;
  }
}
