/* Yalnizca aktif oyun ekranlari: baslik + tahta + klavye tek gorunumde. */
body.active-game-screen {
  --active-header-height: 64px;
  height: 100dvh;
  min-height: 100svh;
  overflow: hidden !important;
}

body.active-game-screen main {
  flex: none;
  width: 100%;
  height: 100dvh !important;
  min-height: 100svh !important;
  padding-top: var(--active-header-height) !important;
  overflow: hidden !important;
}

body.active-game-screen > footer { display: none !important; }

body.active-game-screen .game-page,
body.active-game-screen .duel-page.duel-game-page {
  width: min(calc(100% - 20px), 760px);
  max-width: 760px;
  height: calc(100dvh - var(--active-header-height));
  min-height: 0;
  margin: 0 auto;
  padding: 0 !important;
  overflow: hidden;
  grid-template-columns: minmax(0, 1fr) !important;
  transform: none !important;
  zoom: 1;
}

body.active-game-screen .game-shell,
body.active-game-screen .duel-playfield {
  --board-gap: clamp(4px, .7dvh, 8px);
  --cell-size: min(clamp(42px, 4vw, 64px), clamp(42px, 7.2dvh, 64px));
  display: grid;
  grid-template-rows: auto auto auto auto;
  align-content: center;
  align-items: center;
  gap: clamp(4px, .8dvh, 9px);
  width: 100%;
  max-width: 760px;
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: clamp(4px, 1dvh, 10px) 0 max(4px, env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  transform: none !important;
  zoom: 1;
}

body.active-game-screen .game-shell .city-pulse { display: none; }

body.active-game-screen .game-topline {
  min-height: 30px;
  margin: 0;
}

body.active-game-screen .game-heading,
body.active-game-screen .duel-playfield > header {
  min-width: 0;
  margin: 0;
}

body.active-game-screen .game-heading h1,
body.active-game-screen .duel-playfield > header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3.5vw, 2.5rem);
  line-height: 1.05;
}

body.active-game-screen .game-heading p,
body.active-game-screen .duel-playfield > header p {
  margin: 2px 0 0;
  font-size: clamp(.78rem, 1.25vw, .95rem);
  line-height: 1.25;
}

body.active-game-screen .message {
  min-height: 20px;
  margin: 0;
  font-size: clamp(.72rem, 1.2vw, .85rem);
  line-height: 1.25;
}

body.active-game-screen .game-shell .board,
body.active-game-screen .duel-playfield .board {
  display: grid;
  width: calc((5 * var(--cell-size)) + (4 * var(--board-gap)));
  min-width: 0;
  max-width: 100%;
  aspect-ratio: auto;
  gap: var(--board-gap);
  margin: 0 auto !important;
  align-content: center;
  justify-content: center;
  transform: none !important;
}

body.active-game-screen .duel-hard-mode .board {
  width: calc((6 * var(--cell-size)) + (5 * var(--board-gap)));
}

body.active-game-screen .game-shell .row,
body.active-game-screen .duel-playfield .row {
  display: grid;
  grid-template-columns: repeat(5, var(--cell-size));
  gap: var(--board-gap);
  width: auto;
}

body.active-game-screen .duel-hard-mode .row {
  grid-template-columns: repeat(6, var(--cell-size));
}

body.active-game-screen .game-shell .tile,
body.active-game-screen .duel-playfield .tile {
  width: var(--cell-size);
  height: var(--cell-size);
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  font-size: calc(var(--cell-size) * .44);
}

body.active-game-screen .game-shell .keyboard,
body.active-game-screen .duel-playfield .keyboard,
body.active-game-screen .bomb-playfield .keyboard {
  position: static !important;
  display: flex !important;
  flex-direction: column !important;
  gap: clamp(3px, .55dvh, 6px) !important;
  width: min(100%, 540px) !important;
  max-width: 540px !important;
  margin: 0 auto !important;
  padding: 0 0 max(4px, env(safe-area-inset-bottom, 0px));
  transform: none !important;
}

body.active-game-screen .game-shell .keyboard > div,
body.active-game-screen .duel-playfield .keyboard > div,
body.active-game-screen .bomb-playfield .keyboard-row {
  display: flex !important;
  justify-content: center !important;
  gap: clamp(3px, .4vw, 6px) !important;
  width: 100% !important;
}

body.active-game-screen .game-shell .keyboard button,
body.active-game-screen .duel-playfield .keyboard button,
body.active-game-screen .bomb-playfield .keyboard button,
body.active-game-screen .bomb-playfield .keyboard .key {
  position: static !important;
  flex: 1 1 0 !important;
  min-width: 0 !important;
  height: clamp(36px, 5.2dvh, 50px) !important;
  padding-inline: 2px !important;
  font-size: clamp(.72rem, 1.4vw, .95rem) !important;
  transform: none;
}

