/* Tideglass Hunt HUD — ornate navy field gear, layered after the base game CSS. */
:root {
  --hud-ink: #061522;
  --hud-navy: #0a2638;
  --hud-navy-hi: #123e55;
  --hud-brass: #b99255;
  --hud-brass-hi: #f0d39a;
  --hud-brass-deep: #5c3c20;
  --hud-cyan: #63eaff;
  --hud-cyan-deep: #087da1;
  --hud-ivory: #f5ead4;
  --hud-muted: #b9cbd0;
  --hud-panel: linear-gradient(180deg, rgba(10, 37, 54, .96), rgba(5, 20, 32, .97));
  --hud-shadow: 0 10px 26px rgba(0, 7, 12, .7), inset 0 0 0 1px rgba(114, 226, 245, .1);
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--hud-cyan);
  outline-offset: 3px;
}

.hud-icon {
  display: inline-block;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 1px 2px #02070a);
}

.hud-crystal,
.belt-crystal {
  display: block;
  width: 22px;
  height: 30px;
  border: 2px solid var(--hud-brass-hi);
  background: linear-gradient(135deg, #d8fbff 0 18%, #3fdcf7 20% 52%, #087898 55% 78%, #b9f8ff 80%);
  clip-path: polygon(50% 0, 100% 45%, 72% 100%, 28% 100%, 0 45%);
  box-shadow: 0 0 16px rgba(79, 225, 255, .72);
}

#prototype-notice {
  top: 8px;
  width: max-content;
  min-width: 0;
  max-width: calc(100vw - 660px);
  padding: 6px 26px;
  color: var(--hud-ivory);
  background: linear-gradient(180deg, rgba(17, 59, 78, .94), rgba(7, 29, 44, .96));
  border: 1px solid var(--hud-brass);
  clip-path: polygon(4% 0, 96% 0, 100% 50%, 96% 100%, 4% 100%, 0 50%);
  text-align: center;
  letter-spacing: .13em;
  white-space: nowrap;
  box-shadow: var(--hud-shadow);
}
#prototype-notice button {
  display: inline-block;
  margin: 0 0 0 10px;
  padding: 3px 8px;
  white-space: nowrap;
  font-size: 9px;
}

#hud {
  top: 26px;
  left: 28px;
  right: 28px;
  align-items: flex-start;
  gap: 0;
  z-index: 12;
}

.hero-crest {
  position: relative;
  width: 154px;
  height: 174px;
  flex: 0 0 auto;
  z-index: 2;
}

#hero-portrait {
  position: absolute;
  inset: 8px 10px 22px;
  overflow: hidden;
  border: 4px solid var(--hud-brass-hi);
  border-radius: 50% 50% 44% 44%;
  background-color: #102c3d;
  background-position: center 15%;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: 0 0 0 5px #163e54, 0 0 0 8px var(--hud-brass-deep), 0 8px 22px #000c;
}

.hero-crest::before,
.hero-crest::after {
  content: "";
  position: absolute;
  top: 0;
  width: 35px;
  height: 48px;
  z-index: 3;
  background: linear-gradient(135deg, var(--hud-brass-hi), var(--hud-brass-deep));
  clip-path: polygon(50% 0, 100% 100%, 60% 78%, 50% 100%, 40% 78%, 0 100%);
}
.hero-crest::before { left: 8px; transform: rotate(-32deg); }
.hero-crest::after { right: 8px; transform: rotate(32deg); }

.hero-level {
  position: absolute;
  left: 36px;
  right: 36px;
  bottom: 0;
  padding: 4px 8px;
  color: var(--hud-ivory);
  background: var(--hud-panel);
  border: 2px solid var(--hud-brass);
  clip-path: polygon(10% 0, 90% 0, 100% 50%, 90% 100%, 10% 100%, 0 50%);
  text-align: center;
  font: 700 14px 'Cormorant Garamond', Georgia, serif;
  letter-spacing: .08em;
}

.hero-readout {
  width: min(390px, 31vw);
  margin: 18px 0 0 -4px;
}

