:root {
  --bg: #0f1116;
  --panel: #1a1f2b;
  --panel2: #222838;
  --line: #2e3650;
  --text: #e8ecf5;
  --muted: #8a93a8;
  --gold: #f4c542;
  --xp: #5bc0ff;
  --good: #41c97a;
  --bad: #e2575b;
  --accent: #7b6cff;
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
  background: linear-gradient(180deg, #0c0e13, #13161f);
  color: var(--text);
  min-height: 100vh
}

a {
  color: var(--xp);
  text-decoration: none
}

a:hover {
  text-decoration: underline
}

.upgrade-item {
  border: 1px solid #4ade80 !important;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.2);
}

.upgrade-item td {
  background-color: rgba(74, 222, 128, 0.05);
}

.upgrade-badge {
  color: #4ade80;
  font-weight: bold;
  margin-left: 5px;
  font-size: 0.9em;
  text-shadow: 0 0 5px rgba(74, 222, 128, 0.5);
}

h1 {
  margin: .2em 0 .4em;
  font-size: 1.7rem
}

h2 {
  margin: 1.3em 0 .5em;
  border-bottom: 1px solid var(--line);
  padding-bottom: .3em;
  font-size: 1.15rem
}

h3 {
  margin: .2em 0 .5em
}

.muted {
  color: var(--muted)
}

.small {
  font-size: .82rem
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: .7rem 1.4rem;
  background: #0a0c11;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10
}

.brand {
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--gold)
}

.nav {
  display: flex;
  gap: .3rem;
  flex-wrap: wrap
}

.nav a {
  padding: .4rem .8rem;
  border-radius: 7px;
  color: var(--text);
  font-weight: 500
}

.nav a:hover {
  background: var(--panel);
  text-decoration: none
}

.nav a.active {
  background: var(--accent);
  color: #fff
}

.purse {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .6rem
}

.pill {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: .3rem .7rem;
  font-size: .85rem;
  font-weight: 600
}

.pill.gold {
  color: var(--gold)
}

.pill.tokens {
  color: var(--accent)
}

.pill.xp {
  color: var(--xp)
}

.logout {
  font-size: .82rem;
  color: var(--muted)
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 1.4rem
}

.foot {
  text-align: center;
  color: var(--muted);
  font-size: .78rem;
  padding: 2rem
}

/* Hero / character header */
.hero {
  display: flex;
  gap: 1.2rem;
  align-items: center;
  background: linear-gradient(135deg, var(--panel), var(--panel2));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.2rem
}

.hero-portrait {
  font-size: 3.4rem;
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d1017;
  border-radius: 12px;
  border: 1px solid var(--line)
}

.hero-info {
  flex: 1
}

.hero-info h1 {
  margin: 0
}

.hero-sub {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin: .3rem 0 .6rem;
  font-size: .85rem
}

.hero-sub span {
  background: #0d1017;
  border: 1px solid var(--line);
  padding: .2rem .55rem;
  border-radius: 6px
}

.hero-sub .rank {
  color: var(--gold)
}

.hero-sub .prestige {
  color: var(--accent)
}

.hero-purse {
  text-align: right
}

.big {
  font-weight: 700;
  font-size: 1.1rem;
  margin: .2rem 0
}

.big.gold {
  color: var(--gold)
}

.bars {
  max-width: 420px
}

.bar {
  position: relative;
  height: 20px;
  background: #0c0f16;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin: .35rem 0
}

.bar span {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  display: block;
  border-radius: 10px
}

.bar.hp span {
  background: linear-gradient(90deg, #2a8a4a, #41c97a)
}

.bar.hp.enemy span {
  background: linear-gradient(90deg, #8a2a2a, #e2575b)
}

.bar.xp span {
  background: linear-gradient(90deg, #2575a8, #5bc0ff)
}

.bar label {
  position: absolute;
  width: 100%;
  text-align: center;
  font-size: .72rem;
  line-height: 20px;
  color: #fff;
  text-shadow: 0 1px 2px #000
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .6rem
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .7rem;
  text-align: center
}

.stat b {
  display: block;
  font-size: 1.3rem;
  color: var(--gold)
}

.stat span {
  font-size: .78rem;
  color: var(--muted)
}

.gear-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: .55rem
}

.gear-cell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: .55rem .65rem;
  min-height: 64px
}

.gear-cell.empty {
  opacity: .5
}

.gear-slot {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted)
}

.gear-name {
  font-weight: 600;
  margin: .15rem 0;
  font-size: .9rem
}

.gear-meta {
  font-size: .72rem;
  color: var(--muted)
}

.gear-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .5rem;
  margin: .3rem 0 .1rem;
  font-size: .72rem
}

.gear-stats .gstat {
  color: var(--muted)
}

.gear-stats .gstat b {
  color: var(--text)
}

.gear-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin-top: .25rem
}

.gtag {
  font-size: .66rem;
  padding: .05rem .35rem;
  border-radius: 6px;
  border: 1px solid var(--line)
}

.gtag.elem {
  color: #5fcaff;
  border-color: #27506b
}

.gtag.xp {
  color: var(--good);
  border-color: #2c6b46
}

.gtag.fx {
  color: #d9b3ff;
  border-color: #5a4080
}

.gear-fxdesc {
  font-size: .68rem;
  color: var(--muted);
  margin-top: .2rem;
  font-style: italic
}

.shop-timer {
  color: var(--gold);
  font-variant-numeric: tabular-nums
}

.skill-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem
}

.skill-pill {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: .3rem .7rem;
  font-size: .82rem
}

/* Boons/banes, ultimate & skills */
.gtag.bane {
  color: #ff8585;
  border-color: #7a2c2c
}

.gtag.time {
  color: #cdb88a;
  border-color: #6b5a2c
}

.loadout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .6rem
}

.loadout-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: .7rem .8rem
}

.loadout-card.artifact.cursed {
  border-color: #7a2c2c;
  background: linear-gradient(180deg, rgba(122, 44, 44, .12), transparent)
}

.loadout-card.artifact.boon {
  border-color: #2c6b46;
  background: linear-gradient(180deg, rgba(44, 107, 70, .12), transparent)
}

.loadout-card.title {
  border-color: #6b5a2c;
  background: linear-gradient(180deg, rgba(107, 90, 44, .12), transparent)
}

.loadout-card.ultimate {
  background: linear-gradient(180deg, rgba(120, 80, 160, .14), transparent)
}

.lc-kind {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted)
}

.lc-name {
  font-weight: 700;
  font-size: 1.02rem;
  margin: .2rem 0
}

.lc-desc {
  font-size: .74rem;
  color: var(--muted);
  margin-bottom: .35rem
}

.lc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .25rem
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .55rem
}

.skill-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .55rem .65rem
}

.sk-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .4rem
}

.sk-name {
  font-weight: 600;
  font-size: .88rem
}

.sk-type {
  font-size: .66rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px
}

.sk-desc {
  font-size: .72rem;
  color: var(--muted);
  margin-top: .2rem
}

/* Leaderboards */
.lb-h {
  margin-top: 1.4rem
}

.lb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: .8rem
}

.lb-col {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: .7rem .8rem
}

.lb-col h3 {
  margin: 0 0 .4rem;
  font-size: .95rem
}

.lbtable {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem
}

.lbtable th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .4px;
  border-bottom: 1px solid var(--line);
  padding: .2rem .3rem
}

.lbtable td {
  padding: .28rem .3rem;
  border-bottom: 1px solid rgba(255, 255, 255, .04)
}

.lbtable tr:last-child td {
  border-bottom: none
}

.lb-rank {
  color: var(--muted);
  width: 1.6rem;
  text-align: center;
  font-variant-numeric: tabular-nums
}

.lb-rank-1 {
  color: #f4c542;
  font-weight: 700
}

.lb-rank-2 {
  color: #cfd6e4;
  font-weight: 700
}

.lb-rank-3 {
  color: #d9925a;
  font-weight: 700
}

.lb-name {
  font-weight: 600
}

.lb-wins {
  color: var(--gold);
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums
}

.lbtable td.win {
  color: var(--good);
  text-align: right;
  font-variant-numeric: tabular-nums
}

.lbtable td.loss {
  color: #ff8585;
  text-align: right;
  font-variant-numeric: tabular-nums
}

/* ===== Leaderboards Page ===== */
.lb-page {
  max-width: 1100px;
  margin: 0 auto
}

.lb-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap
}

.lb-page-title {
  margin: 0;
  font-size: 1.8rem
}

.lb-page-sub {
  margin: .3rem 0 0;
  color: var(--muted);
  font-size: .9rem
}

.lb-back-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: .5rem 1rem;
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s
}

.lb-back-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  transform: translateX(-2px)
}

/* Category tabs */
.lb-category-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: .6rem
}

.lb-cat-btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 8px 8px 0 0;
  padding: .55rem 1.2rem;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  position: relative;
  bottom: -1px
}

