.name-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.name-input-wrap input {
  width: 100%;
  padding-right: 34px;
}

.sprite-preview-badge {
  position: absolute;
  right: 5px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.sprite-preview-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.template-keep-row {
  margin-top: 10px;
  color: var(--muted);
}

.variants-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.variants-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.variants-header h3 {
  font-size: 13px;
  font-weight: 600;
}

.variants-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.variant-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  display: grid;
  grid-template-columns: 74px 1fr 22px;
  gap: 6px;
  align-items: start;
}

.variant-item .vi-set {
  grid-column: 2 / 3;
}

.variant-item .vi-second {
  grid-column: 1 / 3;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.btn-remove-variant {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  grid-column: 3;
  grid-row: 1;
}

.btn-remove-variant:hover:not(:disabled) {
  color: var(--danger);
}

.btn-remove-variant:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.tcg-card[data-type="fire"]      { --tc: #cf4a3a; }
.tcg-card[data-type="water"]     { --tc: #3d7fc4; }
.tcg-card[data-type="grass"]     { --tc: #4c9a54; }
.tcg-card[data-type="lightning"] { --tc: #d9a916; }
.tcg-card[data-type="psychic"]   { --tc: #8a58b8; }
.tcg-card[data-type="fighting"]  { --tc: #a85a32; }
.tcg-card[data-type="darkness"]  { --tc: #2c3440; }
.tcg-card[data-type="metal"]     { --tc: #7d8a96; }
.tcg-card[data-type="dragon"]    { --tc: #b0802a; }
.tcg-card[data-type="fairy"]     { --tc: #d36a9a; }
.tcg-card[data-type="trainer"]   { --tc: #3b8aa6; }
.tcg-card[data-type="colorless"] { --tc: #5f6b76; }

.theme-minimal .tcg-card {
  --tc: #111 !important;
}

.tcg-card-inner {
  height: 100%;
  padding: 0 4mm 3mm;
  display: flex;
  flex-direction: column;
  border-top: 2mm solid var(--tc);
}

.card-top-section {
  padding-top: 2.8mm;
  padding-bottom: 2mm;
  border-bottom: 0.3mm solid #d5d8dc;
}

.card-top-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 6pt;
  color: #7a8089;
  margin-bottom: 1mm;
}

.card-type-pill {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tc);
  font-weight: 600;
}

.theme-minimal .card-type-pill {
  color: #555;
}

.card-rarity-top {
  font-weight: 500;
  color: #6b727a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 36mm;
}

.card-header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2mm;
}

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

.card-pokemon-name {
  font-size: 12pt;
  font-weight: 700;
  line-height: 1.12;
  word-break: break-word;
}

.card-pokemon-name.long-name {
  font-size: 9.8pt;
}

.card-subname {
  font-size: 6.5pt;
  color: #6b727a;
  margin-top: 0.6mm;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-thumb-box {
  width: 11.5mm;
  height: 11.5mm;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.card-variants-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 0.8mm 0;
}

.card-variant-block {
  padding: 1.6mm 0;
  border-bottom: 0.25mm dotted #c3c7cc;
}

.card-variant-block:last-child {
  border-bottom: none;
}

.cv-top-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5mm;
}

.cv-lang-set {
  display: flex;
  align-items: baseline;
  gap: 1.4mm;
  min-width: 0;
  flex: 1;
}

.cv-lang-tag {
  font-size: 6pt;
  font-weight: 700;
  color: var(--tc);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.theme-minimal .cv-lang-tag {
  color: #111;
}

.cv-set-name {
  font-weight: 600;
  line-height: 1.15;
  word-break: break-word;
}

.cv-edition-tag {
  font-size: 5.5pt;
  font-weight: 600;
  color: #4b525a;
  border: 0.2mm solid #b9bec4;
  border-radius: 0.8mm;
  padding: 0.1mm 1mm;
  white-space: nowrap;
  flex-shrink: 0;
}

.cv-bottom-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2mm;
  margin-top: 0.7mm;
}

.cv-number {
  font-family: var(--font-num);
  color: #555d66;
}

.cv-price {
  font-family: var(--font-num);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.density-1 .cv-set-name { font-size: 10pt; }
.density-1 .cv-number   { font-size: 9pt; }
.density-1 .cv-price    { font-size: 13pt; }
.density-1 .card-variant-block { padding: 2.8mm 0; }

.density-2 .cv-set-name { font-size: 8.4pt; }
.density-2 .cv-number   { font-size: 7.6pt; }
.density-2 .cv-price    { font-size: 10pt; }

.density-3 .cv-set-name { font-size: 7.4pt; }
.density-3 .cv-number   { font-size: 6.8pt; }
.density-3 .cv-price    { font-size: 8.4pt; }
.density-3 .card-variant-block { padding: 1.2mm 0; }

.density-many .cv-set-name { font-size: 6.4pt; }
.density-many .cv-number   { font-size: 6pt; }
.density-many .cv-price    { font-size: 7pt; }
.density-many .card-variant-block { padding: 0.8mm 0; }

.card-footer-section {
  border-top: 0.3mm solid #d5d8dc;
  padding-top: 1.4mm;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2mm;
  font-size: 6pt;
  color: #6b727a;
  min-height: 4.5mm;
}

.card-footer-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3mm;
}

.card-note-label {
  color: #333;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-qr-caption {
  font-size: 5pt;
  color: #8a8f95;
}

.card-qr-box {
  width: 11.5mm;
  height: 11.5mm;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-qr-box svg {
  width: 100%;
  height: 100%;
  display: block;
}
