body {
  margin: 0;
  background: #0f0f10;
  color: #e6e6e6;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  display: flex;
  justify-content: center;
  padding: 16px;
  padding-top: 16px;
  box-sizing: border-box;
}

/* padding-top set dynamically by updateRunHeader() */

#fireworksCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  display: none;
}

body.celebrating {
  pointer-events: none;
}

.page {
  width: 100%;
  max-width: 920px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ------------------ RUN HEADER ------------------ */

.run-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 920px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 8px 24px;
  box-sizing: border-box;
  background: #1c1812;
  border: 1px solid #3a3020;
  border-top: none;
  border-radius: 0 0 8px 8px;
  font-size: 18px;
  font-weight: 700;
}

.run-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.run-header-left {
  color: #ddd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex-shrink: 1;
}

.run-header-right {
  display: flex;
  gap: 16px;
  white-space: nowrap;
  flex-shrink: 0;
}

.run-header-relics:empty {
  display: none;
}

.run-header-relics {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.run-header-relics-label {
  font-size: 17px;
  color: #aaa;
  margin-right: 2px;
}

.run-header-gold {
  color: #ffd84d;
}

.run-header-energy {
  color: #6bbcff;
}

/* ------------------ PANELS ------------------ */

.panel {
  background: #1a1a1c;
  border: 1px solid #2a2a2d;
  border-radius: 8px;
  padding: 12px;
  box-sizing: border-box;
}

.goal-panel,
.item-panel,
.deck-panel {
  width: 100%;
}

/* ------------------ GOAL ------------------ */

.goal-panel {
  text-align: center;
}

.goal-panel h2 {
  margin: 0 0 10px 0;
  font-size: 28px;
  font-weight: bold;
}

.goal-panel div {
  margin-bottom: 2px;
}

.goal-panel .goal-progress {
  font-size: 20px;
}

/* ------------------ GOAL BREAKDOWN ------------------ */

.goal-breakdown {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.goal-breakdown-piece {
  background: #151516;
  border: 1px solid #2a2a2d;
  border-radius: 6px;
  padding: 8px 12px;
  text-align: center;
  min-width: 66px;
}

.goal-breakdown-label {
  font-size: 11px;
  color: #888;
}

.goal-breakdown-value {
  font-size: 20px;
  font-weight: bold;
  color: #f2f2f2;
  margin-top: 2px;
}

.goal-breakdown-value.boosted {
  color: #6bff9e;
}

.goal-breakdown-value.neutral {
  color: #bbb;
}

.goal-breakdown-piece.final-piece {
  border-color: #5a4c1a;
  background: #232018;
}

.goal-breakdown-piece.final-piece .goal-breakdown-label {
  color: #d7c27a;
}

.goal-breakdown-piece.final-piece .goal-breakdown-value {
  color: #ffd84d;
  font-size: 22px;
}

/* ------------------ ITEM PANEL ------------------ */

.item-panel {
  overflow: hidden;
}

.item-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.item-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 0;
}

.item-right {
  min-width: 0;
}

.item-left h2 {
  margin: 0 0 10px 0;
  font-size: 18px;
  font-weight: bold;
}

.item-image-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

#itemImage {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
  max-height: 429px;
  object-fit: contain;
  border-radius: 6px;
}

.has-enemy #itemImage {
  max-width: 180px;
  max-height: 280px;
}

/* ------------------ ITEM STATS ------------------ */

.item-stats {
  width: 100%;
  margin-top: 2px;
  margin-bottom: 8px;
}

.item-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.item-stat-badge {
  position: relative;
  background: #2a2a2d;
  border: 1px solid #3a3a3d;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  transition: opacity 0.15s ease;
  cursor: default;
}

.stat-tooltip {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  background: #1a1a1c;
  border: 1px solid #c48a2e;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #e6e6e6;
  white-space: nowrap;
  z-index: 200;
  pointer-events: none;
}

.item-stat-badge:hover .stat-tooltip {
  display: block;
}

.item-stat-badge.stat-fade-out {
  opacity: 0;
}

.item-stat-badge.stat-fade-in {
  opacity: 0;
  animation: statFadeIn 0.2s ease forwards;
}

@keyframes statFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.stat-boosted {
  color: #66dd88;
}

/* ------------------ DAMAGE SUMMARY ------------------ */

.damage-stats {
  width: 100%;
  text-align: center;
}

.damage-stats-title {
  font-size: 12px;
  color: #aaa;
  margin-bottom: 4px;
  font-weight: bold;
}

.damage-line {
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 3px;
  line-height: 1.25;
}

.damage-breakdown {
  font-weight: normal;
  margin-left: 6px;
}

.damage-physical {
  color: #aaa;
}

.damage-fire {
  color: #ff6b6b;
}

.damage-cold {
  color: #6bbcff;
}

.damage-lightning {
  color: #ffd84d;
}

/* ------------------ AFFIXES ------------------ */

.affix-section-title {
  margin: 0 0 6px 0;
  font-size: 14px;
  font-weight: bold;
}

