:root {
  --ink: #17131b;
  --paper: #fffaf0;
  --cream: #f7f0dc;
  --line: rgba(23, 19, 27, 0.1);
  --muted: #81786b;
  --green: #91d96d;
  --mint: #bfe6dc;
  --peach: #f5b58d;
  --pink: #ef9fd2;
  --blue: #8eb8ff;
  --gold: #f3d46d;
  --lilac: #c6a5ef;
  --rail: #121019;
  --surface: #fff9ec;
  --surface-strong: #ffffff;
  --surface-blue: #eef6ff;
  --surface-green: #effbe9;
  --shadow: 0 22px 46px rgba(41, 27, 13, 0.14);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  color: var(--ink);
  font-family: Manrope, Verdana, sans-serif;
  background: #fff;
  overflow: hidden;
}

body[data-theme="dark"] {
  --ink: #fff8e8;
  --paper: #100c14;
  --cream: #201824;
  --line: rgba(255, 248, 232, 0.26);
  --muted: #eadcc1;
  --green: #9ee87a;
  --mint: #75d4c5;
  --peach: #ffb38a;
  --pink: #f3a4d8;
  --blue: #8fbaff;
  --gold: #f4d36a;
  --lilac: #c7a7ff;
  --rail: #09070d;
  --surface: #17111b;
  --surface-strong: #251c2b;
  --surface-blue: #18304a;
  --surface-green: #193b20;
  --shadow: 0 22px 46px rgba(0, 0, 0, 0.46);
  color-scheme: dark;
}

button, input, select { font: inherit; }
button { border: 0; cursor: pointer; }

.shell {
  width: 100vw;
  height: 100vh;
  padding: 0;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 0;
}

.rail {
  min-height: 0;
  padding: 24px 14px;
  border-radius: 0;
  background: var(--rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: none;
  z-index: 3;
  scrollbar-width: none;
}

.rail::-webkit-scrollbar { display: none; }

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0;
}

.rail-nav {
  margin-top: 74px;
  display: grid;
  gap: 18px;
}

.rail-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: transparent;
  color: rgba(255,255,255,0.62);
  font-weight: 900;
  transition: 0.18s ease;
}

.nav-svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rail-btn > span { transform: translateY(-1px); }

.nav-icon {
  width: 21px;
  height: 21px;
  position: relative;
  display: block;
  color: currentColor;
}

.nav-icon::before,
.nav-icon::after {
  content: "";
  position: absolute;
  display: block;
}

.icon-table::before {
  inset: 3px;
  border: 2px solid currentColor;
  border-radius: 7px;
}

.icon-table::after {
  left: 6px;
  right: 6px;
  top: 9px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor;
}

.icon-duel::before,
.icon-duel::after {
  width: 18px;
  height: 3px;
  top: 9px;
  left: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(42deg);
  transform-origin: center;
}

.icon-duel::after {
  transform: rotate(-42deg);
}

.icon-quests::before {
  left: 4px;
  top: 3px;
  width: 13px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 5px;
}

.icon-quests::after {
  left: 8px;
  top: 7px;
  width: 8px;
  height: 5px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

.icon-deck::before {
  width: 14px;
  height: 17px;
  left: 4px;
  top: 2px;
  border: 2px solid currentColor;
  border-radius: 5px;
  background: rgba(255,255,255,0.03);
  transform: rotate(-7deg);
}

.icon-deck::after {
  width: 14px;
  height: 17px;
  left: 2px;
  top: 4px;
  border: 2px solid currentColor;
  border-radius: 5px;
  transform: rotate(7deg);
}

.icon-market::before {
  left: 3px;
  top: 5px;
  width: 15px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 4px 4px 7px 7px;
}

.icon-market::after {
  left: 7px;
  top: 2px;
  width: 7px;
  height: 6px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.icon-league::before {
  left: 5px;
  top: 3px;
  width: 11px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 4px 4px 8px 8px;
}

.icon-league::after {
  left: 8px;
  top: 15px;
  width: 5px;
  height: 4px;
  background: currentColor;
  box-shadow: -4px 4px 0 currentColor, 4px 4px 0 currentColor;
}

.icon-stats::before {
  left: 4px;
  bottom: 3px;
  width: 3px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 6px -5px 0 currentColor, 12px -10px 0 currentColor;
}

.icon-stats::after {
  left: 3px;
  right: 2px;
  bottom: 2px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.icon-wallet::before {
  left: 3px;
  top: 5px;
  width: 16px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 5px;
}

.icon-wallet::after {
  right: 2px;
  top: 9px;
  width: 7px;
  height: 6px;
  border: 2px solid currentColor;
  border-radius: 5px 0 0 5px;
  background: var(--rail);
}

.rail-btn:hover,
.rail-btn.active {
  color: #fff;
  background: rgba(255,255,255,0.14);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

.rail-btn::after {
  content: attr(data-tip);
  position: absolute;
  left: 58px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  opacity: 0;
  transform: translateX(-8px);
  pointer-events: none;
  transition: 0.16s ease;
  white-space: nowrap;
}

.rail-btn:hover::after { opacity: 1; transform: translateX(0); }
.wallet { margin-top: auto; }

.network-pill {
  width: 42px;
  height: 24px;
  margin-top: 14px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.08);
}

.network-pill span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(145,217,109,0.18);
}

.network-pill.wrong span { background: #f15c5c; box-shadow: 0 0 0 5px rgba(241,92,92,0.18); }

.app-card {
  min-width: 0;
  height: 100%;
  padding: clamp(22px, 2.6vw, 38px);
  border-radius: 0;
  background: #f5efe3;
  box-shadow: none;
  overflow: auto;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(190px, 300px) minmax(220px, 420px) 1fr;
  gap: 18px;
  align-items: center;
}

.title-lockup span,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.title-lockup strong {
  display: block;
  margin-top: 3px;
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(27px, 3vw, 42px);
  line-height: 0.95;
}

.search-box {
  height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-strong);
  border: 1px solid rgba(23,19,27,0.12);
  box-shadow: 0 8px 18px rgba(23,19,27,0.05);
}

.search-box span {
  width: 14px;
  height: 14px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  position: relative;
}

.search-box span::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: -5px;
  width: 8px;
  height: 3px;
  border-radius: 3px;
  background: var(--ink);
  transform: rotate(45deg);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
}

.profile {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}

.apr-live {
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-strong);
  border: 1px solid rgba(23,19,27,0.1);
  font-size: 12px;
  font-weight: 900;
}

.apr-live i {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--green);
}

.wallet-cta,
.primary-action,
.ghost-action,
.icon-btn,
.link-btn,
.theme-toggle {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 900;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.wallet-cta,
.primary-action {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 10px 22px rgba(23,19,27,0.18);
}

.wallet-cta.connected {
  background: #254822;
  color: #dfffd6;
}

.primary-action.small { min-height: 34px; padding: 0 14px; font-size: 12px; }
.primary-action.wide { width: 100%; }
.primary-action:disabled,
.primary-action.blocked { opacity: 0.42; cursor: not-allowed; box-shadow: none; }

.ghost-action,
.icon-btn,
.link-btn,
.theme-toggle {
  background: var(--surface-strong);
  color: var(--ink);
  border: 1px solid rgba(23,19,27,0.13);
}

.theme-toggle {
  min-width: 88px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.theme-toggle span {
  width: 28px;
  height: 16px;
  padding: 2px;
  border-radius: 999px;
  display: block;
  background: rgba(23,19,27,0.16);
}

.theme-toggle span::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: block;
  background: var(--ink);
  transition: transform 0.18s ease, background 0.18s ease;
}

.theme-toggle[aria-pressed="true"] span::before { transform: translateX(12px); }
.theme-toggle b { font-size: 11px; }

.icon-btn {
  width: 42px;
  padding: 0;
  font-size: 10px;
}

.avatar {
  width: 46px;
  height: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--peach), #f7e0c5);
  color: var(--ink);
  font-size: 10px;
  font-weight: 900;
  overflow: hidden;
}

.primary-action:hover,
.ghost-action:hover,
.link-btn:hover,
.wallet-cta:hover,
.icon-btn:hover,
.theme-toggle:hover {
  transform: translateY(-2px);
}

.chain-banner {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffe0dc;
  border: 1px solid #f5ada4;
  font-weight: 900;
}

.view { display: none; animation: rise 0.22s ease; }
.view.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

#dashboardView {
  margin-top: 28px;
  display: none;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  gap: 22px;
}

#dashboardView.active { display: grid; }

.game-table {
  min-height: 0;
  padding: clamp(18px, 2vw, 28px);
  border-radius: 28px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(23,19,27,0.045) 1px, transparent 1px),
    linear-gradient(rgba(23,19,27,0.045) 1px, transparent 1px),
    linear-gradient(135deg, #fffaf0, #eef6ff 58%, #effbe9);
  background-size: 18px 18px, 18px 18px, auto;
  border: 1px solid rgba(23,19,27,0.13);
  box-shadow: var(--shadow);
}

.dash-head,
.table-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.dash-head h1,
.table-toolbar h1 {
  margin: 6px 0 0;
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(34px, 3.6vw, 54px);
  line-height: 0.95;
  letter-spacing: 0;
}

.table-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.command-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.status-card {
  min-height: 132px;
  padding: 16px;
  border-radius: 22px;
  display: grid;
  align-content: space-between;
  background: var(--surface-strong);
  border: 1px solid rgba(23,19,27,0.12);
  box-shadow: 0 12px 26px rgba(23,19,27,0.07);
}

.status-card:nth-child(2) { background: var(--surface-blue); }
.status-card:nth-child(3) { background: var(--surface-green); }
.status-card:nth-child(4) { background: #fff4d2; }

.status-card span,
.pot-strip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-card strong {
  font-size: 28px;
  line-height: 1;
}

.status-card em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}

.action-board {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 14px;
  align-items: stretch;
}

.duel-preview,
.opponent-panel {
  padding: 18px;
  border-radius: 24px;
  background: var(--surface-strong);
  border: 1px solid rgba(23,19,27,0.12);
  box-shadow: 0 14px 28px rgba(23,19,27,0.08);
}

.duel-preview .versus-lane {
  margin-top: 14px;
}

.pot-strip {
  margin-top: 14px;
  min-height: 58px;
  padding: 0 16px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #17131b;
  color: #fff;
}

.pot-strip span { color: rgba(255,255,255,0.65); }
.pot-strip strong { font-size: 22px; }

.board-grid {
  min-height: 410px;
  display: grid;
  grid-template-columns: minmax(150px, 0.65fr) minmax(340px, 1.25fr) minmax(160px, 0.65fr);
  gap: 18px;
  align-items: center;
}

.opponent-panel,
.match-panel,
.panel-block {
  padding: 22px;
  border-radius: 24px;
  background: var(--surface-strong);
  border: 1px solid rgba(23,19,27,0.12);
  box-shadow: var(--shadow);
}

.opponent-panel { align-self: start; margin-top: 54px; }
.match-panel { align-self: end; }
.action-board .opponent-panel { align-self: stretch; margin-top: 0; }

.agent-orb {
  width: 70px;
  height: 70px;
  margin-bottom: 14px;
  border-radius: 25px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  font-family: Fraunces, Georgia, serif;
  font-size: 26px;
}

.opponent-panel span,
.opponent-panel strong,
.opponent-panel p { display: block; }
.opponent-panel span { color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; }
.opponent-panel strong { margin-top: 4px; font-size: 20px; }
.opponent-panel p { margin: 14px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.table-center { display: grid; justify-items: center; gap: 22px; }

.pot-ring {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  background:
    radial-gradient(circle at center, rgba(255,255,255,0.92) 0 48%, transparent 50%),
    conic-gradient(from 20deg, var(--green), var(--gold), var(--pink), var(--blue), var(--green));
  box-shadow: 0 20px 34px rgba(23,19,27,0.14);
}

.pot-ring span,
.pot-ring em { color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; font-style: normal; }
.pot-ring strong { margin: 4px 0; font-family: Fraunces, Georgia, serif; font-size: 28px; }

.versus-lane,
.battle-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 52px minmax(150px, 1fr);
  gap: 16px;
  align-items: center;
}

.duel-arena .battle-row {
  width: min(100%, 640px);
  margin: 135px auto 38px;
  align-self: center;
}

.versus-lane > b,
.versus {
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 12px 24px rgba(23,19,27,0.18);
}

.played-card {
  min-height: 148px;
  padding: 20px;
  border-radius: 24px;
  display: grid;
  align-content: end;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(23,19,27,0.08);
  box-shadow: 0 16px 30px rgba(23,19,27,0.08);
}

