.cards-panel {
  display: grid;
  gap: 18px;
  padding: clamp(16px, 2.4vw, 28px);
}

.cards-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.cards-title-row h2 {
  margin: 0;
}

.cards-title-row p {
  margin: 6px 0 0;
  max-width: 720px;
  font-size: .95rem;
  line-height: 1.45;
}

.cards-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.cards-actions [hidden] {
  display: none;
}

.cards-icon-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.primary-action.card-import-btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid rgba(179, 18, 75, .65);
  border-radius: 8px;
  background: var(--accent);
  color: var(--text);
  font-weight: 900;
}

.primary-action.card-import-btn:hover {
  background: #d21d61;
}

.card-import-drop {
  min-height: 170px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  border: 1px dashed rgba(255, 255, 255, .24);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .045), transparent),
    rgba(0, 0, 0, .24);
  color: var(--muted);
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease;
}

.card-import-drop[hidden] {
  display: none;
}

.card-import-drop i {
  color: #ffd7e4;
  font-size: 2rem;
}

.card-import-drop:hover,
.card-import-drop.dragging {
  border-color: rgba(179, 18, 75, .75);
  background:
    linear-gradient(180deg, rgba(179, 18, 75, .14), transparent),
    rgba(0, 0, 0, .34);
  color: var(--text);
}

.card-link-entry {
  width: min(540px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 2px;
}

.card-recent-entry,
.card-series-complete-entry {
  position: relative;
}

.card-series-complete-entry.active .card-series-complete-search {
  border-color: rgba(179, 18, 75, .85);
  background: rgba(179, 18, 75, .18);
}

.card-recent-entry[hidden],
.card-series-complete-entry[hidden] {
  display: none;
}

.card-recent-btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid rgba(179, 18, 75, .55);
  border-radius: 8px;
  background: rgba(255, 255, 255, .035);
  color: var(--text);
  font-weight: 900;
}

.card-series-complete-search {
  min-height: 42px;
  width: min(260px, 42vw);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid rgba(179, 18, 75, .55);
  border-radius: 8px;
  background: rgba(255, 255, 255, .035);
  color: var(--text);
}

.card-series-complete-search input {
  min-width: 0;
  width: 100%;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: .9rem;
  font-weight: 900;
  outline: 0;
}

.card-series-complete-search input::placeholder {
  color: #ffd7e4;
  opacity: .9;
}

.card-series-complete-search:focus-within {
  border-color: rgba(179, 18, 75, .9);
  background: rgba(18, 18, 18, .86);
}

.card-series-complete-count {
  min-width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 215, 228, .18);
  color: #ffd7e4;
  font-size: .72rem;
  font-weight: 950;
}

.card-series-complete-count[hidden] {
  display: none;
}

.card-recent-btn:hover:not(:disabled),
.card-recent-btn[aria-expanded="true"] {
  background: rgba(179, 18, 75, .22);
  border-color: rgba(179, 18, 75, .85);
}

.card-recent-btn:disabled {
  cursor: default;
  opacity: .55;
}

.card-link-entry input {
  min-width: 0;
  width: 100%;
}

.card-link-entry button {
  min-height: 42px;
}

.card-recent-menu,
.card-series-complete-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 80;
  width: min(280px, 76vw);
  padding: 8px;
  border: 1px solid rgba(179, 18, 75, .45);
  border-radius: 12px;
  background: rgba(10, 10, 10, .98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .45);
}

.card-series-complete-menu {
  width: min(390px, 88vw);
  display: grid;
  gap: 8px;
}

.card-recent-menu[hidden],
.card-series-complete-menu[hidden] {
  display: none;
}

.card-recent-menu button {
  width: 100%;
  min-height: 0;
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.card-recent-menu button:hover,
.card-recent-menu button:focus-visible {
  background: rgba(179, 18, 75, .22);
}

.card-series-complete-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px 4px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 900;
}

.card-series-complete-actions button {
  width: auto;
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 7px;
  background: rgba(255, 255, 255, .06);
  color: #ffd7e4;
  font-size: .72rem;
  font-weight: 950;
}

.card-series-complete-actions button:disabled {
  opacity: .45;
}

.card-series-complete-list {
  max-height: min(300px, 46vh);
  display: grid;
  gap: 4px;
  overflow: auto;
}