.mod-slot {
  border: 1px solid #2a2a2d;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  text-align: center;
  min-height: 72px;
  box-sizing: border-box;
  background: #161618;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.mod-slot.empty-slot {
  color: #666;
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mod-slot:not(.empty-slot):not(.locked-slot):not(.fractured-slot):not(.negative-slot) {
  border-color: #4c4c52;
}

.mod-slot.locked-slot {
  color: #555;
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(
    45deg,
    #1a1a1c,
    #1a1a1c 6px,
    #222224 6px,
    #222224 12px
  );
  border-style: dashed;
  border-color: #333;
}

.mod-slot.fractured-slot {
  position: relative;
  border-color: #8a6a2a;
  box-shadow: inset 0 0 0 1px #8a6a2a, 0 0 8px rgba(214, 168, 70, 0.25);
  background:
    linear-gradient(rgba(28, 22, 10, 0.55), rgba(28, 22, 10, 0.55)),
    repeating-linear-gradient(
      135deg,
      #1a1612,
      #1a1612 6px,
      #211b12 6px,
      #211b12 12px
    );
}

.mod-slot.fractured-slot .mod-lock-icon {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 14px;
  line-height: 1;
  opacity: 0.9;
}

.mod-slot.fractured-slot .mod-name {
  color: #d6a846;
}

.mod-slot.negative-slot {
  border-color: #7a2a2a;
  box-shadow: inset 0 0 0 1px #7a2a2a, 0 0 8px rgba(180, 60, 60, 0.2);
  background:
    linear-gradient(rgba(30, 14, 14, 0.55), rgba(30, 14, 14, 0.55)),
    repeating-linear-gradient(
      135deg,
      #1a1212,
      #1a1212 6px,
      #211414 6px,
      #211414 12px
    );
}

.mod-slot.negative-slot .mod-name {
  color: #c97070;
}

.mod-slot.negative-slot .mod-effect {
  color: #e08888;
}

.mod-effect {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 2px;
  line-height: 1.2;
  word-break: break-word;
}

.mod-effect.physical-effect {
  color: #aaa;
}

.mod-effect.fire-effect {
  color: #ff6b6b;
}

.mod-effect.cold-effect {
  color: #6bbcff;
}

.mod-effect.lightning-effect {
  color: #ffd84d;
}

.mod-name {
  font-size: 12px;
  color: #bbb;
  line-height: 1.2;
}

.mod-max-badge {
  font-size: 10px;
  font-weight: bold;
  color: #e0a13c;
  background: #2a2010;
  border: 1px solid #5a4a1a;
  border-radius: 3px;
  padding: 1px 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.mod-slot-maxed {
  border-color: #5a4a1a;
}

.mod-tags {
  font-size: 11px;
  color: #777;
  line-height: 1.2;
  word-break: break-word;
}

/* ------------------ DECK PANEL ------------------ */

.deck-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.deck-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: bold;
}

.gold-display {
  font-size: 18px;
  font-weight: bold;
  white-space: nowrap;
}

.deck-info {
  background: #151516;
  border: 1px solid #2a2a2d;
  border-radius: 6px;
  padding: 10px 12px;
}

.deck-info-top {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.deck-info-stat {
  font-size: 13px;
  color: #ddd;
}

.deck-info-title {
  font-size: 12px;
  color: #999;
  font-weight: bold;
  margin-bottom: 6px;
}

.deck-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.deck-chip {
  background: #242428;
  border: 1px solid #3a3a40;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  color: #ddd;
  line-height: 1.2;
}

.queue-craft-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 12px;
  align-items: start;
}

.queue {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.queue-slot,
.queue .card-btn {
  position: relative;
  min-height: 130px;
  padding: 28px 10px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
}

.queue .card-btn .card-icon {
  top: 55px;
  font-size: 20px;
}

.queue .card-btn.card-action {
  border-color: #8a8a92;
}

.queue-slot {
  border: 1px dashed #444;
  border-radius: 6px;
  background: #141416;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  box-sizing: border-box;
}

.craft-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.craft-btn {
  position: relative;
  width: 100%;
  min-height: 130px;
  font-size: 18px;
  font-weight: bold;
  border-color: #c48a2e;
  border-width: 2px;
  padding: 28px 10px 12px;
}

.undo-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.undo-btn {
  background: #242428;
  border: 1px solid #444;
  border-radius: 6px;
  color: #ccc;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}

.undo-btn:hover:not(:disabled) {
  background: #2f2f34;
  border-color: #666;
}

.undo-row.hidden,
.undo-btn.hidden {
  display: none;
}

.craft-btn:hover:not(:disabled) {
  border-color: #e0a13c;
  background: #323236;
}

.craft-btn .craft-cost-badge {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 16px;
  font-weight: bold;
}

.toast-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  min-height: 0;
}

.toast {
  background: #2a1a1a;
  border: 1px solid #7a3a3a;
  border-radius: 6px;
  padding: 8px 16px;
  color: #f0a0a0;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  animation: toast-in 0.25s ease-out, toast-out 0.4s ease-in 2.2s forwards;
}

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

@keyframes toast-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

.toast-warning {
  background: #2a2510;
  border: 1px solid #7a6a2a;
  color: #f0d870;
  animation: toast-in 0.25s ease-out;
}

.hand-section {
  margin-top: 14px;
}

.hand-title {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 8px;
}

.hand {
  display: grid;
  grid-template-columns: repeat(var(--hand-size, 6), minmax(0, 1fr));
  gap: 8px;
}

button,
.card-btn {
  background: #2a2a2d;
  border: 1px solid #444;
  border-radius: 6px;
  color: #eee;
  padding: 10px 12px;
  cursor: pointer;
  min-width: 0;
  min-height: 64px;
  box-sizing: border-box;
  white-space: normal;
  text-align: center;
  line-height: 1.2;
}

button:hover,
.card-btn:hover {
  background: #3a3a3d;
}

.hand .card-btn {
  position: relative;
  min-height: 190px;
  padding: 28px 10px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 36px;
  font-size: 18px;
  font-weight: 600;
}

.hand .card-btn.card-action {
  border-color: #8a8a92;
}
.hand-card-help {
  position: absolute;
  bottom: 6px;
  left: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #444;
  border: 1px solid #666;
  color: #aaa;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  z-index: 10;
}
.hand-card-help:hover {
  background: #555;
  color: #fff;
  border-color: #999;
}
.hand-card-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  background: #1a1a1c;
  border: 1px solid #c48a2e;
  border-radius: 6px;
  padding: 10px 14px;
  white-space: normal;
  width: 220px;
  font-size: 12px;
  font-weight: 600;
  color: #e6e6e6;
  line-height: 1.4;
  z-index: 200;
  pointer-events: none;
  text-align: left;
}
.hand-card-help:hover .hand-card-tooltip {
  display: block;
}
.hand-tooltip-desc {
  margin-bottom: 0;
}
.hand-tooltip-modifier {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #444;
  color: #d4a940;
  font-size: 12px;
}

.card-cost-badge {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 16px;
  font-weight: bold;
}

.card-type-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 20px;
}

