/* Trollrreria — UI styles (arcade dark chrome, gold accents). */

:root {
  --tt-bg: #0a0616;
  --tt-panel: rgba(16, 10, 34, 0.92);
  --tt-line: rgba(255, 255, 255, 0.12);
  --tt-gold: #ffb300;
  --tt-text: #efeaff;
  --tt-muted: #9a92b8;
  --tt-danger: #ff4d5e;
  --slot: 46px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--tt-bg); color: var(--tt-text);
  font-family: "DM Sans", system-ui, sans-serif;
  overflow: hidden;
}
#tt-root { position: fixed; inset: 0; }
#tt-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  image-rendering: pixelated; cursor: default; display: block;
}
/* crosshair only while a tool/weapon is actively equipped (aiming);
   bare-handed/unequipped keeps the plain arrow so the state reads at a glance */
#tt-canvas.tt-equipped { cursor: crosshair; }

/* ------------------------------------------------------------------ HUD */
#hud { position: absolute; inset: 0; pointer-events: none; }

#hud-hearts {
  position: absolute; top: 12px; left: 14px;
  display: flex; gap: 4px; flex-wrap: wrap; max-width: 300px;
}
.heart { width: 20px; height: 20px; font-size: 17px; line-height: 20px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.heart.empty { opacity: 0.25; filter: grayscale(1); }

#hud-hunger {
  position: absolute; top: 40px; left: 14px;
  display: flex; gap: 4px; flex-wrap: wrap; max-width: 300px;
}
.hunger { width: 18px; height: 18px; font-size: 15px; line-height: 18px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.hunger.empty { opacity: 0.25; filter: grayscale(1); }
.hunger.starving { animation: hunger-pulse 0.9s ease-in-out infinite; }
@keyframes hunger-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

#hud-breath { position: absolute; top: 68px; left: 14px; display: flex; gap: 3px; }
.bubble { width: 12px; height: 12px; border-radius: 50%; background: #7cc4ff; box-shadow: 0 0 4px #7cc4ff88; }

#hud-status {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 14px; font-family: "DM Mono", monospace; font-size: 13px;
  background: rgba(0,0,0,0.45); padding: 5px 14px; border-radius: 999px;
  border: 0.5px solid var(--tt-line);
}
#hud-depth { color: var(--tt-muted); }

#hud-stations {
  position: absolute; top: 42px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; font-family: "DM Mono", monospace; font-size: 12px;
}
#hud-stations[hidden] { display: none; }
.station-chip {
  background: rgba(0,0,0,0.5); border: 0.5px solid var(--tt-line);
  border-radius: 999px; padding: 3px 10px; color: var(--tt-text);
}

#hotbar {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  display: flex; gap: 6px; pointer-events: auto;
}

#minimap {
  position: absolute; top: 12px; right: 14px;
  border: 0.5px solid var(--tt-line); border-radius: 8px;
  background: rgba(0,0,0,0.5); image-rendering: pixelated;
}

.hud-hotkeys-btn {
  position: absolute; top: 144px; right: 14px;
  width: 30px; height: 30px; pointer-events: auto;
  border: 0.5px solid var(--tt-line); border-radius: 50%;
  background: rgba(0,0,0,0.5); color: var(--tt-text);
  font: 800 14px "DM Sans", sans-serif; cursor: pointer;
}
.hud-hotkeys-btn:hover { border-color: var(--tt-gold); color: var(--tt-gold); }
.hud-travel-btn { top: 182px; }

#travel-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
#pylon-panel {
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(340px, 90vw); max-height: 70vh; overflow-y: auto;
}
#pylon-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.travel-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 0.5px solid var(--tt-line); border-radius: 8px;
  background: rgba(255,255,255,0.03); color: var(--tt-text);
  font: 600 13px "DM Sans", sans-serif; cursor: pointer; text-align: left;
}
.travel-row:hover { border-color: var(--tt-gold); color: var(--tt-gold); }

