@font-face {
  font-family: 'PixelHud';
  src: url('../assets/fonts/PressStart2P.ttf') format('truetype');
  font-display: block;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --hp: #e01c1c;
  --shield: #1c8ce0;
  --gold: #ffd21a;
  --xp: #5ce04f;
  --panel: rgba(0, 0, 0, 0.82);
  --edge: #000;
}

html, body {
  width: 100%; height: 100%;
  background: #000;
  overflow: hidden;
  font-family: 'PixelHud', 'Courier New', monospace;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}

#view {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.hidden { display: none !important; }

/* ---------------- HUD ---------------- */
#hud {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 10;
}

/* Ust siyah serit */
#topbar {
  position: absolute; top: 0; left: 0; right: 0;
  height: 42px;
  background: #000;
  display: flex; align-items: center;
  padding: 0 14px;
}
#topStats { display: flex; gap: 26px; align-items: center; }
.stat { display: flex; align-items: center; gap: 7px; font-size: 15px; }
.stat i { font-style: normal; font-size: 13px; opacity: 0.95; }
.stat b { font-weight: normal; letter-spacing: 1px; }
.xpIcon, .goldIcon, .silverIcon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%;
  font-size: 9px; color: #000;
}
.xpIcon { background: var(--xp); }
.goldIcon { background: var(--gold); }
.silverIcon { background: #c0c8d0; }

#countdown {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 26px; letter-spacing: 2px;
  text-shadow: 3px 3px 0 #000;
}
#countdown.urgent { color: #ff3b3b; animation: pulse 0.5s steps(2) infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }

#levelText {
  position: absolute; right: 16px;
  font-size: 24px; letter-spacing: 2px;
  text-shadow: 3px 3px 0 #000;
}

/* Sol panel */
#leftPanel {
  position: absolute; top: 50px; left: 12px;
  display: flex; flex-direction: column; gap: 8px;
  width: 250px;
}
#bars { display: flex; flex-direction: column; gap: 3px; }
.bar {
  position: relative;
  height: 20px; width: 250px;
  background: #000;
  border: 2px solid #000;
}
.bar .fill {
  position: absolute; inset: 0;
  transform-origin: left;
  transition: transform 0.12s linear;
}
.bar.health .fill { background: var(--hp); }
.bar.shield .fill { background: var(--shield); }
/* Overheal: Max HP'nin ustundeyken bar altin rengine kayar */
.bar.health.over .fill { background: linear-gradient(90deg, var(--hp), var(--gold)); }
.bar span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; text-shadow: 1.5px 1.5px 0 #000;
}

/* Silah + item slotlari */
#slots, #itemSlots { display: flex; flex-wrap: wrap; gap: 3px; width: 174px; }
.slot {
  position: relative;
  width: 40px; height: 40px;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid rgba(0, 0, 0, 0.85);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.slot.item { width: 32px; height: 32px; font-size: 14px; }
.slot .lv {
  position: absolute; bottom: 1px; left: 2px;
  font-size: 6px; letter-spacing: 0; text-shadow: 1px 1px 0 #000;
}
.slot.maxed { box-shadow: inset 0 0 0 2px var(--gold); }
.slot.empty { opacity: 0.32; }

/* Hedef */
#objective {
  display: inline-flex; align-items: center; gap: 8px;
  background: #000;
  padding: 8px 12px;
  font-size: 13px;
  width: fit-content;
  max-width: 250px;
}
#objective .chk { font-size: 14px; }
#objective.done { color: var(--xp); }
#charBadge { font-size: 9px; opacity: 0.6; padding-left: 2px; }

/* Minimap */
#minimapWrap {
  position: absolute; top: 52px; right: 14px;
  width: 180px; height: 180px;
}
#minimap {
  width: 180px; height: 180px;
  border-radius: 50%;
  border: 3px solid #6b5a3a;
  background: #0a0f1a;
  image-rendering: pixelated;
}
.dir {
  position: absolute;
  font-size: 10px;
  text-shadow: 2px 2px 0 #000;
  pointer-events: none;
}
.dir.n { top: -3px; left: 50%; transform: translateX(-50%); }
.dir.s { bottom: -3px; left: 50%; transform: translateX(-50%); }
.dir.e { right: -12px; top: 50%; transform: translateY(-50%); }
.dir.w { left: -12px; top: 50%; transform: translateY(-50%); }