.card-series-complete-option {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 8px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text);
}

.card-series-complete-option:hover,
.card-series-complete-option:focus-within,
.card-series-complete-option.checked {
  background: rgba(179, 18, 75, .2);
}

.card-series-complete-option input {
  grid-row: 1 / span 2;
  accent-color: #d21d61;
}

.card-series-complete-option span,
.card-recent-menu span {
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-series-complete-option small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-series-complete-option small.incomplete,
.card-series-complete-help {
  color: #ffbecf;
}

.card-recent-menu small,
.card-recent-menu p,
.card-series-complete-menu p {
  margin: 0;
  color: var(--muted);
  font-size: .78rem;
}

.card-series-complete-help {
  padding: 8px 9px;
  border: 1px solid rgba(255, 190, 207, .18);
  border-radius: 8px;
  background: rgba(179, 18, 75, .12);
  font-weight: 800;
  line-height: 1.35;
}

@media (max-width: 760px) {
  .card-recent-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .card-recent-btn {
    width: 42px;
    justify-content: center;
    padding-inline: 0;
  }

  .card-recent-btn .fa-chevron-down {
    display: none;
  }

  .card-series-complete-search {
    width: min(100%, 280px);
  }
}

.card-link-modal-field {
  display: grid;
  gap: 6px;
}

.card-link-modal-field[hidden] {
  display: none;
}

.card-link-modal-field span {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 900;
}

.card-controls {
  position: relative;
  z-index: 30;
  display: grid;
  gap: 10px;
  justify-items: start;
}

.card-controls[hidden] {
  display: none;
}

.card-search {
  width: 100%;
  max-width: 760px;
  flex: 1 1 auto;
  z-index: 6;
}

.card-control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.card-control-row-search {
  width: min(960px, 100%);
  flex-wrap: nowrap;
  gap: 8px;
}

.card-control-row-selects {
  width: min(100%, 960px);
  gap: 8px;
}

.card-select-label {
  min-width: max-content;
  width: max-content;
  max-width: calc(100vw - 24px);
  position: relative;
  display: inline-flex;
  align-items: center;
  color: #ffd7e4;
  font-size: .84rem;
  font-weight: 900;
  letter-spacing: 0;
  transition: transform .16s ease;
}

.card-select-label select {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.card-select-label > i,
.card-select-label > .card-select-text-icon {
  display: none;
}

.card-select-text-icon {
  font-size: .72rem;
  font-weight: 950;
  line-height: 1;
}

.card-select-sort {
  width: max-content;
  min-width: 190px;
  max-width: min(260px, 42vw);
  flex: 0 0 auto;
}

.card-select-sort select {
  min-height: 1px;
}

.card-custom-select {
  width: max-content;
  max-width: 100%;
}

.card-custom-select-button {
  width: max-content;
  max-width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(179, 18, 75, .5);
  border-radius: 999px;
  background: rgba(18, 18, 18, .58);
  color: var(--text);
  font: inherit;
  font-size: .86rem;
  font-weight: 900;
  line-height: 1.1;
  cursor: pointer;
  box-shadow: none;
  transition: border-color .16s ease, background .16s ease, color .16s ease;
}

.card-select-label:hover,
.card-select-label:focus-within,
.card-select-label.open {
  transform: translateY(-1px);
}

.card-select-label.open {
  z-index: 80;
}

.card-select-label:hover .card-custom-select-button,
.card-select-label:focus-within .card-custom-select-button,
.card-select-label.open .card-custom-select-button {
  border-color: rgba(255, 215, 228, .5);
  background: rgba(179, 18, 75, .18);
}

.card-custom-select-button .card-custom-value {
  min-width: 0;
  overflow: visible;
  white-space: normal;
}

.card-custom-leading {
  flex: 0 0 18px;
  width: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffd7e4;
  pointer-events: none;
}

.card-custom-leading i,
.card-custom-leading .card-select-text-icon {
  display: inline-flex;
  position: static;
  width: auto;
  color: inherit;
  font-size: .82rem;
  transform: none;
}

.card-custom-leading .card-select-text-icon {
  font-size: .72rem;
  font-weight: 950;
}

.card-select-label.is-all:not(.card-select-sort) {
  min-width: 58px;
}

.card-select-label.is-all:not(.card-select-sort) .card-custom-select-button {
  width: 58px;
  min-width: 58px;
  justify-content: space-between;
  gap: 7px;
  padding: 8px 10px;
}

.card-select-label.is-all:not(.card-select-sort) .card-custom-value {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.card-select-label.is-all:not(.card-select-sort) .card-custom-select-button > i {
  font-size: .72rem;
}

.card-custom-select-button > i {
  flex: 0 0 auto;
  color: #ffd7e4;
  font-size: .78rem;
}

.card-custom-select-menu {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  z-index: 90;
  min-width: 100%;
  width: max-content;
  max-width: calc(100vw - 24px);
  max-height: min(320px, 52vh);
  display: grid;
  overflow: auto;
  padding: 5px;
  border: 1px solid rgba(179, 18, 75, .42);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .06), transparent 40%),
    rgba(8, 8, 10, .98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .42);
}

.card-custom-select-menu[hidden] {
  display: none;
}

.card-custom-option {
  min-width: 0;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: .82rem;
  font-weight: 850;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}

.card-custom-option:hover {
  background: rgba(179, 18, 75, .26);
  color: #ffe7f0;
}

.card-custom-option[data-state="all"],
.card-custom-option[data-state="include"] {
  background: rgba(179, 18, 75, .24);
  color: #ffe7f0;
}

.card-custom-option[data-state="exclude"] {
  background: rgba(60, 16, 27, .86);
  color: #ffd7e4;
}

.card-custom-option-label {
  min-width: 0;
}

.card-custom-option-state {
  flex: 0 0 auto;
  min-width: 54px;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--muted);
  font-size: .62rem;
  font-weight: 950;
  text-align: center;
  text-transform: uppercase;
}

