/* Cricket Legends v3 — modern game chrome layer. */

.ck-game {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

.ck-top {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.ck-stats {
  flex: 1 1 auto;
  gap: 6px;
}

.ck-stats .stat {
  background: linear-gradient(135deg, #101a10 0%, #1a2a1a 100%);
  border: 1px solid #2a4a2a;
  border-radius: 8px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ck-stats .stat b {
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
  color: #eaffd0;
  line-height: 1.1;
}

.ck-stats .stat span {
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #7a9a6a;
}

.ck-top .btn {
  flex: 0 0 auto;
  min-width: 44px;
  padding: 0 10px;
  font-size: 14px;
  display: grid;
  place-items: center;
}

.ck-sound-top {
  font-size: 16px;
  line-height: 1;
}

.ck-sound-top[aria-pressed="true"] {
  opacity: 0.5;
  filter: grayscale(1);
}

.ck-pause[aria-pressed="true"] {
  background: #2a4a2a;
  color: #fff;
}

.ck-screen {
  position: relative;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8), 0 8px 24px rgba(0, 0, 0, 0.3);
  aspect-ratio: 3 / 2;
  width: 100%;
}

.ck-screen canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
  image-rendering: auto;
}

/* ---- Mobile D-pad ---- */
.ck-pad {
  display: none;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.ck-game[data-pad="on"] .ck-pad {
  display: flex;
}

.ck-dpad {
  position: relative;
  width: 140px;
  height: 140px;
  flex: 0 0 auto;
}

.ck-dpad-up,
.ck-dpad-mid {
  display: flex;
  justify-content: center;
}

.ck-dpad-up { margin-bottom: 3px; }

.ck-dpad .btn {
  width: 44px;
  height: 44px;
  min-width: 0;
  padding: 0;
  font-size: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #1e3a1e 0%, #0f1f0f 100%);
  border: 2px solid #3a5a3a;
  color: #b8e090;
  border-radius: 8px;
}

.ck-dpad .btn:active {
  background: #3a5a3a;
  transform: translateY(1px);
}

.ck-pad .btn.primary {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #4aff4a 0%, #1a8a1a 60%, #0a5a0a 100%);
  border: 4px solid #0a2a0a;
  color: #fff;
  font-size: 22px;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 800;
  letter-spacing: 2px;
  box-shadow: 0 6px 0 #0a2a0a, 0 8px 20px rgba(74, 255, 74, 0.4);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  flex: 0 0 auto;
}

.ck-pad .btn.primary:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #0a2a0a, 0 4px 12px rgba(74, 255, 74, 0.3);
}

/* Fullscreen overrides — fill viewport, keep all UI visible (snake-game pattern).
   Stats, canvas and controls all stay on screen; no hidden overlays. */
.ck-game:fullscreen,
.ck-game.is-fill {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: auto;
}

.ck-game.is-fill {
  position: fixed;
  inset: 0;
  z-index: 2000;
  height: 100dvh;
  box-sizing: border-box;
}

/* Cap canvas width so the whole UI (top bar + canvas + pad) fits the viewport height */
.ck-game:fullscreen .ck-screen,
.ck-game.is-fill .ck-screen {
  max-width: min(100%, calc((100dvh - 260px) * 3 / 2));
  margin-inline: auto;
}

@media (max-width: 520px) {
  .ck-game { padding: 8px; }
  .ck-stats .stat { padding: 4px 8px; }
  .ck-stats .stat b { font-size: 15px; }
  .ck-stats .stat span { font-size: 8px; }
  .ck-sound-top { font-size: 0; padding: 0 8px; }
  .ck-sound-top::before { content: "🔊"; font-size: 14px; }
  .ck-dpad { width: 116px; height: 116px; }
  .ck-dpad .btn { width: 36px; height: 36px; font-size: 13px; }
  .ck-pad .btn.primary { width: 100px; height: 100px; font-size: 18px; }
}

/* Hidden attribute */
.ck-game [hidden] { display: none !important; }

