:root {
  --bg: #080d22;
  --panel: #111936;
  --line: #33405f;
  --text: #e9f3ff;
  --muted: #8da1c3;
  --cyan: #18d5e8;
  --white: #f1fbff;
  --red: #ee2e45;
  --black: #050712;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 20% 10%, rgba(70, 118, 210, .22), transparent 32rem),
    radial-gradient(circle at 80% 0%, rgba(180, 210, 255, .08), transparent 24rem),
    radial-gradient(circle at 50% 100%, rgba(80, 40, 130, .14), transparent 36rem),
    linear-gradient(180deg, #030711 0%, #050816 52%, #02030a 100%);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

body {
  padding: 0;
  overflow-x: hidden;
  touch-action: manipulation;
}

.shell {
  width: 100vw;
  max-width: none;
  margin: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin-bottom: 8px;
  padding: max(8px, env(safe-area-inset-top)) 8px 0;
}

h1 {
  margin: 0;
  font-size: clamp(1.05rem, 3.6vw, 1.8rem);
  letter-spacing: .08em;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(24, 213, 232, .65);
}

.topbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: .82rem;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  min-width: 180px;
  text-align: right;
  font-size: .78rem;
  color: #cfe7ff;
}

.stats span,
.controls button {
  border: 1px solid rgba(141, 161, 195, .35);
  background: rgba(16, 24, 50, .88);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03), 0 0 18px rgba(24,213,232,.06);
  border-radius: 8px;
  padding: 6px 9px;
}

.game-card {
  position: relative;
  width: 100%;
  border: 1px solid rgba(141, 161, 195, .45);
  border-radius: 0;
  padding: 6px 0;
  background: linear-gradient(180deg, rgba(12,18,42,.84), rgba(3,5,15,.92));
  box-shadow: 0 20px 80px rgba(0,0,0,.38), inset 0 0 0 1px rgba(255,255,255,.04);
}

canvas {
  display: block;
  width: 100%;
  height: clamp(460px, calc(100dvh - 138px), 920px);
  background: #030711;
  border-radius: 0;
  image-rendering: auto;
  touch-action: none;
  cursor: crosshair;
}

.overlay[hidden] { display: none; }

.overlay {
  position: absolute;
  inset: 6px 0;
  display: grid;
  place-content: center;
  gap: 16px;
  text-align: center;
  background: rgba(4, 7, 18, .72);
  border-radius: 0;
  backdrop-filter: blur(2px);
}

.overlay strong {
  font-size: clamp(1.4rem, 7vw, 2.5rem);
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 18px rgba(255,79,164,.8);
}

button {
  font: inherit;
  color: var(--text);
  border: 0;
}

button:active { transform: translateY(1px); }

.overlay button,
.controls button {
  cursor: pointer;
  color: #fff;
}