.played-card span,
.played-card em { color: var(--muted); font-size: 12px; font-weight: 900; font-style: normal; }
.played-card strong { margin: 7px 0; font-size: 22px; line-height: 1.05; }
.played-card.selected { background: #fff; box-shadow: 0 0 0 3px rgba(145,217,109,0.48), 0 16px 30px rgba(23,19,27,0.08); }
.played-card.revealed { background: rgba(255,255,255,0.92); box-shadow: 0 0 0 3px rgba(142,184,255,0.42), 0 16px 30px rgba(23,19,27,0.08); }
.empty-slot { opacity: 0.72; }

.stat-pair {
  margin-top: 12px;
  padding: 13px 0;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
}
.stat-pair span { color: var(--muted); font-weight: 900; }

.hand-dock {
  margin-top: 18px;
  padding: 14px;
  border-radius: 28px;
  background: rgba(23,19,27,0.055);
  border: 1px solid rgba(23,19,27,0.12);
}

.dock-head,
.section-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-weight: 900;
}

.dock-head span,
.section-kicker span:first-child {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.card-hand,
.cards-grid,
.market-grid,
.stats-top-grid {
  margin-top: 14px;
  display: grid;
  /* auto-fill keeps empty tracks → cards stay fixed width when filtered */
  grid-template-columns: repeat(auto-fill, minmax(220px, 280px));
  gap: 14px;
}

.game-card {
  min-height: 260px;
  padding: 16px;
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(23,19,27,0.08);
  box-shadow: 0 14px 30px rgba(23,19,27,0.08);
  text-align: left;
}

.game-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.9;
  background: linear-gradient(160deg, var(--tone, var(--mint)), rgba(255,255,255,0.7));
  z-index: 0;
}

