/* ============================================
   Buz Kulesi — Icy Tower tarzı dikey platform zıplama
   Native portrait: 400 × 640 canvas
   ============================================ */

.bk-wrap {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  background: #001a40;
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 0 0 4px #0288D1,
    0 0 0 6px #003a6e,
    0 20px 40px rgba(0, 30, 80, 0.5);
  user-select: none;
  touch-action: manipulation;
  display: flex;
  flex-direction: column;
}

.bk-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 400 / 640;
  overflow: hidden;
}

.bk-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: linear-gradient(180deg, #001a40 0%, #0a3a78 100%);
}

/* ---- HUD ---- */
.bk-hud {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-family: 'Comic Sans MS', 'Baloo', system-ui, sans-serif;
  pointer-events: none;
  z-index: 4;
}

.bk-hud-box {
  background: rgba(0, 26, 64, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 2px solid #4FC3F7;
  border-radius: 10px;
  padding: 4px 10px;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(0, 30, 80, 0.5);
  text-shadow: 1px 1px 0 rgba(0, 30, 80, 0.6);
}

.bk-hud-label {
  font-size: 10px;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #a9e8ff;
}

.bk-hud-value {
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.bk-hud-combo {
  background: rgba(20, 70, 130, 0.85);
  border-color: #FFD54F;
  color: #FFD54F;
  text-shadow: 0 0 6px rgba(255, 213, 79, 0.6);
  font-size: 16px;
  transition: transform 0.18s ease;
}
.bk-hud-combo.pulse {
  transform: scale(1.25);
}

/* ---- Big combo flash on land ---- */
.bk-combo-flash {
  position: absolute;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  font-family: 'Comic Sans MS', 'Fredoka', system-ui, sans-serif;
  font-size: 44px;
  font-weight: 900;
  color: #FFD54F;
  text-shadow:
    0 0 14px rgba(255, 213, 79, 0.9),
    2px 2px 0 #0288D1;
  pointer-events: none;
  opacity: 0;
  z-index: 3;
}
.bk-combo-flash.show {
  animation: bkComboPop 0.65s ease-out forwards;
}
@keyframes bkComboPop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-8deg); }
  35%  { opacity: 1; transform: translate(-50%, -50%) scale(1.25) rotate(3deg); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(1.1) rotate(0deg); }
}

/* ---- Mobile controls (alt bar) ---- */
.bk-controls {
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #002650 0%, #001530 100%);
  border-top: 2px solid #0288D1;
}

.bk-ctrl-side {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bk-btn {
  pointer-events: auto;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(0, 26, 64, 0.85);
  border: 2.5px solid #4FC3F7;
  color: #d6f0ff;
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0, 30, 80, 0.5), inset 0 0 12px rgba(79, 195, 247, 0.2);
  text-shadow: 0 0 6px rgba(79, 195, 247, 0.6);
  transition: transform 0.08s;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
}
.bk-btn:active {
  background: rgba(79, 195, 247, 0.35);
  transform: scale(0.92);
}

.bk-btn-jump {
  width: 72px;
  height: 72px;
  border-color: #FFD54F;
  color: #FFD54F;
  text-shadow: 0 0 8px rgba(255, 213, 79, 0.7);
  box-shadow: 0 4px 14px rgba(255, 213, 79, 0.45), inset 0 0 12px rgba(255, 213, 79, 0.2);
  font-size: 26px;
}
.bk-btn-jump:active { background: rgba(255, 213, 79, 0.35); }

@media (pointer: coarse), (hover: none), (max-width: 820px) {
  .bk-controls { display: flex; }
}

@media (max-width: 380px) {
  .bk-btn { width: 52px; height: 52px; font-size: 19px; }
  .bk-btn-jump { width: 64px; height: 64px; font-size: 22px; }
  .bk-controls { padding: 8px 10px; gap: 8px; }
  .bk-ctrl-side { gap: 8px; }
}

/* Mobil portrait: wrap dikey ekrana otursun (rotate yok, dikey native!) */
@media (orientation: portrait) and (max-width: 820px) {
  .bk-wrap {
    max-width: min(100vw, calc((100vh - 56px - 100px) * 400 / 640));
  }
}

/* Geniş ekran: yan yana hizalama */
@media (min-width: 900px) {
  .bk-wrap {
    max-height: calc(100vh - 100px);
    max-width: min(400px, calc((100vh - 100px) * 400 / 640));
  }
}

/* ---- Game Over Modal ---- */
.bk-modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 10, 30, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: bkFadeIn 0.3s ease;
}
@keyframes bkFadeIn { from { opacity: 0; } to { opacity: 1; } }

.bk-modal-card {
  background: linear-gradient(160deg, #003a78 0%, #0d2a55 100%);
  border: 3px solid #4FC3F7;
  border-radius: 18px;
  padding: 22px 26px;
  max-width: 88%;
  min-width: 280px;
  color: #fff;
  font-family: 'Comic Sans MS', system-ui, sans-serif;
  box-shadow: 0 25px 80px rgba(0, 30, 80, 0.6);
  text-align: center;
}

.bk-modal-title {
  font-size: 26px;
  font-weight: 900;
  margin-bottom: 10px;
  color: #4FC3F7;
  text-shadow: 0 4px 14px rgba(79, 195, 247, 0.6);
}
.bk-modal-sub {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.82);
  margin-bottom: 14px;
}
.bk-modal-stats {
  background: rgba(0, 0, 0, 0.3);
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 15px;
  display: grid;
  gap: 6px;
}
.bk-stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.bk-stat-row b {
  color: #FFD54F;
  font-size: 17px;
  text-shadow: 0 0 6px rgba(255, 213, 79, 0.6);
  font-variant-numeric: tabular-nums;
}
.bk-stat-row.record b { color: #a9e8ff; }

.bk-modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bk-mbtn {
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: transform 0.12s;
}
.bk-mbtn:hover { transform: translateY(-2px); }
.bk-mbtn:active { transform: translateY(0); }
.bk-mbtn-primary {
  background: linear-gradient(135deg, #4FC3F7, #0288D1);
  color: #001a40;
  box-shadow: 0 5px 18px rgba(2, 136, 209, 0.5);
}
.bk-mbtn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
}

/* ---- New record rozeti ---- */
.bk-new-record {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  background: linear-gradient(135deg, #FFD54F, #FF9800);
  color: #2a1010;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
  animation: bkRecordBlink 1.2s ease infinite;
}
@keyframes bkRecordBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.95); }
}
