/* ═══════════════════════════════════════════════════════════════
   Hex 2048 — cursor-pointer.com
   Neon cyber-puzzle estetik. Tüm CSS izole, dark theme.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg-deep:    #0a0a18;
  --bg-mid:     #0f0f1e;
  --bg-light:   #1a1a2e;
  --pink:       #FF006E;
  --orange:     #FF6B35;
  --yellow:     #FFD23F;
  --green:      #06D6A0;
  --cyan:       #00B4D8;
  --blue:       #3A86FF;
  --purple:     #8338EC;
  --white-soft: #f8fafc;
  --text-dim:   rgba(248, 250, 252, .68);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; padding: 0; }
html, body { margin: 0; min-height: 100%; overscroll-behavior: none; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(circle at 20% 0%,  rgba(255,0,110,.16)   0%, transparent 40%),
    radial-gradient(circle at 80% 30%, rgba(58,134,255,.14)  0%, transparent 45%),
    radial-gradient(circle at 50% 100%,rgba(131,56,236,.18)  0%, transparent 55%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-mid) 50%, var(--bg-light) 100%);
  color: var(--white-soft);
  min-height: 100vh; min-height: 100svh; min-height: 100dvh;
  overflow: hidden;
  display: flex; justify-content: center; align-items: center;
}

/* ═══ Ana çerçeve ══════════════════════════════════════════ */
.h2-shell {
  width: min(100vw, 520px);
  height: 100vh; height: 100svh; height: 100dvh;
  display: flex; flex-direction: column;
  padding: 64px 12px calc(10px + env(safe-area-inset-bottom));  /* 64px üst = FAB clearance */
  gap: 8px;
  position: relative;
}
@media (max-width: 480px) { .h2-shell { padding-top: 58px; } }

/* ═══ Status bar (Bölüm | Puan | Coin | Zaman) ═════════════ */
.h2-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  flex: 0 0 auto;
}
.h2-stat {
  background: rgba(15,15,30,.85);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  padding: 7px 6px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.h2-stat::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--accent, var(--cyan)), transparent 50%);
  opacity: .12; pointer-events: none;
}
.h2-stat-label {
  font-size: 9px; font-weight: 800; letter-spacing: 1.2px;
  color: var(--text-dim); text-transform: uppercase;
  margin-bottom: 2px;
}
.h2-stat-value {
  font-size: 16px; font-weight: 900; line-height: 1.1;
  color: #fff;
}
.h2-stat.h2-coin   { --accent: var(--yellow); }
.h2-stat.h2-coin   .h2-stat-value { color: var(--yellow); text-shadow: 0 0 10px rgba(255,210,63,.45); }
.h2-stat.h2-score  { --accent: var(--cyan); }
.h2-stat.h2-time   { --accent: var(--pink); }
.h2-stat.h2-time .h2-stat-value.h2-warn   { color: var(--yellow); }
.h2-stat.h2-time .h2-stat-value.h2-danger { color: var(--pink); animation: h2Pulse .55s ease-in-out infinite; }

/* ═══ Goal banner ══════════════════════════════════════════ */
.h2-goal {
  flex: 0 0 auto;
  background: linear-gradient(90deg, rgba(255,0,110,.10), rgba(58,134,255,.10));
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 12.5px;
  text-align: center;
  color: rgba(255,255,255,.92);
  font-weight: 600;
  letter-spacing: .2px;
}
.h2-goal b { color: var(--yellow); }
.h2-goal-progress {
  font-size: 10.5px; color: var(--text-dim);
  margin-top: 2px; font-weight: 500;
}

/* ═══ Board (canvas) ═══════════════════════════════════════ */
.h2-board {
  flex: 1 1 auto;
  min-height: 0;
  background: linear-gradient(145deg, rgba(15,15,30,.95), rgba(20,20,45,.92));
  border: 1px solid rgba(0,180,216,.22);
  border-radius: 20px;
  box-shadow:
    0 14px 34px rgba(0,0,0,.45),
    0 0 30px rgba(0,180,216,.12),
    inset 0 0 32px rgba(58,134,255,.08);
  overflow: hidden;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  touch-action: none;
}
canvas#h2Canvas { width: 100%; height: 100%; display: block; }