.card-custom-option-state:empty {
  min-width: 0;
  padding: 0;
}

.card-custom-option[data-state="all"] .card-custom-option-state,
.card-custom-option[data-state="include"] .card-custom-option-state {
  background: rgba(255, 215, 228, .14);
  color: #ffd7e4;
}

.card-custom-option[data-state="exclude"] .card-custom-option-state {
  background: rgba(255, 113, 113, .16);
  color: #ffb4c5;
}

.card-select-sort > i {
  display: none;
  font-size: .9rem;
}

.card-select-sort .card-custom-select-button {
  min-height: 48px;
  justify-content: space-between;
  padding: 8px 12px;
  border-color: rgba(179, 18, 75, .72);
  background: rgba(18, 18, 18, .52);
}

.card-select-sort.open .card-custom-select-button {
  background: rgba(18, 18, 18, .88);
}

.card-select-sort .card-custom-select-menu {
  min-width: 210px;
  right: 0;
  left: auto;
}

.card-select-compact select {
  border-color: rgba(255, 215, 228, .42);
  background:
    linear-gradient(90deg, rgba(179, 18, 75, .16), transparent 48%),
    rgba(18, 18, 18, .88);
}

.card-search-suggestions {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(179, 18, 75, .38);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .06), transparent 40%),
    rgba(8, 8, 10, .98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .42);
}

.card-search-suggestions[hidden] {
  display: none;
}

.card-search-suggestion {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  padding: 9px 11px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.card-search-suggestion:last-child {
  border-bottom: 0;
}

.card-search-suggestion:hover,
.card-search-suggestion[aria-selected="true"] {
  background: rgba(179, 18, 75, .26);
}

.card-search-suggestion-main,
.card-search-suggestion-detail {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-search-suggestion-main {
  font-size: .9rem;
  font-weight: 900;
}

.card-search-suggestion-type {
  align-self: center;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(255, 215, 228, .13);
  color: #ffd7e4;
  font-size: .66rem;
  font-weight: 950;
  letter-spacing: .06em;
  line-height: 1;
  text-transform: uppercase;
}

.card-search-suggestion-detail {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: .74rem;
  font-weight: 800;
}

.card-filter-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.card-filter {
  border-radius: 999px;
}

.card-filter > span:last-child:not(.filter-mark):not(.frame-owned-icon):not(.frame-inventory-icon) {
  min-width: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: .88rem;
}

.card-filter[data-state="yes"] > span:last-child:not(.filter-mark):not(.frame-owned-icon):not(.frame-inventory-icon),
.card-filter[data-state="no"] > span:last-child:not(.filter-mark):not(.frame-owned-icon):not(.frame-inventory-icon) {
  background: transparent;
}

.card-grid-wrap {
  position: relative;
  min-height: 120px;
}

/* ==========================================================================
   Karuta Cards Tool
   ========================================================================== */

.card-loading {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  min-height: 120px;
  border: 1px solid rgba(179, 18, 75, .24);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(8, 8, 10, .88), rgba(8, 8, 10, .7)),
    rgba(8, 8, 10, .86);
  color: #ffe7f0;
  font-size: .92rem;
  font-weight: 900;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .34);
}