.card-name {
  display: block;
}

.card-name-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.card-icon {
  position: absolute;
  top: 93px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 28px;
  line-height: 1;
}

.card-single-use {
  font-size: 11px;
  color: #aaa;
  font-style: italic;
  letter-spacing: 0.5px;
}

.card-help-single-use {
  color: #aaa;
  font-style: italic;
}

.deck-chip-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  color: #bbb;
  background: #2a2a2d;
  border: 1px solid #444;
  border-radius: 3px;
  font-style: italic;
}

.card-modifiers-row {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 3px;
  justify-content: center;
  flex-wrap: wrap;
  width: 90%;
}

.card-modified {
  background: linear-gradient(165deg, #2a2a2d 20%, #4a3818 100%);
  box-shadow: 0 0 10px rgba(255, 216, 77, 0.4), inset 0 0 8px rgba(255, 216, 77, 0.1);
}

.card-modified:hover {
  background: linear-gradient(165deg, #3a3a3d 20%, #5a4520 100%);
  box-shadow: 0 0 14px rgba(255, 216, 77, 0.55), inset 0 0 10px rgba(255, 216, 77, 0.15);
}

.card-legendary {
  border: 2px solid #c084fc;
  background:
    linear-gradient(165deg, rgba(192, 132, 252, 0.18) 0%, transparent 50%),
    linear-gradient(345deg, rgba(192, 132, 252, 0.18) 0%, transparent 50%),
    linear-gradient(165deg, #302040 20%, #3a1860 100%);
  box-shadow:
    0 0 16px rgba(192, 132, 252, 0.7),
    0 0 40px rgba(168, 85, 247, 0.35),
    inset 0 0 16px rgba(192, 132, 252, 0.2);
  animation: legendaryShimmer 2.5s ease-in-out infinite;
}

.card-legendary:hover {
  border-color: #e9d5ff;
  background:
    linear-gradient(165deg, rgba(233, 213, 255, 0.2) 0%, transparent 50%),
    linear-gradient(345deg, rgba(233, 213, 255, 0.2) 0%, transparent 50%),
    linear-gradient(165deg, #3a2850 20%, #4a2070 100%);
  box-shadow:
    0 0 24px rgba(192, 132, 252, 0.9),
    0 0 50px rgba(168, 85, 247, 0.45),
    inset 0 0 20px rgba(192, 132, 252, 0.3);
}

@keyframes legendaryShimmer {
  0%, 100% { box-shadow: 0 0 16px rgba(192, 132, 252, 0.7), 0 0 40px rgba(168, 85, 247, 0.35), inset 0 0 16px rgba(192, 132, 252, 0.2); }
  50% { box-shadow: 0 0 24px rgba(192, 132, 252, 0.9), 0 0 50px rgba(168, 85, 247, 0.5), inset 0 0 22px rgba(192, 132, 252, 0.3); }
}

.card-mod-tab {
  display: inline-block;
  padding: 1px 4px;
  font-size: 12px;
  border-radius: 3px;
  line-height: 1.2;
  white-space: nowrap;
}

.card-mod-tab-gameplay {
  color: #ddd;
  background: #3a3a50;
  border: 1px solid #5a5a80;
}

.card-mod-tab-stat {
  color: #c8e6c9;
  background: #2d3d2d;
  border: 1px solid #4a6a4a;
}

.card-mod-tab-single-use {
  color: #e09080;
  background: #3d2020;
  border: 1px solid #804040;
}

.card-cost-original {
  opacity: 0.5;
  margin-right: 2px;
}

.deck-chip-mods {
  display: inline;
  margin-left: 4px;
}

.shop-deck-card-mods {
  display: inline;
  margin-left: 4px;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ------------------ HELP + DECK INFO ROW ------------------ */

.cards-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  width: 100%;
}

.card-help-panel h2,
.deck-info-panel h2,
.log-panel h2 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: bold;
}

.card-help-content {
  min-height: 116px;
  font-size: 13px;
  color: #ddd;
  line-height: 1.45;
}

.card-help-name {
  font-size: 16px;
  font-weight: bold;
  color: #f2f2f2;
  margin-bottom: 4px;
}

.card-help-meta {
  font-size: 12px;
  color: #aaa;
  margin-bottom: 8px;
}

.card-help-text {
  color: #ddd;
  margin-bottom: 8px;
}

.card-help-notes {
  font-size: 12px;
  color: #bcbcbc;
}

/* ------------------ LOG ------------------ */

#log {
  background: #0d0d0e;
  border-radius: 6px;
  padding: 10px;
  font-size: 12px;
  white-space: pre-line;
  max-height: 160px;
  overflow-y: auto;
  box-sizing: border-box;
}

/* ------------------ RESET ------------------ */

.reset-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.rl-debug-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.rl-debug-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.rl-debug-row label {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.deck-select {
  background: #2a2a2d;
  border: 1px solid #444;
  border-radius: 6px;
  color: #eee;
  padding: 8px 10px;
  font-size: 14px;
  cursor: pointer;
}

/* ------------------ SEE MODS BUTTON + MODAL ------------------ */

.see-mods-btn {
  display: block;
  margin: 0 auto 12px;
  padding: 6px 14px;
  font-size: 13px;
  min-height: 0;
}

.mods-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.mods-modal.hidden {
  display: none;
}

.mods-modal-content {
  background: #1b1b1d;
  border: 1px solid #444;
  border-radius: 8px;
  width: min(900px, 95vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.mods-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #333;
}

.mods-modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.mods-modal-close {
  background: transparent;
  border: none;
  color: #eee;
  font-size: 24px;
  line-height: 1;
  padding: 0 8px;
  min-height: 0;
  cursor: pointer;
}

.mods-modal-close:hover {
  color: #fff;
}

.mods-modal-body {
  overflow-y: auto;
  padding: 8px 12px 16px;
}

.mod-section-header {
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 6px 6px;
  border-bottom: 1px solid #3a3a3d;
  margin-top: 8px;
  color: #aaa;
}

.mod-section-header:first-child {
  margin-top: 0;
}

.mod-section-title {
  flex: 1;
  color: #c48a2e;
}

.mod-group-row {
  border-bottom: 1px solid #2a2a2d;
  border-left: 3px solid transparent;
}

.mod-group-row.helps-goal {
  border-left-color: #c48a2e;
  background: rgba(196, 138, 46, 0.06);
}

.mod-group-row.helps-goal .mod-group-title {
  color: #f0d090;
}

.mod-group-row.mod-group-occupied {
  opacity: 0.45;
}

.mod-group-row.mod-group-occupied .mod-group-title {
  text-decoration: line-through;
}

.mod-occupied-badge {
  margin-left: 8px;
  font-size: 11px;
  color: #888;
  background: #2a2a2d;
  padding: 1px 6px;
  border-radius: 4px;
}

.goal-pip {
  margin-left: 8px;
  color: #c48a2e;
  font-size: 13px;
}

.mod-group-header {
  display: flex;
  align-items: center;
  padding: 10px 6px;
  cursor: pointer;
  user-select: none;
}

.mod-group-header:hover {
  background: #242428;
}

.mod-group-title-cell {
  flex: 1;
  min-width: 0;
}

.mod-group-title {
  font-weight: bold;
}

.mod-group-type-cell {
  width: 70px;
  font-size: 13px;
  color: #aaa;
  text-align: left;
}

.mod-group-weight-cell {
  width: 70px;
  font-size: 13px;
  color: #aaa;
  text-align: left;
}

.mod-group-tags-cell {
  width: 180px;
  font-size: 13px;
  color: #aaa;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mod-group-caret {
  margin-right: 8px;
  color: #888;
  display: inline-block;
  width: 12px;
}

.mod-tiers-table {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0 10px;
  font-size: 13px;
}

.mod-tiers-table th,
.mod-tiers-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid #2a2a2d;
}

.mod-tiers-table th {
  color: #aaa;
  font-weight: normal;
  font-size: 12px;
}

/* ------------------ UTILITY ------------------ */

.empty {
  color: #777;
}

/* ------------------ ANIMATIONS ------------------ */

.fade-in {
  animation: fadeIn 0.15s ease-out;
}

.slow-fade-in {
  animation: fadeIn 0.25s ease-out;
}

.fade-out {
  animation: fadeOut 0.12s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* ------------------ MUSIC TOGGLE ------------------ */

.music-toggle-row {
  text-align: center;
  margin-top: 8px;
}

.music-toggle-btn {
  background: transparent;
  border: 1px solid #333;
  border-radius: 6px;
  color: #888;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}

.music-toggle-btn:hover {
  color: #ccc;
  border-color: #555;
}

/* ------------------ GENERIC HIDDEN ------------------ */

.hidden {
  display: none !important;
}

/* ------------------ LEVEL SELECT SCREEN ------------------ */

.level-select {
  width: 100%;
  max-width: 920px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px 8px;
  box-sizing: border-box;
}

.level-select-title {
  margin: 0;
  font-size: 28px;
  text-align: center;
}

.level-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  width: 100%;
}

.level-card-btn {
  background: #1a1a1c;
  border: 1px solid #2a2a2d;
  border-radius: 8px;
  padding: 18px 12px;
  text-align: center;
  color: #eee;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
  display: block;
}

.level-card-btn:hover {
  border-color: #e0a13c;
  background: #222226;
}

.level-card-num {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #aaa;
  margin-bottom: 4px;
}

.level-card-name {
  font-size: 16px;
  font-weight: bold;
}

.level-card-debug {
  border-style: dashed;
}

.seeded-run-panel {
  margin-top: 24px;
  padding: 16px 20px;
  background: #1a1a1c;
  border: 1px dashed #2a2a2d;
  border-radius: 8px;
  width: 100%;
  box-sizing: border-box;
}

.seeded-run-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #aaa;
  margin-bottom: 10px;
}

.seeded-run-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.seeded-run-input {
  flex: 1;
  min-width: 200px;
  font-family: Consolas, Menlo, monospace;
  font-size: 13px;
  padding: 8px 10px;
  background: #15161c;
  border: 1px solid #2a2c3a;
  color: #e0d8c8;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.seeded-run-input:focus {
  outline: none;
  border-color: #e0a13c;
}

.seeded-run-btn {
  background: #1a1a1c;
  border: 1px solid #2a2a2d;
  color: #e0d8c8;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.seeded-run-btn:hover {
  border-color: #e0a13c;
  background: #222226;
}

.seeded-run-hint {
  font-size: 12px;
  color: #888;
  margin-top: 8px;
  min-height: 16px;
}

/* ------------------ LEVEL CONTROLS ROW ------------------ */

.level-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
}

/* ------------------ MODAL ACTIONS (win / give-up) ------------------ */

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid #333;
}

.modal-actions button {
  padding: 8px 14px;
  font-size: 14px;
  min-height: 0;
}

.modal-actions button.modal-cta {
  border-color: #c48a2e;
  border-width: 2px;
  font-weight: bold;
  font-size: 16px;
  padding: 10px 22px;
  color: #f2e4c6;
}

.modal-actions button.modal-cta:hover:not(:disabled) {
  border-color: #e0a13c;
  background: #323236;
}

/* ------------------ INTRO MODAL ------------------ */

.intro-progress {
  font-size: 13px;
  color: #aaa;
  padding-right: 8px;
}

.intro-step-intro {
  font-size: 14px;
  color: #ccc;
  margin-bottom: 12px;
}

.intro-lore {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.intro-lore-top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.intro-lore-image {
  flex: 0 0 auto;
  width: 200px;
  height: 200px;
  object-fit: cover;
  border: 1px solid #333;
  border-radius: 6px;
  background: #111;
}

.intro-lore-text {
  flex: 1 1 auto;
  margin: 0;
  padding: 0 24px;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 18px;
  line-height: 1.6;
  text-align: center;
  color: #e8dcc0;
}

.intro-lore-bottom {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid #2a2a2d;
}

.intro-lore-goal {
  font-size: 24px;
  color: #e0a13c;
  text-align: center;
  font-weight: bold;
  padding: 12px 0;
}

.intro-lore-instructions {
  margin: 8px auto 0;
  padding-left: 22px;
  max-width: 560px;
  font-size: 16px;
  color: #ccc;
  line-height: 1.6;
}

.intro-lore-instructions li {
  margin: 2px 0;
}

.intro-mods {
  display: flex;
  flex-direction: column;
}

.intro-mod-section-header {
  display: grid;
  grid-template-columns: 1fr 60px 1fr;
  gap: 10px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 6px 6px;
  border-bottom: 1px solid #3a3a3d;
  margin-top: 8px;
}

.intro-mod-row {
  display: grid;
  grid-template-columns: 1fr 60px 1fr;
  gap: 10px;
  align-items: center;
  padding: 6px;
  border-bottom: 1px solid #232325;
  font-size: 13px;
}

.intro-mod-row.helps-goal .intro-mod-name {
  color: #e0a13c;
}

.intro-mod-weight {
  text-align: right;
  color: #aaa;
}

.intro-mod-tags {
  color: #aaa;
  font-size: 12px;
}

.intro-deck-section {
  margin-bottom: 14px;
}

.intro-deck-title {
  font-size: 13px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #aaa;
  margin-bottom: 8px;
}

.deck-preview-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px 8px;
}

.deck-preview-card {
  position: relative;
  width: 100%;
  min-height: 190px;
  padding: 36px 10px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  cursor: default;
}

.deck-preview-card.card-action {
  border-color: #8a8a92;
}

/* ------------------ WIN MODAL BODY ------------------ */

#winModal .mods-modal-header {
  justify-content: center;
  padding: 18px 16px;
}