/* Boss can bari */
#bossBar {
  position: absolute; top: 52px; left: 50%; transform: translateX(-50%);
  width: min(70vw, 900px);
  text-align: center;
}
#bossName {
  font-size: 17px; margin-bottom: 5px;
  text-shadow: 3px 3px 0 #000;
  letter-spacing: 1px;
}
.bbar {
  position: relative;
  height: 24px;
  background: #1a0000;
  border: 3px solid #000;
}
.bbar .bfill {
  position: absolute; inset: 0;
  background: linear-gradient(#ff4444, #cc0000);
  transform-origin: left;
  transition: transform 0.15s linear;
}
.bbar span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; text-shadow: 1.5px 1.5px 0 #000;
}

/* Hasar sayilari */
#dmgLayer { position: absolute; inset: 0; overflow: hidden; }
.dmg {
  position: absolute;
  font-size: 13px;
  text-shadow: 2px 2px 0 #000;
  animation: float 0.75s ease-out forwards;
  white-space: nowrap;
}
.dmg.crit { font-size: 19px; color: var(--gold); }
.dmg.gold { color: var(--gold); }
.dmg.heal { color: #4dff88; }
.dmg.hurt { color: #ff4444; font-size: 17px; }
.dmg.shield { color: #6ec6ff; font-size: 15px; }
@keyframes float {
  0%   { transform: translate(-50%, 0) scale(0.6); opacity: 1; }
  25%  { transform: translate(-50%, -18px) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -52px) scale(0.9); opacity: 0; }
}

/* Bildirimler */
#toasts {
  position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.toast {
  background: #000; padding: 9px 16px;
  font-size: 11px;
  animation: toastIn 0.25s ease-out, toastOut 0.4s ease-in 2.6s forwards;
}
@keyframes toastIn { from { transform: translateY(14px); opacity: 0; } }
@keyframes toastOut { to { opacity: 0; } }

#version {
  position: absolute; bottom: 8px; right: 12px;
  font-size: 9px; opacity: 0.5;
}
#crosshair {
  position: absolute; top: 50%; left: 50%;
  width: 4px; height: 4px; margin: -2px 0 0 -2px;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 50%;
}

/* ---------------- OVERLAY'LER ---------------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(4, 6, 12, 0.9);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px;
  z-index: 50;
  padding: 20px;
}
.lvTitle {
  font-size: 30px; color: var(--gold);
  text-shadow: 4px 4px 0 #000;
  letter-spacing: 2px;
}

/* Level-up kartlari */
#cards, #chestCards { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.card {
  width: 218px; min-height: 260px;
  background: #12141c;
  border: 4px solid #555;
  padding: 16px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  cursor: pointer;
  transition: transform 0.1s steps(2), box-shadow 0.1s;
  text-align: center;
}
.card:hover { transform: translateY(-8px) scale(1.03); }
.card .cIcon { font-size: 44px; margin-top: 6px; }
.card .cRarity { font-size: 8px; letter-spacing: 1px; }
.card .cTitle { font-size: 13px; line-height: 1.5; }
.card .cSub { font-size: 8px; opacity: 0.65; }
.card .cDesc {
  font-size: 8.5px; line-height: 1.75; opacity: 0.9;
  margin-top: auto; padding-top: 8px;
}
.card.banishMode { border-color: #ff3b3b !important; }
.card.banishMode:hover { background: #2a0e0e; }

#lvActions { display: flex; gap: 12px; margin-top: 6px; }
#lvActions button, .tinyBtn {
  font-family: inherit;
  background: #1a1d28; color: #fff;
  border: 3px solid #000;
  padding: 10px 16px;
  font-size: 10px;
  cursor: pointer;
}
#lvActions button:hover:not(:disabled), .tinyBtn:hover { background: #2a2f40; }
#lvActions button:disabled { opacity: 0.3; cursor: not-allowed; }
#lvActions em { font-style: normal; opacity: 0.6; }

.bigBtn {
  font-family: inherit;
  background: var(--gold); color: #000;
  border: 4px solid #000;
  padding: 16px 44px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.6);
  letter-spacing: 1px;
}
.bigBtn:hover { transform: translate(2px, 2px); box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.6); }
.bigBtn:active { transform: translate(5px, 5px); box-shadow: none; }

/* ---------------- ANA MENU ---------------- */
#logo {
  font-size: 52px; letter-spacing: 3px;
  text-shadow: 6px 6px 0 #000, 0 0 30px rgba(255, 210, 26, 0.35);
  color: #fff;
}
#logo span { color: var(--gold); }
#tagline { font-size: 9px; opacity: 0.55; letter-spacing: 2px; margin-top: -6px; }

