/* =========================================
   CUBEX — Modern iOS Style
   ========================================= */

:root {
  --bg-dark: #0a0a1a;
  --bg-card: rgba(255, 255, 255, 0.06);
  --bg-card-2: rgba(255, 255, 255, 0.10);
  --border: rgba(255, 255, 255, 0.10);
  --accent-blue: #4f8ef7;
  --accent-purple: #a855f7;
  --accent-pink: #ec4899;
  --accent-cyan: #06b6d4;
  --accent-green: #22c55e;
  --accent-yellow: #eab308;
  --accent-orange: #f97316;
  --accent-red: #ef4444;
  --text-primary: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.5);
  --shadow-glow: 0 0 20px rgba(79, 142, 247, 0.2);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --will-change: transform;
  --safe-top: env(safe-area-inset-top, 20px);
  --safe-bottom: env(safe-area-inset-bottom, 20px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

html,
body {
  width: 100%;
  height: 100%;
  height: -webkit-fill-available;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #020617;
  background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  color: var(--text-primary);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(125deg, #4f8ef722, #a855f722, #ec489922);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
  z-index: -1;
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ---- Background Particles ---- */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0.15;
  animation: floatUp linear infinite;
  will-change: transform;
}

@keyframes floatUp {
  0% {
    transform: translateY(110vh) scale(0);
    opacity: 0;
  }

  10% {
    opacity: 0.15;
  }

  90% {
    opacity: 0.10;
  }

  100% {
    transform: translateY(-10vh) scale(1.2);
    opacity: 0;
  }
}

/* ---- App Container ---- */
.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  max-width: 430px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 8px) 16px calc(var(--safe-bottom) + 8px);
  overflow: hidden;
  justify-content: center;
}

.app-container > * {
  margin-bottom: 16px;
}

.app-container > *:last-child {
  margin-bottom: 0;
}

/* Responsive tweaks for max-height: 700px merged below (line ~995) */

/* ---- Header ---- */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(calc(100vw - 50px), 376px); /* Align with board container */
  padding: 0 4px;
}

.header-left {
  display: flex;
  align-items: center;
}

.header-left > * {
  margin-right: 10px;
}

.header-left > *:last-child {
  margin-right: 0;
}

.app-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 10px rgba(79, 142, 247, 0.7));
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    filter: drop-shadow(0 0 10px rgba(79, 142, 247, 0.7));
  }

  50% {
    filter: drop-shadow(0 0 20px rgba(168, 85, 247, 0.9));
  }
}

.app-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #4f8ef7, #a855f7, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.header-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---- Download Button with Rotating Light ---- */
.download-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 2px;
  border-radius: 14px;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s ease;
  z-index: 10;
  box-sizing: border-box;
  flex-shrink: 0;
}

.download-btn:hover {
  transform: scale(1.05);
}

.download-btn-border {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    #1e3a8a, /* Koyu Lacivert */
    #4c1d95, /* Koyu Mor */
    #1e1b4b, /* Gece Mavisi */
    #312e81, /* İndigo */
    #1e3a8a
  );
  animation: rotateTransform 3s linear infinite;
  pointer-events: none;
}

@keyframes rotateTransform {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.download-btn-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 34px; /* Border payı ile beraber toplam 38px olması için */
  padding: 0 16px;
  border-radius: 12px;
  background: #0a0a1a;
  color: #ffffff; /* Saf Beyaz */
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
  pointer-events: none;
}

.download-btn::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    rgba(30, 58, 138, 0.3),
    rgba(76, 29, 149, 0.3),
    rgba(30, 27, 75, 0.3),
    rgba(49, 46, 129, 0.3),
    rgba(30, 58, 138, 0.3)
  );
  filter: blur(6px);
  z-index: -1;
  animation: rotateTransform 3s linear infinite;
  pointer-events: none;
}

.download-btn:active .download-btn-content {
  background: rgba(20, 20, 40, 1);
  transform: scale(0.96);
}

.icon-btn {
  width: 38px;
  height: 38px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.icon-btn:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.15);
}

.overlay-btn i {
  margin-right: 8px;
}

/* ---- Score Section ---- */
.score-section {
  width: min(calc(100vw - 50px), 376px); /* Align with board container */
  display: flex;
  align-items: stretch;
}

.score-section > .score-card {
  margin-right: 10px;
}

.score-card {
  flex: 1.4;
  background: linear-gradient(135deg, rgba(79, 142, 247, 0.25), rgba(168, 85, 247, 0.25));
  border: 1px solid rgba(79, 142, 247, 0.35);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 4px 16px rgba(79, 142, 247, 0.15);
  position: relative;
  overflow: hidden;
}