#winModal .mods-modal-header h2 {
  font-size: 28px;
  text-align: center;
}

#introModal .mods-modal-header {
  position: relative;
  justify-content: center;
}

#introModal .mods-modal-header h2 {
  font-size: 24px;
  text-align: center;
}

#introModal .intro-progress {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.win-meta {
  text-align: center;
  margin-bottom: 16px;
}

.win-level-label {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 4px;
}

.win-goal-label {
  font-size: 16px;
  color: #e0a13c;
}

.win-top-row {
  display: flex;
  gap: 20px;
  margin-bottom: 14px;
}

.win-top-left {
  flex: 0 0 auto;
  text-align: center;
}

.win-top-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.win-item-hero {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.win-item-image {
  width: 140px;
  height: 140px;
  object-fit: contain;
  border: 1px solid #333;
  border-radius: 8px;
  background: #111;
}

.win-item-name {
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 6px;
}

.win-hp-bar {
  text-align: center;
}

.win-item-section {
  margin-bottom: 14px;
}

.win-section-title {
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #aaa;
  margin-bottom: 6px;
  border-bottom: 1px solid #2a2a2d;
  padding-bottom: 4px;
}

.win-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
  font-size: 13px;
  text-align: left;
}

.win-item-mods {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.win-mod {
  background: #151516;
  border: 1px solid #2a2a2d;
  border-radius: 6px;
  padding: 8px 10px;
  text-align: center;
}

.win-mod-effects {
  font-size: 14px;
  color: #eee;
  line-height: 1.4;
  margin-bottom: 2px;
}

.win-mod-name {
  font-size: 12px;
  color: #aaa;
}

.win-damage {
  text-align: center;
}

.win-damage .damage-line {
  font-size: 14px;
  margin: 2px 0;
}

.win-rewards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 300px;
  margin: 0 auto;
}