.card-loading[hidden] {
  display: none;
}

.card-loading-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(255, 215, 228, .22);
  border-top-color: #ffd7e4;
  border-radius: 50%;
  animation: card-loading-spin .8s linear infinite;
}

@keyframes card-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.cards-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cards-stats-row[hidden] {
  display: none;
}

.cards-stats-row p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

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

.karuta-card {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-rows: 220px 1fr auto auto;
  content-visibility: auto;
  contain-intrinsic-size: 0 360px;
  overflow: hidden;
  border: 1px solid rgba(179, 18, 75, .28);
  border-radius: 8px;
  background:
    radial-gradient(circle at 28% 0%, rgba(255, 215, 228, .13), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, .05), transparent 36%),
    rgba(8, 8, 10, .72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.karuta-card:hover,
.karuta-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(179, 18, 75, .72);
  background:
    radial-gradient(circle at 28% 0%, rgba(255, 215, 228, .18), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, .07), transparent 36%),
    rgba(8, 8, 10, .82);
}

.karuta-card:focus-visible {
  outline: 2px solid rgba(255, 215, 228, .72);
  outline-offset: 3px;
}

.karuta-card-unowned {
  border-color: rgba(255, 255, 255, .14);
  background:
    radial-gradient(circle at 28% 0%, rgba(255, 255, 255, .06), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, .035), transparent 36%),
    rgba(8, 8, 10, .5);
  filter: grayscale(.72);
  opacity: .58;
}

.karuta-card-unowned:hover,
.karuta-card-unowned:focus-visible {
  border-color: rgba(255, 215, 228, .42);
  opacity: .82;
  filter: grayscale(.42);
}

.karuta-card-art {
  position: relative;
  height: 220px;
  display: grid;
  place-items: center;
  border-bottom: 1px solid rgba(179, 18, 75, .22);
  background:
    linear-gradient(135deg, rgba(179, 18, 75, .46), rgba(36, 36, 42, .2)),
    radial-gradient(circle at 68% 36%, rgba(255, 255, 255, .13), transparent 34%),
    rgba(20, 20, 24, .78);
  overflow: hidden;
}

.karuta-card-art img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.karuta-card-art .card-image-placeholder {
  width: 68px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 50%;
  background: rgba(0, 0, 0, .24);
  color: #ffe7f0;
  font-size: 1.45rem;
  font-weight: 950;
  text-shadow: 0 0 18px rgba(0, 0, 0, .6);
}

.card-image-fix-btn,
.card-image-view-btn,
.card-image-editions-btn,
.card-image-test-frames-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-width: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 6px;
  background: rgba(8, 8, 10, .72);
  color: #ffe7f0;
  font-size: .82rem;
  font-weight: 900;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .28);
  cursor: pointer;
  transition: opacity .16s ease, background .16s ease, transform .16s ease;
}

.card-image-view-btn {
  top: 8px;
  bottom: auto;
}

.card-image-editions-btn {
  top: 48px;
  bottom: auto;
}

.card-image-test-frames-btn {
  top: 88px;
  bottom: auto;
}

.karuta-card:hover .card-image-fix-btn,
.karuta-card:hover .card-image-view-btn,
.karuta-card:hover .card-image-editions-btn,
.karuta-card:hover .card-image-test-frames-btn,
.karuta-card:focus-within .card-image-fix-btn,
.karuta-card:focus-within .card-image-view-btn,
.karuta-card:focus-within .card-image-editions-btn,
.karuta-card:focus-within .card-image-test-frames-btn,
.card-image-fix-btn:focus-visible,
.card-image-view-btn:focus-visible,
.card-image-editions-btn:focus-visible,
.card-image-test-frames-btn:focus-visible,
.card-image-fix-btn-empty {
  opacity: 1;
  pointer-events: auto;
}