.score-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(79, 142, 247, 0.1) 0%, transparent 70%);
  animation: rotate 8s linear infinite;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.score-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

.score-value {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -2px;
  background: linear-gradient(135deg, #fff, #a0c4ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  transition: transform 0.15s ease;
}

.score-value.bump {
  transform: scale(1.2);
}

.score-combo {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-yellow);
  min-height: 16px;
  text-shadow: 0 0 10px rgba(234, 179, 8, 0.7);
}

.stats-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.stats-grid > .stat-card {
  margin-bottom: 6px;
}

.stats-grid > .stat-card:last-child {
  margin-bottom: 0;
}

.stat-card {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-muted);
}

.stat-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}

/* ---- Board Section ---- */
.board-section {
  width: 100%;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.board-container {
  position: relative;
  padding: 3px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(79, 142, 247, 0.4), rgba(168, 85, 247, 0.4), rgba(236, 72, 153, 0.4));
  display: inline-block;
}

.board-glow {
  position: absolute;
  inset: -8px;
  border-radius: calc(var(--radius-md) + 8px);
  background: linear-gradient(135deg, rgba(79, 142, 247, 0.15), rgba(168, 85, 247, 0.15));
  filter: blur(8px);
  z-index: -1;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 3px;
  background: rgba(10, 10, 26, 0.98);
  border-radius: calc(var(--radius-md) - 3px);
  padding: 6px;
  /* CSS-based sizing — viewport'a göre otomatik */
  width: min(calc(100vw - 56px), 370px);
  height: min(calc(100vw - 56px), 370px);
}

.cell {
  aspect-ratio: 1;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.1s ease;
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
}

.cell.filled {
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.cell.filled::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 4px;
  right: 4px;
  height: 35%;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
}

.cell.highlight {
  background: rgba(255, 255, 255, 0.15) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  transform: scale(1.05);
}

.cell.highlight-valid {
  background: rgba(79, 142, 247, 0.35) !important;
  border-color: rgba(79, 142, 247, 0.6) !important;
  box-shadow: 0 0 10px rgba(79, 142, 247, 0.4) !important;
}

.cell.highlight-invalid {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
}

/* Sadeleştirilmiş ve daha hızlı parlama efekti */
.cell.almost-ready {
  box-shadow: inset 0 0 10px rgba(234, 179, 8, 0.6) !important;
  border: 2px solid rgba(234, 179, 8, 0.8) !important;
  animation: almostPulseSimple 1s ease-in-out infinite alternate;
  z-index: 2;
}

