/* ABYSS — Tachys brand: Deep Navy #071B59, Azure Pulse #18B6F6,
   Digital Blue #3D7BFF, Neo Violet #6A3FF5, Soft Mist #F4F6FB */

:root {
  --navy: #071B59;
  --navy-deep: #040F33;
  --azure: #18B6F6;
  --blue: #3D7BFF;
  --violet: #6A3FF5;
  --mist: #F4F6FB;
  --ink-70: rgba(244, 246, 251, 0.72);
  --grad: linear-gradient(120deg, #18B6F6, #3D7BFF, #6A3FF5);
  --hp: #C22A3A;
  --gold: #E8B84B;
  --rare: #F2CF63;
  --magic: #6FA8FF;
  --unique: #E8964B;
  --font-display: "Sora", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--navy-deep);
  font-family: var(--font-body);
  color: var(--mist);
  user-select: none;
  -webkit-user-select: none;
}

#game {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  cursor: crosshair;
}

#vignette {
  position: fixed; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(2, 6, 23, 0.55) 100%);
}

.hidden { display: none !important; }

/* ── Horní lišta ─────────────────────────────── */
#topbar {
  position: fixed; top: 14px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 22px; align-items: center;
  padding: 8px 20px;
  background: rgba(4, 15, 51, 0.82);
  border: 1px solid rgba(61, 123, 255, 0.35);
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 14px; font-weight: 600;
  letter-spacing: 0.04em;
  z-index: 20;
}
#gold-label { color: var(--gold); }

#minimap {
  position: fixed; top: 14px; right: 14px;
  border: 1px solid rgba(61, 123, 255, 0.4);
  border-radius: 8px;
  background: rgba(4, 15, 51, 0.85);
  z-index: 20;
}

/* ── Nepřítel ────────────────────────────────── */
#enemy-bar {
  position: fixed; top: 64px; left: 50%;
  transform: translateX(-50%);
  width: 300px; text-align: center;
  z-index: 20; pointer-events: none;
}
#enemy-name {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
#enemy-hp {
  margin-top: 4px; height: 10px;
  background: rgba(4, 15, 51, 0.85);
  border: 1px solid rgba(244,246,251,0.3);
  border-radius: 5px; overflow: hidden;
}
#enemy-hp-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #8f1f2c, #C22A3A);
  transition: width 0.12s linear;
}

/* ── Toasty ──────────────────────────────────── */
#toasts {
  position: fixed; left: 18px; bottom: 130px;
  display: flex; flex-direction: column-reverse; gap: 5px;
  z-index: 25; pointer-events: none;
}
.toast {
  padding: 5px 12px;
  background: rgba(4, 15, 51, 0.88);
  border-left: 3px solid var(--azure);
  border-radius: 4px;
  font-size: 13px; font-weight: 500;
  animation: toast-in 0.2s ease-out, toast-out 0.5s ease-in 3s forwards;
  max-width: 340px;
}
.toast.gold { border-left-color: var(--gold); }
.toast.levelup { border-left-color: var(--violet); font-weight: 700; }
@keyframes toast-in { from { opacity: 0; transform: translateX(-14px); } }
@keyframes toast-out { to { opacity: 0; } }

/* ── Spodní HUD ──────────────────────────────── */
#hud {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; align-items: flex-end; justify-content: center;
  gap: 26px; padding: 0 12px 14px;
  z-index: 20; pointer-events: none;
}
#hud > * { pointer-events: auto; }

.orb {
  position: relative;
  width: 92px; height: 92px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(244,246,251,0.16), rgba(4,15,51,0.9) 60%);
  border: 3px solid rgba(61, 123, 255, 0.45);
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(0,0,0,0.6), inset 0 0 22px rgba(0,0,0,0.75);
}
.orb-fill {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 100%;
  transition: height 0.18s ease-out;
}
#orb-hp-fill { background: radial-gradient(circle at 50% 0%, #e4576a, #C22A3A 55%, #6d1220); }
#orb-mp-fill { background: radial-gradient(circle at 50% 0%, #6fd4ff, #18B6F6 50%, #1a49b8); }
.orb-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}