.overlay button {
  padding: 10px 18px;
  border-radius: 10px;
  background: linear-gradient(180deg, #253869, #111a3a);
  border: 1px solid rgba(255,255,255,.2);
}

.controls {
  padding: 0 8px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  color: var(--muted);
  font-size: .74rem;
}

.controls p { margin: 0; line-height: 1.35; }

.control-buttons { display: flex; gap: 8px; align-items: center; }
.controls button { white-space: nowrap; width: 96px; text-align: center; }
.controls button.is-on { border-color: rgba(255,255,255,.72); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 0 18px rgba(24,213,232,.22); }

@media (max-width: 520px) {
  body { padding-left: 6px; padding-right: 6px; }
  .topbar { align-items: start; }
  .stats { font-size: .7rem; min-width: 100px; }
  .controls {
  padding: 0 8px; align-items: start; flex-direction: column; }
  .control-buttons { gap: 8px; }
  canvas { height: clamp(440px, calc(100dvh - 155px), 680px); }
}


/* V12: Fullscreen only on mobile. Desktop remains like the base version. */
[hidden] { display: none !important; }
.mobile-fullscreen { display: none; }
body.is-mobile .mobile-fullscreen { display: inline-block; }

/* Mobile landscape: same look, but real visible playfield. No automatic rotation. */
body.mobile-landscape {
  overflow: hidden;
  height: var(--app-vh, 100dvh);
  min-height: 0;
}

body.mobile-landscape .shell {
  width: 100vw;
  height: var(--app-vh, 100dvh);
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

body.mobile-landscape .topbar {
  margin: 0;
  padding: max(2px, env(safe-area-inset-top)) 6px 2px;
  align-items: end;
  gap: 8px;
}

body.mobile-landscape h1 {
  font-size: clamp(.9rem, 4.2vh, 1.15rem);
  line-height: 1.02;
  letter-spacing: .07em;
}

body.mobile-landscape .topbar p {
  font-size: .62rem;
  margin: 1px 0 0;
}

body.mobile-landscape .stats {
  font-size: .6rem;
  gap: 4px;
  min-width: 0;
}

body.mobile-landscape .stats span,
body.mobile-landscape .controls button {
  padding: 4px 7px;
  border-radius: 7px;
}

body.mobile-landscape .game-card {
  min-height: 0;
  height: 100%;
  padding: 3px 0;
  display: flex;
  overflow: hidden;
}

body.mobile-landscape canvas {
  flex: 1 1 auto;
  width: 100%;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
}

body.mobile-landscape .controls {
  margin: 0;
  padding: 3px 6px max(3px, env(safe-area-inset-bottom));
  min-height: 0;
  flex: 0 0 auto;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: .6rem;
  overflow: hidden;
}

body.mobile-landscape .control-buttons {
  flex: 0 0 auto;
  gap: 6px;
}

body.mobile-landscape .controls button {
  width: 86px;
  text-align: center;
}

body.mobile-landscape .controls p {
  display: none;
}

@media (max-height: 390px) {
  body.mobile-landscape .topbar p { display: none; }
}


/* V15: Small footer area like on the other pages. */
.site-footer {
  padding: 10px 8px max(12px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 8px;
  color: rgba(141, 161, 195, .76);
  font-size: .68rem;
}

.site-footer a {
  color: rgba(207, 231, 255, .86);
  text-decoration: none;
  border-bottom: 1px solid rgba(207, 231, 255, .28);
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: #ffffff;
  border-bottom-color: rgba(255, 255, 255, .82);
}

.global-counter {
  min-width: 184px;
}

.legal-shell {
  width: min(920px, calc(100vw - 28px));
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 0 28px;
}

.legal-card {
  border: 1px solid rgba(141, 161, 195, .45);
  background: linear-gradient(180deg, rgba(12,18,42,.86), rgba(3,5,15,.94));
  box-shadow: 0 20px 80px rgba(0,0,0,.38), inset 0 0 0 1px rgba(255,255,255,.04);
  padding: clamp(18px, 4vw, 34px);
  color: var(--text);
}

.legal-card h1,
.legal-card h2 {
  text-transform: none;
  letter-spacing: .02em;
}

.legal-card h1 {
  margin-bottom: 22px;
}

.legal-card h2 {
  margin: 26px 0 8px;
  font-size: 1.05rem;
  color: #cfe7ff;
}

.legal-card p,
.legal-card li {
  color: rgba(233, 243, 255, .88);
  line-height: 1.62;
  font-size: .92rem;
}

.legal-card ul {
  padding-left: 1.2rem;
}

.legal-card a,
.legal-nav a {
  color: #d7f7ff;
}

.legal-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: .82rem;
}

.legal-nav a {
  text-decoration: none;
  border-bottom: 1px solid rgba(215,247,255,.28);
}

@media (max-width: 520px) {
  .global-counter { min-width: 0; }
  .site-footer { font-size: .66rem; padding-top: 8px; }
}

body.mobile-landscape .site-footer {
  display: none;
}

/* V17: Global brick counter visible, landscape without clipped ball zone. */
.global-counter {
  min-width: 0;
  white-space: nowrap;
}

@media (min-width: 760px) {
  .global-counter { min-width: 210px; }
}

body.mobile-landscape {
  width: 100vw;
  height: var(--app-vh, 100dvh);
  max-height: var(--app-vh, 100dvh);
  overflow: hidden;
}

body.mobile-landscape .shell {
  width: 100vw;
  height: var(--app-vh, 100dvh);
  max-height: var(--app-vh, 100dvh);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

body.mobile-landscape .topbar {
  min-height: 0;
  margin: 0;
  padding: max(1px, env(safe-area-inset-top)) 5px 1px;
  align-items: center;
}

body.mobile-landscape h1 {
  font-size: clamp(.72rem, 4.4vh, 1.02rem);
  line-height: 1;
  letter-spacing: .06em;
}

body.mobile-landscape .topbar p {
  display: none;
}

body.mobile-landscape .stats {
  min-width: 0;
  gap: 3px;
  font-size: clamp(.48rem, 2.8vh, .62rem);
  line-height: 1;
}

body.mobile-landscape .stats span,
body.mobile-landscape .controls button {
  padding: 3px 6px;
  border-radius: 7px;
}

body.mobile-landscape .global-counter {
  max-width: 155px;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.mobile-landscape .game-card {
  height: 100%;
  min-height: 0;
  padding: 2px 0;
  overflow: hidden;
}

body.mobile-landscape canvas {
  width: 100%;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
}

body.mobile-landscape .controls {
  height: auto;
  min-height: 34px;
  max-height: 40px;
  margin: 0;
  padding: 3px 6px max(3px, env(safe-area-inset-bottom));
  overflow: hidden;
  flex-direction: row;
  align-items: center;
}

body.mobile-landscape .controls p,
body.mobile-landscape .site-footer {
  display: none !important;
}

body.mobile-landscape .control-buttons {
  gap: 5px;
}

body.mobile-landscape .controls button {
  width: 78px;
  min-width: 78px;
  font-size: clamp(.52rem, 2.8vh, .64rem);
}

body.mobile-landscape .controls #fullscreenButton {
  width: 82px;
  min-width: 82px;
}

/* V18: Do not hide the counter anymore. Visible chip below plus desktop chip above. */
.counter-chip {
  border: 1px solid rgba(141, 161, 195, .35);
  background: rgba(16, 24, 50, .88);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03), 0 0 18px rgba(24,213,232,.06);
  border-radius: 8px;
  padding: 6px 9px;
  color: #cfe7ff;
  white-space: nowrap;
  min-width: 178px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.control-buttons {
  flex-wrap: wrap;
}

.global-counter {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .stats .global-counter {
    display: none;
  }
  .counter-chip {
    min-width: 170px;
    flex: 1 1 170px;
  }
}

body.mobile-landscape .stats .global-counter {
  display: none !important;
}

body.mobile-landscape .counter-chip {
  min-width: 128px;
  width: 140px;
  flex: 0 0 140px;
  padding: 3px 6px;
  border-radius: 7px;
  font-size: clamp(.50rem, 2.7vh, .62rem);
  line-height: 1;
}

body.mobile-landscape .control-buttons {
  flex-wrap: nowrap;
  max-width: 100vw;
}


/* V19: Counter forcefully made visible. The lower chip must no longer be missing. */
.global-destroyed-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.counter-chip {
  flex: 0 0 auto;
}
@media (max-width: 720px) {
  .stats .global-destroyed-label {
    display: none !important;
  }
  .control-buttons .global-destroyed-label {
    display: inline-flex !important;
  }
}
body.mobile-landscape .control-buttons .global-destroyed-label {
  display: inline-flex !important;
  width: 148px;
  min-width: 148px;
  max-width: 148px;
}
body.mobile-landscape .control-buttons {
  overflow-x: auto;
  scrollbar-width: none;
}
body.mobile-landscape .control-buttons::-webkit-scrollbar {
  display: none;
}

/* V20: Hard correction for mobile landscape and visible total brick counter. */
.destroyed-fixed {
  display: none;
  position: fixed;
  right: max(8px, env(safe-area-inset-right));
  bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 80;
  border: 1px solid rgba(141, 161, 195, .42);
  background: rgba(16, 24, 50, .94);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), 0 0 18px rgba(24,213,232,.14);
  border-radius: 8px;
  padding: 6px 9px;
  color: #cfe7ff;
  font-size: .68rem;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .stats .global-destroyed-label { display: none !important; }
  .control-buttons #globalDestroyedBottom { display: inline-flex !important; }
}

body.mobile-landscape .shell {
  height: var(--app-vh, 100dvh) !important;
  max-height: var(--app-vh, 100dvh) !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
}

body.mobile-landscape .topbar {
  padding: max(1px, env(safe-area-inset-top)) 5px 1px !important;
  margin: 0 !important;
}

body.mobile-landscape .game-card {
  min-height: 0 !important;
  height: 100% !important;
  padding: 2px 0 !important;
  overflow: hidden !important;
}

body.mobile-landscape canvas {
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
}

body.mobile-landscape .controls {
  display: flex !important;
  height: 38px !important;
  max-height: 38px !important;
  min-height: 38px !important;
  margin: 0 !important;
  padding: 3px 6px max(3px, env(safe-area-inset-bottom)) !important;
  overflow: hidden !important;
  align-items: center !important;
  justify-content: flex-start !important;
}

body.mobile-landscape .control-buttons {
  width: 100% !important;
  max-width: none !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 6px !important;
  overflow: visible !important;
}

body.mobile-landscape .controls button {
  width: 78px !important;
  min-width: 78px !important;
  height: 29px !important;
  padding: 3px 6px !important;
  font-size: clamp(.52rem, 2.8vh, .64rem) !important;
}

body.mobile-landscape .controls #fullscreenButton {
  width: 82px !important;
  min-width: 82px !important;
}

body.mobile-landscape .control-buttons #globalDestroyedBottom {
  display: inline-flex !important;
  margin-left: auto !important;
  width: auto !important;
  min-width: 148px !important;
  max-width: none !important;
  flex: 0 0 auto !important;
  height: 29px !important;
  padding: 3px 7px !important;
  font-size: clamp(.50rem, 2.7vh, .62rem) !important;
  line-height: 1 !important;
}