@keyframes almostPulseSimple {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* will-change sadece animasyon anında — GPU bellek optimizasyonu */
.cell.explode,
.cell.highlight-valid,
.cell.highlight-invalid,
.cell.almost-ready {
  will-change: transform, opacity;
}

.cell.explode {
  animation: cellExplode 0.4s ease-out forwards;
}

@keyframes cellExplode {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  30% {
    transform: scale(1.3);
    opacity: 1;
  }

  100% {
    transform: scale(0);
    opacity: 0;
    background: white;
  }
}

.cell.refill {
  animation: cellRefill 0.3s ease-out forwards;
}

@keyframes cellRefill {
  0% {
    transform: scale(0);
    opacity: 0;
  }

  70% {
    transform: scale(1.1);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Row/Col clear flash */
.clear-flash {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  pointer-events: none;
  opacity: 0;
}

.clear-flash.flash {
  animation: flashAnim 0.5s ease-out;
}

@keyframes flashAnim {
  0% {
    opacity: 0;
    background: rgba(255, 255, 255, 0);
  }

  30% {
    opacity: 1;
    background: rgba(255, 255, 255, 0.3);
  }

  100% {
    opacity: 0;
    background: rgba(255, 255, 255, 0);
  }
}

/* ---- Tray Section ---- */
.tray-section {
  width: 100%;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}


.piece-tray {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(20, 20, 40, 0.85); /* Performans için blur yerine mat arka plan */
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  /* Match board container width perfectly */
  width: min(calc(100vw - 50px), 376px);
}

.piece-tray > .piece-slot {
  margin-right: 6px;
}

.piece-tray > .piece-slot:last-child {
  margin-right: 0;
}

.piece-slot {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px; /* Taller slot for easier hit */
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  cursor: grab;
  background: rgba(255, 255, 255, 0.02); /* Subtle hit area hint */
  touch-action: none; /* Critical for mobile drag */
}

.piece-slot:hover {
  background: rgba(255, 255, 255, 0.05);
}

.piece-slot:active {
  cursor: grabbing;
}

.piece-slot.used {
  opacity: 0.25;
}

/* Piece canvas/grid inside slot */
.piece-preview {
  display: grid;
  gap: 2px;
  touch-action: none;
}

.piece-cell {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); /* Gölge hafifletildi */
  position: relative;
  overflow: hidden;
  will-change: transform;
}

.piece-cell::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 3px;
  right: 3px;
  height: 35%;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

/* ---- Ghost piece (floating during drag) ---- */
.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  display: grid;
  gap: 2px;
  opacity: 0.85;
  transform: translate(-50%, -50%);
  /* Centered on the logic point */
  transition: opacity 0.1s;
  will-change: left, top, transform;
}

.drag-ghost .piece-cell {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

/* ---- Action Section ---- */
/* Fallback for browsers without backdrop-filter (e.g., iOS 12) */
@supports not (backdrop-filter: blur(10px)) {

  .icon-btn,
  .overlay,
  .overlay-card,
  .piece-tray,
  .stat-card,
  .score-card,
  .action-btn {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: none !important;
  }
}

.action-section {
  width: 100%;
  display: flex;
  justify-content: center;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.restart-btn {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.restart-btn:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.15);
}

.btn-icon {
  font-size: 18px;
}

/* ---- Overlays ---- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(16px);
  padding: 24px;
}

.overlay.active {
  display: flex;
  animation: overlayIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes overlayIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.overlay-card {
  background: rgba(20, 20, 40, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6), var(--shadow-glow);
}

.overlay-emoji {
  font-size: 52px;
  filter: drop-shadow(0 0 20px rgba(79, 142, 247, 0.6));
  animation: bounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bounceIn {
  from {
    transform: scale(0);
  }

  to {
    transform: scale(1);
  }
}

.overlay-title {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #fff, #a0c4ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.overlay-sub {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
}

.result-grid {
  display: flex;
  gap: 16px;
  width: 100%;
  justify-content: center;
}

.result-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
}

.result-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.result-value {
  font-size: 22px;
  font-weight: 900;
  color: white;
}

.overlay-btn {
  width: 100%;
  padding: 16px;
  border-radius: 100px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.primary-btn {
  background: linear-gradient(135deg, #4f8ef7, #a855f7);
  color: white;
  box-shadow: 0 8px 24px rgba(79, 142, 247, 0.4);
}

.primary-btn:active {
  transform: scale(0.97);
  box-shadow: 0 4px 12px rgba(79, 142, 247, 0.3);
}

.secondary-btn {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.secondary-btn:active {
  transform: scale(0.97);
}

/* ---- Help Card ---- */
.help-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.help-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
}

.step-num {
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f8ef7, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

/* ---- Score Popup ---- */
.score-popup {
  position: fixed;
  z-index: 200;
  font-size: 22px;
  font-weight: 900;
  pointer-events: none;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  opacity: 0;
  display: none;
}

.score-popup.show {
  display: block;
  animation: popupAnim 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes popupAnim {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.5);
  }

  20% {
    opacity: 1;
    transform: translateY(-10px) scale(1.1);
  }

  80% {
    opacity: 1;
    transform: translateY(-50px) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-80px) scale(0.9);
  }
}

