.den:has(.hub) {
  height: 100dvh;
  min-height: 0;
}

.den:has(.hub) > main {
  padding: 0;
  overflow: hidden;
  min-height: 0;
}

.hub {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 3fr) minmax(0, 2fr);
  row-gap: 0;
  column-gap: 0.75rem;
  padding: 0.75rem;
  overflow: hidden;
  min-height: 0;

  --block-bg: rgba(16, 10, 6, 0.72);
  --block-bg-inner: rgba(0, 0, 0, 0.5);
  --block-border: 1px dashed rgba(226, 213, 184, 0.28);
  --block-text: rgba(226, 213, 184, 0.8);
  --block-lit: rgba(212, 133, 74, 0.55);
  --block-lit-border: var(--ember);
}

.hub [data-block],
.hub [data-block] a {
  color: var(--block-text);
  text-decoration: none;
}

.hub h2 {
  font-size: 0.75rem;
  font-weight: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--block-text);
  margin-bottom: 0.5rem;
}

.hud {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
}

.hud-portrait {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.portrait-slot {
  width: 48px;
  height: 48px;
  background: url("/assets/medallion-c5da3ef2.png") center/contain no-repeat;
  display: grid;
  place-items: center;
  color: var(--parchment-light);
  font-size: 0.75rem;
  font-weight: bold;
  padding-top: 4px;
}

.portrait-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  font-size: 0.75rem;
  color: var(--block-text);
}

.portrait-meta .username {
  font-weight: bold;
}

.hud-milestone {
  display: grid;
  gap: 0.25rem;
}

.gauge-track {
  position: relative;
  background: url("/assets/gauge-4d9a24c7.png") center / 100% 100% no-repeat;
  aspect-ratio: 1403 / 149;
  width: 100%;
  max-width: 520px;
  justify-self: center;
}

.gauge-channel {
  position: absolute;
  top: 22%;
  bottom: 22%;
  left: 7%;
  right: 7%;
  overflow: hidden;
}

.gauge-fill {
  height: 100%;
  background:
    url("/assets/gauge-fill-785e27ff.png") left center / 100% 100% no-repeat,
    linear-gradient(180deg, #f0b878 0%, #d98540 45%, #b0622c 100%);
  transition: width 0.3s;
}

.gauge-label {
  font-size: 0.7rem;
  color: var(--block-text);
  text-align: center;
}

.hud-fragments {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.75rem;
  color: var(--block-text);
  padding-left: 1rem;
}

.hud-fragments .value {
  font-size: 1rem;
  color: var(--amber);
  font-weight: bold;
}

.corridor {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 0.75rem;
  padding: 0 0.75rem;
  min-height: 0;
}

.corridor-doors {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.75rem;
  min-width: 0;
}

.door {
  aspect-ratio: 3 / 5;
  display: grid;
  place-items: center;
  background: var(--block-bg-inner);
  border: var(--block-border);
  font-size: 0.75rem;
  color: var(--block-text);
  cursor: pointer;
  transition: background 0.15s;
}

.door:hover {
  background: rgba(255, 255, 255, 0.05);
}

.corridor-equipment {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 0.5rem;
  min-height: 0;
}

.map-link {
  display: grid;
  place-items: center;
  background: var(--block-bg-inner);
  border: var(--block-border);
  padding: 1rem 0.5rem;
  font-size: 0.75rem;
  color: var(--block-text);
  cursor: pointer;
  transition: background 0.15s;
}

.map-link:hover {
  background: rgba(255, 255, 255, 0.05);
}

.lamps {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.lamp {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--block-bg-inner);
  border: var(--block-border);
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}

.lamp.lit {
  background: var(--block-lit);
  border-color: var(--block-lit-border);
}

.lamp:hover {
  filter: brightness(1.2);
}

.desk {
  display: grid;
  grid-template-columns: 260px 1fr 340px;
  gap: 0.75rem;
  min-height: 0;
  overflow: hidden;
  margin-top: 0.75rem;
}

.friend-line {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0.5rem 1rem 0.75rem;
  overflow: hidden;
}

.friend-line::before {
  content: "";
  display: block;
  width: 88%;
  aspect-ratio: 923 / 83;
  background: url("/assets/rod-090ba412.png") center / 100% 100% no-repeat;
  margin: 0.5rem auto 1.5rem;
}

.friend-line h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.inventory-case {
  display: block;
  background: url("/assets/inventory-case-64527889.png") center / 100% 100% no-repeat;
  padding: 6.5% 5.5%;
  aspect-ratio: 711 / 533;
  align-self: end;
  width: 100%;
  max-height: 100%;
}

.inventory-case h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.quest-sheet {
  display: flex;
  flex-direction: column;
  min-height: 240px;
  max-width: 360px;
  width: 100%;
  justify-self: center;
  align-self: start;
  padding: 0.5rem 0.75rem;
  color: var(--ink);
  border-style: solid;
  border-color: transparent;
  border-width: 42px;
  border-image-source: url("/assets/quest-sheet-27882c61.png");
  border-image-slice: 100 fill;
  border-image-width: 42px;
  border-image-repeat: stretch;
  overflow: hidden;
}

.quest-sheet h2 {
  color: var(--ink-light);
  letter-spacing: 0.12em;
}

.quest-sheet .quest-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow-y: auto;
  min-height: 0;
  font-size: 0.8125rem;
  color: var(--ink);
}

.quest-sheet .quest-list li {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.quest-sheet .checkbox {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--ink-light);
  flex-shrink: 0;
}

.quest-sheet .checkbox.done {
  background: var(--ink-light);
}

.friend-line .medallions {
  display: flex;
  gap: 0.5rem;
  padding: 0 0.5rem;
  min-height: 0;
  justify-content: center;
  flex-wrap: wrap;
}

.friend-line .medallion {
  position: relative;
}

.friend-line .medallion::before {
  content: "";
  position: absolute;
  bottom: calc(100% - 4px);
  left: 50%;
  width: 2.5px;
  height: 1.75rem;
  background: #1a1208;
  transform: translateX(-50%);
  border-radius: 1px;
}

.medallion {
  width: 52px;
  height: 52px;
  background: url("/assets/medallion-c5da3ef2.png") center/contain no-repeat;
  display: grid;
  place-items: center;
  font-size: 0.8125rem;
  color: var(--parchment-light);
  flex-shrink: 0;
  padding-top: 4px;
  font-weight: bold;
}

.inventory-case .relics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4.5% 2.4%;
  height: 100%;
  width: 100%;
}

.relic {
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: bold;
  color: var(--parchment-light);
  opacity: 0.85;
}

.relic.empty {
  opacity: 0.15;
}

.empty-note {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--block-text);
  opacity: 0.75;
}

@media (max-width: 900px) {
  .hub {
    grid-template-rows: auto auto auto auto;
    overflow-y: auto;
  }

  .corridor {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  .desk {
    grid-template-columns: 1fr;
  }
}