.card-image-fix-btn:hover,
.card-image-fix-btn:focus-visible,
.card-image-view-btn:hover,
.card-image-view-btn:focus-visible,
.card-image-editions-btn:hover,
.card-image-editions-btn:focus-visible,
.card-image-test-frames-btn:hover,
.card-image-test-frames-btn:focus-visible {
  background: rgba(179, 18, 75, .88);
  transform: translateY(-1px);
}

.card-image-editions-btn.loading {
  color: transparent;
  pointer-events: none;
}

.card-image-editions-btn.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 215, 228, .24);
  border-top-color: #ffd7e4;
  border-radius: 50%;
  animation: card-loading-spin .8s linear infinite;
}

.card-image-fix-btn-empty {
  left: 50%;
  right: auto;
  bottom: 50%;
  min-height: 40px;
  padding: 0 13px;
  transform: translate(-50%, 50%);
}

.card-image-fix-btn-empty:hover,
.card-image-fix-btn-empty:focus-visible {
  transform: translate(-50%, calc(50% - 1px));
}

/* Interaction: Touch / coarse pointer */
@media (hover: none), (pointer: coarse) {
  .card-image-view-btn {
    opacity: 1;
    pointer-events: auto;
  }

  .card-image-editions-btn {
    opacity: 1;
    pointer-events: auto;
  }
}

.card-fix-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, .68);
  backdrop-filter: blur(8px);
}

.card-fix-modal-panel {
  width: min(520px, 100%);
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid rgba(179, 18, 75, .34);
  border-radius: 8px;
  background:
    radial-gradient(circle at 24% 0%, rgba(255, 215, 228, .14), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, .06), transparent 34%),
    rgba(8, 8, 10, .96);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .42);
}

.card-fix-modal-panel h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 950;
  line-height: 1.05;
}

.card-fix-modal-panel p {
  margin: 0;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.45;
}

.card-fix-modal-panel input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(179, 18, 75, .38);
  border-radius: 6px;
  background: rgba(0, 0, 0, .22);
  color: var(--text);
  font: inherit;
  box-sizing: border-box;
}

.card-fix-modal-panel input:focus {
  outline: 2px solid rgba(255, 215, 228, .52);
  outline-offset: 2px;
  border-color: rgba(255, 215, 228, .64);
}

.card-fix-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.card-copy-klookup {
  width: fit-content;
  min-height: 36px;
  padding: 8px 11px;
  border-radius: 6px;
}

body.card-gallery-open {
  overflow: hidden;
}

.card-gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 14px;
  padding: 22px;
  background: rgba(0, 0, 0, .9);
  backdrop-filter: blur(9px);
}

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

.card-editions-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(0, 0, 0, .9);
  backdrop-filter: blur(9px);
}

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

.card-notice {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10001;
  transform: translateX(-50%);
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid rgba(255, 215, 228, .22);
  border-radius: 999px;
  background: rgba(8, 8, 10, .92);
  color: #ffe7f0;
  font-size: .88rem;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .42);
}

.card-notice[hidden] {
  display: none;
}

.card-card-notice {
  position: absolute;
  left: 8px;
  right: auto;
  bottom: 8px;
  z-index: 4;
  transform: none;
  max-width: calc(100% - 58px);
  width: fit-content;
  padding: 8px 10px;
  border-color: rgba(255, 215, 228, .3);
  border-radius: 6px;
  background: rgba(8, 8, 10, .94);
  font-size: .78rem;
  line-height: 1.2;
  text-align: left;
  box-shadow: 0 12px 26px rgba(0, 0, 0, .38);
  pointer-events: none;
}