/* ------------------------------------------------------------ quest tracker */
#quest-tracker {
  position: absolute; top: 66px; left: 14px; width: 240px;
  background: rgba(10, 6, 26, 0.72); border: 0.5px solid var(--tt-line);
  border-left: 3px solid #57e87a; border-radius: 10px;
  padding: 9px 12px; pointer-events: none;
  backdrop-filter: blur(4px);
}
#quest-tracker[hidden] { display: none; }
#quest-title {
  font: 800 12px "DM Sans", sans-serif; letter-spacing: 0.02em;
  color: #57e87a; margin-bottom: 5px;
}
#quest-objectives { display: flex; flex-direction: column; gap: 3px; }
.quest-obj {
  font-family: "DM Mono", monospace; font-size: 11px; color: var(--tt-muted);
  display: flex; justify-content: space-between; gap: 8px;
}
.quest-obj.done { color: var(--tt-text); text-decoration: line-through; opacity: 0.6; }

/* ------------------------------------------------------------- area title */
#area-title {
  position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%);
  text-align: center; pointer-events: none; z-index: 15;
  font: 900 26px "DM Sans", sans-serif; letter-spacing: 0.1em;
  color: var(--tt-gold); text-shadow: 0 3px 14px rgba(0,0,0,0.7), 0 1px 0 #7a4e00;
  opacity: 0; transition: opacity 0.6s ease;
}
#area-title.show { opacity: 1; transition: opacity 0.25s ease; }
#area-title[hidden] { display: none; }

#hotkeys-panel { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(420px, 92vw); }
#hotkeys-panel[hidden] { display: none; }
#hotkeys-panel .menu-controls { margin: 6px 0 12px; }
#hotkeys-panel .btn-ghost { padding: 8px 14px; }

#bigmap {
  position: absolute; inset: 0; margin: auto;
  border: 0.5px solid var(--tt-line); border-radius: 12px;
  background: rgba(4, 2, 12, 0.96); z-index: 40;
}

/* ----------------------------------------------------------------- slots */
.slot {
  width: var(--slot); height: var(--slot);
  background: rgba(10, 6, 26, 0.82);
  border: 1px solid var(--tt-line); border-radius: 9px;
  position: relative; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: center;
}
.slot:hover { border-color: rgba(255, 179, 0, 0.55); }
.slot.sel { border-color: var(--tt-gold); box-shadow: 0 0 8px rgba(255, 179, 0, 0.35); }
.slot.unequipped { border-color: var(--tt-gold); opacity: 0.55; }
.slot canvas { width: 36px; height: 36px; image-rendering: pixelated; pointer-events: none; }
.slot .n {
  position: absolute; right: 4px; bottom: 2px; font-size: 11px;
  font-family: "DM Mono", monospace; color: #fff;
  text-shadow: 0 1px 2px #000, 0 0 3px #000; pointer-events: none;
}
.slot .k {
  position: absolute; left: 4px; top: 2px; font-size: 9px;
  color: var(--tt-muted); pointer-events: none;
}
.slot-trash { font-size: 19px; opacity: 0.8; }

/* ---------------------------------------------------------------- panels */
.tt-panel {
  position: absolute; z-index: 30;
  background: var(--tt-panel);
  border: 0.5px solid var(--tt-line); border-radius: 14px;
  padding: 14px 16px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
}
.tt-panel h3 {
  margin: 0 0 8px; font-size: 12px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--tt-muted);
}

#inv-panel {
  top: 64px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 18px; max-height: calc(100vh - 160px);
}
#inv-panel[hidden] { display: none; }
.inv-left { width: 250px; display: flex; flex-direction: column; }
#craft-list { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 4px; }
.craft-row {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px;
  border-radius: 8px; border: 1px solid transparent; cursor: pointer;
  background: rgba(255,255,255,0.03);
}
.craft-row:hover { border-color: rgba(255,179,0,0.5); }
.craft-row.cant { opacity: 0.38; }
.craft-row canvas { width: 28px; height: 28px; image-rendering: pixelated; flex: none; }
.craft-row .cr-name { font-size: 13px; font-weight: 700; }
.craft-row .cr-ing { font-size: 11px; color: var(--tt-muted); font-family: "DM Mono", monospace; }

#craft-grid-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
#craft-grid { display: grid; grid-template-columns: repeat(3, var(--slot)); gap: 5px; }
.craft-arrow { font-size: 18px; color: var(--tt-muted); flex: none; }
#craft-output.has-result { border-color: var(--tt-gold); box-shadow: 0 0 8px rgba(255, 179, 0, 0.35); }