body.mobile-landscape .destroyed-fixed {
  display: none !important;
}

body.mobile-landscape .site-footer {
  display: none !important;
}

body.is-fullscreen.mobile-landscape .controls {
  height: 36px !important;
  max-height: 36px !important;
  min-height: 36px !important;
}

body.is-fullscreen.mobile-landscape .topbar {
  padding-top: max(1px, env(safe-area-inset-top)) !important;
}

@media (max-width: 520px) and (orientation: portrait) {
  .control-buttons {
    width: 100%;
  }
  .control-buttons #globalDestroyedBottom {
    flex: 1 0 100%;
    min-width: 0;
  }
}

/* V21: Visible total counter, no scrolling away in mobile landscape. */
#globalDestroyedLabel,
#globalDestroyedBottom,
#globalDestroyedFixed {
  visibility: visible !important;
}

#globalDestroyedLabel {
  display: inline-flex !important;
}

#globalDestroyedBottom {
  display: inline-flex !important;
  order: -10 !important;
  margin-left: 0 !important;
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: none !important;
}

@media (max-width: 720px) and (orientation: portrait) {
  .stats #globalDestroyedLabel {
    display: none !important;
  }

  .control-buttons #globalDestroyedBottom {
    display: inline-flex !important;
    flex: 1 0 calc(100vw - 32px) !important;
    width: calc(100vw - 32px) !important;
    max-width: calc(100vw - 32px) !important;
    order: -10 !important;
    justify-content: center !important;
  }
}

body.mobile-landscape .stats #globalDestroyedLabel {
  display: inline-flex !important;
  width: auto !important;
  min-width: 128px !important;
  max-width: none !important;
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
  padding: 3px 6px !important;
  font-size: clamp(.48rem, 2.5vh, .58rem) !important;
}

body.mobile-landscape .control-buttons #globalDestroyedBottom {
  display: inline-flex !important;
  order: -10 !important;
  margin-left: 0 !important;
  min-width: 138px !important;
  max-width: none !important;
  width: auto !important;
  flex: 0 0 auto !important;
  height: 29px !important;
  padding: 3px 7px !important;
  font-size: clamp(.50rem, 2.7vh, .62rem) !important;
  line-height: 1 !important;
}

body.mobile-landscape .control-buttons {
  justify-content: flex-start !important;
  overflow: visible !important;
}

@media (min-width: 721px) {
  #globalDestroyedBottom {
    min-width: 190px !important;
  }
}


/* V23: Total counter at the top center. Game stats remain on the right. */
.topbar {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
  align-items: end !important;
  gap: 10px !important;
}

.topbar > div:first-child {
  grid-column: 1 !important;
  min-width: 0 !important;
}

.topbar .stats {
  grid-column: 3 !important;
  justify-self: end !important;
  min-width: 0 !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  justify-content: flex-end !important;
  text-align: right !important;
}

.top-global-counter {
  grid-column: 2 !important;
  justify-self: center !important;
  align-self: end !important;
  border: 1px solid rgba(141, 161, 195, .35) !important;
  background: rgba(16, 24, 50, .88) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03), 0 0 18px rgba(24,213,232,.06) !important;
  border-radius: 8px !important;
  padding: 6px 10px !important;
  color: #cfe7ff !important;
  font-size: .76rem !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  text-align: center !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  visibility: visible !important;
  max-width: calc(100vw - 420px) !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* From V23 onward the counter is at the top. The old lower chip remains in the HTML as a fallback but is not displayed. */
#globalDestroyedBottom,
#globalDestroyedFixed {
  display: none !important;
}

@media (max-width: 900px) {
  .top-global-counter {
    font-size: .68rem !important;
    padding: 5px 8px !important;
    max-width: 34vw !important;
  }
}

@media (max-width: 720px) and (orientation: portrait) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas:
      "brand stats"
      "counter counter" !important;
    align-items: start !important;
    gap: 4px 8px !important;
    padding: max(6px, env(safe-area-inset-top)) 6px 0 !important;
  }

  .topbar > div:first-child {
    grid-area: brand !important;
  }

  .topbar .stats {
    grid-area: stats !important;
    justify-self: end !important;
    align-self: start !important;
    gap: 4px !important;
    font-size: .68rem !important;
    flex-wrap: wrap !important;
    max-width: 174px !important;
  }

  .topbar .stats span {
    padding: 5px 7px !important;
  }

  .top-global-counter {
    grid-area: counter !important;
    justify-self: center !important;
    align-self: center !important;
    display: inline-flex !important;
    width: auto !important;
    max-width: calc(100vw - 24px) !important;
    font-size: .66rem !important;
    padding: 5px 8px !important;
    margin: 1px 0 0 !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  #globalDestroyedBottom,
  #globalDestroyedFixed {
    display: none !important;
  }
}

body.mobile-landscape .topbar {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 6px !important;
}

body.mobile-landscape .topbar > div:first-child {
  grid-column: 1 !important;
}

body.mobile-landscape .topbar .stats {
  grid-column: 3 !important;
  justify-self: end !important;
  flex-wrap: nowrap !important;
  max-width: none !important;
}

body.mobile-landscape .top-global-counter {
  grid-column: 2 !important;
  justify-self: center !important;
  display: inline-flex !important;
  min-width: 0 !important;
  max-width: 32vw !important;
  padding: 3px 6px !important;
  font-size: clamp(.46rem, 2.45vh, .58rem) !important;
  line-height: 1 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body.mobile-landscape #globalDestroyedBottom,
body.mobile-landscape #globalDestroyedFixed {
  display: none !important;
}


/* V24: Only the upper world counter remains visible. Mobile landscape is zoomed out by 10 percent. */
#globalDestroyedBottom,
#globalDestroyedFixed {
  display: none !important;
}

body.mobile-landscape .control-buttons #globalDestroyedBottom,
body.mobile-landscape #globalDestroyedBottom,
body.mobile-landscape #globalDestroyedFixed {
  display: none !important;
}

body.mobile-landscape {
  overflow: hidden !important;
}

body.mobile-landscape .shell {
  width: 111.111vw !important;
  height: calc(var(--app-vh, 100dvh) / 0.9) !important;
  max-height: calc(var(--app-vh, 100dvh) / 0.9) !important;
  transform: scale(0.9) !important;
  transform-origin: top left !important;
}

body.mobile-landscape .topbar {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
  gap: 7px !important;
  padding-left: max(6px, env(safe-area-inset-left)) !important;
  padding-right: max(6px, env(safe-area-inset-right)) !important;
}

