/* =========================================================
   Tasarım tokenları — diğer modüllerin CSS'i de bunları kullanır
   (--glass, --stroke, --muted, --accent, --radius, --pixel, --font adları sabit kalmalı)
   ========================================================= */
:root {
  /* Renk */
  --glass: rgba(16, 20, 30, 0.46);
  --glass-strong: rgba(14, 18, 28, 0.78);
  --stroke: rgba(255, 255, 255, 0.14);
  --stroke-hi: rgba(255, 255, 255, 0.26);
  --text: #f3f5f8;
  --muted: rgba(243, 245, 248, 0.64);
  --accent: #ffd166;
  --accent-2: #f4a24c;
  --accent-soft: rgba(255, 209, 102, 0.16);
  --green: #6ee06e;
  --red: #eb5757;
  --blue: #5ab0ff;
  /* Biçim */
  --radius: 14px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 18px;
  --r-pill: 999px;
  --blur: blur(14px) saturate(150%);
  --shadow-1: 0 2px 8px rgba(0, 0, 0, 0.28);
  --shadow-2: 0 10px 34px rgba(0, 0, 0, 0.34);
  --inset-hi: inset 0 1px 0 rgba(255, 255, 255, 0.09);
  --glow-accent: 0 0 0 1px rgba(255, 209, 102, 0.55), 0 6px 22px rgba(255, 209, 102, 0.28);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  /* Yazı: başlıklar piksel, gövde okunur */
  --font: 'Outfit', system-ui, sans-serif;
  --pixel: 'Pixelify Sans', 'Outfit', monospace;
  --display: 'Press Start 2P', 'Pixelify Sans', monospace;
}
/* Gece: cam koyulaşır, kenarlar soğuk mavi — karanlık zeminde metin kontrastı korunur */
body.night {
  --glass: rgba(10, 13, 24, 0.62);
  --glass-strong: rgba(9, 12, 22, 0.86);
  --stroke: rgba(150, 170, 255, 0.2);
  --muted: rgba(226, 232, 255, 0.72);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0d1210; color: var(--text); font-family: var(--font); user-select: none; -webkit-font-smoothing: antialiased; }
#game, #game canvas { position: fixed; inset: 0; image-rendering: pixelated; }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#ui button, #ui .slot, .modal, #menu, #gameover { pointer-events: auto; }

.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow-2), var(--inset-hi);
  transition: background 0.6s, border-color 0.6s;
}
.muted { color: var(--muted); }
.center { text-align: center; padding: 16px; }

/* Oyun başlamadan (menüde) HUD gizli: menü arka planı temiz kalsın */
body:not(.playing) #hud-top, body:not(.playing) #hotbar, body:not(.playing) #keys, body:not(.playing) #quest-tracker { visibility: hidden; }

/* ---------- Üst bar ---------- */
#hud-top {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; padding: 8px 18px;
  font-size: 14px; white-space: nowrap; max-width: calc(100vw - 24px);
}
#hud-top .block { display: flex; align-items: center; gap: 8px; }
#hud-top .sep { width: 1px; height: 26px; background: linear-gradient(transparent, var(--stroke), transparent); }
#hud-top .big { font-family: var(--pixel); font-size: 20px; line-height: 1; letter-spacing: 0.5px; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
#hud-top .sub { font-size: 11px; color: var(--muted); }
#hud-top .phase { font-size: 22px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4)); }
#hud-top .num { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 22px; }
#hud-top .lbl { display: inline-block; opacity: 0.95; }
#hud-coins { color: var(--accent); display: inline-block; }
#hud-coins.bump { animation: bump 0.35s var(--ease); }
@keyframes bump { 40% { transform: scale(1.25); } }