.lb-cat-btn:hover {
  color: var(--text);
  border-color: var(--accent)
}

.lb-cat-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff
}

/* Category panels */
.lb-cat-panel {
  display: none
}

.lb-cat-panel.active {
  display: block
}

/* Sections */
.lb-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  margin-bottom: 1rem
}

.lb-section-title {
  margin: 0 0 .3rem;
  font-size: 1.15rem
}

.lb-section-desc {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: .82rem
}

/* 3D game selector */
.lb-game-selector {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .8rem 0 1rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--line)
}

.lb-game-btn {
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 16px;
  padding: .3rem .7rem;
  font-size: .76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s
}

.lb-game-btn:hover {
  color: var(--text);
  border-color: var(--accent)
}

.lb-game-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff
}

/* 3D panels */
.lb-3d-panel {
  display: none
}

.lb-3d-panel.active {
  display: block
}

/* Leaderboards page sections (legacy) */
.lb-section {
  margin: 1.4rem 0
}

.lb-section h2 {
  margin: 0 0 .6rem;
  font-size: 1.1rem
}

/* 3D game tabs (legacy) */
.game-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .6rem 0
}

.game-tab {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 18px;
  padding: .3rem .75rem;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s
}

.game-tab:hover {
  border-color: var(--accent);
  color: var(--accent)
}

.game-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff
}

/* 3D games hub */
.g3d-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .7rem
}

.g3d-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .9rem .7rem;
  color: var(--text);
  text-decoration: none;
  transition: transform .12s, border-color .12s, box-shadow .12s
}

.g3d-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .4);
  text-decoration: none
}

.g3d-ico {
  font-size: 2.1rem;
  line-height: 1;
  margin-bottom: .4rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5))
}

.g3d-title {
  font-weight: 700;
  font-size: .92rem
}

.g3d-desc {
  font-size: .72rem;
  color: var(--muted);
  margin: .25rem 0 .5rem;
  min-height: 2.2em
}

.g3d-play {
  font-size: .74rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 14px;
  padding: .22rem .8rem
}

/* game-icons.net SVG icons, recolourable via CSS mask (inherits text color) */
.gi {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.14em;
  background-color: currentColor;
  -webkit-mask: var(--gi) center/contain no-repeat;
  mask: var(--gi) center/contain no-repeat
}

.slot-gi {
  font-size: 1.5em;
  vertical-align: -0.28em
}

.stat .gi {
  font-size: 1.15rem;
  color: var(--gold);
  display: block;
  margin: 0 auto .15rem
}

.gtag .gi {
  font-size: .9em;
  vertical-align: -0.1em
}

/* Inventory & shop cards */
.inv-grid,
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: .7rem
}

.inv-card,
.shop-card,
.game-card,
.ex-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: .8rem
}

.inv-name {
  font-weight: 600
}

.inv-meta {
  font-size: .76rem;
  color: var(--muted)
}

.inv-actions {
  display: flex;
  gap: .4rem;
  margin-top: .5rem
}

.price {
  color: var(--gold);
  font-weight: 700;
  margin: .4rem 0
}

.empty-state {
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 1.4rem;
  text-align: center;
  color: var(--muted)
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .45rem .9rem;
  font-weight: 600;
  cursor: pointer;
  font-size: .85rem
}

button:hover {
  filter: brightness(1.1)
}

button:disabled {
  opacity: .5;
  cursor: not-allowed
}

button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text)
}

input[type=number] {
  background: #0c0f16;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 7px;
  padding: .4rem .5rem;
  width: 110px
}

/* Modern themed checkboxes & radios: replace the native widgets everywhere
   with custom-drawn controls that match the panel/accent palette. */
input[type=checkbox],
input[type=radio] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  position: relative;
  display: inline-block;
  vertical-align: text-bottom;
  background: #0c0f16;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

input[type=checkbox] {
  border-radius: 5px;
}

input[type=radio] {
  border-radius: 50%;
}

input[type=checkbox]:hover:not(:disabled),
input[type=radio]:hover:not(:disabled) {
  border-color: var(--accent);
}

input[type=checkbox]:focus-visible,
input[type=radio]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(123, 108, 255, .35);
}

input[type=checkbox]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

/* Drawn check mark */
input[type=checkbox]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input[type=radio]:checked {
  border-color: var(--accent);
}

/* Inner dot */
input[type=radio]:checked::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(123, 108, 255, .55);
}

input[type=checkbox]:disabled,
input[type=radio]:disabled {
  opacity: .45;
  cursor: not-allowed;
}

label {
  font-size: .85rem;
  display: inline-flex;
  gap: .4rem;
  align-items: center
}

/* Battle arena */
.arena {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background: linear-gradient(135deg, #161a26, #0e1118);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem;
  margin: .6rem 0
}

.fighter {
  text-align: center;
  flex: 1;
  max-width: 300px
}

.face {
  font-size: 3.4rem
}

.fname {
  font-weight: 600;
  margin: .2rem 0 .4rem
}

.vs {
  font-weight: 800;
  color: var(--muted)
}

.battle-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: .4rem 0 1rem
}

#fightBtn {
  font-size: 1rem;
  padding: .6rem 1.4rem
}

.battle-log {
  background: #0a0c11;
  border: 1px solid var(--line);
  border-radius: 10px;
  height: 200px;
  overflow-y: auto;
  padding: .6rem;
  font-size: .85rem
}

.logline {
  padding: .15rem 0;
  border-bottom: 1px solid #161a26
}

.logline.you {
  color: #a8d8ff
}

.logline.mob {
  color: #ffb3b3
}

.logline.crit {
  font-weight: 700
}

.result {
  margin: .8rem 0;
  font-weight: 600;
  min-height: 1.4em
}

.result.win {
  color: var(--good)
}

.result.loss {
  color: var(--bad)
}

.arcade-grid,
.exchange-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .8rem
}

.game-card {
  text-align: center
}

.reels {
  font-size: 1.8rem;
  letter-spacing: .3rem;
  margin: .4rem 0
}

.choices {
  display: flex;
  gap: .4rem;
  justify-content: center;
  margin: .4rem 0
}

.bet-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: .6rem 0
}

/* Tables */
.histtable {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden
}

.histtable th,
.histtable td {
  padding: .5rem .7rem;
  text-align: left;
  border-bottom: 1px solid var(--line)
}

.histtable th {
  background: #0d1017;
  color: var(--muted);
  font-weight: 600
}

.histtable td.win {
  color: var(--good)
}

.histtable td.loss {
  color: var(--bad)
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  transition: all .3s cubic-bezier(.18, .89, .32, 1.28);
  font-size: .9rem;
  padding: .7rem 1.2rem;
  border-radius: 10px;
  z-index: 100;
  pointer-events: none;
  background: #1a1f2b;
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  max-width: 90%;
  text-align: center
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0)
}

.toast.good {
  border-color: var(--good);
  color: var(--good);
  background: rgba(26, 31, 43, .95)
}

.toast.bad {
  border-color: var(--bad);
  color: var(--bad);
  background: rgba(26, 31, 43, .95)
}

/* Modal (shared across every page) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 13, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity .18s ease
}

.modal-overlay.open {
  display: flex;
  opacity: 1
}

.modal-card {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.4rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .55);
  width: min(460px, 92vw);
  max-height: 86vh;
  overflow: auto;
  transform: translateY(8px) scale(.98);
  transition: transform .18s ease
}

.modal-overlay.open .modal-card {
  transform: translateY(0) scale(1)
}

.modal-card h3 {
  margin: 0 0 .5rem;
  font-size: 1.1rem
}

.modal-card p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 .8rem
}

.modal-card .modal-body {
  display: flex;
  flex-direction: column;
  gap: .5rem
}

.modal-actions {
  display: flex;
  gap: .6rem;
  justify-content: flex-end;
  margin-top: 1.1rem
}

.modal-option {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .7rem .9rem;
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  font-size: .88rem
}

.modal-option:hover {
  border-color: var(--accent);
  background: #262c40
}

.denied {
  text-align: center;
  padding: 3rem 1rem;
  max-width: 520px;
  margin: 0 auto
}

.exchange {
  margin-bottom: 1rem
}

/* ===== Animated arcade ===== */
.quickbets {
  display: flex;
  gap: .3rem
}

button.xs {
  padding: .25rem .5rem;
  font-size: .75rem
}

.result.pop {
  animation: popres .4s ease
}

@keyframes popres {
  0% {
    transform: scale(.8)
  }

  50% {
    transform: scale(1.15)
  }

  100% {
    transform: scale(1)
  }
}

.slots-card {
  grid-column: span 2
}

/* Extra arcade games */
.more-games-h {
  margin-top: 1.4rem
}

/* Arcade leaderboard nav banner */
.lb-nav-banner {
  margin: 1.5rem 0 .5rem;
  text-align: center
}