.game-card > * { position: relative; z-index: 1; }
.game-card.green { --tone: #b7ec9c; }
.game-card.cyan { --tone: #a9e6f0; }
.game-card.pink { --tone: #f3afe0; }
.game-card.lilac { --tone: #d6bef5; }
.game-card.gold { --tone: #f4d66f; }
.game-card.mint { --tone: #bdebdc; }

.game-card.compact { min-height: 216px; }
.game-card.equipped { box-shadow: 0 0 0 3px rgba(23,19,27,0.86), 0 14px 30px rgba(23,19,27,0.08); }

.card-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.rarity {
  min-width: 28px;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}
.tone-common { background: #34303a; color: #fff; }
.tone-rare { background: #225ab7; color: #fff; }
.tone-epic { background: #7c3fc7; color: #fff; }
.tone-legendary { background: #a26d00; color: #fff; }

.card-topline em {
  color: rgba(23,19,27,0.54);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.protocol-logo {
  width: 70px;
  height: 70px;
  margin: 28px auto 22px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,0.76);
  color: var(--ink);
  font-family: Fraunces, Georgia, serif;
  font-size: 21px;
  box-shadow: inset 0 0 0 1px rgba(23,19,27,0.08);
}

.protocol-logo::after {
  content: attr(data-fallback);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 0;
}

.protocol-logo img {
  width: 62%;
  height: 62%;
  object-fit: contain;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 8px rgba(23,19,27,0.1));
}

.protocol-logo.small {
  width: 48px;
  height: 48px;
  margin: 0 0 12px;
  border-radius: 17px;
  font-size: 14px;
}

.game-card h3 { margin: auto 0 2px; font-size: 20px; line-height: 1.05; }
.game-card small { color: rgba(23,19,27,0.62); font-weight: 900; }

.card-values {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(23,19,27,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 900;
}

.card-values b {
  min-width: 42px;
  min-height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
}

.card-actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.card-actions button {
  min-height: 34px;
  border-radius: 14px;
  background: rgba(255,255,255,0.62);
  color: var(--ink);
  font-weight: 900;
}

.side-grid {
  display: grid;
  gap: 18px;
  align-content: start;
}

.apr-stack,
.match-list,
.tx-list,
.leaderboard,
.apr-bars {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.apr-row,
.match-row,
.tx-row,
.leader-row,
.apr-bar-row {
  min-height: 58px;
  padding: 12px 14px;
  border-radius: 18px;
  display: grid;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  border: 1px solid rgba(23,19,27,0.12);
  box-shadow: 0 8px 18px rgba(23,19,27,0.045);
}

.apr-row {
  grid-template-columns: 82px 1fr 92px;
}
.apr-row span { font-family: Fraunces, Georgia, serif; font-size: 20px; }
.apr-row strong { font-size: 20px; }
.apr-row em { color: var(--muted); font-style: normal; font-size: 12px; font-weight: 900; }

.match-row {
  grid-template-columns: 76px 1fr 76px 88px;
}
.match-row.win { background: rgba(145,217,109,0.64); }
.match-row.loss { background: rgba(245,181,141,0.55); }
.match-row em { color: var(--muted); font-style: normal; font-size: 12px; }

.play-screen {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 260px minmax(480px, 1fr) 290px;
  gap: 18px;
  align-items: stretch;
  min-height: calc(100vh - 170px);
  padding: 18px;
  border-radius: 32px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle, rgba(23,19,27,0.08) 1px, transparent 1px) 0 0 / 16px 16px,
    radial-gradient(circle at 24% 18%, rgba(255,153,168,0.36), transparent 30%),
    radial-gradient(circle at 78% 18%, rgba(247,220,118,0.42), transparent 32%),
    radial-gradient(circle at 62% 74%, rgba(221,167,242,0.38), transparent 30%),
    linear-gradient(125deg, rgba(255,255,255,0.94), rgba(255,240,246,0.86) 42%, rgba(255,249,204,0.82));
  border: 1px solid rgba(23,19,27,0.05);
}

.play-screen > .panel-block {
  background: rgba(255,255,255,0.76);
  backdrop-filter: blur(18px);
}

.resources-btn {
  min-width: 52px;
  width: auto;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0;
}

.match-setup,
.hand-panel {
  align-self: start;
}

.match-stats,
.wallet-stats,
.stats-cards {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.match-stats article,
.wallet-stats article,
.stats-cards article {
  padding: 14px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(23,19,27,0.12);
}

.match-stats small,
.wallet-stats small,
.stats-cards small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.match-stats strong,
.wallet-stats strong,
.stats-cards strong { display: block; margin-top: 5px; font-size: 22px; }

.duel-arena {
  min-height: 620px;
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  overflow: hidden;
  background: transparent;
  border-color: rgba(255,255,255,0.46);
  box-shadow: none;
}

.duel-arena .section-kicker,
.duel-arena .score-strip,
.duel-arena .battle-row,
.duel-arena .round-log,
.duel-arena > .primary-action {
  position: relative;
  z-index: 2;
}

.duel-arena .score-strip {
  margin: 8px 0 18px;
  min-height: 66px;
  padding: 0 18px;
  border-radius: 999px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--ink);
  color: #fff;
}
.score-strip span { color: rgba(255,255,255,0.58); font-weight: 900; }

.floating-card {
  position: absolute;
  width: clamp(128px, 12vw, 174px);
  min-height: 126px;
  z-index: 1;
  filter: drop-shadow(0 22px 24px rgba(23,19,27,0.13));
}

.float-a { left: 6%; top: 23%; transform: rotate(-9deg); }
.float-b { right: 7%; top: 17%; transform: rotate(8deg); }
.float-c { right: 8%; bottom: 21%; transform: rotate(-6deg); }
.float-d { left: 9%; bottom: 17%; transform: rotate(7deg); }

.float-card-inner {
  min-height: 126px;
  padding: 14px;
  border-radius: 22px;
  display: grid;
  align-content: end;
  gap: 5px;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(255,255,255,0.72);
}

.float-card-inner.dex { background: linear-gradient(150deg, #fff, rgba(191,230,220,0.9)); }
.float-card-inner.lending { background: linear-gradient(150deg, #fff, rgba(142,184,255,0.78)); }
.float-card-inner.staking { background: linear-gradient(150deg, #fff, rgba(243,212,109,0.82)); }
.float-card-inner.rwa { background: linear-gradient(150deg, #fff, rgba(239,159,210,0.76)); }
.float-card-inner strong { font-size: 15px; line-height: 1.05; }
.float-card-inner em,
.float-card-inner b {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.round-log {
  margin: 16px 0;
  min-height: 82px;
  max-height: 140px;
  overflow: auto;
  display: grid;
  gap: 8px;
}
.round-log span,
.empty {
  padding: 12px;
  border-radius: 14px;
  background: rgba(23,19,27,0.055);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.hand-list {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.hand-list button {
  min-height: 74px;
  padding: 12px;
  border-radius: 18px;
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  border: 1px solid rgba(23,19,27,0.12);
}
.hand-list button.picked { box-shadow: 0 0 0 3px var(--ink); }
.hand-list button span {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  font-family: Fraunces, Georgia, serif;
}
.hand-list button strong,
.hand-list button em { grid-column: 2; }
.hand-list button em { color: var(--muted); font-size: 12px; font-style: normal; font-weight: 900; }

.muted-panel { opacity: 0.58; }

.deck-summary,
.market-hero,
.quests-hero,
.wallet-hero,
.stats-screen {
  margin-top: 28px;
}

#walletView {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.deck-summary,
.market-hero,
.quests-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.deck-summary h2,
.market-hero h2,
.quests-hero h2 { margin: 3px 0 5px; font-family: Fraunces, Georgia, serif; font-size: 38px; }
.deck-summary p,
.market-hero p,
.quests-hero p { margin: 0; color: var(--muted); font-weight: 800; }

.quests-hero {
  background:
    radial-gradient(circle at 86% 22%, rgba(145,217,109,0.34), transparent 30%),
    linear-gradient(135deg, rgba(255,255,255,0.96), rgba(255,250,240,0.9));
}

.quests-hero h2,
.quest-progress strong,
.quest-card h3 {
  color: var(--ink);
}

.quests-hero .primary-action {
  background: var(--ink);
  color: #fff;
}

.quest-board {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.quest-progress {
  position: sticky;
  top: 24px;
  min-height: 360px;
  display: grid;
  align-content: space-between;
  background:
    radial-gradient(circle at 30% 18%, rgba(145,217,109,0.34), transparent 34%),
    radial-gradient(circle at 70% 80%, rgba(142,184,255,0.3), transparent 36%),
    rgba(255,255,255,0.78);
}

.quest-progress strong {
  display: block;
  margin-top: 16px;
  font-family: Fraunces, Georgia, serif;
  font-size: 64px;
  line-height: 0.95;
}

.quest-progress p {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.5;
}

.quest-rings {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.quest-rings i {
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(23,19,27,0.09);
  border: 1px solid rgba(23,19,27,0.08);
}

.quest-rings i.ready { background: var(--gold); }
.quest-rings i.claimed { background: var(--green); box-shadow: inset 0 0 0 5px rgba(255,255,255,0.52); }

.quest-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 14px;
}

.quest-card {
  min-height: 286px;
  padding: 18px;
  border-radius: 26px;
  display: grid;
  align-content: space-between;
  gap: 12px;
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(23,19,27,0.07);
  box-shadow: 0 16px 34px rgba(23,19,27,0.06);
}

.quest-card::before {
  content: "";
  position: absolute;
  inset: auto -24px -48px auto;
  width: 140px;
  height: 140px;
  border-radius: 42px;
  transform: rotate(16deg);
  background: rgba(23,19,27,0.05);
}

.quest-card.ready { box-shadow: 0 0 0 3px rgba(243,212,109,0.48), 0 18px 38px rgba(23,19,27,0.08); }
.quest-card.claimed { background: rgba(233,252,224,0.86); }

.quest-index {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.quest-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.quest-card h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.05;
}

.quest-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.quest-proof {
  min-height: 54px;
  padding: 11px 12px;
  border-radius: 16px;
  display: grid;
  gap: 2px;
  background: rgba(23,19,27,0.05);
}

.quest-proof b { font-size: 13px; }
.quest-proof em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.quest-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
}

.quest-actions button { min-width: 128px; }

.deck-filters,
.leader-tabs,
.match-filters,
.chip-row {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.deck-filters button,
.leader-tabs button,
.match-filters button,
.chip-row button {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.58);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.deck-filters button.active,
.leader-tabs button.active,
.match-filters button.active,
.chip-row button.active {
  background: var(--ink);
  color: #fff;
}

.market-grid {
  margin-top: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.market-toolbar { grid-column: 1 / -1; }
.pack-card,
.market-card {
  padding: 18px;
  border-radius: 24px;
  background: rgba(255,255,255,0.68);
  border: 1px solid rgba(255,255,255,0.78);
  box-shadow: 0 14px 30px rgba(23,19,27,0.08);
}
body[data-theme="dark"] .pack-card {
  background: var(--ds-panel-elev) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4) !important;
}
body[data-theme="dark"] .pack-card small { color: var(--ds-fg-muted) !important; }
body[data-theme="dark"] .pack-card h3 { color: var(--ds-fg) !important; }
body[data-theme="dark"] .pack-card p { color: var(--ds-fg-subtle) !important; }
.pack-card small { color: var(--muted); font-weight: 900; text-transform: uppercase; }
.pack-card h3 { margin: 10px 0 4px; font-family: Fraunces, Georgia, serif; font-size: 28px; }
.pack-card p,
.market-card p { color: var(--muted); font-size: 13px; font-weight: 800; }
.market-card .game-card { min-height: 210px; box-shadow: none; }
.market-card > b { display: block; margin: 12px 0; font-size: 24px; }

.lb-head,
.leader-row {
  display: grid;
  grid-template-columns: 50px minmax(140px, 1fr) 90px 90px 110px;
  gap: 12px;
}
.lb-head {
  padding: 0 14px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.leader-row.you { box-shadow: inset 0 0 0 2px var(--ink); }

.wallet-balance {
  margin: 14px 0;
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(58px, 8vw, 108px);
  line-height: 0.9;
}
.wallet-balance span,
.wallet-balance em { font-family: Manrope, sans-serif; color: var(--muted); font-size: 18px; font-style: normal; }

.wallet-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stats-screen { display: grid; gap: 16px; }
.stats-cards { grid-template-columns: repeat(4, 1fr); }
.stats-cards span { color: var(--muted); font-size: 12px; font-weight: 800; }

.apr-bar-row {
  grid-template-columns: 180px 1fr 80px;
}
.apr-bar-row span em { display: block; color: var(--muted); font-size: 12px; font-style: normal; }
.apr-bar-row i {
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(23,19,27,0.09);
}
.apr-bar-row i u {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--pink));
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 340px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.18s ease;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #b93b3b; }
.toast.warn { background: #e7c64e; color: var(--ink); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  padding: 24px;
  display: none;
  place-items: center;
  background: rgba(18,16,25,0.42);
  backdrop-filter: blur(10px);
  z-index: 30;
}
.modal-backdrop.show { display: grid; }
.modal {
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  padding: 26px;
  position: relative;
  border-radius: 28px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.modal.size-lg { width: min(920px, 100%); }
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}
.modal h2 { margin: 0 42px 10px 0; font-family: Fraunces, Georgia, serif; font-size: 36px; }
.modal p { color: var(--muted); font-weight: 800; line-height: 1.55; }
.modal-row,
.modal-stat {
  min-height: 48px;
  padding: 12px;
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: rgba(23,19,27,0.05);
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  margin-top: 8px;
}
.modal-actions { display: flex; gap: 10px; margin-top: 14px; }
.resource-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.resource-card {
  padding: 16px;
  border-radius: 22px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(23,19,27,0.07);
}

.resource-card h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.resource-card a {
  min-height: 48px;
  padding: 10px 0;
  display: grid;
  gap: 2px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  border-top: 1px solid rgba(23,19,27,0.07);
}

.resource-card a span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.setting-line {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  font-weight: 900;
}
.setting-line input,
.setting-line select {
  width: min(260px, 52%);
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}
.pack-reveal-grid {
  margin: 18px 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.round-recap { display: grid; gap: 8px; margin-top: 12px; }
.recap-row {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(23,19,27,0.05);
  font-weight: 900;
}
.recap-row.win { box-shadow: inset 4px 0 0 var(--green); }
.recap-row.loss { box-shadow: inset 4px 0 0 var(--peach); }
.link-list { line-height: 1.9; font-weight: 800; }
.link-list a { color: var(--ink); }

body[data-theme="dark"] {
  background: #0d0a10;
}

body[data-theme="dark"] .app-card {
  background: #110d16;
}

body[data-theme="dark"] .brand-mark {
  background: #fff6df;
  color: #17131b;
}

body[data-theme="dark"] .search-box,
body[data-theme="dark"] .apr-live,
body[data-theme="dark"] .ghost-action,
body[data-theme="dark"] .icon-btn,
body[data-theme="dark"] .link-btn,
body[data-theme="dark"] .theme-toggle,
body[data-theme="dark"] .panel-block,
body[data-theme="dark"] .duel-preview,
body[data-theme="dark"] .opponent-panel,
body[data-theme="dark"] .match-panel,
body[data-theme="dark"] .status-card,
body[data-theme="dark"] .resource-card,
body[data-theme="dark"] .modal,
body[data-theme="dark"] .modal-row,
body[data-theme="dark"] .modal-stat,
body[data-theme="dark"] .setting-line input,
body[data-theme="dark"] .setting-line select {
  background: var(--surface-strong);
  color: var(--ink);
  border-color: rgba(255,246,223,0.16);
}

body[data-theme="dark"] .primary-action,
body[data-theme="dark"] .wallet-cta {
  background: #fff0bf;
  color: #17131b;
  box-shadow: 0 12px 26px rgba(0,0,0,0.34);
}

body[data-theme="dark"] .wallet-cta.connected {
  background: #b9f49a;
  color: #10210d;
}

body[data-theme="dark"] .theme-toggle span {
  background: rgba(255,246,223,0.2);
}

body[data-theme="dark"] .theme-toggle span::before {
  background: #fff0bf;
}

body[data-theme="dark"] .game-table {
  background:
    linear-gradient(90deg, rgba(255,246,223,0.045) 1px, transparent 1px),
    linear-gradient(rgba(255,246,223,0.045) 1px, transparent 1px),
    linear-gradient(135deg, #17121d, #111b26 58%, #142116);
  background-size: 18px 18px, 18px 18px, auto;
  border-color: rgba(255,246,223,0.14);
}

body[data-theme="dark"] .play-screen {
  background:
    radial-gradient(circle, rgba(255,246,223,0.11) 1px, transparent 1px) 0 0 / 16px 16px,
    radial-gradient(circle at 24% 18%, rgba(255,153,168,0.14), transparent 30%),
    radial-gradient(circle at 78% 18%, rgba(247,220,118,0.14), transparent 32%),
    radial-gradient(circle at 62% 74%, rgba(221,167,242,0.13), transparent 30%),
    linear-gradient(125deg, #17121d, #151321 42%, #191c14);
  border-color: rgba(255,246,223,0.14);
}

body[data-theme="dark"] .play-screen > .panel-block {
  background: rgba(33,26,39,0.88);
}

body[data-theme="dark"] .status-card:nth-child(2) { background: var(--surface-blue); }
body[data-theme="dark"] .status-card:nth-child(3) { background: var(--surface-green); }
body[data-theme="dark"] .status-card:nth-child(4) { background: #30270f; }

body[data-theme="dark"] .hand-dock,
body[data-theme="dark"] .round-log span,
body[data-theme="dark"] .empty,
body[data-theme="dark"] .quest-proof,
body[data-theme="dark"] .recap-row {
  background: rgba(255,246,223,0.08);
  color: var(--muted);
  border-color: rgba(255,246,223,0.14);
}

body[data-theme="dark"] .apr-row,
body[data-theme="dark"] .match-row,
body[data-theme="dark"] .tx-row,
body[data-theme="dark"] .leader-row,
body[data-theme="dark"] .apr-bar-row,
body[data-theme="dark"] .hand-list button,
body[data-theme="dark"] .match-stats article,
body[data-theme="dark"] .wallet-stats article,
body[data-theme="dark"] .stats-cards article {
  background: #201927;
  color: var(--ink);
  border-color: rgba(255,246,223,0.14);
}

body[data-theme="dark"] .match-row.win { background: rgba(53,95,44,0.78); }
body[data-theme="dark"] .match-row.loss { background: rgba(105,55,39,0.82); }

body[data-theme="dark"] .game-card {
  background: #1e1724;
  color: var(--ink);
  border-color: rgba(255,246,223,0.16);
  box-shadow: 0 16px 30px rgba(0,0,0,0.28);
}

body[data-theme="dark"] .game-card::before {
  opacity: 0.62;
  background: linear-gradient(160deg, var(--tone, var(--mint)), rgba(17,13,22,0.94));
}

body[data-theme="dark"] .game-card.equipped {
  box-shadow: 0 0 0 3px #fff0bf, 0 16px 30px rgba(0,0,0,0.32);
}

body[data-theme="dark"] .game-card small,
body[data-theme="dark"] .card-topline em,
body[data-theme="dark"] .card-values,
body[data-theme="dark"] .played-card span,
body[data-theme="dark"] .played-card em,
body[data-theme="dark"] .float-card-inner em,
body[data-theme="dark"] .float-card-inner b,
body[data-theme="dark"] .resource-card a span {
  color: var(--muted);
}

body[data-theme="dark"] .protocol-logo {
  background: rgba(255,246,223,0.9);
  color: #17131b;
}

body[data-theme="dark"] .played-card,
body[data-theme="dark"] .played-card.revealed,
body[data-theme="dark"] .played-card.selected {
  background: #211a27;
  color: var(--ink);
  border-color: rgba(255,246,223,0.16);
}

body[data-theme="dark"] .played-card.selected {
  box-shadow: 0 0 0 3px rgba(158,232,122,0.72), 0 18px 32px rgba(0,0,0,0.3);
}

body[data-theme="dark"] .played-card.revealed {
  box-shadow: 0 0 0 3px rgba(143,186,255,0.62), 0 18px 32px rgba(0,0,0,0.3);
}

body[data-theme="dark"] .float-card-inner {
  color: #17131b;
  border-color: rgba(255,246,223,0.18);
}

body[data-theme="dark"] .quests-hero {
  background:
    radial-gradient(circle at 86% 22%, rgba(158,232,122,0.14), transparent 30%),
    linear-gradient(135deg, #211a27, #151119);
}

body[data-theme="dark"] .quest-progress {
  background:
    radial-gradient(circle at 30% 18%, rgba(158,232,122,0.14), transparent 34%),
    radial-gradient(circle at 70% 80%, rgba(143,186,255,0.14), transparent 36%),
    var(--surface-strong);
}

body[data-theme="dark"] .quest-card {
  background: #211a27;
  color: var(--ink);
  border-color: rgba(255,246,223,0.16);
}

body[data-theme="dark"] .quest-card.claimed {
  background: #1d301c;
}

body[data-theme="dark"] .quest-card.ready {
  box-shadow: 0 0 0 3px rgba(244,211,106,0.58), 0 18px 38px rgba(0,0,0,0.3);
}

body[data-theme="dark"] .title-lockup strong,
body[data-theme="dark"] h1,
body[data-theme="dark"] h2,
body[data-theme="dark"] h3,
body[data-theme="dark"] strong,
body[data-theme="dark"] b {
  color: #fff8e8;
}

body[data-theme="dark"] .title-lockup span,
body[data-theme="dark"] .eyebrow,
body[data-theme="dark"] .dock-head span,
body[data-theme="dark"] .section-kicker span:first-child,
body[data-theme="dark"] .status-card span,
body[data-theme="dark"] .match-stats small,
body[data-theme="dark"] .wallet-stats small,
body[data-theme="dark"] .stats-cards small,
body[data-theme="dark"] .quest-card span,
body[data-theme="dark"] .opponent-panel span {
  color: #ffe7bd;
}

body[data-theme="dark"] p,
body[data-theme="dark"] em,
body[data-theme="dark"] small,
body[data-theme="dark"] .opponent-panel p,
body[data-theme="dark"] .quest-card p,
body[data-theme="dark"] .deck-summary p,
body[data-theme="dark"] .market-hero p,
body[data-theme="dark"] .quests-hero p {
  color: #e6d4b8;
}

body[data-theme="dark"] .app-card {
  background:
    radial-gradient(circle at 24% 6%, rgba(143,186,255,0.08), transparent 28%),
    radial-gradient(circle at 80% 22%, rgba(158,232,122,0.06), transparent 24%),
    #0f0b13;
}

body[data-theme="dark"] .rail {
  background: #050408;
  box-shadow: inset -1px 0 0 rgba(255,248,232,0.1);
}

body[data-theme="dark"] .rail-btn {
  color: rgba(255,248,232,0.72);
}

body[data-theme="dark"] .rail-btn:hover,
body[data-theme="dark"] .rail-btn.active {
  color: #fff8e8;
  background: rgba(255,248,232,0.12);
  box-shadow: inset 0 0 0 2px rgba(255,248,232,0.72);
}

body[data-theme="dark"] .game-table {
  background:
    linear-gradient(90deg, rgba(255,248,232,0.07) 1px, transparent 1px),
    linear-gradient(rgba(255,248,232,0.07) 1px, transparent 1px),
    linear-gradient(135deg, #151925, #11202a 52%, #142416);
  background-size: 18px 18px, 18px 18px, auto;
  border-color: rgba(255,248,232,0.24);
  box-shadow: inset 0 0 0 1px rgba(143,186,255,0.1), 0 22px 50px rgba(0,0,0,0.48);
}

body[data-theme="dark"] .panel-block,
body[data-theme="dark"] .duel-preview,
body[data-theme="dark"] .opponent-panel,
body[data-theme="dark"] .match-panel,
body[data-theme="dark"] .resource-card,
body[data-theme="dark"] .modal,
body[data-theme="dark"] .leaderboard {
  background: #251c2d;
  border-color: rgba(255,248,232,0.24);
  box-shadow: 0 18px 38px rgba(0,0,0,0.42), inset 0 1px 0 rgba(255,255,255,0.045);
}

body[data-theme="dark"] .side-grid .panel-block,
body[data-theme="dark"] .matches-panel,
body[data-theme="dark"] .apr-panel {
  background: #23192a;
}

body[data-theme="dark"] .status-card {
  border-color: rgba(255,248,232,0.24);
  box-shadow: 0 14px 28px rgba(0,0,0,0.36), inset 0 1px 0 rgba(255,255,255,0.05);
}

body[data-theme="dark"] .status-card:first-child { background: #2b2031; }
body[data-theme="dark"] .status-card:nth-child(2) { background: #173553; }
body[data-theme="dark"] .status-card:nth-child(3) { background: #17401e; }
body[data-theme="dark"] .status-card:nth-child(4) { background: #42330e; }

body[data-theme="dark"] .status-card strong,
body[data-theme="dark"] .wallet-balance,
body[data-theme="dark"] .match-stats strong,
body[data-theme="dark"] .wallet-stats strong,
body[data-theme="dark"] .stats-cards strong,
body[data-theme="dark"] .apr-row strong,
body[data-theme="dark"] .leader-row strong,
body[data-theme="dark"] .apr-bar-row strong {
  color: #fff4bf;
  text-shadow: 0 1px 0 rgba(0,0,0,0.3);
}

body[data-theme="dark"] .search-box,
body[data-theme="dark"] .apr-live,
body[data-theme="dark"] .ghost-action,
body[data-theme="dark"] .icon-btn,
body[data-theme="dark"] .link-btn,
body[data-theme="dark"] .theme-toggle {
  background: #281f2e;
  color: #fff8e8;
  border-color: rgba(255,248,232,0.28);
  box-shadow: 0 10px 22px rgba(0,0,0,0.3);
}

body[data-theme="dark"] .search-box input::placeholder {
  color: #bcae99;
}

body[data-theme="dark"] .primary-action:disabled,
body[data-theme="dark"] .primary-action.blocked,
body[data-theme="dark"] .ghost-action:disabled {
  opacity: 1;
  background: #514655;
  color: #f8e8c7;
  border: 1px solid rgba(255,248,232,0.28);
  box-shadow: none;
}

body[data-theme="dark"] .deck-filters button,
body[data-theme="dark"] .leader-tabs button,
body[data-theme="dark"] .match-filters button,
body[data-theme="dark"] .chip-row button {
  background: #33273a;
  color: #fff3cf;
  border: 1px solid rgba(255,248,232,0.24);
}

body[data-theme="dark"] .deck-filters button.active,
body[data-theme="dark"] .leader-tabs button.active,
body[data-theme="dark"] .match-filters button.active,
body[data-theme="dark"] .chip-row button.active {
  background: #fff0bf;
  color: #17131b;
}

body[data-theme="dark"] .apr-row,
body[data-theme="dark"] .match-row,
body[data-theme="dark"] .tx-row,
body[data-theme="dark"] .leader-row,
body[data-theme="dark"] .apr-bar-row,
body[data-theme="dark"] .hand-list button {
  background: #2a2031;
  border-color: rgba(255,248,232,0.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.045);
}

body[data-theme="dark"] .apr-row span {
  color: #fff8e8;
}

body[data-theme="dark"] .apr-row em,
body[data-theme="dark"] .match-row em,
body[data-theme="dark"] .hand-list button em,
body[data-theme="dark"] .leader-row span,
body[data-theme="dark"] .tx-row em {
  color: #e2d0b2;
}

body[data-theme="dark"] .played-card,
body[data-theme="dark"] .played-card.revealed,
body[data-theme="dark"] .played-card.selected {
  background: #261d2d;
  border-color: rgba(255,248,232,0.26);
}

body[data-theme="dark"] .played-card strong {
  color: #fff8e8;
}

body[data-theme="dark"] .played-card span,
body[data-theme="dark"] .played-card em {
  color: #ead7b9;
}

body[data-theme="dark"] .pot-strip {
  background: rgba(255, 255, 255, 0.06) !important;
  color: var(--ds-fg) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 10px 22px rgba(0,0,0,0.26);
}

body[data-theme="dark"] .pot-strip span {
  color: var(--ds-fg-muted) !important;
}

body[data-theme="dark"] .pot-strip strong {
  color: var(--ds-fg) !important;
}

body[data-theme="dark"] .score-strip {
  background: #fff0bf;
  color: #161016;
  box-shadow: 0 10px 22px rgba(0,0,0,0.26);
}

body[data-theme="dark"] .score-strip strong,
body[data-theme="dark"] .score-strip span {
  color: #161016;
}

body[data-theme="dark"] .hand-dock {
  background: rgba(143,186,255,0.08);
  border-color: rgba(255,248,232,0.22);
}

body[data-theme="dark"] .empty,
body[data-theme="dark"] .round-log span {
  background: #392f3c;
  color: #f1dfc2;
}

body[data-theme="dark"] .game-card {
  background: #17121b;
  border-color: rgba(255,248,232,0.32);
  box-shadow: 0 18px 34px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
}

body[data-theme="dark"] .game-card::before {
  opacity: 0.74;
  background: linear-gradient(160deg, var(--tone, var(--mint)), rgba(20,15,22,0.72));
}

body[data-theme="dark"] .game-card h3,
body[data-theme="dark"] .game-card .card-values span,
body[data-theme="dark"] .game-card .card-values b {
  color: #fff8e8;
}

body[data-theme="dark"] .game-card small,
body[data-theme="dark"] .card-topline em {
  color: #f0dfc0;
}

body[data-theme="dark"] .card-values {
  border-top-color: rgba(255,248,232,0.18);
}

body[data-theme="dark"] .card-actions button {
  background: rgba(255,248,232,0.78);
  color: #17131b;
}

body[data-theme="dark"] .deck-summary,
body[data-theme="dark"] .market-hero,
body[data-theme="dark"] .quests-hero,
body[data-theme="dark"] .wallet-hero,
body[data-theme="dark"] .stats-hero {
  background: linear-gradient(135deg, #2a2031, #1e1724);
  border-color: rgba(255,248,232,0.24);
}

body[data-theme="dark"] .modal-backdrop {
  background: rgba(5,4,7,0.7);
}

body[data-theme="dark"] .modal-close,
body[data-theme="dark"] .score-strip,
body[data-theme="dark"] .versus-lane > b,
body[data-theme="dark"] .versus,
body[data-theme="dark"] .agent-orb,
body[data-theme="dark"] .hand-list button span {
  background: #fff0bf;
  color: #17131b;
}

body[data-theme="dark"] .positive { color: #9ee87a; }
body[data-theme="dark"] .negative { color: #ff9c8f; }

.positive { color: #287b2f; }
.negative { color: #b93b3b; }
.starter-cta { grid-column: 1 / -1; text-align: center; }

@media (max-width: 1180px) {
  body { overflow: auto; }
  .shell { height: auto; min-height: 100vh; padding: 0; grid-template-columns: 72px minmax(0, 1fr); }
  .rail { border-radius: 0; }
  .app-card { min-height: 100vh; border-radius: 0; }
  #dashboardView.active { grid-template-columns: 1fr; }
  .command-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-board { grid-template-columns: 1fr; }
  .play-screen { grid-template-columns: 1fr; min-height: 0; }
  .quest-board { grid-template-columns: 1fr; }
  .quest-progress { position: static; min-height: 0; }
  .duel-arena { min-height: 0; }
  .duel-arena .battle-row { margin: 28px auto; }
  .floating-card { display: none; }
  .stats-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    min-height: auto;
    padding: 12px;
    flex-direction: row;
    border-radius: 0;
    gap: 8px;
    overflow-x: auto;
  }
  .rail-nav { margin-top: 0; display: flex; gap: 8px; }
  .wallet { margin-top: 0; }
  .network-pill { display: none; }
  .rail-btn::after { display: none; }
  .app-card { padding: 18px; }
  .topbar { grid-template-columns: 1fr; }
  .profile { justify-self: stretch; flex-wrap: wrap; }
  .search-box { order: 3; }
  .board-grid,
  .versus-lane,
  .battle-row,
  .match-row,
  .apr-row,
  .lb-head,
  .leader-row,
  .apr-bar-row {
    grid-template-columns: 1fr;
  }
  .game-table { min-height: 0; }
  .table-toolbar,
  .dash-head,
  .deck-summary,
  .market-hero,
  .quests-hero { flex-direction: column; align-items: stretch; }
  .command-grid { grid-template-columns: 1fr; }
  .quest-grid { grid-template-columns: 1fr; }
  .pot-ring { width: 160px; height: 160px; }
  .stats-cards,
  .match-stats,
  .wallet-stats { grid-template-columns: 1fr; }
  .wallet-balance { font-size: 58px; }
}

/* ========== Feedback round 4 ========== */

/* (1) Hand dock — darker backdrop */
.hand-dock {
  background: rgba(17, 17, 29, 0.92) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  color: #fff;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.25);
}
.hand-dock .dock-head span:first-child,
.hand-dock .section-kicker span:first-child { color: rgba(255, 255, 255, 0.7); }
.hand-dock .dock-head span:last-child,
.hand-dock .section-kicker span:last-child { color: rgba(255, 255, 255, 0.5); }
.hand-dock #handList button {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
}
.hand-dock #handList button:hover { background: rgba(255, 255, 255, 0.12); }
.hand-dock #handList button.picked {
  background: rgba(250, 204, 21, 0.14);
  box-shadow: 0 0 0 2px #facc15;
}

/* (2) Duel arena — proper finish */
.duel-arena {
  background: linear-gradient(180deg, rgba(17,17,29,0.04) 0%, rgba(17,17,29,0.08) 100%) !important;
  border: 1px solid rgba(17, 17, 29, 0.08) !important;
  border-radius: 28px !important;
  padding: 26px 28px !important;
  box-shadow: 0 16px 40px rgba(17, 17, 29, 0.06) !important;
  gap: 14px;
}
.duel-arena::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(132,216,110,0.12), transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(248,113,113,0.08), transparent 50%);
  border-radius: 28px;
  pointer-events: none;
  z-index: 0;
}
.duel-arena .section-kicker {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(17, 17, 29, 0.08);
  margin-bottom: 4px;
}
.duel-arena .battle-row {
  margin: 12px auto;
  padding: 18px;
  border-radius: 20px;
  background: rgba(17, 17, 29, 0.04);
  border: 1px solid rgba(17, 17, 29, 0.06);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  align-self: center;
  justify-self: center;
  width: 100%;
  gap: 18px;
}
.duel-arena .battle-card {
  padding: 16px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(17, 17, 29, 0.08);
  min-height: 130px;
  box-shadow: 0 6px 18px rgba(17, 17, 29, 0.05);
}
.duel-arena .battle-card.selected {
  border-color: #facc15;
  box-shadow: 0 0 0 2px #facc15, 0 8px 24px rgba(250, 204, 21, 0.18);
}
.duel-arena .battle-card.ai {
  background: linear-gradient(160deg, #1a1a2c, #11111d);
  color: #fff;
  border-color: rgba(248, 113, 113, 0.4);
}
.duel-arena .battle-card.ai small,
.duel-arena .battle-card.ai p { color: rgba(255, 255, 255, 0.7); }
.duel-arena .battle-card.placeholder { opacity: 0.5; }
.duel-arena .battle-card h2 {
  margin: 6px 0 4px;
  font-size: 18px;
  letter-spacing: -0.3px;
}
.duel-arena .battle-card small {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.6;
}
.duel-arena .battle-card p {
  font-size: 12px;
  margin: 4px 0;
  opacity: 0.75;
  min-height: 32px;
}
.duel-arena .battle-card b {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(132, 216, 110, 0.18);
  color: #2d6e1f;
  font-size: 13px;
}
.duel-arena .battle-card.ai b { background: rgba(248, 113, 113, 0.2); color: #fca5a5; }
.duel-arena .versus {
  font-weight: 900;
  font-size: 24px;
  letter-spacing: -1px;
  padding: 12px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 6px 18px rgba(17, 17, 29, 0.25);
}
.duel-arena .round-log {
  margin: 8px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(17, 17, 29, 0.04);
  border: 1px solid rgba(17, 17, 29, 0.06);
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
  font-size: 12px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.duel-arena .round-log span {
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  border-left: 3px solid rgba(132, 216, 110, 0.4);
}
.duel-arena > .primary-action {
  margin-top: 8px;
  padding: 14px 24px;
  font-weight: 800;
  font-size: 14px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  width: 100%;
  transition: transform 0.15s, box-shadow 0.15s;
}
.duel-arena > .primary-action:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(17, 17, 29, 0.2);
}
.duel-arena > .primary-action:disabled {
  background: rgba(17, 17, 29, 0.15);
  cursor: not-allowed;
}

/* (3-5) Quest index — make text visible (fix cascade) */
.quest-card .quest-index {
  background: var(--ink);
  color: #ffffff !important;
  font-size: 16px !important;
  text-transform: none !important;
  font-weight: 900;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(17, 17, 29, 0.2);
}
.quest-card.ready .quest-index { background: #f3d46d; color: #11111d !important; }
.quest-card.claimed .quest-index { background: #4ade80; color: #ffffff !important; }
/* ========== Vivid League + APR Oracle (both themes) ========== */

/* Per-rank color tokens */
:root {
  --rank-1: #facc15;
  --rank-2: #c0c4cc;
  --rank-3: #d97757;
  --rank-you: #84d86e;
}

/* League — no duplicate banner; page heading already says "League" */
#leaderboardView { position: relative; }

/* League rows — colored ranks */
.leader-row {
  position: relative;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(17, 17, 29, 0.06);
  border-radius: 14px !important;
  padding: 14px 16px !important;
  margin-bottom: 6px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.leader-row:hover {
  transform: translateX(4px);
  box-shadow: 0 6px 18px rgba(17, 17, 29, 0.08);
}
.leader-row .rank {
  width: 32px; height: 32px;
  display: inline-grid; place-items: center;
  border-radius: 10px;
  font-weight: 900;
  background: rgba(17,17,29,0.06);
  color: var(--ink);
}
/* Top 3 podium — accounts for .lb-head as first child */
.leader-row:nth-of-type(2) .rank { background: linear-gradient(135deg, #facc15, #f59e0b); color: #11111d; box-shadow: 0 4px 12px rgba(250,204,21,0.4); }
.leader-row:nth-of-type(3) .rank { background: linear-gradient(135deg, #e5e7eb, #c0c4cc); color: #11111d; box-shadow: 0 4px 12px rgba(192,196,204,0.35); }
.leader-row:nth-of-type(4) .rank { background: linear-gradient(135deg, #d97757, #b45309); color: #fff; box-shadow: 0 4px 12px rgba(217,119,87,0.35); }
.leader-row:nth-of-type(2) { background: linear-gradient(90deg, rgba(250,204,21,0.15), rgba(255,255,255,0.5) 60%); border-color: rgba(250,204,21,0.4); }
.leader-row:nth-of-type(3) { background: linear-gradient(90deg, rgba(192,196,204,0.18), rgba(255,255,255,0.5) 60%); border-color: rgba(192,196,204,0.4); }
.leader-row:nth-of-type(4) { background: linear-gradient(90deg, rgba(217,119,87,0.15), rgba(255,255,255,0.5) 60%); border-color: rgba(217,119,87,0.4); }

.leader-row.you {
  background: linear-gradient(90deg, rgba(132,216,110,0.18), rgba(255,255,255,0.6) 60%) !important;
  border-color: var(--rank-you) !important;
  box-shadow: 0 0 0 2px var(--rank-you), 0 8px 24px rgba(132,216,110,0.18) !important;
}
.leader-row.you .rank { background: linear-gradient(135deg, #4ade80, #22c55e); color: #fff; }

/* Dark theme */
body[data-theme="dark"] .leader-row {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  color: #e8e8f0;
}
body[data-theme="dark"] .leader-row:nth-of-type(2) { background: linear-gradient(90deg, rgba(250,204,21,0.18), rgba(255,255,255,0.04) 60%); border-color: rgba(250,204,21,0.45); }
body[data-theme="dark"] .leader-row:nth-of-type(3) { background: linear-gradient(90deg, rgba(192,196,204,0.16), rgba(255,255,255,0.04) 60%); border-color: rgba(192,196,204,0.4); }
body[data-theme="dark"] .leader-row:nth-of-type(4) { background: linear-gradient(90deg, rgba(217,119,87,0.18), rgba(255,255,255,0.04) 60%); border-color: rgba(217,119,87,0.45); }
body[data-theme="dark"] .leader-row.you {
  background: linear-gradient(90deg, rgba(132,216,110,0.2), rgba(255,255,255,0.04) 60%) !important;
}
body[data-theme="dark"] .leader-row .rank { background: rgba(255,255,255,0.08); color: #e8e8f0; }

/* APR Oracle — no duplicate banner; page heading already says "APR Oracle" */
#statsView { position: relative; }

/* Stats top cards — gradient accents per position */
.stats-cards article {
  position: relative;
  overflow: hidden;
  border-radius: 18px !important;
}
.stats-cards article::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}
.stats-cards article:nth-child(1)::before { background: linear-gradient(135deg, transparent 60%, rgba(132,216,110,0.18) 100%); }
.stats-cards article:nth-child(2)::before { background: linear-gradient(135deg, transparent 60%, rgba(250,204,21,0.18) 100%); }
.stats-cards article:nth-child(3)::before { background: linear-gradient(135deg, transparent 60%, rgba(139,92,246,0.18) 100%); }
.stats-cards article:nth-child(4)::before { background: linear-gradient(135deg, transparent 60%, rgba(236,72,153,0.18) 100%); }
.stats-cards article strong {
  font-size: 26px !important;
  letter-spacing: -0.6px;
}

/* APR bars */
.apr-bar-row {
  position: relative;
  border-radius: 14px !important;
  overflow: hidden;
  background: rgba(255,255,255,0.7) !important;
  border: 1px solid rgba(17, 17, 29, 0.06);
}
.apr-bar-row::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #4ade80, #06b6d4, #8b5cf6, #ec4899);
}
.apr-bar-fill {
  background: linear-gradient(90deg, #4ade80 0%, #06b6d4 50%, #8b5cf6 100%) !important;
  height: 100% !important;
  border-radius: 8px !important;
  box-shadow: 0 0 12px rgba(132,216,110,0.4);
}
.apr-bar-fill.green  { background: linear-gradient(90deg, #4ade80, #22c55e) !important; }
.apr-bar-fill.cyan   { background: linear-gradient(90deg, #67e8f9, #06b6d4) !important; }
.apr-bar-fill.pink   { background: linear-gradient(90deg, #f0abfc, #d946ef) !important; }
.apr-bar-fill.lilac  { background: linear-gradient(90deg, #c4b5fd, #8b5cf6) !important; }
.apr-bar-fill.gold   { background: linear-gradient(90deg, #facc15, #f59e0b) !important; }
.apr-bar-fill.mint   { background: linear-gradient(90deg, #86efac, #4ade80) !important; }

body[data-theme="dark"] .apr-bar-row {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(255, 255, 255, 0.08);
}

.stats-top-card {
  position: relative;
  border-radius: 18px !important;
  overflow: hidden;
  border: 1px solid rgba(17,17,29,0.08);
  background: linear-gradient(160deg, rgba(255,255,255,0.85), rgba(255,255,255,0.6)) !important;
}
.stats-top-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, transparent 50%, currentColor 100%);
  opacity: 0.08;
  pointer-events: none;
  border-radius: inherit;
}
.stats-top-card.green  { color: #22c55e; }
.stats-top-card.cyan   { color: #06b6d4; }
.stats-top-card.pink   { color: #d946ef; }
.stats-top-card.lilac  { color: #8b5cf6; }
.stats-top-card.gold   { color: #f59e0b; }
.stats-top-card.mint   { color: #4ade80; }
.stats-top-card b {
  font-size: 22px !important;
  background: linear-gradient(90deg, #4ade80, #06b6d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
}

body[data-theme="dark"] .stats-top-card {
  background: linear-gradient(160deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)) !important;
  border-color: rgba(255,255,255,0.08);
}
body[data-theme="dark"] .stats-top-card::before { opacity: 0.18; }
body[data-theme="dark"] .stats-cards article { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); }

/* Stale APR pulse */
.apr-bar-row em,
.apr-ticker-item.stale {
  animation: stalePulse 2.4s ease-in-out infinite;
}
@keyframes stalePulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.85; }
}

/* ========== Quest index — final fix (theme-independent) ========== */
.quest-card .quest-index,
body[data-theme="dark"] .quest-card .quest-index {
  width: 44px !important;
  height: 44px !important;
  border-radius: 14px !important;
  display: grid !important;
  place-items: center !important;
  background: #11111d !important;
  color: #ffffff !important;
  font-size: 15px !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace !important;
  box-shadow: 0 4px 12px rgba(17, 17, 29, 0.25), inset 0 0 0 1px rgba(255,255,255,0.1) !important;
  flex-shrink: 0;
}
.quest-card.ready .quest-index,
body[data-theme="dark"] .quest-card.ready .quest-index {
  background: linear-gradient(135deg, #facc15, #f59e0b) !important;
  color: #11111d !important;
  box-shadow: 0 4px 14px rgba(250, 204, 21, 0.5), inset 0 0 0 1px rgba(255,255,255,0.2) !important;
}
.quest-card.claimed .quest-index,
body[data-theme="dark"] .quest-card.claimed .quest-index {
  background: linear-gradient(135deg, #4ade80, #22c55e) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(74, 222, 128, 0.4), inset 0 0 0 1px rgba(255,255,255,0.18) !important;
}
/* Ensure no inherited descendant rules paint over the digits */
.quest-card .quest-index * { color: inherit !important; }

/* Spacing between market grid and offers panel */
#marketView .market-screen { display: flex; flex-direction: column; gap: 28px; }
#marketView .market-grid { margin-bottom: 12px; }
#marketView .offers-panel { margin-top: 16px; }

/* ========== Light theme arena brightening ========== */

/* Placeholder cards no longer ghosted */
.duel-arena .battle-card.placeholder {
  opacity: 1 !important;
  background: #ffffff !important;
  border-style: dashed !important;
  border-width: 2px !important;
  border-color: rgba(17, 17, 29, 0.18) !important;
}
.duel-arena .battle-card.placeholder h2 { color: rgba(17, 17, 29, 0.4); }
.duel-arena .battle-card.placeholder p { color: rgba(17, 17, 29, 0.5); }

/* Score strip lighter when waiting */
.duel-arena .score-strip {
  background: linear-gradient(90deg, rgba(132, 216, 110, 0.18), rgba(255,255,255,0.6) 50%, rgba(248, 113, 113, 0.14)) !important;
  color: var(--ink) !important;
  border: 1px solid rgba(17, 17, 29, 0.08);
}
.duel-arena .score-strip span { color: rgba(17, 17, 29, 0.55) !important; }
.duel-arena .score-strip strong { color: var(--ink); }

/* Hide decorative floating-cards on duel view (they overlap content) */
#duelView .floating-card { display: none !important; }

/* Lighter radial overlay so it doesn't wash out */
.duel-arena::before {
  background:
    radial-gradient(circle at 20% 0%, rgba(132,216,110,0.06), transparent 60%),
    radial-gradient(circle at 80% 100%, rgba(132,176,255,0.05), transparent 60%) !important;
}

/* Resolve button in waiting stays subtle but readable */
.duel-arena > .primary-action:disabled {
  background: rgba(17, 17, 29, 0.06) !important;
  color: rgba(17, 17, 29, 0.4) !important;
  border: 1px dashed rgba(17, 17, 29, 0.15);
}

/* Dark theme — keep arena dark but more readable */
body[data-theme="dark"] .duel-arena {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.06)) !important;
}
body[data-theme="dark"] .duel-arena .battle-card.placeholder {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}
body[data-theme="dark"] .duel-arena .battle-card.placeholder h2 { color: rgba(255,255,255,0.55); }
body[data-theme="dark"] .duel-arena .battle-card.placeholder p { color: rgba(255,255,255,0.5); }
body[data-theme="dark"] .duel-arena .score-strip {
  background: linear-gradient(90deg, rgba(132, 216, 110, 0.22), rgba(255,255,255,0.06) 50%, rgba(248, 113, 113, 0.18)) !important;
  color: #fff !important;
}
body[data-theme="dark"] .duel-arena .score-strip span { color: rgba(255,255,255,0.6) !important; }

/* ========== Duel arena — vivid waiting state ========== */

/* Stronger arena backdrop with mesh gradient */
.duel-arena {
  background:
    radial-gradient(circle at 15% 20%, rgba(132, 216, 110, 0.18), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(139, 92, 246, 0.16), transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(250, 204, 21, 0.08), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.45) 100%) !important;
  border: 1px solid rgba(17, 17, 29, 0.1) !important;
  box-shadow: 0 16px 40px rgba(17, 17, 29, 0.08), inset 0 1px 0 rgba(255,255,255,0.5) !important;
}

body[data-theme="dark"] .duel-arena {
  background:
    radial-gradient(circle at 15% 20%, rgba(132, 216, 110, 0.22), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(139, 92, 246, 0.20), transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(250, 204, 21, 0.08), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 100%) !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  box-shadow: 0 16px 40px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06) !important;
}

/* Score strip — vibrant when waiting too */
.duel-arena .score-strip {
  background: linear-gradient(90deg, #4ade80 0%, #06b6d4 50%, #ec4899 100%) !important;
  color: #fff !important;
  border: 0 !important;
  box-shadow: 0 8px 24px rgba(132, 216, 110, 0.3);
  font-weight: 900;
}
.duel-arena .score-strip span { color: rgba(255,255,255,0.85) !important; }
.duel-arena .score-strip strong { color: #fff !important; text-shadow: 0 1px 2px rgba(0,0,0,0.18); }

/* Placeholder battle cards — colorful, not gray */
.duel-arena .battle-card.placeholder {
  background: linear-gradient(160deg, rgba(132,216,110,0.22), rgba(255,255,255,0.6)) !important;
  border: 2px dashed rgba(132, 216, 110, 0.55) !important;
  position: relative;
  overflow: hidden;
}
.duel-arena .battle-card.placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 30%, rgba(132,216,110,0.25), transparent 60%);
  pointer-events: none;
}
.duel-arena .battle-card.ai.placeholder {
  background: linear-gradient(160deg, rgba(248,113,113,0.18), rgba(139,92,246,0.18)) !important;
  border-color: rgba(248, 113, 113, 0.5) !important;
}
.duel-arena .battle-card.ai.placeholder::after {
  background: radial-gradient(circle at 70% 30%, rgba(248,113,113,0.25), transparent 60%);
}
.duel-arena .battle-card.placeholder small {
  color: #11111d !important;
  opacity: 0.7;
  font-weight: 800;
}
.duel-arena .battle-card.placeholder h2 {
  color: #11111d !important;
  opacity: 0.85;
}
.duel-arena .battle-card.placeholder p { color: rgba(17,17,29,0.7) !important; }

body[data-theme="dark"] .duel-arena .battle-card.placeholder {
  background: linear-gradient(160deg, rgba(132,216,110,0.18), rgba(255,255,255,0.06)) !important;
}
body[data-theme="dark"] .duel-arena .battle-card.ai.placeholder {
  background: linear-gradient(160deg, rgba(248,113,113,0.18), rgba(139,92,246,0.16)) !important;
}
body[data-theme="dark"] .duel-arena .battle-card.placeholder small,
body[data-theme="dark"] .duel-arena .battle-card.placeholder h2 { color: #fff !important; }
body[data-theme="dark"] .duel-arena .battle-card.placeholder p { color: rgba(255,255,255,0.75) !important; }

/* VS badge — neon ring */
.duel-arena .versus {
  background: linear-gradient(135deg, #facc15, #f97316) !important;
  color: #11111d !important;
  font-weight: 900;
  box-shadow: 0 6px 20px rgba(250, 204, 21, 0.45), 0 0 0 4px rgba(250, 204, 21, 0.15) !important;
}

/* Round log — colorful when empty */
.duel-arena .round-log {
  background: linear-gradient(90deg, rgba(132,216,110,0.08), rgba(6,182,212,0.08), rgba(236,72,153,0.08)) !important;
  border-left: 3px solid #4ade80 !important;
  border-top: 1px solid rgba(17, 17, 29, 0.06);
  border-right: 1px solid rgba(17, 17, 29, 0.06);
  border-bottom: 1px solid rgba(17, 17, 29, 0.06);
}
.duel-arena .round-log span {
  background: rgba(255, 255, 255, 0.75) !important;
  border-left: 0 !important;
}
body[data-theme="dark"] .duel-arena .round-log span { background: rgba(255,255,255,0.06) !important; color: #e8e8f0; }

/* Resolve button when disabled — keep accent */
.duel-arena > .primary-action:disabled,
.duel-arena > .primary-action.blocked {
  background: linear-gradient(90deg, rgba(132,216,110,0.18), rgba(139,92,246,0.18)) !important;
  color: rgba(17,17,29,0.55) !important;
  border: 1px dashed rgba(132,216,110,0.4) !important;
  cursor: not-allowed;
}
body[data-theme="dark"] .duel-arena > .primary-action:disabled {
  color: rgba(255,255,255,0.55) !important;
}

/* Dark-theme modal row contrast — visible separators */
body[data-theme="dark"] .modal-stat {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #e8e8f0;
}
body[data-theme="dark"] .modal-stat b { color: rgba(255,255,255,0.6); }
body[data-theme="dark"] .modal-stat span { color: #fff; }
/* ==========================================================================
   DUELFI — DESIGN SYSTEM POLISH (final overrides)
   Goal: AA contrast everywhere, harmonised palette, no faded states.
   Loaded at end of styles.css so it wins cascade conflicts.
   ========================================================================== */

/* ---------- Unified color tokens (both themes) ---------- */
:root {
  /* Surfaces */
  --ds-bg: #f5f6f1;
  --ds-panel: #ffffff;
  --ds-panel-2: #fafbf6;
  --ds-panel-elev: #ffffff;
  --ds-overlay: rgba(17, 17, 29, 0.55);

  /* Text */
  --ds-fg: #11111d;
  --ds-fg-muted: #4b4f5a;
  --ds-fg-subtle: #767a85;
  --ds-fg-on-accent: #ffffff;

  /* Borders */
  --ds-border: rgba(17, 17, 29, 0.12);
  --ds-border-soft: rgba(17, 17, 29, 0.06);
  --ds-divider: rgba(17, 17, 29, 0.08);

  /* Accent palette (Mantle-inspired) */
  --ds-primary: #22c55e;
  --ds-primary-700: #15803d;
  --ds-primary-100: #dcfce7;
  --ds-secondary: #06b6d4;
  --ds-info: #3b82f6;
  --ds-warn: #f59e0b;
  --ds-warn-100: #fef3c7;
  --ds-danger: #ef4444;
  --ds-danger-100: #fee2e2;

  /* Rarity */
  --ds-rar-common: #94a3b8;
  --ds-rar-rare: #3b82f6;
  --ds-rar-epic: #a855f7;
  --ds-rar-legendary: #f59e0b;

  /* Shadows */
  --ds-shadow-sm: 0 1px 2px rgba(17, 17, 29, 0.06), 0 1px 1px rgba(17, 17, 29, 0.04);
  --ds-shadow-md: 0 4px 12px rgba(17, 17, 29, 0.08), 0 2px 4px rgba(17, 17, 29, 0.04);
  --ds-shadow-lg: 0 12px 32px rgba(17, 17, 29, 0.12);
  --ds-shadow-glow: 0 0 0 1px rgba(34, 197, 94, 0.2), 0 8px 24px rgba(34, 197, 94, 0.15);
}

body[data-theme="dark"] {
  --ds-bg: #0a0a14;
  --ds-panel: #14141f;
  --ds-panel-2: #1a1a26;
  --ds-panel-elev: #1f1f2c;
  --ds-overlay: rgba(0, 0, 0, 0.7);

  --ds-fg: #f1f1f5;
  --ds-fg-muted: #b4b6bf;
  --ds-fg-subtle: #828590;

  --ds-border: rgba(255, 255, 255, 0.14);
  --ds-border-soft: rgba(255, 255, 255, 0.08);
  --ds-divider: rgba(255, 255, 255, 0.10);

  --ds-primary: #4ade80;
  --ds-primary-700: #22c55e;
  --ds-primary-100: rgba(34, 197, 94, 0.18);
  --ds-warn-100: rgba(245, 158, 11, 0.18);
  --ds-danger-100: rgba(239, 68, 68, 0.18);

  --ds-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --ds-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.3);
  --ds-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  --ds-shadow-glow: 0 0 0 1px rgba(74, 222, 128, 0.3), 0 8px 24px rgba(74, 222, 128, 0.18);
}

/* ---------- Body / canvas ---------- */
body { background: var(--ds-bg) !important; color: var(--ds-fg) !important; }
body[data-theme="dark"] body { background: var(--ds-bg) !important; }
.app-card { background: transparent !important; }

/* ---------- Universal text contrast — replace muted with readable mid-tone ---------- */
.section-kicker span:first-child,
.dock-head span:first-child,
.eyebrow,
small {
  color: var(--ds-fg-muted) !important;
}
.section-kicker span:last-child,
.dock-head span:last-child {
  color: var(--ds-fg-subtle) !important;
}
[class*="muted"], .text-muted, .quest-card span, .quest-card p,
.quests-hero p, .stats-cards span, .table-row.head, .lb-head {
  color: var(--ds-fg-muted) !important;
}

/* ---------- Panel surfaces ---------- */
.panel-block,
.balance-block,
.performance-block,
.actions-panel,
.deck-strip,
.online-panel,
.news-panel,
.market-hero,
.stats-hero,
.wallet-hero,
.match-setup,
.hand-panel,
.quests-hero,
.quest-progress {
  background: var(--ds-panel) !important;
  border: 1px solid var(--ds-border-soft) !important;
  box-shadow: var(--ds-shadow-md) !important;
  color: var(--ds-fg);
}

/* Game table itself becomes a soft container */
.game-table {
  background:
    radial-gradient(circle at 0% 0%, rgba(34, 197, 94, 0.06), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(6, 182, 212, 0.06), transparent 40%),
    var(--ds-panel-2) !important;
  border: 1px solid var(--ds-border) !important;
  box-shadow: var(--ds-shadow-md) !important;
}
body[data-theme="dark"] .game-table {
  background:
    radial-gradient(circle at 0% 0%, rgba(74, 222, 128, 0.10), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(6, 182, 212, 0.10), transparent 40%),
    var(--ds-panel-2) !important;
}

/* ---------- Buttons (primary, ghost, link, action) ---------- */
.primary-action {
  background: var(--ds-fg) !important;
  color: var(--ds-fg-on-accent) !important;
  border: 1px solid var(--ds-fg) !important;
  font-weight: 800;
  letter-spacing: 0.2px;
  border-radius: 14px !important;
  padding: 12px 22px;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.primary-action:hover:not(:disabled):not(.blocked) {
  transform: translateY(-1px);
  box-shadow: var(--ds-shadow-md);
}
body[data-theme="dark"] .primary-action {
  background: var(--ds-primary) !important;
  color: #0a0a14 !important;
  border-color: var(--ds-primary) !important;
}
body[data-theme="dark"] .primary-action:hover:not(:disabled) {
  background: var(--ds-primary-700) !important;
}

.ghost-action,
.card-action,
.link-btn {
  background: var(--ds-panel-2) !important;
  color: var(--ds-fg) !important;
  border: 1px solid var(--ds-border) !important;
  border-radius: 12px !important;
  padding: 8px 16px;
  font-weight: 700;
  transition: background 0.15s, border-color 0.15s;
}
.ghost-action:hover,
.card-action:hover,
.link-btn:hover {
  background: var(--ds-panel) !important;
  border-color: var(--ds-fg-muted) !important;
}
.card-action.ghost { background: transparent !important; }

body[data-theme="dark"] .ghost-action,
body[data-theme="dark"] .card-action,
body[data-theme="dark"] .link-btn {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--ds-fg) !important;
}
body[data-theme="dark"] .ghost-action:hover,
body[data-theme="dark"] .card-action:hover,
body[data-theme="dark"] .link-btn:hover {
  background: rgba(255, 255, 255, 0.10) !important;
}

button:disabled,
.primary-action:disabled,
.primary-action.blocked,
.ghost-action:disabled {
  opacity: 1 !important;
  background: var(--ds-panel-2) !important;
  color: var(--ds-fg-subtle) !important;
  border: 1px dashed var(--ds-border) !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
}
body[data-theme="dark"] button:disabled,
body[data-theme="dark"] .primary-action:disabled {
  background: rgba(255, 255, 255, 0.04) !important;
  color: rgba(255, 255, 255, 0.4) !important;
}

/* ---------- Inputs / search ---------- */
input[type="text"],
input[type="number"],
input[type="search"],
select,
textarea {
  background: var(--ds-panel-2) !important;
  color: var(--ds-fg) !important;
  border: 1px solid var(--ds-border) !important;
  border-radius: 12px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--ds-primary) !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}
body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--ds-fg) !important;
  border: 1px solid var(--ds-border) !important;
}
input::placeholder { color: var(--ds-fg-subtle) !important; opacity: 1; }

.search-box {
  background: var(--ds-panel) !important;
  border: 1px solid var(--ds-border) !important;
  box-shadow: var(--ds-shadow-sm);
}
.search-box input {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.search-box input:focus { box-shadow: none !important; }
.search-box kbd {
  background: var(--ds-panel-2) !important;
  color: var(--ds-fg-muted) !important;
  border: 1px solid var(--ds-border-soft);
}

/* ---------- Toast ---------- */
.toast {
  background: var(--ds-fg) !important;
  color: var(--ds-fg-on-accent) !important;
  border: 1px solid var(--ds-fg) !important;
  box-shadow: var(--ds-shadow-lg);
  font-weight: 700;
}
.toast.error { background: var(--ds-danger) !important; border-color: var(--ds-danger) !important; }
.toast.warn  { background: var(--ds-warn) !important;  color: #11111d !important; border-color: var(--ds-warn) !important; }

/* ---------- Modal ---------- */
.modal-backdrop { background: var(--ds-overlay) !important; backdrop-filter: blur(6px); }
.modal {
  background: var(--ds-panel) !important;
  color: var(--ds-fg) !important;
  border: 1px solid var(--ds-border) !important;
  box-shadow: var(--ds-shadow-lg);
}
.modal h2 { color: var(--ds-fg); letter-spacing: -0.4px; }
.modal p { color: var(--ds-fg-muted); }
.modal-stat {
  background: var(--ds-panel-2) !important;
  border: 1px solid var(--ds-border-soft) !important;
  color: var(--ds-fg);
}
.modal-stat b { color: var(--ds-fg-muted); font-weight: 700; }
.modal-stat span { color: var(--ds-fg); font-weight: 700; }
.modal-row {
  background: var(--ds-panel-2) !important;
  color: var(--ds-fg) !important;
  border: 1px solid var(--ds-border-soft) !important;
}
.modal-row:hover { background: var(--ds-panel) !important; border-color: var(--ds-fg-muted) !important; }
.modal-close {
  background: var(--ds-warn-100) !important;
  color: var(--ds-fg) !important;
  border: 1px solid var(--ds-border-soft) !important;
}

body[data-theme="dark"] .modal-stat,
body[data-theme="dark"] .modal-row {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: var(--ds-border) !important;
}

/* ---------- Tx list / activity rows ---------- */
.tx-row, .table-row, .leader-row, .offer-row {
  color: var(--ds-fg);
}
.tx-row strong, .table-row strong, .leader-row strong { color: var(--ds-fg); }
.tx-row em, .table-row em, .leader-row em { color: var(--ds-fg-muted); font-style: normal; }

.tx-row {
  background: var(--ds-panel-2) !important;
  border: 1px solid var(--ds-border-soft) !important;
  border-radius: 12px;
  padding: 12px 14px !important;
}
.tx-row:hover { background: var(--ds-panel) !important; border-color: var(--ds-fg-muted) !important; }
body[data-theme="dark"] .tx-row { background: rgba(255, 255, 255, 0.04) !important; }
body[data-theme="dark"] .tx-row:hover { background: rgba(255, 255, 255, 0.08) !important; }

.tx-row i {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0;
}
.tx-row i.green  { background: var(--ds-primary); }
.tx-row i.red    { background: var(--ds-danger); }
.tx-row i.purple { background: #a855f7; }
.tx-row i.blue   { background: var(--ds-info); }

.positive { color: var(--ds-primary-700) !important; font-weight: 800; }
.negative { color: var(--ds-danger) !important; font-weight: 800; }
body[data-theme="dark"] .positive { color: var(--ds-primary) !important; }

/* ---------- Cards (deck/market) ---------- */
.deck-protocol-card,
.market-card,
.protocol-card {
  background: var(--ds-panel) !important;
  border: 1px solid var(--ds-border) !important;
  color: var(--ds-fg);
  box-shadow: var(--ds-shadow-sm);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.deck-protocol-card:hover,
.market-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--ds-shadow-md);
  border-color: var(--ds-fg-muted) !important;
}
.deck-protocol-card.equipped {
  border-color: var(--ds-primary) !important;
  box-shadow: var(--ds-shadow-glow) !important;
}
body[data-theme="dark"] .deck-protocol-card,
body[data-theme="dark"] .market-card {
  background: var(--ds-panel-elev) !important;
  border-color: var(--ds-border) !important;
}

.protocol-card small,
.deck-protocol-card small,
.market-card small { color: var(--ds-fg-subtle) !important; }
.protocol-card p,
.deck-protocol-card p { color: var(--ds-fg-muted) !important; }
.market-apr { color: var(--ds-primary-700) !important; font-weight: 800; }
body[data-theme="dark"] .market-apr { color: var(--ds-primary) !important; }

/* Card metrics — strong values */
.card-metrics em,
.deck-protocol-card .card-metrics em { color: var(--ds-fg-subtle) !important; }
.card-metrics strong,
.deck-protocol-card .card-metrics strong { color: var(--ds-fg) !important; }

/* ---------- Rarity badges ---------- */
.rarity, .tone-common, .tone-rare, .tone-epic, .tone-legendary {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.tone-common { background: rgba(148, 163, 184, 0.18) !important; color: var(--ds-rar-common) !important; }
.tone-rare   { background: rgba(59, 130, 246, 0.16) !important; color: var(--ds-rar-rare) !important; }
.tone-epic   { background: rgba(168, 85, 247, 0.16) !important; color: var(--ds-rar-epic) !important; }
.tone-legendary { background: linear-gradient(90deg, rgba(245,158,11,0.22), rgba(217,70,239,0.18)) !important; color: var(--ds-rar-legendary) !important; }

body[data-theme="dark"] .tone-common { background: rgba(148, 163, 184, 0.22) !important; color: #cbd5e1 !important; }
body[data-theme="dark"] .tone-rare { color: #93c5fd !important; }
body[data-theme="dark"] .tone-epic { color: #d8b4fe !important; }
body[data-theme="dark"] .tone-legendary { color: #fcd34d !important; }

/* ---------- Hand panel + cards in match ---------- */
.hand-panel {
  background: #17131b !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #fff;
}
body[data-theme="dark"] .hand-panel {
  background: var(--ds-panel-elev) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
}
.hand-panel .section-kicker span:first-child { color: rgba(255, 255, 255, 0.65) !important; }
.hand-panel .section-kicker span:last-child  { color: rgba(255, 255, 255, 0.5) !important; }
.hand-panel #handList button,
.hand-panel #handList .hand-card {
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #fff !important;
  border-radius: 14px;
}
.hand-panel #handList button:hover { background: rgba(255, 255, 255, 0.12) !important; }
.hand-panel #handList button.picked {
  background: rgba(250, 204, 21, 0.18) !important;
  border-color: #facc15 !important;
  box-shadow: 0 0 0 1px #facc15;
}

/* ---------- Mode switch / segmented ---------- */
.mode-switch {
  background: var(--ds-panel-2) !important;
  border: 1px solid var(--ds-border) !important;
}
.mode-tab { color: var(--ds-fg-muted) !important; font-weight: 700; }
.mode-tab.active {
  background: var(--ds-fg) !important;
  color: #fff !important;
}
body[data-theme="dark"] .mode-tab.active { background: var(--ds-primary) !important; color: #0a0a14 !important; }

.match-filters {
  background: transparent !important;
  border: none !important;
}
.match-filters button { color: var(--ds-fg-muted) !important; }
.match-filters button.active,
.match-filters button:hover {
  background: var(--ds-panel) !important;
  color: var(--ds-fg) !important;
  box-shadow: var(--ds-shadow-sm) !important;
}
body[data-theme="dark"] .match-filters button.active,
body[data-theme="dark"] .match-filters button:hover {
  background: rgba(255, 255, 255, 0.10) !important;
  color: #fff !important;
}

/* ---------- Result pills ---------- */
.result-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.result-pill { background: var(--ds-primary-100) !important; color: var(--ds-primary-700) !important; }
.result-pill.loss { background: var(--ds-danger-100) !important; color: var(--ds-danger) !important; }
.result-pill.draw { background: rgba(148, 163, 184, 0.2) !important; color: var(--ds-fg-muted) !important; }
body[data-theme="dark"] .result-pill { color: var(--ds-primary) !important; }

/* ---------- Match chips ---------- */
.match-chips i {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 22px;
  margin-right: 4px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--ds-panel-2);
  border: 1px solid var(--ds-border-soft);
  color: var(--ds-fg-muted);
  font-size: 10px;
  font-weight: 800;
  font-style: normal;
  text-transform: uppercase;
}

/* ---------- News / link cards ---------- */
.news-list a, .news-card {
  background: var(--ds-panel-2) !important;
  border: 1px solid var(--ds-border-soft) !important;
  color: var(--ds-fg) !important;
}
.news-list a:hover, .news-card:hover {
  background: var(--ds-panel) !important;
  border-color: var(--ds-primary) !important;
}
.news-card strong { color: var(--ds-fg) !important; }
.news-card .news-icon {
  background: var(--ds-fg) !important;
  color: var(--ds-fg-on-accent) !important;
}
body[data-theme="dark"] .news-card .news-icon {
  background: var(--ds-primary) !important;
  color: #0a0a14 !important;
}

/* ---------- APR ticker ---------- */
.apr-ticker-wrap {
  background: var(--ds-fg) !important;
  border: 1px solid var(--ds-fg) !important;
  box-shadow: var(--ds-shadow-md);
}
.apr-ticker-item { color: rgba(255, 255, 255, 0.92) !important; }
.apr-ticker-item:hover { color: var(--ds-primary) !important; }

/* ---------- Stats top cards ---------- */
.stats-cards article {
  background: var(--ds-panel) !important;
  border: 1px solid var(--ds-border-soft) !important;
  color: var(--ds-fg);
}
.stats-cards article strong { color: var(--ds-fg) !important; }
.stats-cards article span { color: var(--ds-fg-muted) !important; }
body[data-theme="dark"] .stats-cards article {
  background: var(--ds-panel-elev) !important;
  border-color: var(--ds-border) !important;
}

.apr-bar-row {
  background: var(--ds-panel-2) !important;
  border: 1px solid var(--ds-border-soft) !important;
  color: var(--ds-fg);
}
.apr-bar-row strong { color: var(--ds-fg); }
.apr-bar-row em { color: var(--ds-fg-subtle) !important; }

.stats-top-card {
  background: var(--ds-panel) !important;
  border: 1px solid var(--ds-border-soft) !important;
  color: var(--ds-fg);
}
.stats-top-card h3 { color: var(--ds-fg); }
.stats-top-card small { color: var(--ds-fg-subtle) !important; }
.stats-top-card em { color: var(--ds-fg-muted) !important; }

/* ---------- Wallet hero balance ---------- */
.wallet-balance { color: var(--ds-fg) !important; }
.wallet-balance span { color: var(--ds-fg-muted); }
.wallet-balance em { color: var(--ds-fg-subtle); font-style: normal; font-size: 13px; }
.wallet-stats article strong { color: var(--ds-fg) !important; }
.wallet-stats article small { color: var(--ds-fg-muted) !important; }

/* ---------- Network pill ---------- */
.network-pill { background: var(--ds-panel-2) !important; border: 1px solid var(--ds-border-soft); }
.network-pill span { background: var(--ds-primary) !important; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2); }
.network-pill.wrong span { background: var(--ds-danger) !important; box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.25) !important; }
body[data-theme="dark"] .network-pill { background: rgba(255, 255, 255, 0.06) !important; }

/* ---------- Wallet CTA in topbar ---------- */
.wallet-cta {
  background: var(--ds-fg) !important;
  color: var(--ds-fg-on-accent) !important;
  border: 1px solid var(--ds-fg) !important;
  border-radius: 14px !important;
  padding: 10px 18px !important;
  font-weight: 700;
}
.wallet-cta.connected {
  background: var(--ds-primary-100) !important;
  color: var(--ds-primary-700) !important;
  border-color: var(--ds-primary) !important;
}
body[data-theme="dark"] .wallet-cta {
  background: var(--ds-primary) !important;
  color: #0a0a14 !important;
  border-color: var(--ds-primary) !important;
}
body[data-theme="dark"] .wallet-cta.connected {
  background: rgba(74, 222, 128, 0.18) !important;
  color: #4ade80 !important;
}

/* ---------- Profile copy in topbar ---------- */
.profile-copy span { color: var(--ds-fg-muted) !important; }
.profile-copy strong { color: var(--ds-fg) !important; }

/* Avatar */
.avatar.main-avatar {
  background: var(--ds-fg) !important;
  color: var(--ds-fg-on-accent) !important;
  box-shadow: var(--ds-shadow-sm);
}
body[data-theme="dark"] .avatar.main-avatar {
  background: var(--ds-primary) !important;
  color: #0a0a14 !important;
}

/* ---------- Settings button ---------- */
.settings-btn {
  background: var(--ds-panel-2) !important;
  border: 1px solid var(--ds-border) !important;
  color: var(--ds-fg) !important;
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 16px;
}
.settings-btn:hover { background: var(--ds-panel) !important; border-color: var(--ds-fg-muted) !important; }

/* ---------- Theme toggle button ---------- */
.theme-toggle {
  background: var(--ds-panel-2) !important;
  border: 1px solid var(--ds-border) !important;
  color: var(--ds-fg) !important;
}
.theme-toggle:hover { background: var(--ds-panel) !important; }

/* ---------- Bell button ---------- */
.bell-btn {
  background: var(--ds-warn) !important;
  color: #11111d !important;
  border: 1px solid var(--ds-warn) !important;
  border-radius: 12px;
  padding: 6px 10px;
  font-weight: 800;
  font-size: 12px;
}
.bell-btn:hover { background: #d97706 !important; }

/* ---------- APR live indicator ---------- */
.apr-live {
  background: var(--ds-primary-100) !important;
  color: var(--ds-primary-700) !important;
  border: 1px solid rgba(34, 197, 94, 0.25);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}
.apr-live i { background: var(--ds-primary) !important; }
body[data-theme="dark"] .apr-live {
  background: rgba(74, 222, 128, 0.16) !important;
  color: var(--ds-primary) !important;
}

/* ---------- Dashboard quick-row buttons ---------- */
.round-action,
.player-bubble {
  background: var(--ds-panel-2) !important;
  border: 1px solid var(--ds-border-soft) !important;
  color: var(--ds-fg) !important;
  box-shadow: var(--ds-shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.round-action em,
.player-bubble em {
  color: var(--ds-fg-muted) !important;
  font-style: normal;
}
.round-action:hover,
.player-bubble:hover {
  transform: translateY(-2px);
  box-shadow: var(--ds-shadow-md);
  border-color: var(--ds-primary) !important;
}
.round-action > span,
.player-bubble > span:not(.face) {
  background: var(--ds-fg) !important;
  color: var(--ds-fg-on-accent) !important;
  box-shadow: var(--ds-shadow-sm);
}
.round-action.green > span {
  background: var(--ds-primary) !important;
  color: #0a0a14 !important;
}
.player-bubble.dark {
  background: var(--ds-fg) !important;
  border-color: var(--ds-fg) !important;
  color: #fff !important;
}
.player-bubble.dark em { color: rgba(255, 255, 255, 0.7) !important; }
.player-bubble.dark > span:not(.face) { background: rgba(255, 255, 255, 0.15) !important; }
body[data-theme="dark"] .round-action,
body[data-theme="dark"] .player-bubble {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: var(--ds-border) !important;
}
body[data-theme="dark"] .round-action > span,
body[data-theme="dark"] .player-bubble > span:not(.face) {
  background: var(--ds-primary) !important;
  color: #0a0a14 !important;
}

/* ---------- Quest cards ---------- */
.quest-card {
  background: var(--ds-panel) !important;
  border: 1px solid var(--ds-border-soft) !important;
  color: var(--ds-fg);
  box-shadow: var(--ds-shadow-sm);
}
.quest-card.ready {
  border-color: var(--ds-warn) !important;
  box-shadow: 0 0 0 1px var(--ds-warn), var(--ds-shadow-md) !important;
}
.quest-card.claimed {
  background: var(--ds-primary-100) !important;
  border-color: var(--ds-primary) !important;
}
.quest-card h3 { color: var(--ds-fg) !important; }
.quest-card p { color: var(--ds-fg-muted) !important; }
.quest-card span { color: var(--ds-fg-subtle) !important; }
body[data-theme="dark"] .quest-card { background: var(--ds-panel-elev) !important; border-color: var(--ds-border) !important; }
body[data-theme="dark"] .quest-card.claimed { background: rgba(74, 222, 128, 0.10) !important; }

/* Quest rings */
.quest-rings i {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--ds-border) !important;
  display: inline-block;
  margin: 2px;
}
.quest-rings i.ready { background: var(--ds-warn) !important; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }
.quest-rings i.claimed { background: var(--ds-primary) !important; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }

/* ---------- Battle cards visual hierarchy ---------- */
.battle-card {
  background: var(--ds-panel) !important;
  border: 1px solid var(--ds-border) !important;
  color: var(--ds-fg);
  box-shadow: var(--ds-shadow-sm);
}
.battle-card small { color: var(--ds-fg-subtle) !important; text-transform: uppercase; letter-spacing: 1px; font-size: 11px; }
.battle-card h2 { color: var(--ds-fg) !important; }
.battle-card p { color: var(--ds-fg-muted) !important; }
.battle-card b { color: var(--ds-primary-700) !important; }
.battle-card.ai b { color: var(--ds-danger) !important; }
body[data-theme="dark"] .battle-card { background: var(--ds-panel-elev) !important; }
body[data-theme="dark"] .battle-card b { color: var(--ds-primary) !important; }

/* ---------- App footer ---------- */
.app-footer {
  border-top: 1px solid var(--ds-border-soft) !important;
  color: var(--ds-fg-muted) !important;
  background: var(--ds-panel-2) !important;
}
.app-footer a { color: var(--ds-fg) !important; font-weight: 700; }
.app-footer a:hover { color: var(--ds-primary) !important; }
.footer-link { color: var(--ds-primary-700) !important; }
body[data-theme="dark"] .app-footer { background: rgba(255, 255, 255, 0.02) !important; }
body[data-theme="dark"] .footer-link { color: var(--ds-primary) !important; }

/* ---------- Empty states ---------- */
.empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--ds-fg-muted);
  background: var(--ds-panel-2);
  border: 1px dashed var(--ds-border);
  border-radius: 16px;
  font-size: 14px;
}
.empty.starter-cta { padding: 36px 24px; }
.empty.starter-cta h3 { color: var(--ds-fg); margin: 0 0 6px; font-size: 18px; }
.empty.starter-cta p { color: var(--ds-fg-muted); margin: 0 0 14px; }

/* ---------- Round log readability ---------- */
.duel-arena .round-log span {
  background: var(--ds-panel) !important;
  border: 1px solid var(--ds-border-soft);
  color: var(--ds-fg) !important;
}
body[data-theme="dark"] .duel-arena .round-log span {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #f1f1f5 !important;
}

/* ---------- Brand mark ---------- */
.brand-mark {
  background: var(--ds-primary) !important;
  border-color: var(--ds-primary) !important;
  color: #0a0a14 !important;
}

/* ---------- Sticky polish: ensure no gray-on-gray ---------- */
.duel-arena .battle-card.placeholder small,
.duel-arena .battle-card.placeholder h2,
.duel-arena .battle-card.placeholder p { opacity: 1 !important; }

/* Leader rank chip — neutral when not top-3 */
.leader-row .rank { color: var(--ds-fg) !important; }

/* Final: scroll bars in dark mode less harsh */
body[data-theme="dark"] *::-webkit-scrollbar { width: 10px; height: 10px; }
body[data-theme="dark"] *::-webkit-scrollbar-track { background: transparent; }
body[data-theme="dark"] *::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 8px; }
body[data-theme="dark"] *::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.16); }

/* ─── Protocol quest card additions ─── */
.quest-protocol-badge {
  display: inline-block;
  margin: 4px 0 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--ds-primary-100);
  color: var(--ds-primary-700);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}
body[data-theme="dark"] .quest-protocol-badge {
  background: rgba(74, 222, 128, 0.12);
  color: var(--ds-primary);
}
.quest-action-hint {
  font-size: 12px;
  color: var(--ds-fg-muted);
  margin: 6px 0 10px;
  padding: 6px 10px;
  border-left: 3px solid var(--ds-border);
  background: var(--ds-panel-2);
  border-radius: 0 8px 8px 0;
}
.quest-action-hint span { font-weight: 800; color: var(--ds-fg-subtle); text-transform: uppercase; font-size: 10px; letter-spacing: .06em; margin-right: 4px; }
.quest-go-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid var(--ds-border);
  color: var(--ds-fg-muted);
  background: var(--ds-panel-2);
  cursor: pointer;
  transition: background .15s, color .15s, transform .12s;
}
.quest-go-btn:hover { background: var(--ds-panel-elev); color: var(--ds-fg); transform: translateY(-1px); }
.quest-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.verified-tag { color: var(--ds-primary) !important; }

/* ── APR Trend Badge ── */
.apr-trend {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  padding: 2px 6px;
  border-radius: 999px;
  margin-top: 4px;
  line-height: 1.4;
}
.apr-trend.bullish { background: rgba(52,211,153,.15); color: #10b981; border: 1px solid rgba(52,211,153,.35); }
.apr-trend.bearish { background: rgba(239,68,68,.12); color: #ef4444; border: 1px solid rgba(239,68,68,.3); }

/* ── Agent Panel (dashboard) ── */
.agent-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--ds-panel);
  border: 1px solid var(--ds-border);
  margin-bottom: 14px;
}
.agent-id-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.agent-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c3aed22, #3b82f622);
  color: #7c3aed;
  border: 1px solid #7c3aed44;
}
.agent-id-row b { font-size: 15px; font-weight: 800; color: var(--ds-fg); }
.agent-id-row em { font-size: 11px; color: var(--ds-fg-muted); font-style: normal; }
.agent-stats-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.agent-stats-row span { display: flex; flex-direction: column; gap: 1px; }
.agent-stats-row small { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ds-fg-subtle); font-weight: 700; }
.agent-stats-row strong { font-size: 16px; font-weight: 800; color: var(--ds-fg); }
.agent-strategy { font-size: 12px; color: var(--ds-fg-muted); margin: 0; line-height: 1.5; }
.agent-link {
  font-size: 11px;
  color: var(--ds-primary);
  font-weight: 700;
  text-decoration: none;
  opacity: .8;
  transition: opacity .15s;
}
.agent-link:hover { opacity: 1; text-decoration: underline; }
.action-board-filler { display: contents; }

/* ── Round Log Reasoning ── */
.round-log-row { display: flex; flex-direction: column; gap: 1px; }
.ai-reasoning {
  font-size: 10px;
  color: var(--ds-fg-subtle);
  font-style: normal;
  padding-left: 4px;
  border-left: 2px solid var(--ds-border);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.round-tx-link {
  font-size: 10px;
  color: var(--ds-primary);
  text-decoration: none;
  margin-left: 4px;
  font-weight: 700;
  opacity: .7;
}
.round-tx-link:hover { opacity: 1; }

/* ── Share Twitter button ── */
.share-twitter {
  background: #1d9bf022 !important;
  color: #1d9bf0 !important;
  border-color: #1d9bf044 !important;
}
.share-twitter:hover { background: #1d9bf033 !important; }