#inv-grid { display: grid; grid-template-columns: repeat(10, var(--slot)); gap: 6px; }
.inv-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
#armor-col { display: flex; gap: 6px; }
#accessory-col { display: flex; gap: 6px; }
.slot-armor::before {
  content: attr(data-ph); position: absolute; font-size: 15px; opacity: 0.3;
}

#chest-panel { bottom: 84px; left: 50%; transform: translateX(-50%); }
#chest-panel[hidden] { display: none; }
#chest-grid { display: grid; grid-template-columns: repeat(8, var(--slot)); gap: 6px; }

#enchant-panel { bottom: 84px; left: 50%; transform: translateX(-50%); width: min(300px, 92vw); text-align: center; }
#enchant-panel[hidden] { display: none; }
#enchant-slot-wrap { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0 10px; }
#enchant-status { margin-bottom: 10px; }

#shop-panel { bottom: 84px; left: 50%; transform: translateX(-50%); width: min(360px, 92vw); }
#shop-panel[hidden] { display: none; }
#shop-list { display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow-y: auto; }
#shop-panel .btn-ghost { margin-top: 8px; font-size: 13px; }
.shop-row { justify-content: space-between; }
.shop-row .cr-get { display: flex; align-items: center; gap: 6px; }

#cursor-item { position: fixed; z-index: 60; pointer-events: none; }
#cursor-item canvas { width: 38px; height: 38px; image-rendering: pixelated; filter: drop-shadow(0 2px 4px rgba(0,0,0,.7)); }
#cursor-item .n { position: absolute; right: 0; bottom: -2px; font-size: 11px; font-family: "DM Mono", monospace; text-shadow: 0 1px 2px #000; }

#tooltip {
  position: fixed; z-index: 70; pointer-events: none;
  background: rgba(6, 3, 16, 0.95); border: 0.5px solid var(--tt-line);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; max-width: 240px;
}
#tooltip .tip-name { font-weight: 700; }
#tooltip .tip-sub { color: var(--tt-muted); font-size: 11px; }

/* ---------------------------------------------------------------- dialog */
#dialog {
  bottom: 90px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 12px; align-items: flex-start; max-width: 440px;
}
#dialog[hidden] { display: none; }
#dialog-face {
  width: 56px; height: 56px; border-radius: 12px; flex: none;
  background: rgba(255,255,255,0.06); border: 0.5px solid var(--tt-line);
  display: flex; align-items: center; justify-content: center; font-size: 30px;
  overflow: hidden;
}
#dialog-face img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
#dialog p { margin: 4px 0 10px; font-size: 14px; line-height: 1.45; }
#dialog button {
  font: 700 12px "DM Sans", sans-serif; padding: 6px 12px; margin-right: 6px;
  border-radius: 8px; border: 1px solid var(--tt-line);
  background: rgba(255,255,255,0.06); color: var(--tt-text); cursor: pointer;
}
#dialog button:hover { border-color: var(--tt-gold); }

/* --------------------------------------------------------------- boss bar */
#boss-bar {
  position: absolute; left: 50%; bottom: 78px; transform: translateX(-50%);
  width: min(520px, 80vw); text-align: center; pointer-events: none; z-index: 20;
}
#boss-name {
  font: 900 14px "DM Sans", sans-serif; letter-spacing: 0.18em; color: var(--tt-danger);
  text-shadow: 0 1px 3px #000;
}
.boss-track {
  height: 12px; margin-top: 4px; border-radius: 999px; overflow: hidden;
  background: rgba(0,0,0,0.55); border: 0.5px solid var(--tt-line);
}
#boss-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff4d5e, #ff9500); transition: width 0.15s; }

/* ---------------------------------------------------------------- screens */
.screen {
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 2, 14, 0.78); backdrop-filter: blur(5px);
}
.screen[hidden] { display: none; }

.menu-panel {
  width: min(420px, 92vw); text-align: center;
  background: var(--tt-panel); border: 0.5px solid var(--tt-line);
  border-radius: 18px; padding: 30px 26px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7);
}
.logo { margin-bottom: 18px; }
.logo-troll {
  display: block; font-size: 34px; font-weight: 900; letter-spacing: 0.06em;
  color: var(--tt-gold); text-shadow: 0 3px 0 #7a4e00, 0 6px 18px rgba(255, 179, 0, 0.35);
}
.logo-sub {
  display: block; margin-top: 4px; font-family: "DM Mono", monospace;
  font-size: 12px; letter-spacing: 0.3em; color: var(--tt-muted); text-transform: uppercase;
}
.dialog-title { margin: 0 0 14px; font-size: 24px; font-weight: 900; letter-spacing: 0.1em; }
.dialog-title.is-danger { color: var(--tt-danger); }
.dialog-actions { display: flex; flex-direction: column; gap: 9px; margin: 8px 0 14px; }