.lb-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: linear-gradient(135deg, var(--accent), #5a4fd4);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: .65rem 1.4rem;
  font-size: .92rem;
  font-weight: 700;
  text-decoration: none;
  transition: all .15s;
  box-shadow: 0 4px 16px rgba(123, 108, 255, .3)
}

.lb-nav-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(123, 108, 255, .45);
  text-decoration: none
}

.game-card.mini {
  display: flex;
  flex-direction: column;
  justify-content: space-between
}

.game-card.mini h3 {
  margin: .1rem 0 .2rem
}

.choices.wrap {
  flex-wrap: wrap
}

.numpick {
  width: 64px;
  padding: .25rem .4rem;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #0d1017;
  color: var(--text)
}

.game-card.flash {
  animation: cardflash .35s ease
}

@keyframes cardflash {
  0% {
    box-shadow: 0 0 0 0 rgba(123, 108, 255, .0)
  }

  40% {
    box-shadow: 0 0 0 3px rgba(123, 108, 255, .55)
  }

  100% {
    box-shadow: 0 0 0 0 rgba(123, 108, 255, 0)
  }
}

.game-card.busy {
  opacity: .7
}

.reels {
  display: flex;
  gap: .4rem;
  justify-content: center;
  background: #06080d;
  border: 2px solid #f4c542;
  border-radius: 12px;
  padding: .5rem;
  margin: .4rem auto;
  width: fit-content;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, .7)
}

.reel {
  width: 64px;
  height: 72px;
  overflow: hidden;
  background: #0c0f16;
  border-radius: 8px;
  position: relative
}

.reel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 14px 18px -10px #000, inset 0 -14px 18px -10px #000
}

.reelstrip {
  display: flex;
  flex-direction: column;
  will-change: transform
}

.sym {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.3rem
}

.dice-stage {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 400px
}

.die {
  width: 62px;
  height: 62px;
  background: linear-gradient(145deg, #fff, #cfd6e6);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.6rem;
  color: #1a1f2b;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .5)
}

.die.rolling {
  animation: roll .15s linear infinite
}

@keyframes roll {
  0% {
    transform: rotate3d(1, 1, 0, 0deg)
  }

  100% {
    transform: rotate3d(1, 1, 0, 360deg)
  }
}

.coin-stage {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 600px
}

.coin {
  position: relative;
  width: 70px;
  height: 70px;
  transform-style: preserve-3d
}

.coin-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.6rem;
  color: #3a2c00;
  backface-visibility: hidden
}

.coin-face.heads {
  background: radial-gradient(circle at 35% 30%, #ffe89a, #e0a92a)
}

.coin-face.tails {
  background: radial-gradient(circle at 35% 30%, #dfe6f0, #9aa6bd);
  transform: rotateY(180deg)
}

.wheel-stage {
  position: relative;
  width: 220px;
  height: 230px;
  margin: 0 auto
}

.wheel-pointer {
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  color: #f4c542;
  font-size: 1.3rem;
  z-index: 2;
  text-shadow: 0 1px 2px #000
}

#wheel {
  display: block
}

.card-stage {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 700px
}

.pcard {
  width: 80px;
  height: 112px;
  transform-style: preserve-3d;
  transition: transform .6s
}

.pcard.flip {
  transform: rotateY(180deg)
}

.pcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d
}

.pcard-front,
.pcard-back {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  font-weight: 800;
  backface-visibility: hidden;
  border: 2px solid #f4c542
}

