:root {
  --bg0: #0a090d;
  --bg1: #16121c;
  --bg2: #1f1412;
  --card: rgba(22, 19, 28, 0.86);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f6eee3;
  --muted: #bba691;
  --good: #7ce2a4;
  --bad: #ff6f6f;
  --gold: #d6b15a;
  --accent: #87d7ff;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -3%, #3a2722 0%, transparent 37%),
    radial-gradient(circle at 92% 8%, #12253f 0%, transparent 38%),
    linear-gradient(165deg, var(--bg0), var(--bg1) 60%, var(--bg2));
}

.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image: radial-gradient(circle, #fff 1px, transparent 1px);
  background-size: 4px 4px;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(5px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.kicker {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.7rem;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Cinzel", serif;
}

h1 {
  font-size: clamp(1.2rem, 2.25vw, 2rem);
}

h2 {
  font-size: 1.12rem;
  margin-bottom: 0.6rem;
}

h3 {
  font-size: 0.92rem;
  margin-bottom: 0.5rem;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.pill {
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.76rem;
}

.pill.live {
  color: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.panel {
  padding: 1rem;
}

.playfield {
  min-height: 420px;
}

.phase {
  display: block;
  animation: appear 0.28s ease;
}

.hidden {
  display: none;
}

@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.phase-copy {
  margin-top: 0;
  color: var(--muted);
}

.action-grid {
  display: grid;
  gap: 0.6rem;
  margin: 0.9rem 0 0.6rem;
}

.menu-grid {
  max-width: 420px;
}

.action-btn {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.event-meta {
  margin: 0.8rem 0 1rem;
  border-left: 3px solid var(--gold);
  padding-left: 0.68rem;
  color: var(--muted);
  line-height: 1.45;
}

.trade-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.85rem;
}

.trade-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.81rem;
  color: var(--muted);
}

input,
select {
  width: 100%;
  background: #1f1923;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem;
  font-family: inherit;
}

.ticker {
  margin-top: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem;
  background: rgba(8, 8, 11, 0.45);
}

.ticker-row {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.ticker-row span {
  color: var(--muted);
}

.ticker-note {
  color: var(--muted);
  font-size: 0.76rem;
  margin-top: 0.2rem;
}

.pulse-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 0.45rem;
}

.pulse-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #9f3333, #d7a042, #54b879);
  transition: width 0.25s ease;
}

.trade-status {
  margin: 0.7rem 0;
  font-size: 0.9rem;
}

.trade-actions,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0.85rem 0 1rem;
}

.result-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem;
}

.result-key {
  color: var(--muted);
  font-size: 0.75rem;
}

.result-val {
  margin-top: 0.18rem;
  font-weight: 700;
}

.stat-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.52rem;
}

.stat .key {
  color: var(--muted);
  font-size: 0.75rem;
}

.stat .val {
  margin-top: 0.2rem;
  font-weight: 700;
}

.char-name {
  margin-top: -0.2rem;
  margin-bottom: 0.55rem;
  color: var(--gold);
}

.profile-label {
  margin: 0.4rem 0 0.55rem;
}

.condition-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  min-height: 42px;
}

.stacked-actions {
  display: grid;
  gap: 0.45rem;
}

.stacked-actions .btn {
  width: 100%;
}

.save-meta {
  margin-top: 0.55rem;
}

.condition {
  padding: 0.26rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.75rem;
}

.condition.blessing {
  border-color: rgba(130, 217, 168, 0.6);
  color: #9de6c1;
}

.condition.buff {
  border-color: rgba(135, 213, 255, 0.6);
  color: #a5ddff;
}

.condition.curse {
  border-color: rgba(255, 119, 119, 0.6);
  color: #ffaaaa;
}

.condition.enchant {
  border-color: rgba(214, 177, 90, 0.6);
  color: #e3ca8a;
}

.condition.loot {
  border-color: rgba(223, 218, 175, 0.45);
  color: #f2ebc1;
}

.equipment-list {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.equipment-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.46rem;
  font-size: 0.8rem;
  background: rgba(10, 10, 12, 0.25);
}

.equipment-item.empty {
  opacity: 0.78;
}

.equipment-slot {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.68rem;
}

.equipment-name {
  margin-top: 0.1rem;
  font-weight: 700;
}

.equipment-enchant {
  margin-top: 0.15rem;
  color: #e3ca8a;
}