/* Barlar: gradyan dolgu + düşüşte gecikmeli "hasar izi" (.trail, HUD.setBar yönetir) */
.bar {
  position: relative; width: 86px; height: 9px; border-radius: var(--r-pill); overflow: hidden;
  background: rgba(0, 0, 0, 0.38); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.07);
}
.bar i, .bar .trail { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; border-radius: inherit; }
.bar i { display: block; transition: width 0.18s ease-out; }
.bar i::after { content: ''; position: absolute; inset: 0 0 55% 0; border-radius: inherit; background: rgba(255, 255, 255, 0.28); }
.bar .trail { background: rgba(255, 236, 214, 0.85); transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.45s; }
.bar.hp i { background: linear-gradient(90deg, #c8323c, #ff5f5f 55%, #ff9a8a); }
.bar.en i { background: linear-gradient(90deg, #e6a21c, #ffd166 60%, #fff0b8); }
.bar.shelter i { background: linear-gradient(90deg, #2f7fd6, #5ab0ff 60%, #a8d6ff); }
.bar.hit { animation: barHit 0.4s ease; }
@keyframes barHit { 0% { box-shadow: 0 0 0 2px rgba(255, 90, 90, 0.9), 0 0 14px rgba(255, 60, 60, 0.7); } }
.bar.low i { animation: lowPulse 0.9s ease-in-out infinite; }
@keyframes lowPulse { 50% { filter: brightness(1.6) saturate(1.3); } }
.b-hp:has(.bar.low) .lbl { animation: heart 0.9s ease-in-out infinite; }
@keyframes heart { 50% { transform: scale(1.3); } }
body.night #hud-top { box-shadow: var(--shadow-2), var(--inset-hi), 0 0 24px rgba(90, 110, 255, 0.12); }

/* ---------- Görev takipçisi ---------- */
#quest-tracker { position: absolute; top: 80px; left: 14px; width: 230px; padding: 12px 14px; display: none; font-size: 13px; }
#quest-tracker.show { display: block; }
#quest-tracker h4 { font-family: var(--pixel); font-size: 13px; letter-spacing: 1px; color: var(--accent); margin-bottom: 6px; }
#quest-tracker .q { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 6px 0; border-top: 1px solid rgba(255, 255, 255, 0.06); }
#quest-tracker .q span { grid-column: 1; font-size: 12px; color: var(--muted); }
#quest-tracker .q i { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; }
#quest-tracker .q.ready i { color: var(--green); }

/* ---------- Bildirimler ---------- */
#toasts { position: absolute; top: 80px; right: 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 8px;
  background: var(--glass-strong); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--stroke); border-left: 3px solid var(--blue); box-shadow: var(--shadow-1);
  padding: 9px 14px; border-radius: var(--r-md); font-size: 13px; line-height: 1.4; max-width: 320px;
  animation: toastIn 0.3s var(--ease); transition: opacity 0.35s, transform 0.35s;
}
.toast > span:first-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.toast.ok { border-left-color: var(--green); }
.toast.warn { border-left-color: var(--accent); background: rgba(40, 30, 10, 0.84); }
.toast.out { opacity: 0; transform: translateX(20px); }
.toast .n { flex-shrink: 0; min-width: 22px; padding: 0 6px; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.16); font-size: 11px; font-weight: 700; text-align: center; }
.toast.again { animation: toastAgain 0.3s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px) scale(0.96); } }
@keyframes toastAgain { 40% { transform: scale(1.05); } }

#banner { position: absolute; top: 28%; left: 0; right: 0; text-align: center; opacity: 0; pointer-events: none; padding: 0 16px; z-index: 15; }
#banner h2 {
  font-family: var(--display); font-size: 34px; font-weight: 400; line-height: 1.35; letter-spacing: 1px; color: #fff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.55), 0 0 28px rgba(255, 209, 102, 0.35), 0 6px 30px rgba(0, 0, 0, 0.7);
}
#banner p {
  display: inline-block; font-size: 16px; font-weight: 500; color: rgba(255, 255, 255, 0.94); margin-top: 10px; max-width: 640px;
  padding: 6px 16px; border-radius: var(--r-lg); background: rgba(8, 10, 18, 0.6); border: 1px solid var(--stroke);
}
#banner p:empty { display: none; }
#banner.show { animation: banner var(--banner-ms, 3200ms) ease forwards; }
#banner.show h2 { animation: bannerTitle 0.55s var(--ease); }
@keyframes banner { 0% { opacity: 0; transform: translateY(12px) scale(0.94); } 10%, 78% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-8px); } }
@keyframes bannerTitle { from { letter-spacing: 10px; filter: blur(4px); } }
body.night #banner h2 { text-shadow: 0 3px 0 rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 80, 80, 0.45), 0 6px 30px rgba(0, 0, 0, 0.8); }