.pcard-front {
  background: linear-gradient(145deg, #39406b, #222840);
  color: #f4c542
}

.pcard-back {
  background: linear-gradient(145deg, #cfd6e6, #ffffff);
  color: #1a1f2b;
  transform: rotateY(180deg)
}

/* Arcade Expansion */
.arcade-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.vip-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
}

.vip-badge .icon {
  font-size: 1.2rem;
}

.vip-badge .name {
  font-weight: 800;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.vip-badge .pts {
  font-size: 0.75rem;
  color: var(--gold);
}

.vip-badge.tier-none {
  border-color: #444;
  filter: grayscale(1);
  opacity: 0.5;
}

.vip-badge.tier-bronze {
  border-color: #cd7f32;
  box-shadow: 0 0 10px rgba(205, 127, 50, 0.3);
  color: #ffb366;
}

.vip-badge.tier-silver {
  border-color: #c0c0c0;
  box-shadow: 0 0 10px rgba(192, 192, 192, 0.3);
  color: #fff;
}

.vip-badge.tier-gold {
  border-color: var(--gold);
  box-shadow: 0 0 15px rgba(244, 197, 66, 0.4);
  color: var(--gold);
}

.vip-badge.tier-platinum {
  border-color: #e5e4e2;
  box-shadow: 0 0 20px rgba(229, 228, 226, 0.5);
  color: #fff;
  text-shadow: 0 0 5px #fff;
}

.vip-badge.tier-diamond {
  border-color: #b9f2ff;
  box-shadow: 0 0 25px rgba(185, 242, 255, 0.6);
  color: #b9f2ff;
  text-shadow: 0 0 8px #b9f2ff;
}

.jackpot-banner {
  background: linear-gradient(90deg, #ff0000, #ff8800, #ff0000);
  background-size: 200% auto;
  animation: shine 2s linear infinite;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 900;
  text-align: center;
  padding: 2px 0;
  border-radius: 4px 4px 0 0;
  margin: -10px -10px 10px -10px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

@keyframes shine {
  to {
    background-position: 200% center;
  }
}

.daily-spin-banner {
  background: linear-gradient(135deg, #1a1f2b, #2c3e50);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.daily-spin-banner h3 {
  margin: 0 0 0.2rem 0;
  color: var(--accent);
}

.daily-spin-banner p {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.8;
}

.auto-bet-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
  margin-left: 10px;
  color: var(--xp);
  font-weight: bold;
}

.unit-item-slot.filled {
  background: var(--accent);
  border-color: #fff;
}

/* TFT Page Layout */
.tft-layout {
  display: flex;
  gap: 2rem;
}

.tft-main {
  flex: 1;
}

.tft-side {
  width: 300px;
}

@media (max-width: 900px) {
  .tft-layout {
    flex-direction: column;
  }

  .tft-side {
    width: 100%;
  }
}

.synergy-list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.synergy-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid transparent;
  transition: all 0.3s;
}

.synergy-item.active {
  background: linear-gradient(135deg, rgba(244, 197, 66, 0.15), rgba(244, 197, 66, 0.05));
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(244, 197, 66, 0.2);
}

.synergy-item .name {
  font-weight: 700;
  color: var(--muted);
}

.synergy-item.active .name {
  color: var(--gold);
}

.synergy-item .count {
  font-weight: 800;
  font-family: monospace;
}

.unit-items {
  display: flex;
  gap: 3px;
  margin-top: 6px;
  justify-content: center;
}

.unit-item-slot {
  width: 10px;
  height: 10px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.unit-item-slot.filled {
  background: var(--xp);
  border-color: #fff;
  box-shadow: 0 0 4px var(--xp);
}

.anim-stage {
  height: 80px;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  overflow: hidden;
  position: relative;
  margin-bottom: 12px;
  background: #0c0f16;
  border-radius: 12px;
  border: 2px inset var(--line);
  display: none;
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.6);
  perspective: 500px;
}

.anim-wheel {
  animation: roll 0.4s linear infinite;
}

.anim-rps {
  display: flex;
  gap: 15px;
}

.anim-rps .l {
  animation: rpsShake 0.2s ease infinite alternate;
}

.anim-rps .r {
  animation: rpsShake 0.2s ease infinite alternate-reverse;
  transform: scaleX(-1);
}

.anim-crash {
  position: absolute;
  bottom: -20px;
  left: 10px;
  animation: crashFly 1.5s cubic-bezier(.4, 0, 1, 1) forwards;
}

.anim-dice {
  display: flex;
  gap: 8px;
  animation: shake 0.15s linear infinite;
}

.anim-plinko {
  position: absolute;
  top: -40px;
  animation: plinkoDrop 1.5s cubic-bezier(.3, 1.2, .7, -0.2) forwards;
  text-shadow: 0 0 15px var(--xp);
}

.anim-horse {
  position: absolute;
  left: -40px;
  animation: horseRun 1.5s linear forwards;
}

.anim-pop {
  animation: pulse 0.4s ease infinite;
}

.anim-cards {
  display: flex;
  gap: 0px;
  position: relative;
}

.anim-cards .c1 {
  animation: cardSlideL 1.5s ease forwards;
  position: absolute;
  transform-origin: bottom right;
}

.anim-cards .c2 {
  animation: cardSlideR 1.5s ease forwards;
  position: absolute;
  transform-origin: bottom left;
}

.anim-slot {
  display: flex;
  gap: 8px;
  animation: slotSpin 0.12s linear infinite;
  filter: blur(1px);
}

.anim-dart {
  position: absolute;
  animation: dartThrow 1.5s cubic-bezier(.1, .7, .3, 1) forwards;
}

.anim-mine {
  display: flex;
  align-items: center;
  animation: mineWalk 1.5s steps(6) forwards;
}

.anim-chest {
  animation: chestBounce 0.5s ease-in-out infinite alternate;
}

.anim-scratch {
  position: relative;
  width: 60px;
  height: 40px;
  background: #444;
  border-radius: 4px;
  overflow: hidden;
}

.anim-scratch::after {
  content: "✨";
  position: absolute;
  left: 0;
  top: 0;
  animation: scratchMove 1.5s linear forwards;
  font-size: 1.5rem;
}

.anim-bolt {
  animation: boltFlash 0.3s steps(2) infinite;
  filter: drop-shadow(0 0 10px #fff);
}

.anim-gem {
  animation: gemGlow 0.8s ease-in-out infinite alternate;
}

.anim-keno {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.anim-keno span {
  width: 24px;
  height: 24px;
  background: #fff;
  color: #000;
  border-radius: 50%;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  animation: kenoDrop 1.5s cubic-bezier(.17, .67, .83, .67) infinite;
  position: relative;
}

.anim-keno span:nth-child(2) {
  animation-delay: 0.2s;
}

.anim-keno span:nth-child(3) {
  animation-delay: 0.4s;
}

.anim-color {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  animation: colorCycle 1.5s linear infinite;
  border: 3px solid #fff;
}

@keyframes rpsShake {
  0% {
    transform: translateY(0) rotate(0);
  }

  100% {
    transform: translateY(-15px) rotate(20deg);
  }
}

@keyframes crashFly {
  0% {
    transform: translate(0, 0) rotate(10deg) scale(1);
  }

  70% {
    transform: translate(140px, -60px) rotate(45deg) scale(1.6);
    opacity: 1;
  }

  85% {
    transform: translate(150px, -65px) rotate(45deg) scale(2.2);
    opacity: 0.8;
    filter: brightness(2);
  }

  100% {
    opacity: 0;
    transform: translate(160px, -70px) scale(0);
  }
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-6px) rotate(-15deg);
  }

  75% {
    transform: translateX(6px) rotate(15deg);
  }
}

@keyframes plinkoDrop {
  0% {
    top: -40px;
    left: 50%;
  }

  15% {
    top: 0px;
    left: 35%;
  }

  30% {
    top: 15px;
    left: 65%;
  }

  45% {
    top: 30px;
    left: 30%;
  }

  60% {
    top: 45px;
    left: 70%;
  }

  75% {
    top: 60px;
    left: 35%;
  }

  100% {
    top: 80px;
    left: 50%;
  }
}

@keyframes horseRun {
  0% {
    left: -50px;
    transform: rotate(-8deg);
  }

  25% {
    transform: rotate(8deg) translateY(-6px);
  }

  50% {
    transform: rotate(-8deg) translateY(0);
  }

  75% {
    transform: rotate(8deg) translateY(-6px);
  }

  100% {
    left: 110%;
    transform: rotate(-8deg);
  }
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }

  50% {
    transform: scale(1.4);
    filter: brightness(1.6);
    text-shadow: 0 0 15px var(--gold);
  }
}

@keyframes cardSlideL {
  0% {
    transform: translateX(0) rotate(0);
  }

  100% {
    transform: translateX(-25px) rotate(-25deg);
  }
}

@keyframes cardSlideR {
  0% {
    transform: translateX(0) rotate(0);
  }

  100% {
    transform: translateX(25px) rotate(25deg);
  }
}

@keyframes slotSpin {
  0% {
    transform: translateY(-15px);
  }

  100% {
    transform: translateY(15px);
  }
}

@keyframes dartThrow {
  0% {
    transform: translate(-100px, 50px) scale(2) rotate(-60deg);
    opacity: 0;
  }

  25% {
    opacity: 1;
  }

  100% {
    transform: translate(0, 0) scale(1) rotate(0);
  }
}

@keyframes mineWalk {
  0% {
    transform: translateX(-50px) rotate(-15deg);
  }

  100% {
    transform: translateX(50px) rotate(-15deg);
  }
}

@keyframes chestBounce {
  from {
    transform: scale(1) translateY(0);
  }

  to {
    transform: scale(1.1) translateY(-10px);
    filter: brightness(1.2);
  }
}

@keyframes scratchMove {
  0% {
    left: -20px;
    top: 0;
  }

  25% {
    left: 40px;
    top: 10px;
  }

  50% {
    left: 0px;
    top: 20px;
  }

  75% {
    left: 40px;
    top: 30px;
  }

  100% {
    left: 60px;
    top: 10px;
  }
}

@keyframes boltFlash {
  0% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0.3;
    transform: scale(1.1);
  }
}

@keyframes gemGlow {
  from {
    filter: drop-shadow(0 0 5px var(--xp)) brightness(1);
  }

  to {
    filter: drop-shadow(0 0 20px var(--xp)) brightness(1.5);
    transform: scale(1.1);
  }
}

@keyframes kenoDrop {
  0% {
    top: -60px;
    opacity: 0;
    transform: scale(0.5);
  }

  30% {
    opacity: 1;
  }

  100% {
    top: 80px;
    opacity: 0;
    transform: scale(1.2);
  }
}

@keyframes colorCycle {
  0% {
    background: #ff4d4d;
  }

  33% {
    background: #4dff4d;
  }

  66% {
    background: #4d4dff;
  }

  100% {
    background: #ff4d4d;
  }
}

/* Game States */
.game-card.win-glow {
  animation: winGlow 0.6s ease-out forwards;
}

.game-card.loss-shake {
  animation: lossShake 0.4s ease-out forwards;
}

@keyframes winGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(244, 197, 66, 0);
  }

  50% {
    box-shadow: 0 0 30px 5px rgba(244, 197, 66, 0.6);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(244, 197, 66, 0);
  }
}

@keyframes lossShake {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-5px);
  }

  40%,
  80% {
    transform: translateX(5px);
  }
}

/* ===== TFT board autobattler ===== */
.tft-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem;
  margin: .4rem 0
}

/* 3D perspective board */
.tft-stage {
  position: relative;
  background: radial-gradient(120% 100% at 50% 0%, #2a2150, #10131d 75%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 54px 14px 96px;
  overflow: hidden;
  perspective: 1200px;
  perspective-origin: 50% 26%
}

.tft-board {
  position: relative;
  margin: 0 auto;
  transform-style: preserve-3d;
  transform: rotateX(54deg);
  transition: transform .5s ease;
  animation: board-in .8s ease
}

@keyframes board-in {
  from {
    transform: rotateX(80deg) scale(.85);
    opacity: .2
  }

  to {
    transform: rotateX(54deg) scale(1);
    opacity: 1
  }
}

#tokens {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d
}

.hexcell {
  box-sizing: border-box;
  width: 64px;
  height: 56px;
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(80, 120, 220, .14), rgba(40, 55, 95, .22));
  border: 1px solid rgba(120, 160, 255, .22);
  box-shadow: 0 7px 0 rgba(10, 14, 30, .65), 0 10px 13px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .08);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s, box-shadow .15s, background .15s
}

.hexcell.enemy {
  background: linear-gradient(180deg, rgba(226, 87, 91, .16), rgba(80, 30, 40, .22));
  border-color: rgba(226, 120, 120, .25)
}

.hexcell.drop {
  transform: translateZ(10px);
  background: linear-gradient(180deg, rgba(123, 108, 255, .32), rgba(60, 50, 120, .32));
  box-shadow: 0 9px 0 rgba(10, 14, 30, .7), 0 0 0 2px var(--accent), 0 16px 20px rgba(0, 0, 0, .55)
}

.unit-tok {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  background: radial-gradient(circle at 40% 28%, #445078, #272d44);
  border: 2px solid #4a82d8;
  cursor: grab;
  z-index: 3;
  transform-style: preserve-3d;
  transform: rotateX(-54deg) translateZ(28px);
  transition: left .28s linear, top .28s linear, transform .14s ease;
  box-shadow: 0 4px 7px rgba(0, 0, 0, .5)
}

.unit-tok.enemy {
  border-color: #e2575b;
  background: radial-gradient(circle at 40% 28%, #5a2b3a, #3a2030)
}

.unit-tok::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  width: 46px;
  height: 18px;
  transform: translate(-50%, -3px) rotateX(54deg);
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, .55), transparent 72%);
  z-index: -1;
  pointer-events: none
}

.unit-tok:hover {
  transform: rotateX(-54deg) translateZ(40px) scale(1.06)
}

.unit-tok.attacking {
  transform: rotateX(-54deg) translateZ(48px) scale(1.16)
}

