* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
}

body {
  margin: 0;
  background: #0b0b0d;
  color: #f3f1ea;
  font: 16px/1.4 'Inter', system-ui, 'Segoe UI', Roboto, sans-serif;
}

.page {
  position: relative;
  min-height: 100svh;
  background-image: var(--bg-url);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.page-portrait {
  position: fixed;
  right: 0;
  bottom: 0;
  width: min(46vw, 480px);
  aspect-ratio: 642 / 703;
  background-image: var(--portrait-url);
  background-size: cover;
  background-position: top center;
  opacity: 0.55;
  -webkit-mask-image: linear-gradient(to top left, black 35%, transparent 88%);
  mask-image: linear-gradient(to top left, black 35%, transparent 88%);
  z-index: 0;
  pointer-events: none;
}

@media (max-width: 780px) {
  .page-portrait {
    width: 62vw;
    opacity: 0.4;
  }
}

.page-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(40, 32, 10, 0.35), transparent 60%),
    linear-gradient(rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.86));
  z-index: 0;
}

.content {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 18px 56px;
}

.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 26px 20px 30px;
  margin-bottom: 32px;
  background: linear-gradient(180deg, rgba(24, 22, 18, 0.6), rgba(14, 13, 11, 0.55));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.brand-tag {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: rgba(212, 175, 55, 0.75);
}

.title-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.header h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.5px;
  background: linear-gradient(180deg, #f3d97a, #b8892e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 10px rgba(212, 175, 55, 0.25));
}

.stamp {
  display: inline-block;
  border: 3px solid #b91c1c;
  color: #ef4444;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12.5px;
  padding: 4px 10px;
  transform: rotate(-8deg);
  border-radius: 6px;
  letter-spacing: 1px;
  opacity: 0.92;
  box-shadow: 0 0 0 1px rgba(185, 28, 28, 0.15);
}

.subtitle {
  color: #c7cad1;
  max-width: 620px;
  font-size: 14.5px;
  margin: 2px 0 10px;
  line-height: 1.5;
}

.saldo-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 6px 0 4px;
}

.saldo-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #a3a5ad;
}

.saldo-value {
  font-size: clamp(34px, 8vw, 58px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #fbf7ec;
  text-shadow: 0 0 30px rgba(212, 175, 55, 0.4);
  letter-spacing: -0.5px;
}

.progress-track {
  width: 100%;
  max-width: 520px;
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #d4af37, #ef4444);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.5);
  transition: width 0.4s ease;
}

.progress-label {
  font-size: 11.5px;
  color: #9a9ca4;
  margin-top: 2px;
}

.header-actions {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  font-family: inherit;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-gold {
  background: linear-gradient(180deg, #e8c458, #c99a2e);
  color: #241a04;
  box-shadow: 0 6px 16px rgba(212, 175, 55, 0.25);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: #f3f1ea;
  border-color: rgba(255, 255, 255, 0.18);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.09);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  background: linear-gradient(180deg, rgba(26, 26, 30, 0.92), rgba(16, 16, 19, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
  border-color: rgba(212, 175, 55, 0.35);
}

.card--owned {
  border-color: #d4af37;
  box-shadow: 0 0 0 1px #d4af37, 0 10px 26px rgba(212, 175, 55, 0.18);
}

.card-img-wrap {
  position: relative;
  height: 158px;
  overflow: hidden;
  background: #24242a;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  display: block;
  transition: transform 0.4s ease;
}

.card-img--face {
  object-position: 50% 12%;
}

.card:hover .card-img {
  transform: scale(1.06);
}

.card-body {
  padding: 13px 14px 15px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  flex: 1;
}

.card-name {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.32;
  margin: 0;
  min-height: 34px;
  color: #f3f1ea;
}

.card-price {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #e0b84a;
}

.card-controls {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-controls button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: #f3f1ea;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.card-controls button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.card-controls button:not(:disabled):hover {
  background: #d4af37;
  color: #1a1305;
  border-color: #d4af37;
}

.card-qty {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 20px;
  text-align: center;
}

.info-wrap {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}

.info-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: rgba(212, 175, 55, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.info-wrap:hover .info-btn,
.info-btn:focus-visible {
  opacity: 1;
  background: rgba(0, 0, 0, 0.65);
  border-color: #d4af37;
  color: #d4af37;
}

.tooltip {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: -2px;
  padding-top: 11px;
  width: 230px;
  background: #17161a;
  border: 1px solid rgba(212, 175, 55, 0.55);
  border-radius: 10px;
  padding-inline: 12px;
  padding-bottom: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  text-align: left;
}

.tooltip[hidden] {
  display: none;
}

.tooltip-meme {
  margin: 0 0 8px;
  font-size: 12px;
  color: #d9d7cf;
  line-height: 1.42;
}

.tooltip-source {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #d4af37;
  text-decoration: none;
  font-weight: 600;
}

.tooltip-source:hover {
  text-decoration: underline;
}

.footer {
  margin-top: 44px;
  padding-top: 20px;
  border-top: 1px solid rgba(212, 175, 55, 0.15);
  text-align: center;
  font-size: 11.5px;
  color: #86868c;
  max-width: 720px;
  margin-inline: auto;
  line-height: 1.55;
}

.footer p {
  margin: 0 0 8px;
}

.footer-update {
  color: rgba(212, 175, 55, 0.7);
  font-weight: 500;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: #17161a;
  border: 1px solid rgba(212, 175, 55, 0.5);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-header h2 {
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  color: #e0b84a;
}

.modal-close {
  background: none;
  border: none;
  color: #f3f1ea;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.modal-close:hover {
  opacity: 1;
}

.modal-empty {
  color: #9ca3af;
  font-size: 14px;
}

.modal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.modal-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  padding-bottom: 7px;
}

.modal-total {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(212, 175, 55, 0.4);
  font-weight: 700;
  color: #e0b84a;
  font-variant-numeric: tabular-nums;
}

.modal-actions {
  margin-top: 16px;
}

.btn-export {
  width: 100%;
  justify-content: center;
}

.modal-brand {
  margin-top: 14px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(212, 175, 55, 0.55);
}

.modal.exporting .modal-actions,
.modal.exporting .modal-close {
  display: none;
}

@media (max-width: 600px) {
  .header {
    padding: 22px 16px 24px;
    border-radius: 16px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }

  .card-img-wrap {
    height: 118px;
  }

  .tooltip {
    width: 190px;
    right: -58px;
  }
}