/* ---------- Hotbar / slotlar ---------- */
#hotbar { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; padding: 7px; }
.slot {
  position: relative; width: 52px; height: 52px; border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25);
  display: grid; place-items: center; cursor: pointer;
  transition: transform 0.14s var(--ease), border-color 0.14s, background 0.14s, box-shadow 0.14s;
}
.slot:not(:has(img)) { background: rgba(0, 0, 0, 0.16); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3); }
.slot:hover { background: rgba(255, 255, 255, 0.15); border-color: var(--stroke-hi); }
.slot:hover img { transform: scale(1.08); }
.slot img { width: 36px; height: 36px; image-rendering: pixelated; pointer-events: none; filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.45)); transition: transform 0.14s var(--ease); }
.slot .key { position: absolute; top: 2px; left: 5px; font-size: 10px; font-weight: 600; color: var(--muted); }
.slot .count {
  position: absolute; bottom: -3px; right: -3px; min-width: 18px; height: 17px; padding: 0 4px;
  border-radius: var(--r-pill); background: rgba(12, 14, 22, 0.92); border: 1px solid var(--stroke-hi);
  font-size: 11px; font-weight: 700; line-height: 15px; text-align: center; font-variant-numeric: tabular-nums;
}
#hotbar .slot.active { border-color: var(--accent); background: linear-gradient(180deg, rgba(255, 209, 102, 0.26), rgba(255, 209, 102, 0.1)); transform: translateY(-5px); box-shadow: var(--glow-accent); }
#hotbar .slot.active .key { color: var(--accent); }
#item-name {
  position: absolute; bottom: 92px; left: 50%; transform: translateX(-50%); font-size: 14px; font-weight: 600; opacity: 0;
  padding: 3px 12px; border-radius: var(--r-pill); background: rgba(8, 10, 18, 0.55); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); pointer-events: none;
}
#item-name:empty { display: none; }
#item-name.show { animation: fadeName 1.6s ease forwards; }
@keyframes fadeName { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }

/* Eşya ipucu (HUD.js #item-tip) — yalnız fareyle */
#item-tip {
  position: fixed; z-index: 60; max-width: 240px; padding: 9px 12px; pointer-events: none; opacity: 0;
  background: var(--glass-strong); border: 1px solid var(--stroke-hi); border-radius: var(--r-md); box-shadow: var(--shadow-2);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 12px; line-height: 1.45; color: var(--text);
  transform: translateY(4px); transition: opacity 0.12s, transform 0.12s;
}
#item-tip.show { opacity: 1; transform: none; }
#item-tip b { display: block; font-size: 14px; color: var(--accent); }
#item-tip .tt-desc { color: var(--muted); }
#item-tip .tt-stats { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
#item-tip .tt-stats span { padding: 1px 7px; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.1); font-size: 11px; }
body.is-touch #item-tip { display: none; }

#hint { position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%) translateY(6px); padding: 7px 14px; font-size: 13px; font-weight: 500; opacity: 0; transition: opacity 0.2s, transform 0.2s; }
#hint.show { opacity: 1; transform: translateX(-50%); }
#keys { position: absolute; bottom: 18px; left: 14px; padding: 7px 12px; font-size: 11px; color: var(--muted); max-width: 210px; line-height: 1.5; }

/* ---------- Modallar ---------- */
#backdrop { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(5, 8, 15, 0.25), rgba(5, 8, 15, 0.6)); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
#backdrop.show { opacity: 1; pointer-events: auto; }
/* Pencereler açıkken köşedeki tıklanabilir rozetler/mini harita pencerenin üstünde kalıp tıklamayı çalmasın */
#backdrop.show { z-index: 45; }
.modal.show { z-index: 50; }
.modal:not(.show), .modal:not(.show) * { pointer-events: none !important; }
body.modal-open #feature-ui, body.modal-open #feature-ui * { pointer-events: none !important; }
.modal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -46%) scale(0.98);
  background: var(--glass-strong); padding: 18px; opacity: 0; pointer-events: none; border-radius: var(--r-lg);
  transition: opacity 0.2s, transform 0.25s var(--ease); max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.modal.show { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
.modal header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.modal h3 { font-size: 19px; font-weight: 700; letter-spacing: 0.2px; flex: 1; }
.modal h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin-bottom: 8px; }
.x { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: var(--r-sm); }
.x:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }

button {
  font-family: var(--font); font-size: 13px; font-weight: 500; color: var(--text);
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--stroke); border-radius: var(--r-md);
  padding: 8px 14px; cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); border-color: var(--stroke-hi); }