body.mobile-landscape h1 {
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
  font-size: clamp(.70rem, 4vh, .98rem) !important;
}

body.mobile-landscape .top-global-counter {
  max-width: 30vw !important;
  font-size: clamp(.43rem, 2.25vh, .54rem) !important;
}

body.mobile-landscape .topbar .stats {
  overflow: visible !important;
}

body.mobile-landscape .topbar .stats span {
  font-size: clamp(.46rem, 2.35vh, .58rem) !important;
  padding: 3px 5px !important;
  white-space: nowrap !important;
}

/* V25: Mobile landscape only. Pull the right stats row inward so that score remains visible. */
body.mobile-landscape .topbar {
  padding-left: max(12px, env(safe-area-inset-left)) !important;
  padding-right: max(30px, env(safe-area-inset-right)) !important;
  grid-template-columns: minmax(0, 0.9fr) auto minmax(max-content, 0.9fr) !important;
}

body.mobile-landscape .topbar .stats {
  justify-self: end !important;
  margin-right: 14px !important;
  max-width: calc(100vw - 24px) !important;
  gap: 4px !important;
  overflow: visible !important;
}

body.mobile-landscape .topbar .stats span {
  font-size: clamp(.44rem, 2.2vh, .56rem) !important;
  padding: 3px 4px !important;
  white-space: nowrap !important;
}

body.mobile-landscape #scoreLabel {
  margin-right: 2px !important;
}

/* Merged game switcher */
.game-switcher {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 5px !important;
  margin-top: 6px !important;
  align-items: center !important;
}

.game-switcher a,
.game-switcher span {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid rgba(141, 161, 195, .35) !important;
  background: rgba(16, 24, 50, .88) !important;
  color: #cfe7ff !important;
  border-radius: 999px !important;
  padding: 5px 9px !important;
  font-size: .68rem !important;
  line-height: 1 !important;
  text-decoration: none !important;
  white-space: nowrap !important;
}

.game-switcher .is-active {
  border-color: rgba(24, 213, 232, .7) !important;
  color: #ffffff !important;
  box-shadow: 0 0 14px rgba(24, 213, 232, .18) !important;
}

.game-switcher a:hover,
.game-switcher a:focus-visible {
  border-color: rgba(24, 213, 232, .8) !important;
  outline: none !important;
}

@media (max-width: 720px) and (orientation: portrait) {
  .game-switcher {
    margin-top: 4px !important;
    gap: 4px !important;
  }

  .game-switcher a,
  .game-switcher span {
    padding: 4px 6px !important;
    font-size: .58rem !important;
  }
}

body.mobile-landscape .game-switcher {
  margin-top: 3px !important;
  gap: 4px !important;
}

body.mobile-landscape .game-switcher a,
body.mobile-landscape .game-switcher span {
  padding: 3px 6px !important;
  font-size: .52rem !important;
}


/* Compact title language switcher */
.title-line {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 0 !important;
}