.win-reward-row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  color: #ccc;
  padding: 4px 0;
}

.win-reward-total {
  border-top: 1px solid #3a3a3d;
  padding-top: 8px;
  font-weight: bold;
  color: #eee;
}

.win-reward-value {
  font-weight: bold;
}

.reward-gold {
  color: #ffd84d;
}

.reward-energy {
  color: #6bbcff;
}

/* ------------------ ENEMY PANEL ------------------ */

.enemy-panel-inline {
  width: 100%;
  margin-top: 4px;
}

.enemy-vs-divider {
  text-align: center;
  font-size: 14px;
  color: #777;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.enemy-name-row {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.enemy-name-label {
  font-size: 18px;
  font-weight: bold;
  color: #ddd;
  text-align: center;
}

.enemy-hp-value {
  font-size: 16px;
  font-weight: bold;
  color: #e6e6e6;
}

.enemy-modifiers {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 5px;
  justify-content: center;
}

.enemy-modifiers:empty {
  display: none;
}

.enemy-modifier-tag.enemy-modifier-normal {
  background: #2a2a2d;
  border-color: #4a4a4d;
  color: #999;
}

.enemy-bottom {
  margin-top: 25px;
}

.enemy-modifier-tag {
  background: #3a1515;
  border: 1px solid #8a3333;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 12px;
  color: #ff8a8a;
  font-weight: 600;
}
.boss-modifier-tag {
  background: #2a1530;
  border: 1px solid #7a3388;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 12px;
  color: #d88aff;
  font-weight: 600;
}