button:active:not(:disabled) { transform: scale(0.97); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #2a1d05; border-color: transparent; font-weight: 600; box-shadow: 0 3px 0 #a8641f, 0 6px 16px rgba(244, 162, 76, 0.25); }
button.primary:hover:not(:disabled) { background: linear-gradient(135deg, #ffe08f, #f7b467); border-color: transparent; }
button.primary:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #a8641f; }
button.accent { border-color: rgba(255, 209, 102, 0.5); background: var(--accent-soft); }
button.ghost { background: transparent; }

/* Envanter */
#modal-inventory { width: 760px; }
.inv-wrap { display: grid; grid-template-columns: auto 1fr; gap: 20px; }
#inv-grid { display: grid; grid-template-columns: repeat(6, 52px); gap: 6px; }
#inv-grid .slot.hot { border-color: rgba(255, 209, 102, 0.28); }
#inv-grid .slot.picked { border-color: var(--blue); background: rgba(90, 176, 255, 0.24); box-shadow: 0 0 0 1px var(--blue), 0 0 16px rgba(90, 176, 255, 0.4); animation: picked 1s ease-in-out infinite; }
@keyframes picked { 50% { box-shadow: 0 0 0 1px var(--blue), 0 0 4px rgba(90, 176, 255, 0.2); } }
#inv-info { margin-top: 12px; font-size: 13px; min-height: 58px; max-width: 350px; line-height: 1.5; padding: 8px 10px; border-radius: var(--r-md); background: rgba(0, 0, 0, 0.18); }
/* Co-op: takım arkadaşına eşya / para verme */
.inv-give { margin-top: 8px; max-width: 350px; padding: 8px 10px; border-radius: var(--r-md); background: rgba(90, 176, 255, 0.08); border: 1px solid rgba(90, 176, 255, 0.25); font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.inv-give .give-h { line-height: 1.4; }
.inv-give .give-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.inv-give .give-name { flex: 1 1 70px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.inv-give .give-btn { min-height: 28px; padding: 2px 8px; font-size: 12px; }
.inv-give .give-btn.coin { border-color: rgba(255, 209, 102, 0.45); }
.craft { min-width: 300px; }
#craft-list { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow: auto; padding-right: 4px; }
.craft-tabs { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; gap: 4px; padding-bottom: 6px; background: var(--glass-strong, rgba(14,16,26,.92)); }
.craft-tab { flex: 1 1 auto; min-height: 32px; padding: 4px 8px; font-size: 12px; opacity: .7; position: relative; }
.craft-tab.on { opacity: 1; border-color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.craft-tab.ready::after { content: ''; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--green, #6ee06e); }
.recipe, .shop-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.05); border: 1px solid transparent; transition: background 0.15s, border-color 0.15s;
}
.recipe:hover, .shop-row:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.1); }
.recipe.ready { border-color: rgba(110, 224, 110, 0.3); background: linear-gradient(90deg, rgba(110, 224, 110, 0.1), rgba(255, 255, 255, 0.04)); }
.recipe.ready button { border-color: rgba(110, 224, 110, 0.55); background: rgba(110, 224, 110, 0.18); }
.recipe.locked { opacity: 0.6; }
.recipe img.out, .shop-row > img { width: 36px; height: 36px; padding: 3px; border-radius: var(--r-sm); background: rgba(0, 0, 0, 0.2); image-rendering: pixelated; flex-shrink: 0; }
.rinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.rinfo .muted { font-size: 11px; }
.cost { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; margin-right: 8px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cost img { width: 14px; height: 14px; image-rendering: pixelated; }
.cost.miss { color: #ff8a8a; }

/* Diyalog */
#modal-dialog { top: auto; bottom: 110px; transform: translate(-50%, 10px); width: 600px; }
#modal-dialog.show { transform: translate(-50%, 0); }
.dlg { display: flex; gap: 16px; }
.portrait {
  width: 84px; height: 84px; image-rendering: pixelated; flex-shrink: 0; padding: 4px;
  background: radial-gradient(circle at 50% 35%, rgba(255, 209, 102, 0.18), rgba(255, 255, 255, 0.04) 70%);
  border-radius: var(--r-md); border: 2px solid rgba(255, 209, 102, 0.4); box-shadow: var(--shadow-1), inset 0 0 12px rgba(0, 0, 0, 0.4);
}
.dlg-body { flex: 1; min-width: 0; }
.npc-name { font-family: var(--pixel); font-size: 24px; color: var(--accent); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4); }
.npc-role { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.npc-text { font-size: 15px; line-height: 1.55; margin-bottom: 14px; min-height: 44px; padding: 10px 12px; border-radius: var(--r-md); background: rgba(0, 0, 0, 0.22); border-left: 3px solid rgba(255, 209, 102, 0.5); }
.options { display: flex; flex-wrap: wrap; gap: 8px; }

/* Dükkân */
#modal-shop { width: 520px; }
.shop-coins { font-family: var(--pixel); font-size: 17px; font-weight: 700; color: var(--accent); padding: 3px 10px; border-radius: var(--r-pill); background: var(--accent-soft); }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; padding: 4px; border-radius: var(--r-md); background: rgba(0, 0, 0, 0.2); }
.tabs .tab { flex: 1; border-color: transparent; background: transparent; }
.tab.active { background: rgba(255, 209, 102, 0.2); border-color: rgba(255, 209, 102, 0.5); color: var(--accent); }
.shop-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; }

/* =========================================================
   Ana menü + oyun sonu
   ========================================================= */
#menu, #gameover { position: absolute; inset: 0; display: none; place-items: center; padding: 16px; overflow: auto; z-index: 40; }
#menu { background: linear-gradient(180deg, rgba(8, 10, 26, 0.88), rgba(12, 22, 18, 0.74) 55%, rgba(5, 8, 10, 0.95)); }
#menu.show, #gameover.show { display: grid; }

/* Hareketli arka plan: ay, sis, kıvılcımlar, ufuk silueti */
.menu-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.menu-bg .moon { position: absolute; top: 9%; right: 14%; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle at 38% 36%, #fff8e0, #f3d9a0 55%, #c99a55); box-shadow: 0 0 60px 20px rgba(255, 220, 150, 0.25), 0 0 160px 60px rgba(255, 180, 90, 0.1); animation: moon 8s ease-in-out infinite; }
@keyframes moon { 50% { box-shadow: 0 0 80px 26px rgba(255, 220, 150, 0.32), 0 0 180px 70px rgba(255, 120, 90, 0.14); } }
.menu-bg .fog { position: absolute; left: -50%; width: 200%; height: 40%; bottom: 8%; opacity: 0.6; background: radial-gradient(ellipse at 25% 60%, rgba(160, 190, 170, 0.2), transparent 45%), radial-gradient(ellipse at 70% 50%, rgba(140, 170, 160, 0.18), transparent 40%); animation: fog 28s linear infinite; }
.menu-bg .fog.f2 { bottom: 0; opacity: 0.45; animation-duration: 42s; animation-direction: reverse; }
@keyframes fog { to { transform: translateX(25%); } }
.menu-bg .embers, .menu-bg .embers::after {
  position: absolute; left: 0; bottom: 0; width: 3px; height: 3px; background: transparent;
  box-shadow: 8vw 0 #ffb45a, 19vw -4vh #ff8a4a, 31vw 2vh #ffd166, 44vw -8vh #ff9a5a, 57vw 0 #ffb45a, 66vw -3vh #ff7a3a, 78vw 1vh #ffd166, 89vw -6vh #ff9a5a, 96vw -2vh #ffb45a;
  animation: embers 9s linear infinite;
}
.menu-bg .embers::after { content: ''; left: 3vw; animation-duration: 13s; animation-delay: -5s; }
@keyframes embers { 0% { transform: translateY(0); opacity: 0; } 10% { opacity: 0.9; } 100% { transform: translate(4vw, -80vh); opacity: 0; } }
.menu-bg svg { position: absolute; left: 0; bottom: 0; width: 100%; height: 24vh; min-height: 110px; }
.menu-bg .zw { animation: shamble 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: bottom; }
.menu-bg .zw.z2 { animation-delay: -1.1s; } .menu-bg .zw.z3 { animation-delay: -2.2s; }
@keyframes shamble { 50% { transform: translateX(5px) rotate(4deg); } }

.menu-card { position: relative; padding: 34px 38px; width: min(560px, 100%); text-align: center; background: var(--glass-strong); border-radius: 22px; animation: cardIn 0.6s var(--ease); }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(0.97); } }
.menu-card .kicker { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 3px; text-transform: uppercase; color: var(--muted); padding: 4px 12px; border-radius: var(--r-pill); border: 1px solid var(--stroke); margin-bottom: 18px; }
.menu-card h1 {
  font-family: var(--display); font-size: 30px; font-weight: 400; line-height: 1.45; letter-spacing: 1px; color: #f6f1de;
  text-shadow: 0 3px 0 #5a3a12, 0 6px 0 rgba(0, 0, 0, 0.35), 0 0 30px rgba(255, 209, 102, 0.25);
  animation: titleFloat 5s ease-in-out infinite;
}
.menu-card h1 span { color: var(--accent); display: inline-block; animation: amp 2.4s ease-in-out infinite; }
@keyframes titleFloat { 50% { transform: translateY(-4px); } }
@keyframes amp { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg) scale(1.1); } }
.tag { color: var(--muted); margin: 16px 0 22px; font-size: 15px; line-height: 1.5; }
.menu-btns { display: flex; gap: 10px; justify-content: center; margin-bottom: 18px; }
.menu-btns button { font-size: 15px; padding: 12px 28px; min-height: 46px; }
#btn-new.open { border-color: var(--accent); color: var(--accent); }
.howto { text-align: left; list-style: none; display: grid; gap: 8px; font-size: 13px; color: var(--muted); padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.howto li::before { content: '›'; color: var(--accent); margin-right: 8px; }
.howto b { color: var(--text); font-weight: 600; }

/* Zorluk kartları */
.diff-pick { display: none; gap: 8px; margin: 4px 0 18px; }
.diff-pick.show { display: grid; grid-template-columns: repeat(3, 1fr); animation: cardIn 0.35s var(--ease); }
.diff-pick button {
  --dc: var(--accent);
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 16px 8px 12px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--stroke); border-top: 3px solid var(--dc); border-radius: 12px; color: var(--text); box-shadow: none;
}
.diff-pick button.d-easy { --dc: var(--green); } .diff-pick button.d-hard { --dc: var(--red); }
.diff-pick button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); transform: translateY(-3px); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--dc); border-color: var(--dc); }
.diff-pick button.primary, .diff-pick button.primary:hover:not(:disabled) { background: linear-gradient(180deg, rgba(255, 209, 102, 0.2), rgba(255, 209, 102, 0.06)); color: var(--text); }
.diff-pick button.primary { box-shadow: 0 0 0 1px rgba(255, 209, 102, 0.5); }
.diff-pick button.primary::after { content: 'Önerilen'; position: absolute; top: -10px; left: 50%; transform: translateX(-50%); font-size: 9px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; padding: 2px 8px; border-radius: var(--r-pill); background: var(--accent); color: #2a1d05; }
.diff-pick .d-ic { font-size: 28px; line-height: 1.1; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.4)); }
.diff-pick b { font-size: 16px; font-weight: 700; letter-spacing: 0.3px; color: var(--dc); }
.diff-pick small { font-size: 11px; font-weight: 400; opacity: 0.85; line-height: 1.35; }
.diff-pick .d-pips { display: flex; gap: 3px; }
.diff-pick .d-pips i { width: 14px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.15); }
.diff-pick .d-pips i.on { background: var(--dc); box-shadow: 0 0 6px var(--dc); }
.diff-pick .d-rw { font-size: 10px; font-weight: 600; color: var(--muted); }