.inventory-list {
  margin: 0 0 0.8rem;
  display: grid;
  gap: 0.45rem;
  min-height: 56px;
}

.inventory-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem;
  background: rgba(8, 8, 11, 0.3);
}

.inventory-row.gear {
  border-color: rgba(135, 213, 255, 0.3);
}

.inventory-row.loot {
  border-color: rgba(214, 177, 90, 0.35);
}

.inventory-summary {
  margin-bottom: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.inventory-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.inventory-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.79rem;
}

.inventory-name {
  font-weight: 700;
}

.inventory-meta {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.inventory-actions {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.shop-services {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.shop-service {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0.5rem;
  background: rgba(10, 10, 14, 0.38);
}

.shop-service-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
}

.shop-service-name {
  font-weight: 700;
  color: var(--text);
  font-size: 0.83rem;
}

.shop-list {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.shop-item {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0.52rem;
  background: rgba(10, 10, 14, 0.44);
}

.shop-item.common {
  border-color: rgba(186, 176, 157, 0.5);
}

.shop-item.uncommon {
  border-color: rgba(125, 196, 184, 0.6);
}

.shop-item.rare {
  border-color: rgba(124, 158, 222, 0.68);
}

.shop-item.legendary {
  border-color: rgba(226, 177, 84, 0.72);
  box-shadow: inset 0 0 0 1px rgba(226, 177, 84, 0.28);
}

.shop-item-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.78rem;
}

.shop-item-name {
  font-weight: 700;
}

.shop-item-meta {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.shop-item-actions {
  margin-top: 0.4rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.shop-investment {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0.58rem;
  margin-bottom: 0.8rem;
  background: rgba(10, 10, 14, 0.34);
}

.mini-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1d2730;
  color: var(--text);
  font-size: 0.73rem;
  padding: 0.22rem 0.45rem;
  cursor: pointer;
}

.mini-btn.sell {
  border-color: rgba(214, 177, 90, 0.5);
  color: #e3ca8a;
}

.mini-btn:hover {
  filter: brightness(1.1);
}

.enchant-chooser {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem;
  margin: 0.55rem 0 0.9rem;
  background: rgba(13, 13, 17, 0.34);
}

.hover-card {
  position: fixed;
  z-index: 1000;
  max-width: 310px;
  background: linear-gradient(170deg, rgba(27, 24, 34, 0.98), rgba(17, 16, 24, 0.98));
  border: 1px solid rgba(150, 140, 120, 0.5);
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
  padding: 0.6rem 0.7rem;
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.35;
  white-space: pre-line;
  pointer-events: none;
}

.btn {
  border: 1px solid transparent;
  background: linear-gradient(130deg, #3f2d2c, #684523);
  color: #fff;
  border-radius: 10px;
  padding: 0.5rem 0.82rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.btn.secondary {
  background: #1d2730;
  border-color: var(--line);
}

.btn.danger {
  background: linear-gradient(130deg, #5f1e1e, #8f2f2f);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.quote-list {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}

.quote {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.52rem;
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.89rem;
}

.quote small {
  color: var(--muted);
}

.log-list {
  margin: 0.55rem 0 0;
  padding-left: 1rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  max-height: 118px;
  overflow: auto;
}

.leaderboard-list {
  margin: 0.35rem 0 0.7rem;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
}

.board-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.4rem 0.48rem;
  background: rgba(8, 8, 11, 0.27);
  list-style-position: outside;
}

.board-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.board-name {
  font-weight: 700;
}

.board-meta {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.74rem;
}

.board-status {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
}

.board-status.alive {
  color: var(--good);
}

.board-status.dead {
  color: var(--bad);
}

.board-status.retired {
  color: var(--gold);
}

.panel-flash {
  animation: panelFlash 0.8s ease;
}

@keyframes panelFlash {
  from { box-shadow: 0 0 0 rgba(135, 215, 255, 0.2); }
  45% { box-shadow: 0 0 0 3px rgba(135, 215, 255, 0.35); }
  to { box-shadow: var(--shadow); }
}

.good {
  color: var(--good);
}

.bad {
  color: var(--bad);
}

.footer {
  margin-top: 0.9rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}

@media (min-width: 640px) {
  .trade-controls {
    grid-template-columns: 1fr 1fr;
  }

  .action-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 920px) {
  .grid {
    grid-template-columns: 265px 1fr 295px;
    align-items: start;
  }

  .grid.menu-mode {
    grid-template-columns: 1fr 295px;
  }
}