.btn-primary, .btn-secondary, .btn-ghost {
  font: 800 15px "DM Sans", sans-serif; padding: 12px 18px;
  border-radius: 11px; cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: var(--tt-gold); color: #241600; box-shadow: 0 4px 0 #7a4e00; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #7a4e00; }
.btn-secondary { background: rgba(255,255,255,0.08); color: var(--tt-text); border-color: var(--tt-line); }
.btn-secondary:hover { border-color: var(--tt-gold); }
.btn-ghost { background: transparent; color: var(--tt-muted); border-color: transparent; }
.btn-ghost:hover { color: var(--tt-text); }
.is-danger-text { color: var(--tt-danger); }

.coop-row { display: flex; gap: 7px; }
.coop-row .btn-secondary { flex: 1; padding: 10px 8px; font-size: 13px; }
#coop-code {
  width: 74px; text-align: center; text-transform: uppercase;
  font: 700 14px "DM Mono", monospace; letter-spacing: 0.12em;
  background: rgba(10, 6, 26, 0.82); color: var(--tt-gold);
  border: 1px solid var(--tt-line); border-radius: 11px;
}
#coop-code:focus { outline: none; border-color: var(--tt-gold); }
#hud-coop { color: #7cc4ff; }
#hud-buff { color: #ffd23c; }

.menu-controls {
  display: flex; flex-direction: column; gap: 5px; margin: 12px 0;
  font-size: 12px; color: var(--tt-muted);
}
kbd {
  font: 600 10px "DM Mono", monospace; background: rgba(255,255,255,0.09);
  border: 0.5px solid var(--tt-line); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 5px; margin: 0 1px;
}
.menu-back { color: var(--tt-muted); font-size: 13px; text-decoration: none; }
.menu-back:hover { color: var(--tt-gold); }

.death-cause { color: var(--tt-danger); font-weight: 700; margin: 0 0 6px; }
.death-note { color: var(--tt-muted); font-size: 13px; margin: 0; }

.vol-row {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  font-size: 13px; color: var(--tt-muted);
}
.vol-row input { accent-color: var(--tt-gold); width: 150px; }

/* leaderboard screen reuses the arcade engine styles; just size the shell */
.lb-panel {
  width: min(560px, 94vw); max-height: 86vh; overflow-y: auto;
  background: var(--tt-panel); border: 0.5px solid var(--tt-line);
  border-radius: 18px; padding: 18px 20px;
}
.lb-panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.lb-panel-head h2 { margin: 0; font-size: 18px; letter-spacing: 0.14em; }
.char-back {
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  background: rgba(255,255,255,0.07); border: 0.5px solid var(--tt-line);
  color: var(--tt-text); font-size: 16px;
}

@media (max-width: 720px) {
  :root { --slot: 40px; }
  #inv-panel { flex-direction: column; top: 12px; overflow-y: auto; }
  .inv-left { width: auto; }
  #inv-grid { grid-template-columns: repeat(5, var(--slot)); }
  #minimap { display: none; }
}

/* ---------------------------------------------------------- touch UI */
#touch-ui { position: absolute; inset: 0; pointer-events: none; z-index: 25; }
#touch-ui[hidden] { display: none; }
.tc-cluster {
  position: absolute; bottom: 86px; display: flex; gap: 12px;
  align-items: flex-end; pointer-events: auto;
}
.tc-left { left: 14px; }
.tc-right { right: 14px; flex-direction: row-reverse; }
.tc-btn {
  width: 58px; height: 58px; border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(16, 10, 34, 0.55); color: var(--tt-text);
  font-size: 22px; touch-action: none; user-select: none;
  backdrop-filter: blur(3px);
}
.tc-btn.on { background: rgba(255, 179, 0, 0.4); border-color: var(--tt-gold); }
.tc-jump { width: 66px; height: 66px; }
.tc-small { width: 44px; height: 44px; font-size: 17px; }
@media (pointer: fine) and (min-width: 900px) { /* keyboard users keep a clean HUD */ }