.enemy-hp-label {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 4px;
  color: #e6e6e6;
}

.enemy-hp-bar-container {
  position: relative;
  width: 100%;
  height: 32px;
  background: #2a2a2d;
  border-radius: 4px;
  margin-top: 4px;
}

.enemy-hp-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background:
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 4px,
      rgba(255, 255, 255, 0.06) 4px,
      rgba(255, 255, 255, 0.06) 8px
    ),
    #2d1f3d;
  border-radius: 4px;
  transition: width 0.3s;
  overflow: visible;
  cursor: default;
}

.enemy-damage-segments {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  overflow: visible;
}

.enemy-damage-segment {
  position: absolute;
  top: 0;
  height: 100%;
  transition: width 0.3s, left 0.3s;
  cursor: default;
  overflow: visible;
}

.enemy-damage-segment:first-child {
  border-radius: 4px 0 0 4px;
}

.enemy-damage-segment:last-child {
  border-radius: 0 4px 4px 0;
}

.enemy-damage-segment:only-child {
  border-radius: 4px;
}

.enemy-remaining-segment {
  background: transparent !important;
}

.segment-tooltip {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  background: #1a1a1c;
  border: 1px solid #c48a2e;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #e6e6e6;
  white-space: nowrap;
  z-index: 200;
  pointer-events: none;
}

.enemy-damage-segment:hover .segment-tooltip,
.enemy-hp-bar:hover .segment-tooltip {
  display: block;
}

.formula-line {
  font-size: 11px;
  font-weight: 400;
  color: #aaa;
  margin-bottom: 4px;
  display: block;
}

.formula-line:last-child {
  margin-bottom: 0;
}

.enemy-damage-text {
  font-size: 18px;
  font-weight: bold;
  color: #e6e6e6;
  margin-top: 4px;
  text-align: center;
}

.enemy-damage-raw {
  font-size: 12px;
  color: #888;
  text-align: center;
  margin-top: 2px;
}

/* ------------------ ROGUELIKE PLANNING SCREEN ------------------ */

.roguelike-planning {
  width: 100%;
  max-width: 920px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 8px;
  box-sizing: border-box;
}

.planning-header {
  text-align: center;
}

.planning-title {
  margin: 0 0 6px 0;
  font-size: 32px;
  color: #e0a13c;
}

.planning-floor-label {
  font-size: 20px;
  font-weight: bold;
  color: #ddd;
  margin-bottom: 8px;
}

/* (planning-meta moved to common .run-header) */

.planning-weapon {
  display: flex;
  align-items: center;
  gap: 24px;
  background: #1e1e20;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 24px;
}

.planning-weapon-img {
  width: 160px;
  height: 160px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #444;
  background: #111;
  flex-shrink: 0;
}

.planning-weapon-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.planning-weapon-name {
  font-size: 26px;
  font-weight: bold;
  color: #e0a13c;
}

.planning-weapon-desc {
  font-size: 14px;
  color: #aaa;
  font-style: italic;
  line-height: 1.4;
}

.planning-weapon-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

.planning-stat {
  font-size: 14px;
  color: #ddd;
  background: #222;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid #333;
}

