/* Title, map, rewards, merchant, campfire, events, vault and the end of a delve. */

/* ---------- title ---------- */
.title-screen { justify-content: flex-end; align-items: center; text-align: center; gap: 14px; padding-bottom: max(28px, 6vh); }
.title-screen h1 { font: 900 clamp(2rem, 9.4vw, 5rem)/0.95 var(--display-deco); letter-spacing: 0.02em; }
.title-screen .tag { font: italic 400 1.15rem var(--body); color: var(--parchment); text-shadow: 0 1px 4px #000; max-width: 32ch; }
.title-screen .buttons { display: flex; flex-direction: column; gap: 12px; width: min(300px, 100%); margin-top: 10px; }
.title-screen .records { font: 700 0.75rem var(--display); letter-spacing: 0.12em; color: var(--text-dim); text-transform: uppercase; }

/* ---------- map ---------- */
.map-screen { padding-top: 6px; }
.map-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.map-scroll::-webkit-scrollbar { display: none; }
.map {
  position: relative; margin: 10px auto 24px; width: min(520px, 100%);
  border-radius: 6px;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(255, 245, 220, 0.0) 40%, rgba(80, 50, 20, 0.35) 100%),
    radial-gradient(ellipse at 50% 30%, #efe0bf 0%, #dcc79c 60%, #b89c6a 100%);
  box-shadow: inset 0 0 40px rgba(80, 50, 20, 0.6), 0 10px 30px rgba(0, 0, 0, 0.7);
}
.map svg.paths { position: absolute; inset: 0; width: 100%; height: 100%; }
.map svg.paths line { stroke: rgba(70, 45, 20, 0.45); stroke-width: 2.2; stroke-dasharray: 2 6; stroke-linecap: round; }
.map svg.paths line.taken { stroke: #8a2a1a; stroke-dasharray: none; stroke-width: 3; }
.map svg.paths line.open { stroke: rgba(138, 42, 26, 0.75); stroke-dasharray: 5 5; }
.node {
  position: absolute; transform: translate(-50%, 50%);
  width: 40px; height: 40px; padding: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 40% 35%, #f6ead0, #d8c296);
  border: 2px solid #6b4a26; color: #3a2614; cursor: default;
  box-shadow: 0 2px 4px rgba(60, 35, 10, 0.5);
}
.node svg { width: 22px; height: 22px; }
.node.elite { color: #8a1c1c; border-color: #8a1c1c; }
.node.boss { width: 64px; height: 64px; color: #7a1010; border: 3px solid #7a1010; background: radial-gradient(circle at 40% 35%, #ffe6c0, #d9a86a); }
.node.boss svg { width: 36px; height: 36px; }
.node.vault { color: #8a5a10; }
.node.rest { color: #b2451b; }
.node.shop { color: #6d5212; }
.node.visited { background: #b9a072; opacity: 0.75; }
.node.current { box-shadow: 0 0 0 3px #8a2a1a, 0 2px 4px rgba(60, 35, 10, 0.5); }
.node.open { cursor: pointer; animation: node-pulse 1.3s ease-in-out infinite; border-color: #8a2a1a; }
@keyframes node-pulse { 50% { transform: translate(-50%, 50%) scale(1.14); box-shadow: 0 0 0 4px rgba(138, 42, 26, 0.35); } }
.map-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; padding: 4px 0 8px; font: 700 0.62rem var(--display); letter-spacing: 0.1em; color: var(--text-dim); text-transform: uppercase; }
.map-legend span { display: inline-flex; align-items: center; gap: 4px; }
.map-legend svg { width: 14px; height: 14px; color: var(--gilt); }

/* ---------- shared room layout ---------- */
.room { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 14px 0 22px; scrollbar-width: none; }
.room::-webkit-scrollbar { display: none; }
.room > * { flex-shrink: 0; }   /* scroll instead of squashing paintings */
.room-title { text-align: center; display: grid; gap: 4px; }
.room-title h2 { font-size: clamp(1.5rem, 6vw, 2.2rem); }
.room-title p { margin: 0; color: var(--text-dim); font-style: italic; }
.room .actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.section-label { font: 700 0.72rem var(--display); letter-spacing: 0.2em; color: var(--gilt); text-transform: uppercase; text-align: center; }

/* reward chips */
.loot { display: flex; flex-direction: column; gap: 8px; width: min(420px, 100%); }
.loot-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; text-align: left;
  border-radius: 8px; border: 1px solid var(--gilt-dim); background: rgba(13, 9, 6, 0.8); cursor: pointer;
}
.loot-item > svg { width: 42px; height: 42px; flex: none; }
.loot-item .art { width: 46px; height: 46px; border-radius: 6px; flex: none; border: 2px solid var(--metal, var(--gilt-dim)); }
.loot-item b { font-family: var(--display); color: var(--gilt-bright); }
.loot-item small { display: block; color: var(--text-dim); font-size: 0.9rem; }
.loot-item.taken { opacity: 0.35; pointer-events: none; }

/* treasure showcase (vault, shop, reward) */
.treasure-offers { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.treasure-card {
  --metal: var(--metal-common);
  width: clamp(130px, 40vw, 180px);
  display: flex; flex-direction: column; gap: 6px; align-items: stretch;
  padding: 8px; border-radius: 10px; background: rgba(13, 9, 6, 0.85);
  border: 2px solid var(--metal); cursor: pointer; text-align: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}
.treasure-card[data-rarity="uncommon"] { --metal: var(--metal-uncommon); }
.treasure-card[data-rarity="rare"] { --metal: var(--metal-rare); }
.treasure-card[data-rarity="legendary"] { --metal: var(--metal-legendary); box-shadow: 0 0 22px rgba(255, 157, 77, 0.45), 0 8px 20px rgba(0, 0, 0, 0.6); }
.treasure-card .art { aspect-ratio: 1; border-radius: 6px; }
.treasure-card h3 { font-size: 0.92rem; color: var(--gilt-bright); }
.treasure-card .rarity { font: 700 0.6rem var(--display); letter-spacing: 0.16em; text-transform: uppercase; color: var(--metal); }
.treasure-card p { margin: 0; font-size: 0.9rem; color: var(--parchment); line-height: 1.25; }

/* merchant */
.shop-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; width: 100%; }
.service {
  display: flex; flex-direction: column; align-items: center; gap: 6px; width: clamp(120px, 38vw, 160px);
  padding: 10px; border-radius: 10px; background: rgba(13, 9, 6, 0.85); border: 1px solid var(--gilt-dim); cursor: pointer; text-align: center;
}
.service .orb { width: 54px; height: 54px; border-radius: 50%; border: 2px solid var(--gilt-bright); background: radial-gradient(circle at 35% 30%, #fff 0 8%, var(--rune, #888) 45%, #000 130%); box-shadow: 0 0 16px var(--rune, #888); }
.service h3 { font-size: 0.85rem; color: var(--gilt-bright); }
.service p { margin: 0; font-size: 0.85rem; color: var(--text-dim); line-height: 1.2; }
.service .art { width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--gilt-dim); }

/* campfire */
.rest-options { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }
.rest-option {
  width: clamp(140px, 40vw, 200px); padding: 18px 14px; border-radius: 12px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  background: rgba(13, 9, 6, 0.85); border: 1px solid var(--gilt-dim);
}
.rest-option svg { width: 46px; height: 46px; color: var(--ember); filter: drop-shadow(0 0 10px rgba(224, 112, 63, 0.7)); }
.rest-option h3 { color: var(--gilt-bright); font-size: 1.1rem; }
.rest-option p { margin: 0; color: var(--text-dim); font-size: 0.95rem; }
.rest-option:disabled { opacity: 0.4; cursor: default; }

/* events */
.event-art { width: min(560px, 100%); aspect-ratio: 4 / 3; border-radius: 6px; border: 4px solid var(--gilt-dim); box-shadow: inset 0 0 0 1px #000, 0 14px 34px rgba(0, 0, 0, 0.75); }
.event-text { width: min(560px, 100%); padding: 16px 18px; font-size: 1.08rem; line-height: 1.45; }
.event-text::first-letter { font: 700 2.6em/0.8 var(--display-deco); float: left; margin: 0.08em 0.1em 0 0; color: #7a2312; }
.choices { display: flex; flex-direction: column; gap: 8px; width: min(560px, 100%); }
.choice {
  text-align: left; padding: 10px 14px; border-radius: 8px; cursor: pointer;
  background: rgba(13, 9, 6, 0.85); border: 1px solid var(--gilt-dim);
}
.choice b { font: 700 1rem var(--display); color: var(--gilt-bright); }
.choice small { display: block; color: var(--text-dim); font-size: 0.92rem; }
.choice:disabled { opacity: 0.4; cursor: default; }
.result { font-style: italic; color: var(--parchment); text-align: center; max-width: 46ch; }

/* end of the delve */
.end-screen { justify-content: center; align-items: center; text-align: center; gap: 16px; }
.end-screen h1 { font: 900 clamp(2.2rem, 10vw, 4rem) var(--display-deco); }
.end-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: min(420px, 100%); }
.end-stats div { padding: 10px; border-radius: 8px; background: rgba(13, 9, 6, 0.8); border: 1px solid var(--gilt-dim); display: grid; gap: 2px; }
.end-stats b { font: 700 1.3rem var(--display); color: var(--gilt-bright); font-variant-numeric: tabular-nums; }
.end-stats span { font: 700 0.64rem var(--display); letter-spacing: 0.14em; color: var(--text-dim); text-transform: uppercase; }

/* deck viewer and picker */
.deck-view { width: min(900px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 12px; }
.deck-view .card-grid { overflow-y: auto; padding: 10px 4px 30px; }
.deck-view .card-grid .card { --w: clamp(96px, 27vw, 140px); }
.deck-view header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ---------- hero select ---------- */
.hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 12px; width: min(980px, 100%); }
.hero-card {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: start; text-align: left;
  padding: 10px; border-radius: 12px; cursor: pointer;
  background: rgba(13, 9, 6, 0.86); border: 1px solid var(--gilt-dim);
  box-shadow: inset 4px 0 0 var(--hero), 0 8px 20px rgba(0, 0, 0, 0.6);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.hero-card:hover, .hero-card:focus-visible { transform: translateY(-2px); border-color: var(--gilt-bright); }
.hero-card .portrait { aspect-ratio: 2 / 3; border-radius: 6px; border: 2px solid var(--hero); }
.hero-card h3 { font-size: 1.02rem; color: var(--gilt-bright); }
.hero-title { font: italic 400 0.9rem var(--body); color: var(--text-dim); }
.hero-card p { margin: 6px 0; font-size: 0.95rem; color: var(--parchment); line-height: 1.3; }
.hero-mech { font-size: 0.9rem; color: var(--parchment); line-height: 1.3; }
.hero-mech b { font-family: var(--display); color: var(--hero); }
.hero-stats { display: flex; align-items: center; gap: 4px; margin-top: 6px; font: 700 0.8rem var(--display); color: var(--text-dim); }
.hero-stats svg { width: 15px; height: 15px; margin-left: 6px; }
.hero-stats svg:first-child { margin-left: 0; color: #f08a8f; }
.act-title { display: flex; align-items: baseline; justify-content: center; gap: 10px; padding-top: 4px; font: 700 1.05rem var(--display); color: var(--parchment); letter-spacing: 0.06em; }

/* ---------- codex and how to play ---------- */
.title-links { display: flex; gap: 10px; justify-content: center; }
.title-links { flex-wrap: wrap; }
.title-links .btn { flex: 1 1 auto; white-space: nowrap; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tab { font: 700 0.72rem var(--display); letter-spacing: 0.1em; text-transform: uppercase; padding: 6px 10px; border-radius: 14px; cursor: pointer;
  background: rgba(13, 9, 6, 0.8); color: var(--text-dim); border: 1px solid var(--gilt-dim); }
.tab.on { background: var(--gilt); color: var(--ink); border-color: var(--gilt-bright); }
.codex-acts { display: grid; gap: 18px; width: 100%; }
.codex-act { display: grid; gap: 10px; }
.monster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; width: min(980px, 100%); margin: 0 auto; }
.monster-card { display: grid; gap: 4px; text-align: center; padding: 6px; border-radius: 10px; background: rgba(13, 9, 6, 0.85); border: 1px solid var(--gilt-dim); }
.monster-card.elite { border-color: var(--metal-rare); }
.monster-card.boss { border-color: var(--metal-legendary); box-shadow: 0 0 16px rgba(255, 157, 77, 0.35); }
.monster-card .portrait { aspect-ratio: 2 / 3; border-radius: 6px; }
.monster-card h3 { font-size: 0.78rem; color: var(--gilt-bright); }
.monster-card small { color: var(--text-dim); font-size: 0.8rem; }
.howto { display: grid; gap: 12px; width: min(640px, 100%); }
.howto section { padding: 14px 16px; }
.howto h3 { font-size: 1.05rem; color: #5a2a0e; margin-bottom: 4px; }
.howto p { margin: 6px 0; line-height: 1.4; }
.tally.demo { position: static; transform: none; display: inline-flex; margin: 4px 0; box-shadow: none; }

.act-intro { margin: 2px auto 0; max-width: 46ch; text-align: center; font-style: italic; color: var(--parchment); text-shadow: 0 1px 3px #000; }

/* ---------- descent ---------- */
.descent-pick { display: grid; gap: 6px; justify-items: center; }
.descent-text { margin: 0; max-width: 52ch; text-align: center; color: var(--text-dim); font-style: italic; }
.topbar .descent { color: #ff9b8f; font-size: 0.85rem; }
.hero-wins { display: inline-flex; align-items: center; gap: 3px; color: var(--gilt-bright); }

/* save slots */
.panel.saves { display: grid; gap: 12px; width: min(520px, 100%); text-align: center; }
.saves-sub { margin: 0; color: var(--text-dim); font-size: 0.92rem; }
.save-slots { display: grid; gap: 8px; }
.save-slot {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; text-align: left;
  padding: 10px 12px; border-radius: 10px; background: rgba(13, 9, 6, 0.6); border: 1px solid var(--gilt-dim);
}
.save-slot.empty { opacity: 0.8; border-style: dashed; }
.slot-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 700 0.95rem var(--display); color: #2a1c11; background: linear-gradient(180deg, var(--gilt-bright), var(--gilt)); }
.slot-info { display: grid; gap: 1px; min-width: 0; }
.slot-info b { font-family: var(--display); color: var(--gilt-bright); }
.slot-info span { color: var(--parchment); font-size: 0.92rem; }
.slot-info small { color: var(--text-dim); font-size: 0.8rem; }
.slot-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.btn.danger { color: #ff9c8c; }
.saves-files { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
@media (max-width: 460px) { .save-slot { grid-template-columns: auto minmax(0, 1fr); } .slot-actions { grid-column: 1 / -1; justify-content: flex-start; } }