.brand {
  margin: 0 0 5px 16px;
  color: var(--hud-ivory);
  font-size: 18px;
  letter-spacing: .09em;
}
.brand span { display: inline; margin-left: 9px; letter-spacing: .18em; color: var(--hud-cyan); }

.vitals { width: 100%; }
.barlabel {
  margin: 0 14px 4px;
  color: var(--hud-ivory);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .08em;
}
.stamina-label,
.xp-label { margin-top: 6px; color: var(--hud-ivory); font-size: 10px; }

.bar {
  height: 22px;
  border: 2px solid var(--hud-brass-hi);
  background: #07111b;
  transform: none;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%);
  box-shadow: inset 0 0 0 2px #2b1e16;
}
.bar i { box-shadow: inset 0 3px 4px rgba(255,255,255,.25), inset 0 -3px 6px rgba(0,0,0,.45); }
.bar.life i { background: linear-gradient(90deg, #7e1626, #d83550 65%, #ff6981); }
.bar.energy { height: 14px; margin-top: 0; border: 2px solid var(--hud-brass-hi); }
.bar.energy i { background: linear-gradient(90deg, #075d8d, #13a9e1 68%, #7decff); }
.bar.xp { height: 11px; margin-top: 0; border: 2px solid var(--hud-brass); }
.bar.xp i { background: linear-gradient(90deg, #90621e, #e7b84b 68%, #fff09a); }

#match-timer-box {
  position: relative;
  width: 270px;
  margin: 18px 0 0 auto;
  padding: 12px 28px 10px 64px;
  background: var(--hud-panel);
  border: 2px solid var(--hud-brass);
  clip-path: polygon(9% 0, 91% 0, 100% 50%, 91% 100%, 9% 100%, 0 50%);
  text-align: center;
  box-shadow: var(--hud-shadow);
}
#match-timer-box::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(99, 234, 255, .38);
  clip-path: inherit;
  pointer-events: none;
}
#match-timer-box .hud-crystal { position: absolute; left: 24px; top: 50%; transform: translateY(-50%); }
#match-timer-box .eyebrow { color: var(--hud-ivory); font-size: 10px; letter-spacing: .17em; }
#match-timer { color: var(--hud-ivory); font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
#arena-clock { margin-top: 4px; color: #ff9e83; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
#arena-clock[hidden] { display: none; }
#arena-runeblessed { margin-top: 2px; color: #b98cff; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
#arena-runeblessed[hidden] { display: none; }

#scoreboard,
#offer-panel,
#bag-panel,
#build-panel,
#minimap-frame {
  background: var(--hud-panel);
  border: 2px solid var(--hud-brass);
  border-radius: 2px;
  box-shadow: var(--hud-shadow);
}

#scoreboard {
  top: 125px;
  right: 28px;
  width: 270px;
  padding: 13px 16px 14px;
  color: var(--hud-ivory);
}
.board-header {
  margin: -3px 0 8px;
  padding: 0 4px 8px;
  border-bottom: 1px solid var(--hud-cyan-deep);
  color: var(--hud-ivory);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  font-weight: 700;
}
.board-row { min-height: 27px; padding: 4px; border-bottom: 1px solid rgba(99, 234, 255, .1); font-size: 13px; }
.board-row.me { color: #ffe1a2; background: linear-gradient(90deg, rgba(185,146,85,.18), transparent); }
.board-portrait {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 1px solid var(--hud-brass-hi);
  border-radius: 50%;
  background-position: center 18%;
  background-size: cover;
  box-shadow: 0 0 0 2px #183b4b;
}
.board-name { margin-right: auto; padding-left: 8px; }

#inventory-stack {
  position: absolute;
  left: 28px;
  bottom: 78px;
  z-index: 20;
  display: flex;
  width: 286px;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}
#inventory-stack #bag-panel,
#inventory-stack #build-panel {
  position: relative;
  inset: auto;
  width: 100%;
  font-size: 11px;
}
.panel-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 5px 38px;
  color: var(--hud-ivory);
  background: linear-gradient(180deg, #17506b, #0b2d43);
  border: 0;
  border-bottom: 1px solid var(--hud-brass);
  clip-path: polygon(8% 0, 92% 0, 100% 50%, 92% 100%, 8% 100%, 0 50%);
  font: 700 18px 'Cormorant Garamond', Georgia, serif;
  letter-spacing: .08em;
  text-align: center;
}
.panel-toggle .hud-icon { width: 22px; height: 22px; }
.toggle-caret { margin-left: auto; color: var(--hud-cyan); font: 12px Manrope, sans-serif; }
.panel-body { padding: 11px 13px 12px; }
.bag-equipped { justify-content: flex-start; min-height: 38px; gap: 8px; color: var(--hud-ivory); }
.bag-equipped .build-label { margin-right: auto; }
.bag-equipped .hud-icon { width: 32px; height: 32px; }
.build-label { color: #dfcda9; font-size: 10px; }
.build-list { gap: 6px; }
.build-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 5px 8px;
  color: var(--hud-ivory);
  background: #0a2131;
  border: 1px solid rgba(99,234,255,.38);
  border-radius: 2px;
  font-size: 10px;
}
.build-chip .hud-icon { width: 28px; height: 28px; }
.build-chip-copy { display: inline-flex; min-width: 0; flex-direction: column; line-height: 1.1; }
.build-chip-copy small { margin-top: 2px; color: #e7c37d; font-size: 9px; font-weight: 700; }
.bag-slot { border-color: rgba(185,146,85,.5); background: rgba(2,13,21,.42); }
.bag-slot .hud-icon { width: 34px; height: 34px; }
.bag-slot .bag-item-label { font-size: 11px; line-height: 1.25; }

#skillbar {
  bottom: 22px;
  min-height: 108px;
  gap: 9px;
  align-items: center;
  padding: 10px 34px;
  background: var(--hud-panel);
  border: 3px solid var(--hud-brass);
  clip-path: polygon(4% 0, 96% 0, 100% 50%, 96% 100%, 4% 100%, 0 50%);
  box-shadow: var(--hud-shadow);
}
.belt-crystal { position: absolute; left: 5px; top: 50%; transform: translateY(-50%) rotate(-90deg); }
.belt-crystal-right { right: 5px; left: auto; transform: translateY(-50%) rotate(90deg); }
.skill-slot,
.combat-slot {
  position: relative;
  width: 80px;
  height: 80px;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  padding: 5px 4px 4px;
  overflow: visible;
  border: 2px solid var(--hud-brass-hi);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #17647f, #071722 72%);
  box-shadow: inset 0 0 0 3px #301f15, 0 3px 8px #000c;
}
.skill-slot.ready { border-color: #f4d899; box-shadow: inset 0 0 0 3px #301f15, 0 0 13px rgba(99,234,255,.35); }
.skill-slot .hud-icon,
.combat-slot .hud-icon { width: 46px; height: 46px; }
.skill-key {
  position: absolute;
  top: -15px;
  min-width: 25px;
  padding: 2px 5px;
  color: var(--hud-ivory);
  background: #0a1d2a;
  border: 1px solid var(--hud-brass);
  border-radius: 2px;
  font-size: 10px;
  text-align: center;
}
.skill-name { max-width: 74px; color: var(--hud-ivory); font-size: 11px; font-weight: 600; line-height: 1; text-shadow: 0 1px 2px #000; }
.skill-cd { border-radius: 50%; background: rgba(1,9,15,.72); }
#hud-heavy #cooldown { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%; background: rgba(1,9,15,.68); font-size: 15px; }
#hud-heavy #cooldown:has(#hud-heavy-cd:empty) { display: none; }
#hud-dodge { margin-left: 5px; }
#hud-dodge.exhausted {
  border-color: #9a5d59;
  background: radial-gradient(circle at 50% 35%, #47343a, #120f17 72%);
  box-shadow: inset 0 0 0 3px #271917, 0 0 10px rgba(166, 52, 54, .35);
}
#hud-dodge.exhausted .hud-icon { filter: grayscale(.7) brightness(.65); }
#hud-dodge.exhausted .skill-name { color: #d8a29e; }

#offer-panel {
  top: 295px;
  right: 28px;
  width: 310px;
  padding: 13px;
}
.offer-header {
  align-items: center;
  color: var(--hud-ivory);
  font: 700 17px 'Cormorant Garamond', Georgia, serif;
}
#offer-reroll { color: var(--hud-cyan); border-color: var(--hud-brass); font-size: 10px; }
.offer-card { display: flex; align-items: center; gap: 10px; border-color: rgba(185,146,85,.65); background: rgba(3,18,29,.8); }
.offer-card > .hud-icon { width: 42px; height: 42px; }
.offer-card-copy { min-width: 0; flex: 1; }
.offer-card:hover { background: #123e55; border-color: var(--hud-cyan); }
.offer-card .offer-card-title { color: var(--hud-ivory); }
.offer-card .offer-card-desc { color: var(--hud-muted); line-height: 1.35; }

#minimap-frame {
  position: absolute;
  right: 28px;
  bottom: 24px;
  z-index: 10;
  width: 200px;
  height: 218px;
  padding: 8px;
  pointer-events: none;
}
#minimap-frame::after { content: ""; position: absolute; inset: 5px; border: 1px solid rgba(99,234,255,.25); pointer-events: none; }
#minimap-frame .hud-crystal { position: absolute; top: -17px; left: 50%; z-index: 2; transform: translateX(-50%); }
#minimap-frame #map { position: static; width: 100%; height: 100%; opacity: .95; }

#controls {
  right: 242px;
  bottom: 5px;
  left: auto;
  justify-content: flex-end;
  gap: 6px;
  max-width: 320px;
}
#controls > span { display: none; }
#controls button { margin-left: 0; color: var(--hud-ivory); background: #092235e8; border-color: var(--hud-brass); }

/* Lobby shares the same carved-metal vocabulary without obscuring its form. */
.overlay {
  background:
    radial-gradient(circle at 50% 10%, rgba(27, 111, 137, .28), transparent 38%),
    linear-gradient(100deg, #03101af8, #0b2939ed 50%, #04111bf8);
}
.intro { max-width: 720px; }
.intro h1 { color: var(--hud-ivory); text-shadow: 0 5px 24px #000; }
.intro h1 em { color: var(--hud-cyan); }
#lobby-panel,
#results-panel {
  background: var(--hud-panel);
  border: 2px solid var(--hud-brass);
  box-shadow: var(--hud-shadow);
  clip-path: polygon(3% 0, 97% 0, 100% 7%, 100% 93%, 97% 100%, 3% 100%, 0 93%, 0 7%);
}
.school-option.active,
.lobby-actions button,
#btn-start-match { color: var(--hud-cyan); background: #123b50; border-color: var(--hud-brass-hi); }
.lobby-form input,
.join-box input { border-color: var(--hud-brass); background: #071b29; }

@media (max-width: 1100px) {
  #prototype-notice { max-width: calc(100vw - 40px); }
  #hud { left: 18px; right: 18px; }
  .hero-crest { width: 118px; height: 136px; }
  #hero-portrait { inset: 8px 9px 18px; }
  .hero-level { right: 24px; left: 24px; font-size: 12px; }
  .hero-readout { width: min(330px, 34vw); margin-top: 13px; }
  .brand { font-size: 15px; }
  .brand span { display: none; }
  #match-timer-box { width: 220px; padding-left: 54px; }
  #scoreboard { right: 18px; width: 220px; }
  #offer-panel { top: 350px; right: 18px; width: 276px; max-height: calc(100dvh - 382px); overflow-y: auto; }
  #inventory-stack { left: 18px; bottom: 140px; width: 228px; }
  #minimap-frame { right: 18px; width: 170px; height: 184px; }
  #controls { right: 198px; }
}

@media (max-width: 700px) {
  #prototype-notice { min-width: 0; width: calc(100vw - 20px); max-width: none; padding: 5px 18px; font-size: 8px; }
  #hud { top: 31px; left: 10px; right: 10px; }
  .hero-crest { width: 78px; height: 92px; }
  #hero-portrait { inset: 6px 7px 15px; border-width: 2px; box-shadow: 0 0 0 3px #163e54, 0 0 0 5px var(--hud-brass-deep), 0 5px 12px #000c; }
  .hero-crest::before,
  .hero-crest::after { width: 19px; height: 28px; }
  .hero-level { right: 15px; left: 15px; padding: 2px 4px; font-size: 9px; }
  .hero-readout { width: min(225px, calc(100vw - 166px)); margin-top: 4px; }
  .brand { display: none; }
  .barlabel { margin: 0 7px 2px; font-size: 8px; }
  .bar { height: 12px; border-width: 1px; }
  .bar.energy { height: 8px; border-width: 1px; }
  .bar.xp { height: 7px; border-width: 1px; }
  .stamina-label,
  .xp-label { margin-top: 3px; font-size: 7px; }
  #match-timer-box { width: 82px; margin-top: 3px; padding: 8px 6px; border-width: 1px; clip-path: polygon(8% 0, 92% 0, 100% 50%, 92% 100%, 8% 100%, 0 50%); }
  #match-timer-box .hud-crystal,
  #match-timer-box .eyebrow { display: none; }
  #match-timer { font-size: 20px; }
  #scoreboard { top: 128px; right: 10px; width: 170px; max-height: 116px; overflow: hidden; padding: 8px; font-size: 9px; }
  .board-header { margin-bottom: 4px; padding-bottom: 4px; font-size: 10px; }
  .board-row { min-height: 20px; padding: 2px; font-size: 9px; }
  #inventory-stack { left: 10px; bottom: 137px; width: 148px; gap: 5px; }
  .panel-toggle { min-height: 32px; padding: 3px 12px; font-size: 13px; }
  .panel-toggle .hud-icon { width: 17px; height: 17px; }
  .panel-body { max-height: 112px; overflow-y: auto; padding: 6px 8px; }
  .build-chip { padding: 3px 5px; font-size: 8px; }
  #offer-panel { top: 255px; right: 10px; width: min(260px, calc(100vw - 32px)); max-height: min(390px, calc(100dvh - 345px)); overflow-y: auto; }
  #skillbar { bottom: 10px; min-height: 70px; gap: 4px; padding: 8px 24px; }
  .skill-slot,
  .combat-slot { width: 50px; height: 50px; border-width: 1px; }
  .skill-slot .hud-icon,
  .combat-slot .hud-icon { width: 25px; height: 25px; }
  .skill-key { top: -11px; min-width: 20px; padding: 1px 3px; font-size: 8px; }
  .skill-name { max-width: 46px; font-size: 7px; }
  .belt-crystal { width: 16px; height: 23px; }
  #minimap-frame { right: 10px; bottom: 86px; width: 124px; height: 136px; padding: 5px; }
  #controls { right: 8px; bottom: 3px; max-width: 120px; }
  #controls button { font-size: 7px; padding: 4px 6px; }
}

@media (pointer: coarse) {
  #inventory-stack { top: 126px; bottom: auto; }
  #inventory-stack #bag-panel,
  #inventory-stack #build-panel { max-height: none; overflow: visible; }
  #inventory-stack .panel-body { display: none; }
  #inventory-stack .panel-body.open { display: block; }
  #skillbar { display: none; }
  #controls { display: none; }
  #mobile { z-index: 24; bottom: 14px; align-items: flex-end; }
  #stick { border: 2px solid var(--hud-brass); background: rgba(6,28,40,.76); box-shadow: var(--hud-shadow); }
  .touchactions { max-width: 250px; justify-content: flex-end; flex-wrap: wrap; }
  .touchactions button { width: 58px; height: 54px; padding: 3px; border: 1px solid var(--hud-brass); background: radial-gradient(circle at 50% 30%, #17536c, #071722); font-size: 7px; }
  .touchactions .hud-icon { display: block; width: 24px; height: 24px; margin: 0 auto 2px; }
  #minimap-frame { bottom: 154px; }
}

@media (max-width: 700px) and (pointer: coarse) {
  #scoreboard { display: none; }
  #inventory-stack { top: 126px; width: 140px; }
  #inventory-stack .panel-body { max-height: 96px; }
  #offer-panel { top: 125px; max-height: calc(100dvh - 280px); }
  #minimap-frame { display: none; }
  #mobile { right: 8px; left: 8px; }
  #stick { width: 76px; height: 76px; }
  .touchactions { width: 188px; gap: 4px; }
  .touchactions button { width: 58px; height: 48px; }
}

@media (max-width: 700px) {
  body:has(#offer-panel[style*="display: block"]) #scoreboard,
  body:has(#offer-panel[style*="display: block"]) #minimap-frame { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

#control-help {position:absolute;bottom:10px;left:28px;z-index:24;color:var(--hud-ivory);font:11px/1.6 Manrope,sans-serif;pointer-events:auto;}
#control-help summary {cursor:pointer;width:max-content;padding:4px 12px;background:var(--hud-ink);border:1px solid var(--hud-brass);}
#control-help p {position:absolute;bottom:24px;left:0;width:295px;padding:14px;background:var(--hud-ink);border:1px solid var(--hud-brass);box-shadow:var(--hud-shadow);}
.skill-slot.unlearned {opacity:.6;}
@media(pointer:coarse){#control-help {display:none;}}
@media (max-height:800px) and (min-width:701px) {
  #inventory-stack .panel-body {max-height:140px;overflow-y:auto;}
}
@media (max-width:700px) {
  #prototype-notice #contact-diagnostics-readout, #prototype-notice #copy-contact-diagnostics {display:none;}
  #prototype-notice {font-size:8px;line-height:18px;padding:2px 14px;}
  #hud {top:39px;}
  .bag-equipped {flex-wrap:wrap;gap:4px;}
  #bag-equipped-label {max-width:100%;overflow-wrap:anywhere;}
  #controls {bottom:93px;right:147px;}
}

/* ---- RPG layer ---- */
.rarity-common { color: #b7c2c0; }
.rarity-uncommon { color: #6fd58a; }
.rarity-rare { color: #5aa7e0; }
.rarity-epic { color: #c583ef; }
.rarity-legendary { color: #ff9f3d; text-shadow: 0 0 8px rgba(255, 159, 61, .6); }

.item-tooltip {
  position: fixed;
  z-index: 30;
  max-width: 280px;
  padding: 10px 12px 11px;
  background: var(--hud-panel);
  border: 1px solid var(--hud-brass);
  border-radius: 2px;
  box-shadow: var(--hud-shadow);
  color: var(--hud-ivory);
  font: 12px/1.5 Manrope, sans-serif;
  pointer-events: none;
}
.item-tooltip .tooltip-name { font: 700 14px 'Cormorant Garamond', Georgia, serif; letter-spacing: .02em; }
.item-tooltip .tooltip-meta { margin-top: 2px; color: var(--hud-muted); font-size: 11px; }
.item-tooltip .tooltip-line { margin-top: 5px; }
.item-tooltip .tooltip-legendary { margin-top: 6px; color: var(--hud-cyan); font-style: italic; }
.item-tooltip ul { list-style: none; margin: 6px 0 0; padding: 0; }
.item-tooltip ul li { padding: 1px 0; }
.item-tooltip .tooltip-compare { margin-top: 7px; padding-top: 6px; border-top: 1px solid rgba(185, 146, 85, .4); }
.item-tooltip .delta-row { padding: 1px 0; }
.delta-up { color: #7ef29a; }
.delta-down { color: #ff7b7b; }
.locked-badge {
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 2px;
  background: rgba(166, 52, 54, .35);
  color: #ff9f9f;
  font-size: 10px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

#talent-panel,
#sheet-panel {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 40;
  padding: 16px 18px 18px;
  max-height: 82vh;
  overflow: auto;
  background: var(--hud-panel);
  border: 2px solid var(--hud-brass);
  border-radius: 2px;
  box-shadow: var(--hud-shadow);
  color: var(--hud-ivory);
}
#talent-panel.open,
#sheet-panel.open { display: block; }
#talent-panel { width: min(920px, 94vw); }
#sheet-panel { width: 420px; }

.talent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -4px 0 12px;
  padding: 0 2px 10px;
  border-bottom: 1px solid var(--hud-cyan-deep);
  font: 700 18px 'Cormorant Garamond', Georgia, serif;
  letter-spacing: .1em;
}
.talent-header #talent-points { color: var(--hud-cyan); font: 600 12px Manrope, sans-serif; letter-spacing: normal; }
.talent-tree {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 16px;
  margin-top: 14px;
}
.tree-title {
  grid-column: 1 / -1;
  margin: 0;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(185, 146, 85, .5);
  font: 700 15px 'Cormorant Garamond', Georgia, serif;
  letter-spacing: .04em;
}
.tree-title .tree-spent { margin-left: 8px; color: var(--hud-muted); font: 600 11px Manrope, sans-serif; }
.talent-tier { display: flex; flex-direction: column; gap: 8px; }
.talent-tier-note { color: var(--hud-muted); font-size: 10px; font-style: italic; }
.talent-btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 56px;
  padding: 7px 10px;
  background: rgba(2, 13, 21, .5);
  border: 1px solid rgba(185, 146, 85, .5);
  border-radius: 2px;
  color: var(--hud-ivory);
  text-align: left;
  transition: transform .12s ease, border-color .12s ease;
}
.talent-btn b { font-size: 12px; font-weight: 700; }
.talent-btn i { color: var(--hud-muted); font-size: 10px; font-style: normal; }
.talent-btn:not(:disabled):hover { transform: translateY(-2px); border-color: var(--hud-cyan); }
.talent-btn.owned { border-color: var(--hud-cyan); box-shadow: 0 0 8px rgba(99, 234, 255, .25); }
.talent-btn.maxed { border-color: var(--hud-brass-hi); box-shadow: 0 0 8px rgba(240, 211, 154, .3); }
.talent-btn.maxed i { color: var(--hud-brass-hi); }
.talent-btn.locked { opacity: .45; cursor: not-allowed; }

.sheet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 18px;
  margin-top: 10px;
}
.sheet-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 2px;
  border-bottom: 1px solid rgba(99, 234, 255, .1);
  font-size: 12px;
}
.sheet-row span { color: var(--hud-muted); }
.sheet-row b { color: var(--hud-ivory); font-weight: 700; }

.bag-slot .discard {
  flex: 0 0 auto;
  padding: 3px 7px;
  background: rgba(166, 52, 54, .28);
  border: 1px solid #9a5d59;
  color: #ffb9b6;
}
.bag-slot .discard:hover { background: rgba(166, 52, 54, .5); border-color: #ff9f9f; }

@media (max-width: 720px) {
  #talent-panel,
  #sheet-panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    width: 100%;
    max-height: 78vh;
    border-radius: 8px 8px 0 0;
  }
  .talent-tree { grid-template-columns: 1fr; }
  .sheet-grid { grid-template-columns: 1fr; }
}

/* ---- RPG layer: root wiring (tooltip host, openers, badge) ---- */
#item-tooltip { position: fixed; z-index: 31; pointer-events: none; }
#item-tooltip .item-tooltip { position: static; }
#rpg-buttons { display: flex; gap: 8px; margin: 4px 0 2px; }
.rpg-open {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 4px 10px 4px 8px;
  border: 2px solid var(--hud-brass); border-radius: 3px; background: var(--hud-panel);
  box-shadow: var(--hud-shadow); color: var(--hud-ivory); font: 700 12px/1 Manrope, sans-serif; letter-spacing: .08em;
  cursor: pointer; position: relative;
}
.rpg-open .hud-icon { width: 22px; height: 22px; }
.rpg-open kbd { padding: 1px 5px; border: 1px solid rgba(185,146,85,.6); border-radius: 2px; background: rgba(2,13,21,.6); color: var(--hud-cyan); font: 700 10px Manrope, sans-serif; }
.rpg-open:hover { border-color: var(--hud-cyan); background: #123e55; }
.rpg-open.attention { border-color: #f4d899; box-shadow: 0 0 12px rgba(244,216,153,.55), var(--hud-shadow); }
.talent-badge { position: absolute; top: -8px; right: -8px; min-width: 18px; height: 18px; padding: 0 5px; place-items: center; border-radius: 9px; background: #e7b84b; color: #1a1208; font: 800 11px/18px Manrope, sans-serif; }
@media (max-width: 720px) { #rpg-buttons { display: none; } }