.planning-stat-up {
  color: #6fdc6f;
}

.planning-stat-down {
  color: #e06060;
}

.planning-weapon-slots {
  font-size: 13px;
  color: #888;
}

.planning-weapon-mods-btn {
  align-self: flex-start;
  margin-top: 4px;
  padding: 6px 16px;
  font-size: 13px;
  border-color: #555;
  color: #ccc;
}

.planning-weapon-mods-btn:hover {
  border-color: #888;
  background: #2a2a2e;
}

.planning-encounters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.planning-encounter {
  background: #1a1a1c;
  border: 1px solid #2a2a2d;
  border-radius: 10px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.planning-encounter.encounter-boss {
  border-color: #5a3a1a;
  background: #1c1812;
}

.planning-encounter.encounter-complete {
  opacity: 0.5;
  border-color: #2a5a2a;
}

.planning-encounter.encounter-current {
  border-color: #c48a2e;
  box-shadow: 0 0 12px rgba(196, 138, 46, 0.2);
}

.planning-encounter-num {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #aaa;
}

.planning-encounter-name {
  font-size: 20px;
  font-weight: bold;
  min-height: 28px;
}

.planning-encounter-boss-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #e0a13c;
  background: #2a2010;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #5a4a1a;
}

.planning-encounter-goal-block {
  font-size: 14px;
  color: #e0a13c;
  font-weight: 600;
  line-height: 1.4;
  min-height: 40px;
}

.planning-encounter-enemy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.planning-enemy-name {
  font-size: 16px;
  font-weight: bold;
  color: #ddd;
}

.planning-enemy-hp {
  font-size: 18px;
  font-weight: bold;
  color: #ff6b6b;
}

.planning-enemy-desc {
  font-size: 12px;
  color: #999;
  font-style: italic;
  line-height: 1.3;
  min-height: 32px;
}

.planning-enemy-modifier {
  font-size: 14px;
  font-weight: 600;
  color: #ff8a8a;
  background: #3a1515;
  border: 1px solid #8a3333;
  border-radius: 4px;
  padding: 4px 10px;
  margin-top: 2px;
}
.planning-boss-modifier {
  font-size: 13px;
  font-weight: 600;
  color: #d88aff;
  background: #2a1530;
  border: 1px solid #7a3388;
  border-radius: 4px;
  padding: 4px 10px;
  margin-top: 2px;
}

.planning-encounter-mods {
  min-height: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}
.planning-encounter-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.planning-encounter-reward {
  font-size: 17px;
  font-weight: 600;
  color: #cca832;
}

.planning-encounter-go {
  margin-top: auto;
  padding: 10px 28px;
  font-size: 16px;
  font-weight: bold;
  border-color: #c48a2e;
  border-width: 2px;
  color: #f2e4c6;
}

.planning-encounter-go:hover:not(:disabled) {
  border-color: #e0a13c;
  background: #323236;
}

.planning-encounter-complete-badge {
  font-size: 24px;
}

.planning-actions {
  display: flex;
  justify-content: center;
}

/* (roguelike info bar replaced by common .run-header) */

/* (old tower screen removed — now uses 16:9 layout in style-16x9.css) */