.unit-tok.dead {
  transform: rotateX(-54deg) translateZ(0) scale(.2) rotateZ(40deg);
  opacity: 0
}

.unit-hp {
  position: absolute;
  top: -9px;
  left: 4px;
  right: 4px;
  height: 5px;
  background: #0009;
  border-radius: 3px;
  overflow: hidden
}

.unit-hp>span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2a8a4a, #41c97a);
  transition: width .25s
}

.unit-tok.enemy .unit-hp>span {
  background: linear-gradient(90deg, #8a2a2a, #e2575b)
}

.unit-star {
  position: absolute;
  bottom: -7px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: .6rem;
  color: var(--gold);
  text-shadow: 0 1px 2px #000
}

.tft-bench {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: #0d1017;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  min-height: 64px;
  margin-top: 10px
}

.bench-slot {
  width: 52px;
  height: 52px;
  border-radius: 9px;
  border: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  cursor: grab;
  position: relative;
  background: #161a26
}

.bench-slot.empty {
  cursor: default;
  opacity: .4
}

.tft-shop {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 10px
}

.shop-unit {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--line);
  border-radius: 9px;
  padding: .5rem;
  text-align: center;
  cursor: pointer
}

.shop-unit:hover {
  filter: brightness(1.12)
}

.shop-unit.bought {
  opacity: .35;
  pointer-events: none
}

.shop-unit .ico {
  font-size: 1.7rem
}

.shop-unit .nm {
  font-size: .78rem;
  font-weight: 600;
  margin: .1rem 0
}

.shop-unit .cost {
  color: var(--gold);
  font-size: .8rem
}

.cost1 {
  border-top-color: #9aa6bd
}

.cost2 {
  border-top-color: #41c97a
}

.cost3 {
  border-top-color: #3a7bd5
}

.cost4 {
  border-top-color: #7b6cff
}

.cost5 {
  border-top-color: #f4c542
}

.tft-controls {
  display: flex;
  gap: .6rem;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap
}

.dmgfloat {
  position: absolute;
  font-weight: 800;
  font-size: 1.1rem;
  color: #ffd24a;
  pointer-events: none;
  animation: floatup 1s ease forwards;
  text-shadow: 0 1px 3px #000;
  z-index: 5
}

.dmgfloat.crit {
  color: #ff5b5b;
  font-size: 1.5rem
}

@keyframes floatup {
  0% {
    opacity: 1;
    transform: rotateX(-54deg) translateZ(34px) translateY(0)
  }

  100% {
    opacity: 0;
    transform: rotateX(-54deg) translateZ(34px) translateY(-42px)
  }
}

/* ===== Item icons ===== */
.slot-ico {
  font-size: .95rem;
  margin-right: 2px
}

.item-ico {
  font-size: 1.05rem;
  margin-right: 4px;
  display: inline-block
}

.inv-head {
  display: flex;
  align-items: center;
  gap: .4rem
}

.inv-head .item-ico {
  font-size: 1.5rem
}

.shop-ico {
  font-size: 2rem;
  text-align: center;
  margin: .1rem 0 .2rem;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .5))
}

.gear-cell:not(.empty) .slot-ico {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6))
}

/* ===== Animated auction house ===== */
.ah-table tbody tr.ah-row {
  animation: ahIn .4s ease both
}

.ah-table tbody tr.ah-row:nth-child(1) {
  animation-delay: .02s
}

.ah-table tbody tr.ah-row:nth-child(2) {
  animation-delay: .06s
}

.ah-table tbody tr.ah-row:nth-child(3) {
  animation-delay: .10s
}

.ah-table tbody tr.ah-row:nth-child(4) {
  animation-delay: .14s
}

.ah-table tbody tr.ah-row:nth-child(5) {
  animation-delay: .18s
}

.ah-table tbody tr.ah-row:nth-child(n+6) {
  animation-delay: .22s
}