/* Combo flash text on board */
.h2-combo-flash {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%) translateY(-12px);
  background: linear-gradient(135deg, var(--orange), var(--pink));
  color: #fff;
  padding: 6px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 900;
  letter-spacing: .5px;
  box-shadow: 0 0 20px rgba(255,107,53,.55);
  pointer-events: none; opacity: 0;
  transition: opacity .25s, transform .35s;
  z-index: 4;
}
.h2-combo-flash.show {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* ═══ Direction buttons (alt 6 yön) ════════════════════════ */
.h2-dirs {
  flex: 0 0 auto;
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px;
  margin-top: 2px;
}
.h2-dir-row { display: flex; gap: 6px; }
.h2-dir {
  flex: 1;
  border: 1px solid rgba(0,180,216,.28);
  background: linear-gradient(135deg, rgba(15,15,30,.9), rgba(25,25,55,.85));
  color: #fff;
  border-radius: 14px;
  padding: 8px 4px;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  min-height: 38px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25), inset 0 0 8px rgba(58,134,255,.08);
  transition: transform .08s, box-shadow .15s;
  user-select: none;
}
.h2-dir:active {
  transform: scale(.93);
  box-shadow: 0 0 18px rgba(0,180,216,.45);
}

/* ═══ Action buttons (alt) ═════════════════════════════════ */
.h2-actions {
  flex: 0 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
}
.h2-act {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(15,15,30,.85);
  color: #fff;
  border-radius: 12px;
  padding: 9px 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  transition: transform .08s, background .15s;
  user-select: none;
}
.h2-act-emoji { font-size: 16px; line-height: 1; }
.h2-act:active { transform: scale(.94); background: rgba(58,134,255,.18); }
.h2-act.h2-disabled { opacity: .4; pointer-events: none; }
.h2-act-cost {
  font-size: 9px; color: var(--yellow); font-weight: 800; letter-spacing: .3px;
}

/* ═══ Overlays (modal'lar) ═════════════════════════════════ */
.h2-overlay {
  position: absolute; inset: 0; z-index: 50;
  display: none; align-items: center; justify-content: center;
  background: rgba(5,8,18,.78);
  backdrop-filter: blur(10px);
  padding: 16px;
}
.h2-overlay.show { display: flex; }

.h2-modal {
  width: min(94%, 380px);
  max-height: 92%;
  overflow: auto;
  background: linear-gradient(160deg, rgba(20,20,40,.98), rgba(10,10,25,.96));
  border: 1px solid rgba(0,180,216,.32);
  border-radius: 22px;
  padding: 22px 20px;
  box-shadow:
    0 24px 60px rgba(0,0,0,.55),
    0 0 36px rgba(0,180,216,.18),
    inset 0 0 24px rgba(58,134,255,.06);
  text-align: center;
}
.h2-modal h1 {
  font-size: 28px; margin-bottom: 6px; font-weight: 900;
  background: linear-gradient(90deg, var(--cyan), var(--pink), var(--yellow));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.h2-modal h2 {
  font-size: 22px; margin-bottom: 6px; color: #fff;
}
.h2-modal p { color: var(--text-dim); margin-bottom: 12px; line-height: 1.5; font-size: 14px; }

.h2-btn {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px; font-weight: 900;
  border: 0; border-radius: 14px;
  background: linear-gradient(135deg, var(--cyan), var(--blue), var(--purple));
  color: #fff; cursor: pointer;
  margin-top: 10px;
  box-shadow: 0 6px 18px rgba(58,134,255,.30);
  transition: transform .08s, filter .15s;
}
.h2-btn:active { transform: scale(.97); filter: brightness(1.15); }
.h2-btn.h2-btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: none;
}
.h2-btn.h2-btn-warm {
  background: linear-gradient(135deg, var(--pink), var(--orange), var(--yellow));
  box-shadow: 0 6px 18px rgba(255,107,53,.30);
}
.h2-btn.h2-btn-danger {
  background: rgba(35,8,28,.82);
  border: 1px solid rgba(255,0,110,.32);
  color: #ffd6f7;
  box-shadow: none;
}