#hud-center { display: flex; flex-direction: column; gap: 7px; align-items: center; }

#skillbar { display: flex; gap: 8px; }
.skill {
  position: relative;
  width: 52px; height: 52px;
  border-radius: 9px;
  background: rgba(4, 15, 51, 0.9);
  border: 1px solid rgba(61, 123, 255, 0.4);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(0,0,0,0.5);
}
.skill-icon { display: block; }
.skill-key {
  position: absolute; bottom: -17px; left: 50%;
  transform: translateX(-50%);
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-70);
  white-space: nowrap;
}
.skill-count {
  position: absolute; top: 2px; right: 5px;
  font-family: var(--font-display);
  font-size: 13px; font-weight: 800;
  color: var(--mist);
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}
.skill-cd {
  position: absolute; inset: 0;
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.78);
  transform-origin: bottom;
  transform: scaleY(0);
  pointer-events: none;
}

#xpbar {
  position: relative;
  width: 330px; height: 9px;
  margin-top: 12px;
  background: rgba(4, 15, 51, 0.9);
  border: 1px solid rgba(61, 123, 255, 0.35);
  border-radius: 5px;
  overflow: hidden;
}
#xpbar-fill {
  height: 100%; width: 0%;
  background: var(--grad);
  transition: width 0.25s ease-out;
}
#xpbar-text {
  position: absolute; inset: 0;
  font-size: 8px; line-height: 9px;
  text-align: center;
  color: rgba(244,246,251,0.85);
}

/* ── Panely ──────────────────────────────────── */
.panel {
  position: fixed; top: 50%;
  transform: translateY(-50%);
  background: rgba(4, 15, 51, 0.94);
  border: 1px solid rgba(61, 123, 255, 0.45);
  border-radius: 14px;
  padding: 20px 22px;
  z-index: 30;
  box-shadow: 0 10px 40px rgba(0,0,0,0.7);
}
#inv-panel { right: 24px; width: 340px; }
#char-panel { left: 24px; width: 300px; }

.panel h2 {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700;
  margin-bottom: 14px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.panel-key {
  float: right;
  font-size: 11px; font-weight: 600;
  color: var(--ink-70);
  -webkit-text-fill-color: var(--ink-70);
  border: 1px solid rgba(244,246,251,0.3);
  border-radius: 4px;
  padding: 1px 7px; margin-top: 3px;
}
.panel-hint { margin-top: 12px; font-size: 11px; color: var(--ink-70); }

#equip-row { display: flex; gap: 10px; margin-bottom: 14px; }
.equip-slot {
  position: relative;
  width: 64px; height: 64px;
  border-radius: 9px;
  background: rgba(7, 27, 89, 0.55);
  border: 1px dashed rgba(61, 123, 255, 0.45);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.equip-slot.filled { border-style: solid; }
.eq-label {
  position: absolute; bottom: -16px; left: 50%;
  transform: translateX(-50%);
  font-size: 10px; color: var(--ink-70);
}

#inv-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 18px;
}
.inv-slot {
  aspect-ratio: 1;
  border-radius: 7px;
  background: rgba(7, 27, 89, 0.5);
  border: 1px solid rgba(61, 123, 255, 0.25);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.inv-slot:hover, .equip-slot:hover { background: rgba(61, 123, 255, 0.22); }
.inv-slot canvas, .equip-slot canvas { display: block; pointer-events: none; }

.rarity-common { border-color: rgba(244,246,251,0.4); }
.rarity-magic { border-color: var(--magic); box-shadow: 0 0 7px rgba(111,168,255,0.35); }
.rarity-rare { border-color: var(--rare); box-shadow: 0 0 7px rgba(242,207,99,0.35); }
.rarity-unique { border-color: var(--unique); box-shadow: 0 0 9px rgba(232,150,75,0.45); }

#char-stats { font-size: 13px; }
#char-stats > div {
  display: flex; justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid rgba(61, 123, 255, 0.15);
}
#char-stats dt { color: var(--ink-70); }
#char-stats dd { font-weight: 600; }

/* ── Tooltip ─────────────────────────────────── */
#tooltip {
  position: fixed;
  max-width: 260px;
  padding: 10px 13px;
  background: rgba(2, 8, 30, 0.96);
  border: 1px solid rgba(61, 123, 255, 0.5);
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.55;
  z-index: 50;
  pointer-events: none;
  box-shadow: 0 6px 24px rgba(0,0,0,0.8);
}
#tooltip .tt-name { font-family: var(--font-display); font-weight: 700; font-size: 13px; }
#tooltip .tt-common { color: var(--mist); }
#tooltip .tt-magic { color: var(--magic); }
#tooltip .tt-rare { color: var(--rare); }
#tooltip .tt-unique { color: var(--unique); }
#tooltip .tt-type { color: var(--ink-70); font-size: 11px; margin-bottom: 4px; }
#tooltip .tt-stat { color: #9fc4ff; }
#tooltip .tt-hint { color: var(--ink-70); font-size: 10px; margin-top: 5px; }

