:root {
  --gold-1: #f3c24a;
  --gold-2: #e2b33d;
  --ink-1: #f7edd7;
  --ink-2: #e6d1af;
  --board-1: #7b5336;
  --board-2: #6a472d;
  --board-3: #8f5f3f;
  --line-1: rgba(255, 255, 255, 0.22);
  --line-2: rgba(243, 194, 74, 0.4);
}

#setOverview {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

#setOverview:empty {
  display: none;
}

#setOverview > .set-shell,
#setOverview > .empty-state {
  flex: 1 1 auto;
}

.set-shell {
  background: radial-gradient(circle at top right, #956544 0%, #7a5437 42%, #6a472d 100%);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
}

.set-head {
  border-bottom: 1px solid var(--line-1);
  padding: 10px 12px;
  background: rgba(67, 51, 38, 0.88);
  backdrop-filter: blur(2px);
}

.set-title {
  margin: 0;
  color: var(--gold-1);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 20px;
}

.set-subtitle {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: 13px;
}

.set-kpis {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.kpi-pill {
  border: 1px solid var(--line-2);
  color: var(--ink-1);
  background: rgba(67, 51, 38, 0.46);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.set-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  flex: 1 1 auto;
  min-height: 0;
}

.panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel + .panel {
  border-left: 1px solid var(--line-1);
}

.panel-head {
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(67, 51, 38, 0.88);
  backdrop-filter: blur(2px);
  color: var(--gold-1);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.5px;
  font-size: 13px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-1);
}

.pieces-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.piece-row {
  display: grid;
  grid-template-columns: 98px 1fr;
  gap: 8px;
  align-items: start;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.piece-row:nth-child(2n) {
  background: rgba(255, 255, 255, 0.02);
}

.piece-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  align-self: center;
  justify-content: center;
}

.piece-image {
  width: 66px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.piece-image img,
.piece-image canvas {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border: 2px solid #d44646;
  border-radius: 2px;
  background: transparent;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.piece-name {
  margin: 0;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}

.piece-name-mobile {
  display: none;
}

.piece-meta {
  margin: 2px 0 0;
  color: #e6d1af;
  font-size: 11px;
}

.piece-sell-value {
  width: fit-content;
  margin: 6px 0 0;
  padding: 3px 8px;
  border: 1px solid rgba(243, 194, 74, 0.45);
  border-radius: 999px;
  background: rgba(67, 51, 38, 0.52);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #fff4dc;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.55);
}

.piece-sell-value strong {
  color: var(--gold-1);
  font-size: 11px;
  font-weight: 900;
}

.piece-sell-value img {
  width: 13px;
  height: 13px;
  object-fit: contain;
}

.effect-list {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-1);
  font-size: 12px;
  line-height: 1.35;
}

.effect-list li {
  margin: 1px 0;
  font-size: 12px;
}

.effect-list li::before {
  content: "•";
  color: var(--gold-1);
  margin-right: 5px;
  font-weight: 800;
}

.effect-list li.reward-effect-row::before {
  content: "";
  margin-right: 0;
  color: transparent;
  font-weight: 400;
  background: rgba(245, 230, 207, 0.78);
}

.bonus-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 6px 12px 12px;
}

.bonus-wrap.summary-mode {
  background:
    radial-gradient(circle at 100% 0, rgba(243, 194, 74, 0.12), transparent 44%),
    linear-gradient(180deg, rgba(67, 51, 38, 0.35), rgba(67, 51, 38, 0.18));
}

.bonus-line {
  position: relative;
  padding-left: 22px;
  margin: 10px 0;
}

.bonus-line::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0;
  bottom: -14px;
  width: 2px;
  background: rgba(243, 194, 74, 0.55);
}

.bonus-line:last-child::before {
  content: none;
}

.bonus-node {
  position: absolute;
  left: 0;
  top: 7px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--gold-1);
  border: 2px solid #5e3e27;
  box-shadow: 0 0 0 3px rgba(243, 194, 74, 0.2);
}

.bonus-card {
  background: linear-gradient(180deg, rgba(123, 83, 54, 0.92), rgba(97, 65, 42, 0.94));
  border: 1px solid var(--line-1);
  border-radius: 9px;
  padding: 8px 10px;
}