#menuCols {
  display: flex; gap: 22px;
  align-items: flex-start; justify-content: center;
  margin-top: 8px;
  max-width: 1100px; width: 100%;
}
.col { flex: 1; min-width: 0; }
.col h3 {
  font-size: 10px; opacity: 0.5; margin-bottom: 8px;
  letter-spacing: 2px; font-weight: normal;
}

#charList {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 5px;
  max-height: 260px; overflow-y: auto;
  padding-right: 4px;
}
.charBtn {
  aspect-ratio: 1;
  background: #171a24;
  border: 3px solid #000;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
  font-size: 8px;
  padding: 2px;
  text-align: center;
  line-height: 1.3;
  overflow: hidden;
}
.charBtn:hover { border-color: #666; }
.charBtn.sel { border-color: var(--gold); background: #2a2410; }
.charBtn.locked { opacity: 0.35; cursor: not-allowed; }
.charBtn .lockIcon { font-size: 16px; }
.charBtn .swatch {
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
}

#stageList, #tierList { display: flex; flex-direction: column; gap: 5px; }
.stageBtn, .tierBtn {
  background: #171a24; border: 3px solid #000;
  padding: 10px; font-size: 10px; cursor: pointer;
  font-family: inherit; color: #fff;
  text-align: left;
  display: flex; justify-content: space-between; align-items: center;
}
.stageBtn:hover, .tierBtn:hover { border-color: #666; }
.stageBtn.sel, .tierBtn.sel { border-color: var(--gold); background: #2a2410; }
.stageBtn small, .tierBtn small { font-size: 7px; opacity: 0.5; }
.tierList-row { display: flex; gap: 5px; }
#tierList { flex-direction: row; }
#tierList .tierBtn { flex: 1; justify-content: center; }

#charDetail {
  background: #12141c; border: 3px solid #000;
  padding: 14px; font-size: 9px; line-height: 2;
  min-height: 200px;
}
#charDetail .cdName { font-size: 15px; color: var(--gold); margin-bottom: 4px; }
#charDetail .cdTag { font-size: 8px; opacity: 0.6; margin-bottom: 10px; }
#charDetail .cdRow { display: flex; justify-content: space-between; gap: 10px; }
#charDetail .cdRow span:last-child { opacity: 0.75; }
#charDetail .cdDesc { margin-top: 10px; opacity: 0.85; line-height: 1.9; }
#charDetail .cdLock { color: #ff6b6b; margin-top: 10px; line-height: 1.8; }

#metaRow {
  display: flex; gap: 20px; align-items: center;
  font-size: 9px; opacity: 0.7;
}
#metaRow b { color: var(--gold); }
#controlsHint {
  font-size: 8px; opacity: 0.45; text-align: center; line-height: 2.2;
}
#controlsHint .dim { opacity: 0.7; }

/* Stat paneli */
#statPanel {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(8, 10, 16, 0.95);
  border: 3px solid #000;
  padding: 20px 26px;
  font-size: 9px; line-height: 2.1;
  z-index: 40;
  column-count: 2; column-gap: 30px;
  pointer-events: none;
}
#statPanel .sRow { display: flex; justify-content: space-between; gap: 24px; break-inside: avoid; }
#statPanel .sRow b { color: var(--gold); font-weight: normal; }

/* Kosu sonu */
#goTitle { font-size: 40px; color: #ff3b3b; text-shadow: 5px 5px 0 #000; }
#goTitle.win { color: var(--xp); }
#goStats, #pauseStats {
  background: #12141c; border: 3px solid #000;
  padding: 18px 26px; font-size: 10px; line-height: 2.3;
  min-width: 320px;
}
#goStats .gRow, #pauseStats .gRow { display: flex; justify-content: space-between; gap: 30px; }
#goStats b, #pauseStats b { color: var(--gold); font-weight: normal; }
#goUnlocks { font-size: 9px; color: var(--xp); text-align: center; line-height: 2; }

/* Kaydirma cubugu */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0a0c12; }
::-webkit-scrollbar-thumb { background: #2a2f40; }

@media (max-width: 900px) {
  #menuCols { flex-direction: column; }
  #logo { font-size: 34px; }
  .card { width: 160px; min-height: 210px; }
}