/* ═══ Mode switcher (Macera / Sonsuz) ══════════════════════ */
.h2-mode-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  margin: 12px 0;
}
.h2-mode {
  padding: 14px 8px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(15,15,30,.7);
  border-radius: 14px;
  cursor: pointer;
  font-size: 13px; font-weight: 800; color: #fff;
  transition: all .18s;
}
.h2-mode-emoji { font-size: 24px; display: block; margin-bottom: 4px; }
.h2-mode-sub { font-size: 10.5px; font-weight: 500; color: var(--text-dim); margin-top: 3px; display: block; }
.h2-mode.h2-active {
  border-color: var(--cyan);
  background: linear-gradient(135deg, rgba(0,180,216,.18), rgba(58,134,255,.10));
  box-shadow: 0 0 18px rgba(0,180,216,.22);
}

/* ═══ Level grid (bölüm seç) ═══════════════════════════════ */
.h2-level-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
  margin: 12px 0;
}
.h2-level-btn {
  aspect-ratio: 1/1;
  background: rgba(15,15,30,.85);
  border: 1px solid rgba(0,180,216,.20);
  border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 900; color: #fff;
  cursor: pointer;
  position: relative;
  transition: transform .08s, border-color .15s;
}
.h2-level-btn:active { transform: scale(.94); }
.h2-level-btn.h2-locked {
  opacity: .35; pointer-events: none; border-color: rgba(255,255,255,.06);
  background: rgba(15,15,30,.55);
}
.h2-level-btn.h2-current {
  border-color: var(--pink); border-width: 2px;
  box-shadow: 0 0 14px rgba(255,0,110,.30);
}
.h2-level-btn.h2-completed {
  border-color: var(--green);
  background: rgba(6,214,160,.10);
}
.h2-level-stars {
  font-size: 8px; color: var(--yellow); margin-top: 2px; letter-spacing: 1px;
}
.h2-lock-icon {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 20px; opacity: .55;
}

/* Reward / progress boxes */
.h2-info-box {
  background: linear-gradient(135deg, rgba(0,180,216,.10), rgba(58,134,255,.06));
  border: 1px solid rgba(0,180,216,.22);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 8px 0;
  font-weight: 800;
  color: #dffcff;
  font-size: 14px;
}
.h2-info-box.h2-warm {
  background: linear-gradient(135deg, rgba(255,210,63,.12), rgba(255,107,53,.08));
  border-color: rgba(255,210,63,.34);
  color: var(--yellow);
}

/* Settings list */
.h2-settings-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.h2-settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 14px;
  border: 1px solid rgba(0,180,216,.20);
  background: rgba(0,180,216,.05);
  text-align: left; gap: 10px;
}
.h2-settings-row strong { display: block; font-size: 14px; color: #fff; }
.h2-settings-row span  { display: block; font-size: 11px; color: var(--text-dim); margin-top: 2px; line-height: 1.3; }
.h2-toggle {
  min-width: 70px; padding: 8px 10px;
  border-radius: 999px; border: 0; cursor: pointer;
  font-size: 12px; font-weight: 800;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #fff;
}
.h2-toggle.h2-off {
  background: rgba(15,15,30,.85);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--text-dim);
}

/* ═══ Animasyonlar ═════════════════════════════════════════ */
@keyframes h2Pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.045); }
}
@keyframes h2BoardGlow {
  0%, 100% { box-shadow: 0 14px 34px rgba(0,0,0,.45), 0 0 28px rgba(0,180,216,.12), inset 0 0 30px rgba(58,134,255,.06); }
  50%      { box-shadow: 0 14px 34px rgba(0,0,0,.45), 0 0 44px rgba(0,180,216,.30), inset 0 0 38px rgba(58,134,255,.16); }
}
.h2-board { animation: h2BoardGlow 3s ease-in-out infinite; }

/* Kompakt landscape / küçük ekran */
@media (max-height: 700px) {
  .h2-shell { padding-top: 56px; gap: 6px; }
  .h2-stat-value { font-size: 14px; }
  .h2-stat-label { font-size: 8px; }
  .h2-goal { padding: 6px 10px; font-size: 11.5px; }
  .h2-dir { min-height: 34px; padding: 6px 4px; font-size: 14px; }
  .h2-act { padding: 7px 4px; font-size: 10.5px; }
  .h2-act-emoji { font-size: 14px; }
  .h2-modal { padding: 16px 14px; }
  .h2-modal h1 { font-size: 22px; }
}
@media (max-height: 600px) {
  .h2-goal { display: none; }
  .h2-shell { gap: 4px; padding-top: 52px; }
}