/* ── Velká mapa ──────────────────────────────── */
#map-overlay {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px;
  background: rgba(2, 6, 23, 0.72);
  z-index: 40;
}
#map-overlay p { font-size: 12px; color: var(--ink-70); }
#bigmap {
  border: 1px solid rgba(61, 123, 255, 0.5);
  border-radius: 10px;
  background: rgba(4, 15, 51, 0.9);
  max-width: min(90vw, 80vh);
  max-height: min(90vw, 80vh);
}

/* ── Overlaye (menu / smrt / pauza) ──────────── */
.overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(24, 182, 246, 0.10), transparent 45%),
    radial-gradient(ellipse at 85% 85%, rgba(106, 63, 245, 0.14), transparent 50%),
    rgba(4, 10, 33, 0.93);
  z-index: 60;
}
.menu-box {
  text-align: center;
  max-width: 460px;
  padding: 30px;
}
.brand-mark {
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.34em;
  color: var(--azure);
  margin-bottom: 20px;
}
.brand-dot { color: var(--violet); margin: 0 4px; }
.game-title {
  font-family: var(--font-display);
  font-size: clamp(48px, 8vw, 76px);
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  white-space: nowrap;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 26px rgba(61, 123, 255, 0.35));
}
.death-title, .pause-title {
  font-family: var(--font-display);
  font-size: 42px; font-weight: 800;
}
.death-title { color: #e4576a; }
.game-sub {
  margin: 16px 0 24px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-70);
}
.best-line {
  margin: -10px 0 20px;
  font-size: 13px; font-weight: 600;
  color: var(--gold);
}
.btn-primary {
  display: block;
  width: 100%;
  padding: 15px 30px;
  border: none;
  border-radius: 11px;
  background: var(--grad);
  color: #fff;
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 6px 26px rgba(61, 123, 255, 0.4);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 9px 32px rgba(61, 123, 255, 0.55); }
.btn-ghost {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 12px 30px;
  border: 1px solid rgba(61, 123, 255, 0.5);
  border-radius: 11px;
  background: transparent;
  color: var(--mist);
  font-family: var(--font-display);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease;
}
.btn-ghost:hover { background: rgba(61, 123, 255, 0.16); }

.controls-help {
  margin-top: 26px;
  padding: 16px 20px;
  text-align: left;
  background: rgba(7, 27, 89, 0.45);
  border: 1px solid rgba(61, 123, 255, 0.3);
  border-radius: 11px;
}
.controls-help h3 {
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--azure);
  margin-bottom: 9px;
}
.controls-help ul { list-style: none; font-size: 13px; line-height: 1.9; color: var(--ink-70); }
.controls-help b { color: var(--mist); font-weight: 600; }