.bonus-threshold {
  margin: 0;
  color: var(--gold-1);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.bonus-name {
  margin: 2px 0 0;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.bonus-effects {
  margin: 5px 0 0;
  color: var(--ink-1);
  font-size: 12px;
  line-height: 1.35;
}

.summary-view {
  padding: 2px 0;
}

.summary-grid {
  display: grid;
  gap: 4px;
}

.summary-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  padding: 8px 10px;
  background: linear-gradient(180deg, rgba(123, 83, 54, 0.96), rgba(103, 70, 46, 0.94));
}

.summary-row.is-positive {
  box-shadow: inset 3px 0 0 rgba(243, 194, 74, 0.95);
}

.summary-row.is-neutral {
  box-shadow: inset 3px 0 0 rgba(243, 194, 74, 0.95);
}

.summary-row.is-negative {
  box-shadow: inset 3px 0 0 rgba(220, 93, 93, 0.9);
}

.summary-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(67, 51, 38, 0.9);
  border: 1px solid rgba(243, 194, 74, 0.5);
  color: var(--gold-1);
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.summary-main {
  min-width: 0;
}

.summary-text {
  margin: 0;
  color: #fff;
  font-size: 12px;
  line-height: 1.35;
}


.empty-state {
  border: 2px dashed rgba(243, 194, 74, 0.55);
  border-radius: 12px;
  color: #f5e6cf;
  text-align: center;
  padding: 18px;
  background: rgba(67, 51, 38, 0.45);
  font-weight: 700;
}

.mobile-panel-control {
  display: none;
}

.compare-view-shell {
  border: 1px solid rgba(255, 255, 255, 0.58);
}

.compare-view-toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-1);
  background: linear-gradient(180deg, rgba(67, 51, 38, 0.55), rgba(67, 51, 38, 0.28));
}

.compare-table-wrap {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0 0 10px 10px;
  overflow: auto;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  table-layout: fixed;
}

.compare-table th,
.compare-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px 10px;
  font-size: 12px;
}

.compare-table th:not(:last-child),
.compare-table td:not(:last-child) {
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.compare-table th {
  background: rgba(67, 51, 38, 0.95);
  color: var(--gold-1);
  font-weight: 800;
  position: sticky;
  top: 0;
  z-index: 2;
}

.compare-stat-col {
  width: auto;
  color: #f7edd7;
  font-weight: 700;
}

.compare-value-col {
  width: auto;
  font-weight: 700;
  text-align: center;
  color: #f7edd7;
}

.compare-table.compare-cols-2 .compare-stat-col {
  width: 46%;
}

.compare-table.compare-cols-2 .compare-value-col {
  width: 27%;
}

.compare-table.compare-cols-3 .compare-stat-col {
  width: 40%;
}

.compare-table.compare-cols-3 .compare-value-col {
  width: 20%;
}

.compare-value-empty {
  color: rgba(255, 255, 255, 0.5);
}

.compare-value-win {
  color: #9cffac;
  background: rgba(18, 108, 45, 0.28);
}

.compare-value-equal {
  color: #9cffac;
  background: rgba(18, 108, 45, 0.22);
}

.compare-value-lose {
  color: #ffb2b2;
  background: rgba(129, 33, 33, 0.28);
}

.compare-empty {
  margin: 0;
  padding: 12px;
  color: #f7edd7;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 768px) {
  .set-layout {
    grid-template-columns: 1fr;
  }

  .panel + .panel {
    border-left: 0;
    border-top: 1px solid var(--line-1);
  }

  .pieces-wrap,
  .bonus-wrap {
    min-height: 0;
  }
}

@media (max-width: 768px) {
  #bonusViewCol {
    display: none;
  }

  .set-head {
    display: none;
  }

  .set-shell {
    margin-bottom: 0;
  }

  .mobile-panel-control {
    display: block;
  }

  .compare-view-toolbar {
    grid-template-columns: 1fr;
    padding: 8px;
  }

  .set-layout.mobile-show-pieces .panel:nth-child(2) {
    display: none;
  }

  .set-layout.mobile-show-set-bonuses .panel:nth-child(1),
  .set-layout.mobile-show-effect-summary .panel:nth-child(1) {
    display: none;
  }

  .set-layout.mobile-show-set-bonuses .panel:nth-child(2),
  .set-layout.mobile-show-effect-summary .panel:nth-child(2) {
    border-top: 0;
  }
}

@media (max-width: 700px) {
  .piece-row {
    grid-template-columns: 62px 1fr;
    gap: 3px;
    padding: 7px 6px;
  }

  .piece-name-mobile {
    display: block;
    grid-column: 1 / -1;
    text-align: center;
    margin: 0 0 4px;
  }

  .piece-name-desktop {
    display: none;
  }

  .piece-image {
    width: 50px;
    height: 50px;
  }

  .piece-image img,
  .piece-image canvas {
    width: 46px;
    height: 46px;
  }

  .set-title {
    font-size: 17px;
  }
}