.card-editions-panel {
  width: min(1560px, 100%);
  max-height: calc(100vh - 28px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.card-editions-header {
  min-width: 0;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(179, 18, 75, .28);
  border-radius: 8px;
  background: rgba(8, 8, 10, .78);
  color: var(--text);
}

.card-editions-header div {
  min-width: 0;
}

.card-editions-header h2 {
  margin: 0;
  color: #ffe7f0;
  font-size: 1.08rem;
  line-height: 1.2;
}

.card-editions-header p {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-editions-header > span {
  flex: 0 0 auto;
  color: #ffd7e4;
  font-size: .86rem;
  font-weight: 950;
}

.card-editions-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
  justify-content: center;
  gap: 12px;
  overflow: auto;
}

.card-edition-preview {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto;
  overflow: visible;
  border: 1px solid rgba(179, 18, 75, .32);
  border-radius: 8px;
  background: rgba(14, 14, 18, .82);
}

.card-edition-preview[hidden] {
  display: none;
}

.card-edition-preview-art {
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 10px;
  background:
    linear-gradient(135deg, rgba(179, 18, 75, .2), rgba(36, 36, 42, .12)),
    rgba(8, 8, 10, .55);
  overflow: visible;
}

.card-edition-preview-art img {
  width: 100%;
  height: auto;
  max-height: min(54vh, 520px);
  display: block;
  object-fit: contain;
  object-position: center;
}

.card-edition-preview-art img[hidden] {
  display: none;
}

.card-edition-preview-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
}

.card-edition-preview-status:not(.not-found)::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 215, 228, .24);
  border-top-color: #ffd7e4;
  border-radius: 50%;
  animation: card-loading-spin .8s linear infinite;
}

.card-edition-preview-status.not-found {
  padding: 8px 10px;
  border: 1px solid rgba(255, 215, 228, .16);
  border-radius: 999px;
  background: rgba(8, 8, 10, .45);
}

.card-edition-preview-status[hidden] {
  display: none;
}

.card-edition-preview footer {
  padding: 9px 10px;
  border-top: 1px solid rgba(179, 18, 75, .24);
  color: #ffd7e4;
  font-size: .82rem;
  font-weight: 950;
  text-align: center;
}

.card-gallery-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  height: calc(100vh - 44px);
  margin: 0;
}

.card-gallery-image-wrap {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
}

.card-gallery-image-wrap img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 22px 54px rgba(0, 0, 0, .55));
}

.card-gallery-image-wrap img[hidden] {
  display: none;
}

.card-gallery-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border: 1px solid rgba(255, 215, 228, .18);
  border-radius: 8px;
  background: rgba(8, 8, 10, .72);
  color: #ffe7f0;
  font-size: .92rem;
  font-weight: 900;
}

.card-gallery-status[hidden] {
  display: none;
}

.card-gallery-status::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 215, 228, .24);
  border-top-color: #ffd7e4;
  border-radius: 50%;
  animation: card-loading-spin .8s linear infinite;
}

.card-gallery-caption {
  min-width: 0;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(179, 18, 75, .24);
  border-radius: 8px;
  background: rgba(8, 8, 10, .72);
  color: var(--text);
}

.card-gallery-caption div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.card-gallery-caption strong,
.card-gallery-caption span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-gallery-caption strong {
  color: #ffe7f0;
  font-size: 1rem;
  font-weight: 950;
}

.card-gallery-caption span {
  color: var(--muted);
  font-size: .84rem;
  font-weight: 850;
}

#cardGalleryCount {
  flex: 0 0 auto;
  color: #ffd7e4;
  font-weight: 950;
}

.card-gallery-close,
.card-gallery-nav {
  width: 46px;
  height: 46px;
  min-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255, 215, 228, .2);
  border-radius: 8px;
  background: rgba(8, 8, 10, .68);
  color: #ffe7f0;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.card-gallery-close:hover,
.card-gallery-close:focus-visible,
.card-gallery-nav:hover,
.card-gallery-nav:focus-visible {
  border-color: rgba(255, 215, 228, .48);
  background: rgba(179, 18, 75, .86);
  transform: translateY(-1px);
}

.card-gallery-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
}

.card-fix-status {
  display: none;
  min-height: 1.3em;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 800;
  line-height: 1.4;
}

.karuta-card-main {
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 12px 12px 8px;
}