/* Rekorlar */
.records { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 6px; margin: 0 0 18px; }
.records:empty { display: none; }
.records .rec { display: flex; flex-direction: column; align-items: center; padding: 6px 4px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); border: 1px solid rgba(255, 255, 255, 0.07); }
.records .rec b { font-family: var(--display); font-size: 13px; font-weight: 400; padding: 3px 0 2px; color: var(--accent); line-height: 1.1; }
.records .rec span { font-size: 9px; white-space: nowrap; color: var(--muted); letter-spacing: 0.5px; text-transform: uppercase; }

/* Oyun sonu: yenilgide kırmızı nabız, zaferde altın ışınlar */
#gameover { background: radial-gradient(ellipse at center, rgba(60, 4, 8, 0.55), rgba(10, 0, 2, 0.94) 75%); }
#gameover.show { animation: goIn 0.8s ease; }
#gameover::before { content: ''; position: fixed; inset: 0; pointer-events: none; box-shadow: inset 0 0 180px 40px rgba(180, 10, 20, 0.55); animation: goPulse 2.6s ease-in-out infinite; }
@keyframes goIn { from { background-color: rgba(255, 30, 30, 0.5); } }
@keyframes goPulse { 50% { opacity: 0.45; } }
#gameover .menu-card { border-color: rgba(235, 87, 87, 0.35); animation: goCard 0.7s var(--ease) 0.15s backwards; }
@keyframes goCard { from { opacity: 0; transform: scale(1.12); filter: blur(6px); } }
#gameover h1 { font-size: 28px; color: #ff6b6b; text-shadow: 0 3px 0 #4a0a0e, 0 0 26px rgba(255, 50, 50, 0.6); animation: goShake 0.6s ease 0.3s backwards; }
@keyframes goShake { 0%, 100% { transform: none; } 20% { transform: translate(-6px, 2px) rotate(-1deg); } 40% { transform: translate(5px, -2px) rotate(1deg); } 60% { transform: translate(-3px, 1px); } 80% { transform: translate(2px, 0); } }
#gameover .stats { color: var(--muted); margin: 16px 0; line-height: 1.55; }
#gameover.win { background: radial-gradient(ellipse at center, rgba(30, 60, 20, 0.55), rgba(4, 10, 6, 0.94) 75%); }
#gameover.win::before { box-shadow: none; inset: -50%; background: repeating-conic-gradient(from 0deg, rgba(255, 209, 102, 0.1) 0 10deg, transparent 10deg 20deg); animation: rays 40s linear infinite; mask-image: radial-gradient(circle, #000 10%, transparent 55%); -webkit-mask-image: radial-gradient(circle, #000 10%, transparent 55%); }
@keyframes rays { to { transform: rotate(360deg); } }
#gameover.win .menu-card { border-color: rgba(255, 209, 102, 0.45); box-shadow: var(--shadow-2), 0 0 60px rgba(255, 209, 102, 0.2); }
#gameover.win h1 { color: var(--green); text-shadow: 0 3px 0 #1d4a12, 0 0 26px rgba(110, 224, 110, 0.55); animation: none; }
.go-chips { display: flex; justify-content: center; gap: 8px; margin: 0 0 18px; }
.go-chips div { min-width: 82px; padding: 8px 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(255, 255, 255, 0.08); }
.go-chips b { display: block; font-family: var(--display); font-size: 16px; font-weight: 400; line-height: 1.6; }
.go-chips span { font-size: 10px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); }
.go-score { margin: 0 0 20px; }
.go-score .score { font-family: var(--display); font-size: 40px; color: var(--accent); line-height: 1.3; text-shadow: 0 4px 0 #7a4a10, 0 0 30px rgba(255, 209, 102, 0.4); }
.go-score .best { display: inline-block; margin: 6px 0 4px; padding: 3px 12px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); font-weight: 600; }