.treasure-card-offers {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.treasure-card-offer {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.treasure-card-offer .card-btn {
  width: 150px;
  min-height: 190px;
  padding: 28px 10px 16px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 36px;
}

/* ------------------ ROGUELIKE LEVEL CARD ------------------ */

.level-card-roguelike {
  border-color: #c48a2e;
  background: #1c1812;
}

.level-card-roguelike:hover {
  border-color: #e0a13c;
  background: #2a2218;
}

.level-card-roguelike .level-card-num {
  color: #e0a13c;
}

/* ------------------ ROGUELIKE SHOP ------------------ */

.roguelike-shop {
  width: 100%;
  max-width: 920px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 8px;
  box-sizing: border-box;
}

.shop-header {
  text-align: center;
}

.shop-header h1 {
  margin: 0 0 8px 0;
  font-size: 28px;
}

/* (shop-meta moved to common .run-header) */

.shop-stage-info {
  color: #aaa;
  font-size: 14px;
  margin-top: 4px;
}

.shop-dialogue {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #1a1a1c;
  border: 1px solid #2a2a2d;
  border-radius: 8px;
  padding: 16px;
}

.shop-dialogue-text {
  flex: 1;
  font-size: 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  color: #e8dcc0;
  line-height: 1.5;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shop-dialogue-text p {
  margin: 0;
}

.shop-dialogue-portrait {
  flex: 0 0 auto;
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid #c48a2e;
  background: #111;
}

.shop-section {
  background: #1a1a1c;
  border: 1px solid #2a2a2d;
  border-radius: 8px;
  padding: 16px;
}

.shop-section h2 {
  margin: 0 0 12px 0;
  font-size: 18px;
}

.shop-section-hint {
  font-size: 13px;
  font-weight: 400;
  color: #888;
}

.shop-offers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.shop-card-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.shop-card-wrap .shop-card {
  width: 100%;
  min-height: 190px;
  padding: 28px 10px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 36px;
  font-size: 18px;
  font-weight: 600;
  position: relative;
}

.shop-card-wrap:hover:not(.shop-card-disabled) .shop-card {
  border-color: #c48a2e;
  background: #3a3a3d;
}
.shop-card .card-mod-tab {
  font-size: 13px;
  padding: 3px 7px;
  border-radius: 4px;
  font-weight: 600;
}
.shop-card .card-modifiers-row {
  gap: 4px;
}
.shop-card-tooltip {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 8px;
  background: #1a1a1c;
  border: 1px solid #c48a2e;
  border-radius: 6px;
  padding: 10px 14px;
  white-space: normal;
  width: 220px;
  font-size: 12px;
  font-weight: 600;
  color: #e6e6e6;
  line-height: 1.4;
  z-index: 200;
  pointer-events: none;
  text-align: left;
}
.shop-tooltip-modifier {
  display: block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #444;
  color: #d4a940;
  font-size: 12px;
}
.shop-card-wrap:hover .shop-card-tooltip {
  display: block;
}

.shop-card-disabled {
  opacity: 0.4;
  cursor: default;
}

.shop-card-price {
  font-size: 16px;
  font-weight: bold;
  color: #ffd84d;
}

.shop-deck-view {
  padding: 8px 0;
}

.shop-remove-cost {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 8px;
}

.shop-deck-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.shop-deck-card {
  background: #242428;
  border: 1px solid #3a3a40;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s;
}

.shop-deck-card:hover:not(.shop-card-disabled) {
  border-color: #c48a2e;
}

.shop-deck-card.shop-card-disabled {
  opacity: 0.4;
  cursor: default;
}

.shop-deck-card-icon {
  font-size: 16px;
}

.shop-deck-card-count {
  color: #888;
  font-size: 12px;
}

.shop-actions {
  display: flex;
  justify-content: center;
}

.shop-actions .modal-cta {
  padding: 12px 32px;
  font-size: 18px;
}

/* ------------------ RELICS ------------------ */

.relic-icon {
  position: relative;
  font-size: 32px;
  cursor: default;
  line-height: 1;
}

.relic-icon:hover {
  transform: scale(1.2);
}

.relic-icon.relic-new {
  animation: relicAppear 1.2s ease-out forwards;
}

@keyframes relicAppear {
  0% { opacity: 0; transform: scale(0.3); filter: brightness(3) drop-shadow(0 0 12px #ffd84d); }
  30% { opacity: 1; transform: scale(1.3); filter: brightness(2) drop-shadow(0 0 16px #ffd84d); }
  60% { transform: scale(1); filter: brightness(1.4) drop-shadow(0 0 8px #ffd84d); }
  100% { transform: scale(1); filter: brightness(1) drop-shadow(0 0 0 transparent); }
}

.relic-icon .relic-tooltip {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  background: #1a1a1c;
  border: 1px solid #c48a2e;
  border-radius: 6px;
  padding: 6px 10px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  color: #e6e6e6;
  z-index: 200;
  pointer-events: none;
}

.relic-icon .relic-tooltip-name {
  color: #ffd84d;
}

.relic-icon:hover .relic-tooltip {
  display: block;
}

.shop-relic-offers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.shop-relic-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.shop-relic {
  background: #2a2518;
  border: 1px solid #c48a2e;
  border-radius: 8px;
  padding: 16px;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

.shop-relic-emoji {
  font-size: 32px;
  line-height: 1;
  margin-bottom: 6px;
}

.shop-relic-name {
  font-size: 16px;
  font-weight: 700;
  color: #ffd84d;
  margin-bottom: 6px;
}

.shop-relic-desc {
  font-size: 13px;
  color: #ccc;
  line-height: 1.3;
}

.shop-relic-wrap:hover:not(.shop-card-disabled) .shop-relic {
  border-color: #e0a13c;
  background: #3a3020;
}

.shop-relic-wrap.shop-card-disabled {
  opacity: 0.4;
  cursor: default;
}

.shop-relic-price {
  font-size: 16px;
  font-weight: bold;
  color: #ffd84d;
}

.shop-relic-sold-out {
  font-size: 22px;
  font-weight: 700;
  color: #666;
  text-align: center;
  padding: 20px 0;
}

.relic-toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: #2a2518;
  border: 2px solid #c48a2e;
  border-radius: 8px;
  padding: 10px 20px;
  color: #ffd84d;
  font-weight: 700;
  font-size: 14px;
  z-index: 9999;
  pointer-events: none;
  animation: relicToastFade 2s ease-out forwards;
}

@keyframes relicToastFade {
  0% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* ------------------ ROGUELIKE END SCREEN ------------------ */

.roguelike-end {
  width: 100%;
  max-width: 920px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  box-sizing: border-box;
}

.roguelike-end-content {
  background: #1a1a1c;
  border: 1px solid #2a2a2d;
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  max-width: 500px;
  width: 100%;
}

.roguelike-end-content h1 {
  margin: 0 0 16px 0;
  font-size: 28px;
  color: #ffd84d;
}

.roguelike-end-content p {
  font-size: 16px;
  color: #ccc;
  margin: 8px 0;
}

.roguelike-end-content .modal-actions {
  justify-content: center;
  border-top: none;
  margin-top: 16px;
}

.starting-relic-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.starting-relic-icon {
  font-size: 56px;
  line-height: 1;
}
.starting-relic-name {
  font-size: 22px;
  font-weight: 700;
  color: #ffd84d;
}
.starting-relic-desc {
  font-size: 16px;
  color: #ccc;
  text-align: center;
}
.starting-relic-hint {
  text-align: center;
  font-size: 14px;
  color: #888;
  margin: 0;
}