.karuta-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.karuta-card-heading h3 {
  min-width: 0;
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 950;
  line-height: 1.12;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.karuta-edition-mark {
  flex: 0 0 auto;
  color: #ffe7f0;
  font-size: .78rem;
  font-weight: 950;
  line-height: 1;
}

.karuta-card-main p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.karuta-print-number {
  color: #f5d5df;
  font-size: .76rem;
  font-weight: 900;
  line-height: 1.15;
}

.karuta-unowned-badge {
  width: fit-content;
  min-height: 23px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: #d9d9df;
  font-size: .7rem;
  font-weight: 950;
  line-height: 1;
}

.print-tier-single {
  color: #d9a7ff;
}

.print-tier-low {
  color: #9edcff;
}

.print-tier-mid {
  color: #ffe28a;
}

.karuta-tag {
  max-width: 82px;
  flex: 0 0 auto;
  overflow: hidden;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(179, 18, 75, .24);
  color: #ffd7e4;
  font-size: .68rem;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.karuta-card-meta {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 0 12px 8px;
}

.karuta-card-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 12px 8px;
}

.karuta-card-meta span,
.karuta-card-flags span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .07);
  color: var(--muted);
  font-size: .72rem;
  font-weight: 850;
}

.karuta-card-meta .karuta-quality-badge {
  border: 1px solid rgba(255, 215, 228, .22);
  background: rgba(179, 18, 75, .28);
  color: #ffe7f0;
  font-weight: 950;
}

.karuta-card-flags span {
  max-width: 100%;
  overflow: hidden;
  color: #ffd7e4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.karuta-card-code {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border-top: 1px solid rgba(179, 18, 75, .22);
  background: rgba(5, 5, 7, .82);
}

.karuta-card-code code {
  min-width: 0;
  overflow: hidden;
  color: #f5d5df;
  font-size: .8rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.karuta-card-code .karuta-tag {
  margin-left: auto;
}

.karuta-card.copied .copy-badge {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .card-controls {
    justify-items: stretch;
  }

  .card-search,
  .card-control-row-search {
    max-width: none;
  }

  .card-control-row-search {
    width: 100%;
  }

  .card-control-row-selects {
    width: 100%;
  }

  .card-select-sort {
    flex: 0 0 auto;
    width: max-content;
    min-width: 190px;
    max-width: min(260px, 42vw);
  }
}

@media (max-width: 640px) {
  .cards-title-row,
  .cards-stats-row {
    align-items: stretch;
    flex-direction: column;
  }

  .cards-actions {
    justify-content: flex-start;
  }

  .card-link-entry {
    grid-template-columns: 1fr;
  }

  .card-control-row-selects {
    gap: 7px;
  }

  .card-select-sort {
    flex: 0 0 auto;
    min-width: 168px;
    max-width: 48vw;
  }

  .card-custom-select-button {
    min-height: 36px;
    font-size: .78rem;
    padding-right: 28px;
  }

  .card-select-sort .card-custom-select-button {
    min-height: 42px;
  }

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

  .karuta-card-art .card-image-placeholder {
    width: 56px;
    font-size: 1.2rem;
  }

  .card-gallery-modal {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }

  .card-editions-modal {
    padding: 12px;
  }

  .card-editions-panel {
    max-height: calc(100vh - 24px);
  }

  .card-editions-header {
    align-items: start;
  }

  .card-editions-grid {
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  }

  .card-gallery-panel {
    height: calc(100vh - 24px);
  }

  .card-gallery-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 42px;
    height: 54px;
    transform: translateY(-50%);
  }

  .card-gallery-nav:hover,
  .card-gallery-nav:focus-visible {
    transform: translateY(calc(-50% - 1px));
  }

  .card-gallery-prev {
    left: 10px;
  }

  .card-gallery-next {
    right: 10px;
  }

  .card-gallery-close {
    top: 10px;
    right: 10px;
  }

  .card-gallery-caption {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

  .card-gallery-caption strong,
  .card-gallery-caption span {
    white-space: normal;
  }
}

.dye-color-map {
  margin: 8px 0 18px;
  padding: 14px;
  border: 1px solid rgba(179, 18, 75, .32);
  border-radius: 16px;
  background: rgba(10, 10, 10, .46);
}

.dye-color-map[hidden] {
  display: none;
}

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

.color-map-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.color-map-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 700;
}