@keyframes ahIn {
  from {
    opacity: 0;
    transform: translateY(8px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

.ah-table tbody tr:hover {
  background: rgba(123, 108, 255, .08)
}

.ah-table .goldcell {
  color: var(--gold);
  font-weight: 600
}

.buybtn {
  transition: transform .1s
}

.buybtn:hover {
  transform: scale(1.06)
}

tr.bought-flash {
  animation: boughtflash .8s ease
}

@keyframes boughtflash {
  0% {
    background: rgba(65, 201, 122, .45)
  }

  100% {
    background: transparent
  }
}

.ah-table tbody tr:hover .item-ico {
  animation: wiggle .4s ease
}

@keyframes wiggle {
  25% {
    transform: rotate(-12deg)
  }

  75% {
    transform: rotate(12deg)
  }
}

/* ===== Battle Stats Summary ===== */
.battle-stats-summary {
  display: flex;
  gap: 0.8rem;
  margin: 0.8rem 0;
  flex-wrap: wrap;
}

.stat-pill {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 90px;
}

.stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
}

/* Battle History Table Enhancements */
.histtable td.wave-col {
  font-weight: 600;
  color: var(--xp);
}

.histtable td.result-col {
  font-weight: 600;
}

.histtable td.damage-col {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.histtable td.loot-col {
  color: var(--gold);
}

.histtable tr.milestone {
  background: rgba(244, 197, 66, 0.08);
}

.milestone-badge {
  display: inline-block;
  color: var(--gold);
  font-size: 0.9rem;
  margin-left: 4px;
  animation: pulseFade 2s ease infinite;
}

@keyframes pulseFade {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

/* ===== The Abyss ===== */
.abyss-hero {
  text-align: center;
  padding: .6rem 0 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
}

.abyss-hero h1 {
  font-size: 2rem;
  text-shadow: 0 0 18px rgba(123, 108, 255, .5);
}

.abyss-hero p {
  max-width: 720px;
  margin: .2rem auto 0;
}

.abyss-stats {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: .7rem;
  margin-bottom: 1rem;
}

@media (max-width:680px) {
  .abyss-stats {
    grid-template-columns: 1fr 1fr;
  }
}

.ab-chip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .6rem .8rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.ab-chip-label {
  color: var(--muted);
  font-size: .78rem;
}

.ab-chip-val {
  font-size: 1.25rem;
  font-weight: 700;
}

.ab-hpbar {
  position: relative;
  height: 20px;
  background: #2a1216;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.ab-hpfill {
  height: 100%;
  background: linear-gradient(90deg, #e2575b, #41c97a);
  transition: width .5s ease;
}

.ab-hptext {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 700;
  text-shadow: 0 1px 2px #000;
}

/* Mana bar: sits directly under the health bar as a capacity gauge. */
.ab-mpbar {
  position: relative;
  height: 14px;
  margin-top: 5px;
  background: #10182e;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.ab-mpfill {
  height: 100%;
  background: linear-gradient(90deg, #3a6fd8, #63b3ff);
  transition: width .5s ease;
}

.ab-mptext {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  font-weight: 700;
  text-shadow: 0 1px 2px #000;
}

/* ---- Abyss expansion 2 (docs/ABYSS_IDEAS.md) ------------------------------ */

/* Sticky mini-HUD (#301) */
.ab-minihud {
  position: fixed;
  top: 52px;
  left: 50%;
  transform: translate(-50%, -140%);
  display: flex;
  gap: 1.2rem;
  padding: .45rem 1rem;
  background: rgba(10, 12, 17, .92);
  border: 1px solid var(--line);
  border-radius: 0 0 12px 12px;
  z-index: 9;
  font-size: .85rem;
  transition: transform .25s ease;
}

.ab-minihud.show {
  transform: translate(-50%, 0);
}

/* Section tabs (#303) */
.ab-tabs {
  display: flex;
  gap: .5rem;
  margin-top: 1.4rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: .5rem;
}

.ab-tab {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 8px 8px 0 0;
  padding: .45rem .9rem;
  cursor: pointer;
}

.ab-tab.active {
  background: var(--panel);
  color: var(--text);
  border-color: var(--accent);
}

/* Leaderboard tier tabs (#276) */
.ab-lb-tabs {
  display: flex;
  gap: .4rem;
  margin: .4rem 0 .8rem;
  flex-wrap: wrap;
}

.ab-lb-tab {
  padding: .25rem .7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: .82rem;
}

.ab-lb-tab.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(123, 108, 255, .12);
}

/* Start-mode picker (#2/#3) */
.ab-startmode {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1rem;
  align-items: center;
  font-size: .85rem;
}

.ab-startmode select {
  background: #0c0f16;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 7px;
  padding: .25rem .4rem;
}

.ab-comeback-note {
  background: rgba(65, 201, 122, .1);
  border: 1px solid var(--good);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 10px 0;
  font-size: .9rem;
}

/* Risk tag on the Descend button (#21) */
.ab-risk-tag {
  font-size: .72rem;
  opacity: .85;
  font-weight: 400;
}

/* Momentum / prestige chips */
.ab-prestige-chip .ab-chip-val {
  color: var(--accent);
}

/* Materials row (#101) */
.ab-materials {
  display: flex;
  gap: .9rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
}

.ab-mat {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .2rem .7rem;
  font-size: .85rem;
}

/* Talent tree branches (#159) */
.ab-tree-branch-label {
  margin: .7rem 0 .3rem;
  letter-spacing: .04em;
}

.ab-tree-branch {
  border-left: 2px solid var(--accent);
  padding-left: .6rem;
}

/* Run-loot floor grouping (#313) */
.abyss-side-floorhdr {
  color: var(--muted);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  text-align: center;
  margin-top: .35rem;
}

/* Rarity beams on loot lines (#88/#329) */
.ab-loot-line.rar-rare, .abyss-side-loot.rar-rare { border-left-color: #5bc0ff; }
.ab-loot-line.rar-epic, .abyss-side-loot.rar-epic { border-left-color: #b36bff; }
.ab-loot-line.rar-legendary, .abyss-side-loot.rar-legendary {
  border-left-color: #ff9800;
  box-shadow: -6px 0 14px -6px rgba(255, 152, 0, .55);
}
.ab-loot-line.rar-mythic, .abyss-side-loot.rar-mythic {
  border-left-color: #ff5470;
  box-shadow: -6px 0 16px -6px rgba(255, 84, 112, .6);
}
.ab-loot-line.rar-divine, .abyss-side-loot.rar-divine {
  border-left-color: #7ee787;
  box-shadow: -6px 0 18px -6px rgba(126, 231, 135, .65);
}

/* Pity pulse (#333) */
@keyframes pity-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.6); }
}

#pityFill.pulse {
  animation: pity-pulse 1.2s ease-in-out infinite;
}

/* Insurance shield glow (#347) */
.ab-insured-tag.glow {
  text-shadow: 0 0 8px rgba(123, 108, 255, .9);
  animation: pity-pulse 2.4s ease-in-out infinite;
}

/* Elevator descent flash (#326) */
.ab-cage {
  transition: top .7s cubic-bezier(.4, 0, .2, 1);
}

@keyframes shaft-flash {
  from { box-shadow: 0 0 18px rgba(123, 108, 255, .8) inset; }
  to { box-shadow: none; }
}

.ab-shaft.descending {
  animation: shaft-flash .7s ease-out 1;
}

/* Depth-dial idle shimmer (#349) */
@keyframes dial-idle {
  0%, 100% { box-shadow: 0 0 28px rgba(123, 108, 255, .35) inset, 0 0 18px rgba(123, 108, 255, .25); }
  50% { box-shadow: 0 0 34px rgba(123, 108, 255, .5) inset, 0 0 26px rgba(123, 108, 255, .4); }
}

.ab-depth-ring {
  animation: dial-idle 4s ease-in-out infinite;
}

/* Coin pile (#350) */
.ab-coinpile {
  text-align: center;
  letter-spacing: -6px;
  font-size: 1.05rem;
  min-height: 1.2em;
}

/* Bank vault overlay (#339) */
.ab-vault-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 6, 10, .75);
  z-index: 40;
}

.ab-vault-overlay.open {
  display: flex;
}

@keyframes vault-door {
  0% { transform: scale(.2) rotate(-20deg); opacity: 0; }
  60% { transform: scale(1.4) rotate(6deg); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.ab-vault-door {
  font-size: 6rem;
  animation: vault-door .8s ease-out 1;
}

/* Run summary card (#341) */
.ab-runsummary .ab-rs-row {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: .3rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

@media (prefers-reduced-motion: reduce) {
  .ab-depth-ring, #pityFill.pulse, .ab-insured-tag.glow, .ab-shaft.descending, .ab-vault-door {
    animation: none;
  }
  .ab-cage,
  .ab-minihud {
    transition: none;
  }
}

/* Intro title + flavour text: JS adds .gone a minute after load; collapse
   smoothly instead of popping so the HUD bars below slide up gently. */
.abyss-intro {
  max-height: 260px;
  overflow: hidden;
  transition: opacity .9s ease, max-height .9s ease;
}

.abyss-intro.gone {
  opacity: 0;
  max-height: 0;
}

/* Row wrapper: detached Armoury / Run Loot sidebars flanking the stage */
.abyss-stage-row {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 280px;
  gap: 1rem;
  align-items: start;
}

.abyss-stage {
  display: grid;
  grid-template-columns: 60px 280px 1fr;
  gap: 1rem;
  background: radial-gradient(120% 140% at 50% -20%, #1c2233, #0c0e13);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.2rem;
}

.abyss-dial {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  justify-content: center;
}

.ab-depth-ring {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, #11141d 55%, transparent 56%), conic-gradient(var(--accent), #2b1a5a);
  border: 2px solid var(--accent);
  box-shadow: 0 0 28px rgba(123, 108, 255, .35) inset, 0 0 18px rgba(123, 108, 255, .25);
}

.ab-depth-label {
  color: var(--muted);
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.ab-depth-num {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
}

.ab-escrow {
  text-align: center;
}

.ab-escrow-label {
  display: block;
  color: var(--muted);
  font-size: .8rem;
}

.ab-escrow-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gold);
}

.abyss-controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .8rem;
}

.ab-status {
  min-height: 2.4em;
  margin: 0;
}

.ab-btn-row {
  display: flex;
  gap: .7rem;
  flex-wrap: wrap;
}

.ab-btn-row button {
  flex: 1;
  min-width: 140px;
  font-size: 1.05rem;
  padding: .7rem 1rem;
}

.abyss-banner {
  display: none;
  margin: 1rem 0 0;
  padding: .9rem 1.1rem;
  border-radius: 10px;
  font-weight: 600;
  border: 1px solid var(--line);
}

.abyss-banner.show {
  display: block;
  animation: pulseFade 1.2s ease 1;
}

.abyss-banner.good {
  background: rgba(65, 201, 122, .12);
  border-color: var(--good);
}

.abyss-banner.bad {
  background: rgba(226, 87, 91, .12);
  border-color: var(--bad);
}

.abyss-log-wrap {
  margin-top: 1.2rem;
}

.abyss-log {
  background: #0a0c11;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .8rem 1rem;
  max-height: 380px;
  overflow-y: auto;
  font-family: 'Consolas', 'Cascadia Code', monospace;
  font-size: .9rem;
  line-height: 1.55;
}

.ab-log-line {
  animation: ablinein .25s ease;
}

@keyframes ablinein {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.ab-center {
  display: block;
  text-align: center;
}

.ab-big {
  font-size: 1.1em;
}

.ab-hr {
  display: block;
  border-top: 1px solid var(--line);
  margin: .35rem 0;
}

.abyss-loot {
  margin-top: .6rem;
}

.ab-loot-line {
  background: rgba(244, 197, 66, .08);
  border-left: 3px solid var(--gold);
  padding: .35rem .6rem;
  margin: .3rem 0;
  border-radius: 4px;
  font-size: .9rem;
}

.abyss-lb {
  margin-top: 1.6rem;
}

/* Abyss expansion: tiers, elevator, threat, upgrades, record, history */

@media (max-width:680px) {
  .abyss-stage-row,
  .abyss-stage {
    grid-template-columns: 1fr;
  }
  .ab-elevator,
  .abyss-side-panel {
    display: none;
  }
}

/* Wide pages (Abyss, Armoury): let the grids use the full screen width */
.wrap-wide {
  max-width: 1500px;
}

.abyss-side-panel {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .9rem;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
}

.abyss-side-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  min-height: 0;
  overflow-y: auto;
}

.abyss-side-panel h3 {
  margin: 0 0 .3rem;
  font-size: .85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* On very wide screens the centered wrap leaves large empty page margins:
   float the sidebars out into them (fixed to the viewport edges, below the
   sticky topbar) and give the stage the full wrap width. Breakpoint =
   wrap 1500px + 2 × (20px edge + 290px panel + breathing room). */
@media (min-width: 2140px) {
  .abyss-stage-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .abyss-side-panel {
    position: fixed;
    top: 80px;
    width: 290px;
    max-height: calc(100vh - 100px);
    z-index: 5;
  }
  .abyss-side-left {
    left: 20px;
  }
  .abyss-side-right {
    right: 20px;
  }
}

.abyss-side-gear {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .4rem .5rem;
  font-size: .78rem;
}

.abyss-side-gear .icn {
  font-size: 1.1rem;
  line-height: 1;
}

.abyss-side-gear .cr {
  margin-left: auto;
  color: var(--muted);
  font-size: .72rem;
  white-space: nowrap;
}

.abyss-side-loot {
  background: var(--panel2);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  padding: .35rem .5rem;
  font-size: .78rem;
  line-height: 1.35;
}

.abyss-side-empty {
  color: var(--muted);
  font-size: .8rem;
  font-style: italic;
}

/* Modern hover tooltip shared by the Armoury quick-view and the run-loot manifest.
   JS-positioned and fixed to the viewport so the scrolling sidebar never clips it
   (replaces the plain native title= tooltips). See the tip helper in abyss.html. */
.abyss-side-gear[data-tip],
.abyss-side-loot[data-tip] { cursor: help; }

.ab-hovertip {
  position: fixed;
  z-index: 10000;
  max-width: 320px;
  padding: .55rem .7rem;
  background: linear-gradient(180deg, rgba(28, 32, 46, .98), rgba(17, 19, 29, .98));
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .55);
  color: var(--text);
  font-size: .74rem;
  line-height: 1.5;
  white-space: pre-line;
  pointer-events: none;
  opacity: 0;
  transition: opacity .09s ease;
}
.ab-hovertip.show { opacity: 1; }
/* Emphasise the first line (item name) so both panels read like a gear card. */
.ab-hovertip::first-line {
  font-weight: 700;
  font-size: .82rem;
  color: #fff;
}

.ab-elevator {
  display: flex;
  justify-content: center;
}

.ab-shaft {
  position: relative;
  width: 14px;
  height: 100%;
  min-height: 160px;
  background: repeating-linear-gradient(180deg, #0a0c11, #0a0c11 10px, #14171f 10px, #14171f 20px);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.ab-cage {
  position: absolute;
  left: -3px;
  width: 20px;
  height: 16px;
  background: var(--accent);
  border-radius: 3px;
  box-shadow: 0 0 8px var(--accent);
  transition: top .6s ease;
}

.ab-threat {
  width: 100%;
  text-align: center;
}

.ab-threat-label {
  color: var(--muted);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.ab-threat-bar {
  height: 8px;
  background: #14171f;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-top: .25rem;
}

.ab-threat-fill {
  height: 100%;
  background: linear-gradient(90deg, #41c97a, #f4c542, #e2575b);
  transition: width .5s ease;
}

.ab-insured-tag {
  display: block;
  color: var(--good);
  font-size: .78rem;
  margin-top: .2rem;
}

.ab-tiers {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.ab-tier {
  flex: 1;
  min-width: 130px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .5rem .6rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  background: var(--panel);
}

.ab-tier:has(input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(123, 108, 255, .3);
}

.ab-tier.locked {
  opacity: .5;
  cursor: not-allowed;
}

.ab-tier input {
  margin-right: .3rem;
}

.ab-tier-name {
  font-weight: 700;
}

.ab-tier-meta {
  color: var(--muted);
  font-size: .72rem;
}

.ab-subrow {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  font-size: .85rem;
}

.ab-sub-label {
  color: var(--muted);
}

.ab-cursed {
  margin-left: auto;
  color: var(--muted);
}

.ab-dura-line {
  color: #ffb74d;
  font-size: .85rem;
  margin: .2rem 0;
}

.abyss-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.4rem;
}

@media (max-width:880px) {
  .abyss-cols {
    grid-template-columns: 1fr;
  }
}

.abyss-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}

.abyss-panel h2 {
  margin-top: 0;
}

.ab-upgrades {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.ab-up {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .5rem .6rem;
}

.ab-up-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ab-up-lv {
  color: var(--accent);
  font-weight: 700;
}

.ab-record {
  list-style: none;
  padding: 0;
  margin: 0 0 .8rem;
}

.ab-record li {
  display: flex;
  justify-content: space-between;
  padding: .25rem 0;
  border-bottom: 1px solid var(--line);
}

.ab-record li span {
  color: var(--muted);
}

.ab-achievements {
  margin-top: .8rem;
}

.ab-ach {
  display: inline-block;
  background: rgba(244, 197, 66, .12);
  border: 1px solid var(--gold);
  color: var(--gold);
  border-radius: 999px;
  padding: .15rem .6rem;
  margin: .15rem;
  font-size: .78rem;
}

.ab-badge-picker {
  margin-top: .6rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .3rem
}

.ab-history {
  width: 100%;
  border-collapse: collapse;
}

.ab-history td {
  padding: .3rem .4rem;
  border-bottom: 1px solid var(--line);
}

@media (prefers-reduced-motion: reduce) {

  .ab-log-line,
  .abyss-banner.show,
  .ab-cage,
  .ab-minihud,
  .ab-threat-fill,
  .ab-hpfill {
    animation: none !important;
    transition: none !important;
  }
}

/* ===== Abyss Wave 3 Additions ===== */

.ab-focus-row {
  margin: 15px 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}
.ab-focus-row label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.ab-prep-panel {
  margin-top: 20px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 8px;
}
.ab-prep-panel h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 15px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ab-consumables-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.ab-cons-item {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.ab-cons-item b {
  font-size: 13px;
  color: #9cdcfe;
  margin-bottom: 4px;
}
.ab-cons-item button {
  margin-top: 8px;
  align-self: flex-start;
}

.ab-noncombat-panel {
  background: linear-gradient(135deg, rgba(23, 28, 41, 0.95), rgba(15, 18, 28, 0.95));
  border: 1px solid #4a6fa5;
  box-shadow: 0 0 15px rgba(74, 111, 165, 0.3);
  border-radius: 12px;
  padding: 25px;
  margin: 20px auto;
  max-width: 600px;
}
.ab-noncombat-panel h2 {
  margin-top: 0;
  color: #5b92e5;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ab-nc-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0;
}
.ab-nc-options button {
  text-align: left;
  padding: 14px 18px;
  font-size: 15px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #ccc;
  transition: all 0.2s ease;
  width: 100%;
}
.ab-nc-options button:hover {
  background: rgba(91, 146, 229, 0.1);
  border-color: #5b92e5;
  color: #fff;
}

.abyss-lore-bestiary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 25px;
}
@media(max-width: 768px) {
  .abyss-lore-bestiary {
    grid-template-columns: 1fr;
  }
}

.ab-codex-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 5px;
}
.ab-codex-item {
  border-radius: 8px;
  padding: 12px 15px;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.2s ease;
}
.ab-codex-item.locked {
  border: 1px dashed rgba(255, 255, 255, 0.08);
  opacity: 0.6;
}
.ab-codex-item.unlocked {
  border: 1px solid rgba(74, 111, 165, 0.3);
  background: rgba(74, 111, 165, 0.05);
}
.ab-codex-id {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: bold;
  display: block;
  margin-bottom: 4px;
}
.ab-codex-item.locked .ab-codex-id {
  color: #888;
}
.ab-codex-item.unlocked .ab-codex-id {
  color: #5b92e5;
}
.ab-codex-text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
}

.ab-bestiary {
  max-height: 400px;
  overflow-y: auto;
}
.ab-bestiary-table {
  width: 100%;
  border-collapse: collapse;
}
.ab-bestiary-table th, .ab-bestiary-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.ab-bestiary-table th {
  font-size: 12px;
  text-transform: uppercase;
  color: #888;
  letter-spacing: 0.5px;
}
.ab-bestiary-table td {
  font-size: 14px;
}

/* ===== Abyss UX batch (docs/ABYSS_UX_IDEAS.md) ===== */

/* Stacked toasts (UX-91) + rarity loot toasts (UX-45) */
.ab-toasthost {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 120;
  pointer-events: none;
  max-width: min(560px, 92vw);
}

.toast2 {
  opacity: 0;
  transform: translateY(14px);
  transition: all .25s cubic-bezier(.18, .89, .32, 1.28);
  font-size: .9rem;
  padding: .65rem 1.1rem;
  border-radius: 10px;
  background: rgba(26, 31, 43, .96);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  text-align: center;
}

.toast2.show {
  opacity: 1;
  transform: translateY(0);
}

.toast2.good { border-color: var(--good); color: var(--good); }
.toast2.bad  { border-color: var(--bad);  color: var(--bad);  }

.toast2.loot { color: var(--text); text-align: left; }
.toast2.loot.rar-epic      { border-color: #b26bff; box-shadow: 0 0 14px rgba(178, 107, 255, .35); }
.toast2.loot.rar-legendary { border-color: #ff9d3c; box-shadow: 0 0 16px rgba(255, 157, 60, .4); }
.toast2.loot.rar-mythic    { border-color: #e2575b; box-shadow: 0 0 18px rgba(226, 87, 91, .45); }
.toast2.loot.rar-divine    { border-color: #f4c542; box-shadow: 0 0 20px rgba(244, 197, 66, .5); }

/* Connectivity banner (UX-93) */
.ab-netbanner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 130;
  background: #7a2c2c;
  color: #fff;
  text-align: center;
  font-size: .85rem;
  font-weight: 600;
  padding: .4rem;
}

/* Per-button spinner (UX-89) */
.btn-busy {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btnspin .7s linear infinite;
}

@keyframes btnspin {
  to { transform: rotate(360deg); }
}

/* Escrow delta float (UX-33) */
.ab-escrow { position: relative; }

.ab-float-delta {
  position: absolute;
  right: 0;
  top: -2px;
  font-weight: 700;
  font-size: .85rem;
  pointer-events: none;
  animation: abFloatUp 1.3s ease-out forwards;
}

.ab-float-delta.up   { color: var(--good); }
.ab-float-delta.down { color: var(--bad); }

@keyframes abFloatUp {
  0%   { opacity: 0; transform: translateY(6px); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-26px); }
}

/* Floor trail mini-map (UX-34) */
.ab-depthrail {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex-wrap: wrap;
  margin-top: .5rem;
  font-size: .85rem;
}

.ab-dr-cell {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0d1017;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.ab-dr-cell.boss { border-color: #e91e63; }

.ab-dr-next {
  color: var(--muted);
  font-size: .75rem;
  margin-left: .3rem;
}

/* Boss intro card (UX-28) */
.ab-bosscard {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  pointer-events: none;
  opacity: 0;
}

.ab-bosscard.show { animation: bossCard 1.5s ease forwards; }

.ab-bosscard-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  background: rgba(10, 8, 14, .92);
  border: 2px solid #e91e63;
  border-radius: 14px;
  padding: 1.2rem 2.2rem;
  box-shadow: 0 0 40px rgba(233, 30, 99, .45);
}

.ab-bosscard-skull { font-size: 2.4rem; }

.ab-bosscard-inner b {
  font-size: 1.25rem;
  color: #ff7aa2;
  letter-spacing: .5px;
}

@keyframes bossCard {
  0%   { opacity: 0; transform: scale(.6); }
  18%  { opacity: 1; transform: scale(1.06); }
  30%  { transform: scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: scale(1.02); }
}

/* Screen-edge rarity glow (UX-52) */
.ab-edgeglow {
  position: fixed;
  inset: 0;
  z-index: 85;
  pointer-events: none;
  opacity: 0;
}

.ab-edgeglow.on { animation: edgeGlow 1.3s ease forwards; }

.ab-edgeglow.rar-legendary { box-shadow: inset 0 0 120px rgba(255, 157, 60, .55); }
.ab-edgeglow.rar-mythic    { box-shadow: inset 0 0 130px rgba(226, 87, 91, .55); }
.ab-edgeglow.rar-divine    { box-shadow: inset 0 0 140px rgba(244, 197, 66, .6); }

@keyframes edgeGlow {
  0%   { opacity: 0; }
  25%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Entry gate sweep (UX-20) */
.ab-gate {
  position: fixed;
  inset: 0;
  z-index: 140;
  pointer-events: none;
  overflow: hidden;
}

.ab-gate-l,
.ab-gate-r {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 51%;
  background: linear-gradient(180deg, #0a0c11, #14101d);
  border-right: 2px solid #3a2f55;
  transition: transform .6s cubic-bezier(.7, 0, .3, 1);
}

.ab-gate-l { left: 0; transform: translateX(-102%); }
.ab-gate-r { right: 0; border-right: none; border-left: 2px solid #3a2f55; transform: translateX(102%); }

.ab-gate.closing .ab-gate-l,
.ab-gate.closing .ab-gate-r { transform: translateX(0); }

/* Loot filters + rarity dots (UX-46/48) */
.ab-loot-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin: .35rem 0 .5rem;
}

.ab-chip {
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 14px;
  padding: .15rem .55rem;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
}

.ab-chip:hover { border-color: var(--accent); color: var(--text); }

.ab-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.ab-rar-dots {
  display: flex;
  gap: .5rem;
  font-size: .75rem;
  font-weight: 700;
  margin-top: .15rem;
}

/* Hover compare card (UX-47) */
.ab-hovercard {
  position: absolute;
  z-index: 150;
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .6rem .8rem;
  width: 240px;
  font-size: .8rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .55);
  pointer-events: none;
}

.ab-hovercard b { font-size: .85rem; }

.ab-hc-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .12rem 0;
  color: var(--muted);
}

.ab-hc-row b { color: var(--text); }

.ab-hc-cmp {
  margin-top: .35rem;
  padding-top: .35rem;
  border-top: 1px solid var(--line);
  color: var(--gold);
  font-size: .76rem;
}

/* Undo link on auto-equip rows (UX-53) */
.ab-undo-link {
  color: var(--xp);
  font-size: .74rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}

/* Bank summary total row (UX-49/54) */
.ab-rs-total {
  border-top: 1px solid var(--gold) !important;
  margin-top: .3rem;
  padding-top: .4rem !important;
}

.ab-rs-total b { color: var(--gold); font-size: 1.05rem; }

/* Forge accordions (UX-55) */
.ab-acc {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .015);
}

.ab-acc > summary {
  cursor: pointer;
  padding: .45rem .7rem;
  font-size: .82rem;
  font-weight: 700;
  color: var(--muted);
  user-select: none;
  list-style: none;
}

.ab-acc > summary::-webkit-details-marker { display: none; }

.ab-acc > summary::after {
  content: "▸";
  float: right;
  transition: transform .15s ease;
}

.ab-acc[open] > summary { color: var(--text); }
.ab-acc[open] > summary::after { transform: rotate(90deg); }

.ab-acc-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: .3rem .7rem .6rem;
}

/* Reduced-motion coverage for the new pieces */
@media (prefers-reduced-motion: reduce) {
  .ab-float-delta,
  .ab-bosscard.show,
  .ab-edgeglow.on,
  .btn-busy::after {
    animation: none !important;
  }

  .toast2,
  .ab-gate-l,
  .ab-gate-r {
    transition: none !important;
  }
}

/* ===== Abyss Skill Web (PoE-style passive tree) ===== */
.tree-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.tree-head-right {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.tree-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: .6rem 0;
}

.tree-toolbar input[type=search] {
  background: #0c0f16;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: .45rem .7rem;
  min-width: 280px;
}

.tree-legend {
  display: flex;
  gap: .8rem;
  font-size: .76rem;
  color: var(--muted);
}

.tl-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: -1px;
}

.tl-alloc { background: #7b6cff; box-shadow: 0 0 6px #7b6cff; }
.tl-avail { background: transparent; border: 2px solid #5bc0ff; }
.tl-lock  { background: #232a3d; border: 1px solid var(--line); }
.tl-key   { background: #f4c542; }

.tree-stage {
  position: relative;
  height: 70vh;
  min-height: 480px;
  background: radial-gradient(circle at center, #131725, #0a0c11 75%);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  cursor: grab;
}

.tree-stage:active { cursor: grabbing; }

#treeSvg {
  width: 100%;
  height: 100%;
  display: block;
}

.te { stroke: #232a3d; stroke-width: 2; }
.te.half { stroke: #3a4667; }
.te.on { stroke: #7b6cff; stroke-width: 3; }

.tn {
  fill: #232a3d;
  stroke: #384265;
  stroke-width: 1.5;
  cursor: pointer;
}

.tn.tn-root { fill: #0d1017; stroke: #f4c542; stroke-width: 3; }

/* Sector tints on locked nodes (faint) */
.tn.s0 { stroke: #7a4444; }
.tn.s1 { stroke: #4a7a52; }
.tn.s2 { stroke: #55707a; }
.tn.s3 { stroke: #5f4d80; }
.tn.s4 { stroke: #7a6f3d; }
.tn.s5 { stroke: #6a3d7a; }

.tn.t-keystone { stroke-width: 3; }
.tn.t-notable, .tn.t-bridge { stroke-width: 2.2; }

.tn.can {
  fill: #101827;
  stroke: #5bc0ff;
  stroke-width: 2.5;
}

.tn.on { stroke-width: 2.5; }
.tn.on.s0 { fill: #e2575b; stroke: #ff9d9f; }
.tn.on.s1 { fill: #41c97a; stroke: #9af0be; }
.tn.on.s2 { fill: #5bc0ff; stroke: #b3e3ff; }
.tn.on.s3 { fill: #b26bff; stroke: #dcbfff; }
.tn.on.s4 { fill: #f4c542; stroke: #ffe49a; }
.tn.on.s5 { fill: #7b6cff; stroke: #c3bcff; }

.tn.hit { stroke: #fff; stroke-width: 3.5; }
.tn.dim { opacity: .25; }

/* Visible keyboard focus for tree nodes (they are tabbable buttons). */
.tn:focus { outline: none; }
.tn:focus-visible {
  stroke: #8ab4ff;
  stroke-width: 3.5;
  filter: drop-shadow(0 0 6px rgba(138, 180, 255, .9));
}

.tree-tip {
  position: absolute;
  z-index: 5;
  max-width: 240px;
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .5rem .7rem;
  font-size: .8rem;
  pointer-events: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .55);
}

.tt-on  { color: #7b6cff; font-weight: 700; }
.tt-can { color: #5bc0ff; font-weight: 700; }

.tree-summary { margin-top: 1rem; }

.tree-summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}