@media (max-width: 900px) {
  #hud-top { gap: 8px; padding: 6px 10px; font-size: 12px; top: 8px; }
  #hud-top .bar { width: 48px; }
  #hud-top .sep { display: none; }
  #keys, #quest-tracker { display: none !important; }
  .slot { width: 40px; height: 40px; }
  .slot img { width: 28px; height: 28px; }
  .inv-wrap { grid-template-columns: 1fr; }
  #inv-grid { grid-template-columns: repeat(6, 40px); }
  #banner h2 { font-size: 22px; }
  .menu-card h1 { font-size: 22px; }
}

#modal-feature { width: 560px; }

@media (max-width: 520px) {
  .diff-pick.show { grid-template-columns: 1fr; gap: 12px; }
  .diff-pick button { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; text-align: left; gap: 2px 10px; padding: 10px 12px; min-height: 64px; }
  .diff-pick .d-ic { grid-row: 1 / span 2; }
  .diff-pick small { grid-column: 2 / span 2; }
  .diff-pick .d-pips { grid-column: 3; grid-row: 1; }
  .diff-pick .d-rw { display: none; }
  .diff-pick button.primary::after { left: auto; right: 10px; transform: none; }
  .menu-bg .moon { width: 70px; height: 70px; top: 4%; right: 8%; }
  .go-chips div { min-width: 0; flex: 1; }
  .go-score .score { font-size: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .menu-bg *, .menu-bg *::after, .menu-card h1, .menu-card h1 span, #gameover::before, .bar.low i, .b-hp .lbl { animation: none !important; }
}