.menu-footer {
  margin-top: 24px;
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  font-size: 11px;
  color: rgba(244,246,251,0.5);
}
.menu-footer img { opacity: 0.9; }

/* ── Rychlá tlačítka vpravo dole ─────────────── */
#hud-buttons {
  position: fixed; right: 12px; bottom: 14px;
  display: flex; flex-direction: column; gap: 6px;
  z-index: 21;
}
.hud-btn {
  position: relative;
  width: 44px; height: 40px;
  border: 1px solid rgba(61, 123, 255, 0.4);
  border-radius: 8px;
  background: rgba(4, 15, 51, 0.88);
  color: var(--mist);
  cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1px;
  padding: 3px 2px;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.hud-btn:hover { background: rgba(61, 123, 255, 0.25); border-color: var(--azure); }
.hb-key {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 800;
  line-height: 1;
}
.hb-label { font-size: 6.5px; letter-spacing: 0.04em; color: var(--ink-70); text-transform: uppercase; }
.hb-badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  background: linear-gradient(120deg, #6A3FF5, #3D7BFF);
  font-size: 10px; font-weight: 700; line-height: 16px;
  text-align: center;
  padding: 0 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

/* ── Sledování úkolů pod minimapou ───────────── */
#quest-tracker {
  position: fixed; top: 184px; right: 14px;
  width: 160px;
  display: flex; flex-direction: column; gap: 4px;
  z-index: 19;
  pointer-events: none;
}
.qt-row {
  padding: 5px 9px;
  background: rgba(4, 15, 51, 0.82);
  border-left: 2px solid var(--gold);
  border-radius: 4px;
  font-size: 10.5px; line-height: 1.4;
}
.qt-row .qt-name { font-weight: 700; color: var(--gold); }
.qt-row .qt-progress { color: var(--ink-70); }

/* ── Panel dovedností ────────────────────────── */
#skill-panel {
  left: 50%; transform: translate(-50%, -50%);
  width: min(880px, 94vw);
  max-height: 86vh;
  overflow-y: auto;
}
#skill-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
#skill-points-label {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
  color: var(--gold);
}
.btn-mini {
  padding: 5px 12px;
  border: 1px solid rgba(61, 123, 255, 0.5);
  border-radius: 7px;
  background: transparent;
  color: var(--mist);
  font-size: 11px; font-weight: 600;
  cursor: pointer;
}
.btn-mini:hover { background: rgba(61, 123, 255, 0.2); }
#skill-trees {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 10px;
}
.skill-tree { min-width: 0; }
.skill-tree h3 {
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 2px solid currentColor;
}
.skill-tree .tree-points {
  float: right;
  font-size: 10px;
  color: var(--ink-70);
}
.skill-node {
  position: relative;
  display: flex; gap: 7px;
  align-items: flex-start;
  padding: 7px 6px;
  border-radius: 8px;
  border: 1px solid rgba(61, 123, 255, 0.18);
  background: rgba(7, 27, 89, 0.35);
  margin-bottom: 6px;
}
.skill-node.locked { opacity: 0.45; }
.skill-node.maxed { border-color: rgba(232, 184, 75, 0.55); }
.skill-node canvas { flex-shrink: 0; margin-top: 2px; }
.sn-body { min-width: 0; flex: 1; }
.sn-name { font-size: 11px; font-weight: 700; line-height: 1.25; }
.sn-rank { font-size: 10px; color: var(--gold); font-weight: 600; }
.sn-desc { font-size: 9.5px; color: var(--ink-70); line-height: 1.35; margin-top: 2px; }
.sn-req { font-size: 9px; color: #d8956b; margin-top: 2px; }
.sn-plus {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border: none;
  border-radius: 6px;
  background: var(--grad);
  color: #fff;
  font-size: 13px; font-weight: 800; line-height: 1;
  cursor: pointer;
  margin-top: 2px;
}
.sn-plus:disabled { opacity: 0.25; cursor: default; }

/* ── Panel úkolů ─────────────────────────────── */
#quest-panel { right: 24px; width: 330px; }
.quest-item {
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid rgba(232, 184, 75, 0.35);
  background: rgba(7, 27, 89, 0.4);
  margin-bottom: 8px;
}
.quest-item .q-name { font-weight: 700; font-size: 13px; color: var(--gold); }
.quest-item .q-desc { font-size: 11.5px; color: var(--ink-70); margin: 3px 0; }
.q-bar {
  height: 6px;
  background: rgba(4, 15, 51, 0.9);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 5px;
}
.q-bar-fill { height: 100%; background: linear-gradient(90deg, #E8B84B, #F2CF63); }
.q-progress-text { font-size: 10px; color: var(--ink-70); margin-top: 3px; }
.quest-empty { font-size: 12px; color: var(--ink-70); }

/* ── Obchod ──────────────────────────────────── */
.shop-box {
  width: min(760px, 94vw);
  max-height: 86vh;
  background: rgba(4, 15, 51, 0.96);
  border: 1px solid rgba(61, 123, 255, 0.45);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.7);
  display: flex; flex-direction: column;
}
.shop-header {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 16px;
}
.shop-header h2 {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  flex: 1;
}
#shop-gold { font-family: var(--font-display); font-weight: 700; color: var(--gold); }
.shop-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; overflow: hidden; }
.shop-col { min-width: 0; display: flex; flex-direction: column; }
.shop-col h3 {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--azure);
  margin-bottom: 10px;
}
.shop-hint { font-size: 10px; color: var(--ink-70); font-weight: 400; text-transform: none; letter-spacing: 0; }
.shop-grid { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; max-height: 58vh; padding-right: 4px; }
.shop-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(61, 123, 255, 0.2);
  background: rgba(7, 27, 89, 0.4);
  cursor: pointer;
}
.shop-row:hover { background: rgba(61, 123, 255, 0.2); }
.shop-row.rarity-magic { border-color: var(--magic); }
.shop-row.rarity-rare { border-color: var(--rare); }
.shop-row.rarity-unique { border-color: var(--unique); }
.shop-row canvas { flex-shrink: 0; }
.shop-row .sr-body { flex: 1; min-width: 0; }
.shop-row .sr-name { font-size: 12px; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-row .sr-name.rarity-magic { color: var(--magic); }
.shop-row .sr-name.rarity-rare { color: var(--rare); }
.shop-row .sr-name.rarity-unique { color: var(--unique); }
.shop-row .sr-sub { font-size: 10px; color: var(--ink-70); }
.shop-row .sr-price { font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--gold); white-space: nowrap; }
.shop-row.disabled { opacity: 0.45; cursor: default; }
.shop-empty { font-size: 12px; color: var(--ink-70); padding: 8px; }

/* ── Dialog NPC ──────────────────────────────── */
.dialog-box { max-width: 420px; }
#dialog-name {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.dialog-greet {
  margin: 12px 0 18px;
  font-size: 14px;
  font-style: italic;
  color: var(--ink-70);
}
.dialog-quest {
  text-align: left;
  padding: 13px 16px;
  border-radius: 10px;
  border: 1px solid rgba(232, 184, 75, 0.4);
  background: rgba(7, 27, 89, 0.5);
  margin-bottom: 18px;
  font-size: 13px;
  line-height: 1.5;
}
.dialog-quest .dq-name { font-weight: 700; color: var(--gold); font-size: 14px; }
.dialog-quest .dq-reward { color: #9fc4ff; font-size: 12px; margin-top: 6px; }

#fade {
  position: fixed; inset: 0;
  background: #02061A;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 55;
}
#fade.on { opacity: 1; }