.language-switcher {
  display: inline-flex !important;
  align-items: center !important;
  gap: 2px !important;
  padding: 2px !important;
  border: 1px solid rgba(141, 161, 195, .32) !important;
  background: rgba(16, 24, 50, .70) !important;
  border-radius: 999px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

.language-switcher a,
.language-switcher span {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 24px !important;
  padding: 3px 5px !important;
  border-radius: 999px !important;
  color: #cfe7ff !important;
  font-size: .54rem !important;
  letter-spacing: .04em !important;
  text-decoration: none !important;
}

.language-switcher .is-active {
  background: rgba(24, 213, 232, .20) !important;
  color: #ffffff !important;
}

.language-switcher a:hover,
.language-switcher a:focus-visible {
  color: #ffffff !important;
  outline: none !important;
}

body.mobile-landscape .title-line { gap: 5px !important; }
body.mobile-landscape .language-switcher a,
body.mobile-landscape .language-switcher span {
  min-width: 19px !important;
  padding: 2px 4px !important;
  font-size: .45rem !important;
}

.secret-level2-trigger {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  cursor: default;
}
.secret-level2-trigger:focus-visible {
  outline: 1px dotted rgba(255,255,255,.6);
  outline-offset: 2px;
}

/* V47: Contact form */
.contact-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.form-row {
  display: grid;
  gap: 7px;
}

.form-row label {
  color: #cfe7ff;
  font-size: .9rem;
  line-height: 1.35;
}

.form-row label span,
.form-note {
  color: var(--muted);
  font-size: .78rem;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid rgba(141, 161, 195, .45);
  background: rgba(3, 7, 17, .78);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 11px;
  font: inherit;
  outline: none;
}

.contact-form textarea {
  resize: vertical;
  min-height: 170px;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: rgba(24, 213, 232, .75);
  box-shadow: 0 0 0 2px rgba(24, 213, 232, .16);
}

.form-row-small {
  max-width: 280px;
}

.anti-spam-field {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact-submit {
  justify-self: start;
  border: 1px solid rgba(141, 161, 195, .5);
  background: linear-gradient(180deg, #253869, #111a3a);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
}

.contact-submit:hover,
.contact-submit:focus-visible {
  border-color: rgba(255,255,255,.72);
  box-shadow: 0 0 18px rgba(24,213,232,.22);
}

.form-status {
  border: 1px solid rgba(141, 161, 195, .45);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(3, 7, 17, .64);
}

.form-status-success {
  border-color: rgba(24, 213, 232, .55);
}

.form-status-error {
  border-color: rgba(238, 46, 69, .65);
}



/* V49: Highscore */
.highscore-card {
  margin: 14px auto 0;
  border: 1px solid rgba(141, 161, 195, .32);
  background: rgba(3, 7, 17, .58);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.18);
}

.highscore-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.highscore-head h2 {
  margin: 0;
  font-size: clamp(1.02rem, 2.4vw, 1.32rem);
  letter-spacing: .02em;
}

.highscore-head span,
.highscore-note,
.highscore-message,
.highscore-current span {
  color: var(--muted);
  font-size: .82rem;
}

.highscore-list {
  margin: 0;
  padding-left: 1.35rem;
  display: grid;
  gap: 5px;
  font-size: .92rem;
}

.highscore-list li::marker {
  color: rgba(24, 213, 232, .85);
}

.highscore-entry {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(141, 161, 195, .12);
  padding-bottom: 4px;
}

.highscore-entry-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.highscore-entry-score {
  font-variant-numeric: tabular-nums;
  color: #e7f6ff;
}

.highscore-form {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.highscore-form label {
  color: #cfe7ff;
  font-size: .88rem;
}

.highscore-fields {
  display: flex;
  gap: 8px;
}

.highscore-fields input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(141, 161, 195, .45);
  background: rgba(3, 7, 17, .78);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 11px;
  font: inherit;
  outline: none;
}

.highscore-fields input:focus {
  border-color: rgba(24, 213, 232, .75);
  box-shadow: 0 0 0 2px rgba(24, 213, 232, .16);
}

.highscore-fields button {
  border: 1px solid rgba(141, 161, 195, .5);
  background: linear-gradient(180deg, #253869, #111a3a);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 13px;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.highscore-fields button:hover,
.highscore-fields button:focus-visible {
  border-color: rgba(255,255,255,.72);
  box-shadow: 0 0 18px rgba(24,213,232,.22);
}

.highscore-fields button:disabled {
  opacity: .52;
  cursor: default;
}

.highscore-current {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.highscore-message,
.highscore-note {
  margin: 0;
  line-height: 1.35;
}

@media (max-width: 520px) {
  .highscore-card {
    padding: 12px;
  }

  .highscore-fields {
    align-items: stretch;
  }

  .highscore-fields button {
    padding-left: 10px;
    padding-right: 10px;
  }
}


/* V56: top score action and centered voluntary highscore entry */
.topbar {
  grid-template-rows: auto auto auto !important;
}

.topbar > div:first-child {
  grid-row: 1 !important;
}

.topbar .stats {
  grid-row: 1 !important;
}

.top-score-action {
  grid-column: 1 / -1 !important;
  grid-row: 2 !important;
  justify-self: center !important;
  align-self: center !important;
  margin-top: 2px !important;
}

.score-finish-button {
  border: 1px solid rgba(24, 213, 232, .45);
  background: rgba(16, 24, 50, .88);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03), 0 0 18px rgba(24,213,232,.10);
  border-radius: 10px;
  padding: 6px 12px;
  color: #dff7ff;
  font: inherit;
  font-size: clamp(.66rem, 2.35vw, .82rem);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.score-finish-button:hover,
.score-finish-button:focus-visible {
  border-color: rgba(255,255,255,.72);
  box-shadow: 0 0 18px rgba(24,213,232,.24);
}

.top-global-counter {
  grid-column: 1 / -1 !important;
  grid-row: 3 !important;
  justify-self: center !important;
}

body.highscore-modal-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(2, 5, 15, .70);
  backdrop-filter: blur(3px);
}

.highscore-form.highscore-modal:not([hidden]) {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 81;
  width: min(92vw, 520px);
  max-height: min(86dvh, 640px);
  overflow: auto;
  margin: 0;
  padding: 18px;
  border: 1px solid rgba(141, 161, 195, .55);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(17, 25, 54, .98), rgba(3, 7, 17, .98));
  box-shadow: 0 26px 90px rgba(0,0,0,.62), 0 0 34px rgba(24,213,232,.16);
}

.highscore-modal-title {
  margin: 0 34px 4px 0;
  color: #e9f3ff;
  font-size: clamp(1rem, 3.2vw, 1.28rem);
  letter-spacing: .01em;
}

.highscore-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(141, 161, 195, .45);
  border-radius: 999px;
  background: rgba(3, 7, 17, .74);
  color: #e9f3ff;
  font: inherit;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.highscore-close:hover,
.highscore-close:focus-visible {
  border-color: rgba(255,255,255,.72);
  box-shadow: 0 0 18px rgba(24,213,232,.20);
}

@media (max-width: 520px) {
  .score-finish-button {
    max-width: calc(100vw - 28px);
    overflow: hidden;
    text-overflow: ellipsis;
  }
}


/* V58: cleaner desktop header only. Mobile layout stays unchanged. */
@media (min-width: 901px) {
  .topbar {
    grid-template-columns: minmax(320px, 1fr) minmax(260px, auto) minmax(320px, 1fr) !important;
    grid-template-rows: auto !important;
    align-items: start !important;
    gap: 8px 14px !important;
    margin-bottom: 5px !important;
    padding-top: max(6px, env(safe-area-inset-top)) !important;
  }

  .topbar > div:first-child {
    grid-column: 1 !important;
    grid-row: 1 !important;
    align-self: start !important;
  }

  .topbar .stats {
    grid-column: 3 !important;
    grid-row: 1 !important;
    align-self: start !important;
    justify-self: end !important;
    gap: 5px !important;
  }

  .topbar .stats span {
    padding: 5px 8px !important;
  }

  .top-score-action {
    grid-column: 2 !important;
    grid-row: 1 !important;
    justify-self: center !important;
    align-self: start !important;
    margin: 0 !important;
  }

  .score-finish-button {
    padding: 5px 11px !important;
    border-radius: 9px !important;
    font-size: .72rem !important;
  }

  .top-global-counter {
    grid-column: 2 !important;
    grid-row: 1 !important;
    justify-self: center !important;
    align-self: start !important;
    margin-top: 32px !important;
    max-width: none !important;
    padding: 5px 10px !important;
    font-size: .74rem !important;
  }
}


/* V65: mobile header checked.
   Portrait has exactly three rows:
   1 title/language left, stats right
   2 Pinball left, counter right
   3 Pinball World War left, score button right
   Landscape hides the lower highscore list while playing so the canvas gets room. */
@media (max-width: 720px) and (orientation: portrait) {
  .topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 47vw) minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto !important;
    grid-template-areas:
      "brand stats"
      "brand counter"
      "brand scoreaction" !important;
    align-items: start !important;
    gap: 4px 6px !important;
    margin-bottom: 5px !important;
    padding: max(5px, env(safe-area-inset-top)) 6px 0 !important;
  }

  .topbar > div:first-child {
    grid-area: brand !important;
    min-width: 0 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto !important;
    gap: 5px !important;
    align-items: start !important;
  }

  .title-line {
    grid-row: 1 !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  h1 {
    font-size: clamp(.74rem, 3.9vw, 1.0rem) !important;
    letter-spacing: .055em !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    flex: 0 1 auto !important;
    min-width: 0 !important;
  }

  .language-switcher {
    transform: scale(.78) !important;
    transform-origin: left center !important;
    flex: 0 0 auto !important;
  }

  .game-switcher {
    display: contents !important;
  }

  .game-switcher > :first-child {
    grid-row: 2 !important;
    justify-self: start !important;
  }

  .game-switcher > :last-child {
    grid-row: 3 !important;
    justify-self: start !important;
  }

  .game-switcher a,
  .game-switcher span {
    padding: 5px 8px !important;
    font-size: clamp(.58rem, 2.7vw, .66rem) !important;
    line-height: 1 !important;
    max-width: 46vw !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .topbar .stats {
    grid-area: stats !important;
    justify-self: end !important;
    align-self: center !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 3px !important;
    min-width: 0 !important;
    max-width: 100% !important;
    font-size: clamp(.48rem, 2.25vw, .60rem) !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  .topbar .stats span {
    padding: 4px 5px !important;
    border-radius: 8px !important;
    white-space: nowrap !important;
  }

  .top-global-counter {
    grid-area: counter !important;
    justify-self: stretch !important;
    align-self: center !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 5px 5px !important;
    font-size: clamp(.47rem, 2.05vw, .56rem) !important;
    line-height: 1 !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    text-align: center !important;
  }

  .top-score-action {
    grid-area: scoreaction !important;
    justify-self: stretch !important;
    align-self: center !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  .score-finish-button {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    padding: 5px 5px !important;
    font-size: clamp(.47rem, 2.05vw, .56rem) !important;
    line-height: 1 !important;
    border-radius: 8px !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    text-align: center !important;
  }
}

@media (max-width: 390px) and (orientation: portrait) {
  .topbar {
    grid-template-columns: minmax(0, 46vw) minmax(0, 1fr) !important;
    gap: 4px 5px !important;
  }
  .topbar > div:first-child { gap: 4px !important; }
  .topbar .stats { gap: 2px !important; font-size: .46rem !important; }
  .topbar .stats span { padding: 4px 4px !important; }
  .game-switcher a, .game-switcher span { padding: 4px 7px !important; font-size: .56rem !important; max-width: 45vw !important; }
  .top-global-counter, .score-finish-button { font-size: .425rem !important; padding-left: 4px !important; padding-right: 4px !important; }
}

/* V65: mobile landscape checked. */
body.mobile-landscape {
  overflow: hidden !important;
  height: var(--app-vh, 100dvh) !important;
  min-height: 0 !important;
}
body.mobile-landscape .shell {
  width: 100vw !important;
  height: var(--app-vh, 100dvh) !important;
  max-height: var(--app-vh, 100dvh) !important;
  transform: none !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
body.mobile-landscape .topbar {
  flex: 0 0 auto !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
  grid-template-rows: auto !important;
  align-items: center !important;
  gap: 6px !important;
  margin: 0 0 3px !important;
  padding: max(3px, env(safe-area-inset-top)) 6px 0 !important;
}
body.mobile-landscape .topbar > div:first-child {
  grid-column: 1 !important;
  grid-row: 1 !important;
  display: block !important;
  min-width: 0 !important;
}
body.mobile-landscape .title-line { display: flex !important; align-items: center !important; gap: 6px !important; overflow: hidden !important; }
body.mobile-landscape h1 { font-size: clamp(.66rem, 3.2vh, .88rem) !important; letter-spacing: .05em !important; line-height: 1 !important; white-space: nowrap !important; }
body.mobile-landscape .language-switcher { transform: scale(.70) !important; transform-origin: left center !important; }
body.mobile-landscape .game-switcher { display: flex !important; flex-direction: row !important; gap: 4px !important; margin-top: 2px !important; }
body.mobile-landscape .game-switcher a, body.mobile-landscape .game-switcher span { padding: 3px 7px !important; font-size: clamp(.42rem, 2.0vh, .52rem) !important; line-height: 1 !important; white-space: nowrap !important; }
body.mobile-landscape .topbar .stats { grid-column: 3 !important; grid-row: 1 !important; justify-self: end !important; align-self: center !important; display: flex !important; flex-wrap: nowrap !important; gap: 3px !important; max-width: none !important; margin-right: 0 !important; font-size: clamp(.42rem, 2.0vh, .52rem) !important; line-height: 1 !important; }
body.mobile-landscape .topbar .stats span { padding: 3px 5px !important; border-radius: 7px !important; white-space: nowrap !important; }
body.mobile-landscape .top-score-action { grid-column: 2 !important; grid-row: 1 !important; justify-self: center !important; align-self: start !important; margin: 0 !important; }
body.mobile-landscape .score-finish-button { padding: 3px 7px !important; font-size: clamp(.42rem, 2.0vh, .52rem) !important; line-height: 1 !important; border-radius: 7px !important; white-space: nowrap !important; }
body.mobile-landscape .top-global-counter { grid-column: 2 !important; grid-row: 1 !important; justify-self: center !important; align-self: end !important; margin: 17px 0 0 !important; width: auto !important; max-width: 42vw !important; padding: 3px 7px !important; font-size: clamp(.40rem, 1.9vh, .50rem) !important; line-height: 1 !important; overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; }
body.mobile-landscape .game-card { flex: 1 1 auto !important; min-height: 0 !important; display: flex !important; padding: 0 !important; }
body.mobile-landscape canvas { flex: 1 1 auto !important; height: auto !important; min-height: 0 !important; }
body.mobile-landscape .controls { flex: 0 0 auto !important; padding: 3px 6px max(3px, env(safe-area-inset-bottom)) !important; }
body.mobile-landscape .control-buttons { width: 100% !important; display: grid !important; grid-template-columns: repeat(6, minmax(0, 1fr)) !important; gap: 4px !important; }
body.mobile-landscape .controls button, body.mobile-landscape .joker-button { width: 100% !important; min-width: 0 !important; padding: 4px 2px !important; font-size: clamp(.40rem, 1.9vh, .52rem) !important; border-radius: 6px !important; line-height: 1 !important; }
body.mobile-landscape:not(.highscore-modal-open) .highscore-card, body.mobile-landscape .site-footer { display: none !important; }


/* V66: mobile title fit after rendered check. */
@media (max-width: 720px) and (orientation: portrait) {
  h1 {
    font-size: clamp(.62rem, 3.25vw, .84rem) !important;
    letter-spacing: .045em !important;
  }

  .language-switcher {
    transform: scale(.68) !important;
    transform-origin: left center !important;
  }
}

@media (max-width: 390px) and (orientation: portrait) {
  h1 {
    font-size: clamp(.58rem, 3.05vw, .78rem) !important;
    letter-spacing: .04em !important;
  }

  .language-switcher {
    transform: scale(.64) !important;
  }
}

body.mobile-landscape h1 {
  font-size: clamp(.62rem, 3.0vh, .82rem) !important;
  letter-spacing: .045em !important;
}

body.mobile-landscape .language-switcher {
  transform: scale(.66) !important;
}


/* V68 Web: only center the DE EN switcher on Pinball World War mobile portrait. */
@media (max-width: 720px) and (orientation: portrait) {
  body.worldwar-page .title-line {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
    align-items: center !important;
    column-gap: 6px !important;
  }

  body.worldwar-page .title-line h1 {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    justify-self: start !important;
  }

  body.worldwar-page .title-line .language-switcher {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    justify-self: center !important;
    transform: scale(.90) !important;
    transform-origin: center center !important;
  }
}



/* V71 pause button and stability state */
.pause-button.is-paused {
  border-color: rgba(255,255,255,.82) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.10), 0 0 18px rgba(255,216,77,.24) !important;
}
body.game-paused canvas {
  cursor: default;
}


/* V72: anonymous online player display. */
.top-online-counter {
  grid-column: 1 / -1 !important;
  grid-row: 4 !important;
  justify-self: center !important;
  border: 1px solid rgba(141, 161, 195, .36);
  background: rgba(6, 12, 32, .72);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.025), 0 0 16px rgba(24,213,232,.08);
  border-radius: 999px;
  padding: 4px 10px;
  color: #cfe8ff;
  font-weight: 800;
  font-size: clamp(.58rem, 2.0vw, .74rem);
  line-height: 1;
  white-space: nowrap;
}

.topbar {
  grid-template-rows: auto auto auto auto !important;
}

body.mobile-landscape .top-online-counter {
  grid-column: 2 !important;
  grid-row: 1 !important;
  justify-self: center !important;
  align-self: end !important;
  margin: 31px 0 0 !important;
  max-width: 42vw !important;
  padding: 2px 7px !important;
  font-size: clamp(.36rem, 1.65vh, .46rem) !important;
  line-height: 1 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

@media (max-width: 720px) and (orientation: portrait) {
  .top-online-counter {
    padding: 3px 8px;
    font-size: clamp(.52rem, 2.3vw, .66rem);
  }
}

/* V74: keep the anonymous online player chip in the top header row. */
.top-online-counter {
  grid-row: 1 !important;
  border: 1px solid rgba(141, 161, 195, .36);
  background: rgba(6, 12, 32, .72);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.025), 0 0 16px rgba(24,213,232,.08);
  border-radius: 999px;
  padding: 4px 9px;
  color: #cfe8ff;
  font-weight: 800;
  font-size: clamp(.52rem, 1.25vw, .70rem);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 901px) {
  .topbar {
    grid-template-columns: minmax(320px, 1fr) auto auto minmax(280px, 1fr) !important;
    grid-template-rows: auto !important;
    align-items: start !important;
    gap: 8px 10px !important;
  }

  .topbar > div:first-child {
    grid-column: 1 !important;
    grid-row: 1 !important;
  }

  .top-score-action {
    grid-column: 2 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    align-self: start !important;
    margin: 0 !important;
  }

  .top-online-counter {
    grid-column: 3 !important;
    grid-row: 1 !important;
    justify-self: start !important;
    align-self: start !important;
    margin: 0 !important;
    max-width: 190px !important;
  }

  .topbar .stats {
    grid-column: 4 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    align-self: start !important;
  }

  .top-global-counter {
    grid-column: 2 / 4 !important;
    grid-row: 1 !important;
    justify-self: center !important;
    align-self: start !important;
    margin-top: 32px !important;
  }
}

@media (min-width: 721px) and (max-width: 900px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto auto minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    align-items: start !important;
    gap: 6px 8px !important;
  }

  .topbar > div:first-child {
    grid-column: 1 !important;
    grid-row: 1 / 3 !important;
  }

  .top-score-action {
    grid-column: 2 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    align-self: start !important;
    margin: 0 !important;
  }

  .top-online-counter {
    grid-column: 3 !important;
    grid-row: 1 !important;
    justify-self: start !important;
    align-self: start !important;
    margin: 0 !important;
    max-width: 170px !important;
  }

  .topbar .stats {
    grid-column: 4 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    align-self: start !important;
  }

  .top-global-counter {
    grid-column: 2 / 4 !important;
    grid-row: 2 !important;
    justify-self: center !important;
    align-self: center !important;
    margin: 0 !important;
  }
}

@media (max-width: 720px) and (orientation: portrait) {
  .topbar {
    grid-template-columns: minmax(0, 41vw) auto minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto !important;
    grid-template-areas:
      "brand online stats"
      "brand counter counter"
      "brand scoreaction scoreaction" !important;
    align-items: start !important;
    gap: 4px 4px !important;
  }

  .top-online-counter {
    grid-area: online !important;
    grid-column: auto !important;
    grid-row: auto !important;
    justify-self: center !important;
    align-self: center !important;
    margin: 0 !important;
    max-width: 24vw !important;
    padding: 4px 5px !important;
    font-size: clamp(.39rem, 1.85vw, .50rem) !important;
    line-height: 1 !important;
  }

  .topbar .stats {
    grid-area: stats !important;
  }

  .top-global-counter {
    grid-area: counter !important;
  }

  .top-score-action {
    grid-area: scoreaction !important;
  }
}

@media (max-width: 390px) and (orientation: portrait) {
  .topbar {
    grid-template-columns: minmax(0, 39vw) auto minmax(0, 1fr) !important;
  }

  .top-online-counter {
    max-width: 25vw !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
    font-size: .37rem !important;
  }
}

body.mobile-landscape .topbar {
  grid-template-columns: minmax(0, 1fr) auto auto auto !important;
  grid-template-rows: auto !important;
  align-items: center !important;
  gap: 5px !important;
}

body.mobile-landscape .top-score-action {
  grid-column: 2 !important;
  grid-row: 1 !important;
  justify-self: end !important;
  align-self: start !important;
  margin: 0 !important;
}

body.mobile-landscape .top-online-counter {
  grid-column: 3 !important;
  grid-row: 1 !important;
  justify-self: start !important;
  align-self: start !important;
  margin: 0 !important;
  max-width: 20vw !important;
  padding: 3px 5px !important;
  font-size: clamp(.34rem, 1.55vh, .44rem) !important;
  line-height: 1 !important;
}

body.mobile-landscape .topbar .stats {
  grid-column: 4 !important;
  grid-row: 1 !important;
  justify-self: end !important;
  align-self: center !important;
}

body.mobile-landscape .top-global-counter {
  grid-column: 2 / 4 !important;
  grid-row: 1 !important;
  justify-self: center !important;
  align-self: end !important;
  margin: 17px 0 0 !important;
}

/* Web V1: small visible version marker inside the existing stats row. */
.app-version {
  opacity: .58 !important;
  font-size: .68em !important;
  letter-spacing: .02em !important;
  padding-left: 6px !important;
  padding-right: 6px !important;
  white-space: nowrap !important;
}
body.mobile-landscape .app-version {
  font-size: .62em !important;
  padding-left: 4px !important;
  padding-right: 4px !important;
}
@media (max-width: 390px) and (orientation: portrait) {
  .app-version { font-size: .56em !important; padding-left: 3px !important; padding-right: 3px !important; }
}

/* V77: mobile header cleanup. Language switcher moves one row lower next to the game switcher. Online chip stays in the top row but moves slightly left. */
@media (max-width: 720px) and (orientation: portrait) {
  .topbar {
    grid-template-columns: minmax(0, 45vw) minmax(0, 24vw) minmax(0, 1fr) !important;
    grid-template-areas:
      "brand online stats"
      "brand counter counter"
      "brand scoreaction scoreaction" !important;
    gap: 4px 3px !important;
  }

  .topbar > div:first-child {
    grid-template-columns: auto auto !important;
    grid-template-rows: auto auto auto !important;
    column-gap: 5px !important;
    row-gap: 4px !important;
  }

  .title-line {
    display: contents !important;
  }

  .title-line h1 {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    justify-self: start !important;
    max-width: 45vw !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .title-line .language-switcher {
    grid-column: 2 !important;
    grid-row: 2 !important;
    justify-self: start !important;
    align-self: center !important;
    transform: scale(.66) !important;
    transform-origin: left center !important;
    margin-left: -2px !important;
  }

  .game-switcher > :first-child {
    grid-column: 1 !important;
    grid-row: 2 !important;
  }

  .game-switcher > :last-child {
    grid-column: 1 / -1 !important;
    grid-row: 3 !important;
    max-width: 45vw !important;
  }

  .top-online-counter {
    justify-self: start !important;
    margin-left: -5px !important;
    max-width: 24vw !important;
  }

  body.worldwar-page .title-line,
  body.worldwar-page .title-line h1,
  body.worldwar-page .title-line .language-switcher {
    display: revert-layer !important;
  }

  body.worldwar-page .title-line {
    display: contents !important;
  }

  body.worldwar-page .title-line h1 {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
    justify-self: start !important;
    font-size: clamp(.58rem, 3.05vw, .80rem) !important;
  }

  body.worldwar-page .title-line .language-switcher {
    grid-column: 2 !important;
    grid-row: 2 !important;
    justify-self: start !important;
    transform: scale(.64) !important;
    transform-origin: left center !important;
  }
}

body.mobile-landscape .top-online-counter {
  margin-left: -6px !important;
  max-width: 21vw !important;
}


/* V78: mobile header collision fix. Online chip stays in the top row but cannot overlap stats or other chips. */
@media (max-width: 720px) and (orientation: portrait) {
  .topbar {
    grid-template-columns: minmax(0, 43vw) minmax(0, 20vw) minmax(0, 37vw) !important;
    grid-template-areas:
      "brand online stats"
      "brand counter counter"
      "brand scoreaction scoreaction" !important;
    column-gap: 2px !important;
    row-gap: 4px !important;
    overflow: hidden !important;
  }

  .topbar > * {
    min-width: 0 !important;
  }

  .top-online-counter {
    grid-area: online !important;
    justify-self: start !important;
    align-self: start !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 3px 4px !important;
    font-size: clamp(.34rem, 1.55vw, .44rem) !important;
    line-height: 1.05 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    transform: none !important;
  }

  .topbar .stats {
    grid-area: stats !important;
    min-width: 0 !important;
    width: 100% !important;
    justify-self: end !important;
    justify-content: flex-end !important;
    gap: 2px !important;
    overflow: hidden !important;
  }

  .stats span,
  .stats .app-version {
    padding-left: 4px !important;
    padding-right: 4px !important;
  }

  .title-line h1 {
    max-width: 43vw !important;
  }

  .game-switcher > :last-child {
    max-width: 43vw !important;
  }

  body.worldwar-page .title-line h1 {
    font-size: clamp(.54rem, 2.75vw, .74rem) !important;
    max-width: 43vw !important;
  }

  body.worldwar-page .game-switcher > :last-child {
    max-width: 43vw !important;
  }
}

@media (max-width: 390px) and (orientation: portrait) {
  .topbar {
    grid-template-columns: minmax(0, 42vw) minmax(0, 19vw) minmax(0, 39vw) !important;
  }

  .top-online-counter {
    font-size: .32rem !important;
    padding-left: 3px !important;
    padding-right: 3px !important;
  }

  body.worldwar-page .title-line h1 {
    font-size: clamp(.50rem, 2.55vw, .68rem) !important;
  }
}

body.mobile-landscape .topbar > * {
  min-width: 0 !important;
}

body.mobile-landscape .top-online-counter {
  justify-self: start !important;
  width: 100% !important;
  max-width: 18vw !important;
  min-width: 0 !important;
  margin-left: 0 !important;
  padding-left: 4px !important;
  padding-right: 4px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}


/* V79: final mobile header fix. Online label is short and cannot overlap stats. */
.top-online-counter {
  box-sizing: border-box !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
}

@media (max-width: 720px) and (orientation: portrait) {
  .topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 44vw) minmax(0, 15vw) minmax(0, 41vw) !important;
    grid-template-areas:
      "brand online stats"
      "brand counter counter"
      "brand scoreaction scoreaction" !important;
    column-gap: 0 !important;
    row-gap: 4px !important;
    align-items: start !important;
    overflow: hidden !important;
  }

  .topbar > * {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .topbar > div:first-child {
    grid-area: brand !important;
    min-width: 0 !important;
    max-width: 44vw !important;
    overflow: hidden !important;
  }

  .top-online-counter {
    grid-area: online !important;
    justify-self: start !important;
    align-self: start !important;
    width: 15vw !important;
    max-width: 15vw !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 3px 2px !important;
    font-size: clamp(.34rem, 1.75vw, .46rem) !important;
    line-height: 1.05 !important;
    text-align: center !important;
    transform: none !important;
    z-index: 1 !important;
  }

  .topbar .stats {
    grid-area: stats !important;
    justify-self: end !important;
    align-self: start !important;
    width: 41vw !important;
    max-width: 41vw !important;
    min-width: 0 !important;
    margin: 0 !important;
    justify-content: flex-end !important;
    gap: 2px !important;
    overflow: hidden !important;
    z-index: 2 !important;
  }

  .topbar .stats span,
  .topbar .stats .app-version {
    padding-left: 3px !important;
    padding-right: 3px !important;
    font-size: clamp(.38rem, 1.95vw, .54rem) !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
  }

  .top-global-counter {
    grid-area: counter !important;
    max-width: 56vw !important;
    justify-self: end !important;
  }

  .top-score-action {
    grid-area: scoreaction !important;
    justify-self: end !important;
  }

  .title-line h1 {
    max-width: 44vw !important;
  }

  .game-switcher > :last-child {
    max-width: 44vw !important;
  }

  body.worldwar-page .title-line h1 {
    font-size: clamp(.50rem, 2.55vw, .70rem) !important;
    max-width: 44vw !important;
  }
}

@media (max-width: 390px) and (orientation: portrait) {
  .topbar {
    grid-template-columns: minmax(0, 43vw) minmax(0, 14vw) minmax(0, 43vw) !important;
  }
  .topbar > div:first-child { max-width: 43vw !important; }
  .top-online-counter {
    width: 14vw !important;
    max-width: 14vw !important;
    font-size: .31rem !important;
    padding-left: 1px !important;
    padding-right: 1px !important;
  }
  .topbar .stats {
    width: 43vw !important;
    max-width: 43vw !important;
  }
  .topbar .stats span,
  .topbar .stats .app-version {
    font-size: .39rem !important;
    padding-left: 2px !important;
    padding-right: 2px !important;
  }
}

body.mobile-landscape .top-online-counter {
  width: 12vw !important;
  max-width: 12vw !important;
  text-align: center !important;
  font-size: clamp(.36rem, 1.45vw, .50rem) !important;
  padding-left: 2px !important;
  padding-right: 2px !important;
}