.color-map-field {
  position: relative;
  z-index: 0;
  isolation: isolate;
  min-height: min(68vh, 720px);
  border: 1px solid rgba(179, 18, 75, .34);
  border-radius: 14px;
  overflow: hidden;
  background:
    linear-gradient(to right, rgba(255,0,0,.15), rgba(255,255,0,.13), rgba(0,255,0,.12), rgba(0,255,255,.13), rgba(0,0,255,.14), rgba(255,0,255,.13), rgba(255,0,0,.15)),
    linear-gradient(to bottom, rgba(255,255,255,.18), rgba(255,255,255,0) 42%, rgba(0,0,0,.55)),
    #10090c;
  touch-action: none;
}

.color-map-field.lassoing {
  cursor: crosshair;
  user-select: none;
}

.color-map-axis {
  position: absolute;
  z-index: 2;
  color: rgba(255,255,255,.52);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
  pointer-events: none;
}

.color-map-axis.top {
  top: 12px;
  left: 18px;
}

.color-map-axis.bottom {
  bottom: 12px;
  left: 18px;
}

.color-map-axis.right {
  right: 18px;
  bottom: 12px;
  text-align: right;
}

.color-map-points,
.color-map-lasso {
  position: absolute;
  inset: 38px 28px 42px;
}

.color-map-points {
  z-index: 1;
}

.color-map-lasso {
  z-index: 3;
  pointer-events: none;
  overflow: visible;
}

#colorMapLassoPath {
  fill: rgba(179, 18, 75, .2);
  stroke: rgba(255,255,255,.96);
  stroke-width: 3;
  stroke-dasharray: 10 7;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter:
    drop-shadow(0 0 5px rgba(179, 18, 75, .95))
    drop-shadow(0 4px 10px rgba(0,0,0,.55));
}

.color-map-field.lassoing #colorMapLassoPath {
  animation: lassoMarch .7s linear infinite;
}

@keyframes lassoMarch {
  to { stroke-dashoffset: -17; }
}

.color-map-chip {
  position: absolute;
  width: var(--chip-size, 28px);
  height: var(--chip-size, 28px);
  border: 1px solid rgba(255,255,255,.34);
  border-radius: var(--blob-radius, 48% 52% 46% 54% / 52% 44% 56% 48%);
  background: var(--dye-color);
  box-shadow:
    inset 1px 1px 0 rgba(255,255,255,.28),
    inset -1px -1px 0 rgba(0,0,0,.22);
  transform: translate(-50%, -50%);
  cursor: pointer;
  opacity: .96;
  will-change: auto;
}

.color-map-field.lassoing .color-map-chip {
  pointer-events: none;
}

.color-map-chip:hover,
.color-map-chip:focus-visible,
.color-map-chip.selected {
  z-index: 4;
  outline: 2px solid #fff;
}

.color-map-chip.selected {
  box-shadow:
    inset 0 1px 3px rgba(255,255,255,.2),
    0 0 0 4px rgba(179, 18, 75, .5);
}

.color-map-chip.copied {
  outline: 2px solid #fff;
}

@media (max-width: 560px) {
  .color-map-field {
    min-height: 560px;
  }

  .color-map-points,
  .color-map-lasso {
    inset: 34px 18px 38px;
  }
}

.color-map-tools {
  display: inline-flex;
  gap: 6px;
}

.path-tool.active,
.path-tool:not([hidden]):hover {
  background: var(--accent);
}

#colorMapSortPath {
  display: none;
  fill: none;
  stroke: rgba(255, 255, 255, .72);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 7 7;
  pointer-events: none;
}

.color-map-field.editing-path #colorMapSortPath {
  display: block;
  stroke: rgba(255, 255, 255, .95);
  stroke-width: 4;
  stroke-dasharray: none;
}

.sort-path-point {
  position: absolute;
  z-index: 5;
  width: 24px;
  height: 24px;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: .72rem;
  font-weight: 900;
  transform: translate(-50%, -50%);
}

.sort-path-point:hover {
  transform: translate(-50%, -50%) scale(1.08);
}

.splatoon-page {
  display: grid;
  gap: 22px;
  border-color: rgba(232, 255, 25, .28);
  background:
    linear-gradient(135deg, rgba(232, 255, 25, .08), transparent 28%),
    linear-gradient(315deg, rgba(81, 48, 255, .16), transparent 36%),
    rgba(3, 4, 10, .88);
}