body.active-game-screen .game-shell .keyboard .wide,
body.active-game-screen .duel-playfield .keyboard .wide,
body.active-game-screen .bomb-playfield .keyboard .wide {
  flex: 1.5 1 0 !important;
}

/* Bomba Sende de ayni aktif ekran sinirlarini kullanir. */
body.bomb-game-screen .bomb-playfield {
  width: min(calc(100% - 20px), 540px) !important;
  max-width: 540px !important;
  height: calc(100dvh - var(--active-header-height)) !important;
  min-height: 0 !important;
  margin: 0 auto !important;
  padding: clamp(5px, 1dvh, 10px) 0 max(4px, env(safe-area-inset-bottom, 0px)) !important;
  overflow: hidden !important;
}

body.bomb-game-screen .bomb-game-header { margin-bottom: clamp(4px, .8dvh, 10px); }
body.bomb-game-screen .bomb-visual-container {
  height: clamp(52px, 11dvh, 100px);
  margin-bottom: 4px;
}
body.bomb-game-screen .bomb-chain {
  min-height: 44px;
  margin-bottom: 4px;
}
body.bomb-game-screen .bomb-input-container,
body.bomb-game-screen .bomb-turn-indicator { margin-bottom: 4px; }

@media (max-width: 768px) {
  body.active-game-screen {
    --active-header-height: calc(58px + env(safe-area-inset-top, 0px));
  }

  body.active-game-screen .game-page,
  body.active-game-screen .duel-page.duel-game-page {
    width: min(calc(100% - 12px), 760px);
  }

  body.active-game-screen .game-shell,
  body.active-game-screen .duel-playfield {
    --cell-size: min(clamp(40px, 13vw, 58px), clamp(40px, 7.2dvh, 58px));
    padding-inline: 0;
  }

  body.active-game-screen .game-heading p,
  body.active-game-screen .duel-playfield > header p { display: none; }

  body.active-game-screen .game-topline { min-height: 26px; }

  body.active-game-screen .game-shell .keyboard button,
  body.active-game-screen .duel-playfield .keyboard button,
  body.active-game-screen .bomb-playfield .keyboard button,
  body.active-game-screen .bomb-playfield .keyboard .key {
    font-size: clamp(.7rem, 3.4vw, .88rem) !important;
  }
}

@media (max-height: 780px) {
  body.active-game-screen .game-shell,
  body.active-game-screen .duel-playfield {
    --board-gap: 4px;
    --cell-size: min(clamp(38px, 12.5vw, 56px), 7.1dvh);
    gap: 4px;
    padding-block: 3px max(3px, env(safe-area-inset-bottom, 0px));
  }

  body.active-game-screen .game-heading h1,
  body.active-game-screen .duel-playfield > header h1 {
    font-size: clamp(1.4rem, 3vw, 2rem);
  }

  body.active-game-screen .game-heading p,
  body.active-game-screen .duel-playfield > header p { display: none; }

  body.active-game-screen .game-topline { min-height: 23px; }
  body.active-game-screen .message { min-height: 18px; }

  body.active-game-screen .game-shell .keyboard,
  body.active-game-screen .duel-playfield .keyboard,
  body.active-game-screen .bomb-playfield .keyboard { gap: 3px !important; }

  body.active-game-screen .game-shell .keyboard button,
  body.active-game-screen .duel-playfield .keyboard button,
  body.active-game-screen .bomb-playfield .keyboard button,
  body.active-game-screen .bomb-playfield .keyboard .key {
    height: clamp(34px, 5.1dvh, 40px) !important;
  }
}

@media (max-height: 680px) {
  body.active-game-screen .game-shell,
  body.active-game-screen .duel-playfield {
    --board-gap: 3px;
    --cell-size: min(clamp(36px, 12vw, 50px), 7dvh);
    gap: 3px;
  }

  body.active-game-screen .game-heading h1,
  body.active-game-screen .duel-playfield > header h1 { font-size: 1.35rem; }

  body.active-game-screen .game-heading p,
  body.active-game-screen .duel-playfield > header p,
  body.active-game-screen .game-topline .eyebrow { display: none; }

  body.active-game-screen .game-topline { min-height: 20px; }

  body.active-game-screen .game-shell .keyboard button,
  body.active-game-screen .duel-playfield .keyboard button,
  body.active-game-screen .bomb-playfield .keyboard button,
  body.active-game-screen .bomb-playfield .keyboard .key { height: 34px !important; }

  body.bomb-game-screen .bomb-visual-container { height: 48px; }
  body.bomb-game-screen .bomb-chain { min-height: 38px; }
}

@media (max-width: 340px) and (max-height: 600px) {
  body.active-game-screen .game-shell,
  body.active-game-screen .duel-playfield {
    --cell-size: min(11.8vw, 6.9dvh);
  }
}