/* ---- Color Palette for Pieces ---- */
.color-0 {
  background: linear-gradient(135deg, #4f8ef7, #3b6fd4);
}

.color-1 {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
}

.color-2 {
  background: linear-gradient(135deg, #ec4899, #be185d);
}

.color-3 {
  background: linear-gradient(135deg, #06b6d4, #0284c7);
}

.color-4 {
  background: linear-gradient(135deg, #22c55e, #15803d);
}

.color-5 {
  background: linear-gradient(135deg, #eab308, #ca8a04);
}

.color-6 {
  background: linear-gradient(135deg, #f97316, #c2410c);
}

.color-7 {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}

/* ---- Responsive tweaks for small screens ---- */
@media (max-height: 700px) {
  .app-container {
    gap: 8px;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
  }

  .score-value {
    font-size: 30px;
  }

  .game-board {
    gap: 2px;
    padding: 4px;
  }

  .piece-slot {
    min-height: 80px;
  }

  .piece-cell {
    width: 16px;
    height: 16px;
  }
}

@media (max-height: 600px) {
  .piece-cell {
    width: 14px;
    height: 14px;
  }

  .score-card {
    padding: 8px 12px;
  }
}



/* ---- iOS Install Prompt ---- */
.ios-install-prompt {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%) translateY(150%);
  width: min(calc(100vw - 32px), 360px);
  background: rgba(20, 20, 40, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(79, 142, 247, 0.2);
  z-index: 2000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: none;
}

.ios-install-prompt.show {
  display: block;
  transform: translateX(-50%) translateY(0);
  animation: floatPrompt 3s ease-in-out infinite;
}

@keyframes floatPrompt {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-8px); }
}

.prompt-content {
  padding: 16px;
}

.prompt-header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  position: relative;
}

.prompt-header > .prompt-icon {
  margin-right: 12px;
}

.prompt-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.prompt-text {
  display: flex;
  flex-direction: column;
}

.prompt-title {
  font-size: 16px;
  font-weight: 800;
  color: white;
}

.prompt-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.close-prompt {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.prompt-body {
  display: flex;
  flex-direction: column;
}

.prompt-body > .step {
  margin-bottom: 10px;
}

.prompt-body > .step:last-child {
  margin-bottom: 0;
}

.prompt-body .step {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
}

.prompt-body .step > .step-icon {
  margin-right: 10px;
}

.step-icon {
  font-size: 18px;
  background: rgba(255, 255, 255, 0.08);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.prompt-arrow {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid rgba(20, 20, 40, 0.95);
}

/* ---- Main Menu ---- */
.menu-card {
  text-align: center;
  padding: 40px 24px;
  max-width: 380px;
  width: calc(100% - 40px);
}

.menu-logo {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: -2px;
  background: linear-gradient(to bottom, #fff, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0 auto 40px auto;
  display: block;
  width: fit-content;
  filter: drop-shadow(0 0 20px rgba(79, 142, 247, 0.3));
}

.menu-play-btn {
  width: 100%;
  padding: 18px !important;
  font-size: 18px !important;
  margin-bottom: 60px;
}

.menu-best-text {
  opacity: 0.8;
  font-weight: 400;
  font-size: 14px;
  margin-left: 5px;
}

.menu-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 30px;
  margin-top: 20px;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 25px;
  margin-bottom: 20px;
}

.social-item {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
}

.social-item svg {
  width: 24px;
  height: 24px;
}

.social-item:hover {
  color: white;
  background: rgba(79, 142, 247, 0.2);
  transform: translateY(-8px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.contact-info {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.copyright {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.3);
}

/* ---- Cheat Input ---- */
.cheat-input {
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  text-align: center;
  outline: none;
  transition: border-color 0.3s;
}
.cheat-input:focus {
  border-color: #0ea5e9;
}

/* ---- Leaderboard ---- */

/* Sekme barı: pill kayan göstergesiyle */
.lb-tabs {
  position: relative;
  display: flex;
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 4px;
  margin-top: 5px;
  box-sizing: border-box;
  user-select: none;
}

.lb-tab {
  position: relative;
  z-index: 2;
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-muted, #94a3b8);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.3px;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: color 0.25s ease;
  font-family: inherit;
}

.lb-tab.active {
  color: #fff;
}

.lb-tab-pill {
  position: absolute;
  z-index: 1;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  background: linear-gradient(135deg, #4f8ef7, #a855f7);
  border-radius: 9px;
  box-shadow: 0 4px 14px rgba(79, 142, 247, 0.35);
  transition: transform 0.32s cubic-bezier(0.4, 0.0, 0.2, 1);
  transform: translateX(0);
  pointer-events: none;
}

.lb-tabs[data-active="alltime"] .lb-tab-pill {
  transform: translateX(100%);
}

/* Slide viewport: yatay kaydırılan içerik kabı */
.lb-viewport {
  width: 100%;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 12px;
}

.lb-track {
  display: flex;
  width: 200%;
  transform: translateX(0);
  transition: transform 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
  will-change: transform;
}

.lb-track.show-alltime {
  transform: translateX(-50%);
}

.lb-panel {
  flex: 0 0 50%;
  width: 50%;
  box-sizing: border-box;
}

.leaderboard-list {
  width: 100%;
  max-height: 250px;
  overflow-y: auto;
  background: rgba(0,0,0,0.2);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
}

.leaderboard-list::-webkit-scrollbar {
  width: 6px;
}
.leaderboard-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
}

.lb-item {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.05);
  padding: 8px 12px;
  border-radius: 8px;
  gap: 10px;
}

.lb-item.top-1 { background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(202, 138, 4, 0.2)); border: 1px solid rgba(234, 179, 8, 0.3); }
.lb-item.top-2 { background: linear-gradient(135deg, rgba(148, 163, 184, 0.2), rgba(100, 116, 139, 0.2)); border: 1px solid rgba(148, 163, 184, 0.3); }
.lb-item.top-3 { background: linear-gradient(135deg, rgba(180, 83, 9, 0.2), rgba(120, 53, 15, 0.2)); border: 1px solid rgba(180, 83, 9, 0.3); }

.lb-rank {
  font-weight: 900;
  color: var(--text-muted);
  width: 24px;
  text-align: center;
}

.top-1 .lb-rank { color: #fde047; text-shadow: 0 0 8px rgba(253, 224, 71, 0.5); }
.top-2 .lb-rank { color: #e2e8f0; text-shadow: 0 0 8px rgba(226, 232, 240, 0.5); }
.top-3 .lb-rank { color: #fcd34d; text-shadow: 0 0 8px rgba(252, 211, 77, 0.5); }

.lb-name {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: white;
}

.lb-score {
  font-weight: 800;
  color: var(--accent-blue);
}

.leaderboard-loading {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 20px;
}

/* ==========================================================================
   Real-Time Score Progress Bar & Sticky Self Rank Styles
   ========================================================================== */

.score-progress-container {
  margin: 12px auto 0 auto;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 10px 14px;
  box-sizing: border-box;
  width: min(calc(100vw - 50px), 376px); /* Align with score section and board */
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
}

.progress-label {
  color: var(--text-muted, #94a3b8);
  letter-spacing: 0.5px;
}

.progress-value {
  color: var(--accent-blue, #4f8ef7);
  font-weight: 700;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f8ef7, #a855f7);
  border-radius: 10px;
  width: 0%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(79, 142, 247, 0.5);
}

/* Sticky self rank in leaderboard */
.sticky-self-rank {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-top: 12px;
  box-sizing: border-box;
}

.divider-line {
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0) 100%);
  width: 100%;
  margin-bottom: 10px;
}

.self-rank-content {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(79, 142, 247, 0.12);
  border: 1px solid rgba(79, 142, 247, 0.3);
  padding: 10px 14px;
  border-radius: 10px;
  box-sizing: border-box;
}

.self-rank-num {
  font-weight: 900;
  font-size: 15px;
  color: #fbbf24;
  text-shadow: 0 0 6px rgba(251, 191, 36, 0.4);
}

.self-rank-name {
  flex: 1;
  font-weight: 700;
  color: white;
  text-align: left;
  font-size: 13px;
}

.self-rank-score {
  font-weight: 800;
  color: var(--accent-blue, #4f8ef7);
  font-size: 14px;
}

/* Leaderboard Highlight for User */
.lb-item.is-self {
  background: rgba(79, 142, 247, 0.08);
  border: 1.5px solid rgba(79, 142, 247, 0.25) !important;
  box-shadow: 0 0 10px rgba(79, 142, 247, 0.1) inset;
}

.lb-item.is-self .lb-name {
  color: #fbbf24 !important;
  font-weight: 700;
}

/* ---- Maintenance Overlay ---- */
#maintenanceOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.99));
  z-index: 10000; /* Over everything */
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: opacity 0.4s ease;
  opacity: 0;
}

#maintenanceOverlay.active {
  display: flex;
  opacity: 1;
}

.maintenance-card {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid rgba(245, 158, 11, 0.3);
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.1);
  padding: 30px;
  border-radius: 20px;
  text-align: center;
  max-width: 380px;
  width: min(calc(100vw - 40px), 380px);
  box-sizing: border-box;
  animation: floatCard 4s ease-in-out infinite;
}

.maintenance-icon {
  font-size: 54px;
  color: #f59e0b;
  margin-bottom: 20px;
  text-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

.maintenance-icon i {
  display: inline-block;
  animation: smoothToolsSpin 4s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
}

@keyframes smoothToolsSpin {
  0% {
    transform: rotate(0deg);
  }
  20% {
    transform: rotate(360deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.maintenance-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fff, #fde047);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.maintenance-text {
  font-size: 14px;
  line-height: 1.6;
  color: #cbd5e1;
  margin-bottom: 20px;
}

.maintenance-badge {
  display: inline-block;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #fde047;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

@keyframes floatCard {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* Ensure Developer and Founder overlays appear on top of Maintenance overlay */
#cheatOverlay, #adminOverlay {
  z-index: 20000 !important;
}

/* ---- Narrow Mobile Header Optimizations ---- */
@media (max-width: 375px) {
  .app-title {
    font-size: 18px !important;
  }
  .download-btn {
    height: 34px !important;
  }
  .download-btn-content {
    padding: 0 10px !important;
    font-size: 12px !important;
    height: 30px !important;
  }
  .header-left > * {
    margin-right: 6px !important;
  }
  .header-right {
    gap: 6px !important;
  }
  .icon-btn {
    width: 34px !important;
    height: 34px !important;
    font-size: 13px !important;
  }
}