/* HYDRA Tools — Library (Thư viện) mobile-first */

#hydraToolsShell .lib-tool {
  width: 100%;
  max-width: 1320px;
  min-width: 0;
}

#hydraToolsShell .lib-main {
  padding: 12px 14px 20px;
  min-width: 0;
  overflow-x: hidden;
}

#hydraToolsShell .lib-muted {
  color: #64748b;
  font-size: 12px;
}

#hydraToolsShell .lib-empty {
  padding: 24px 12px;
  text-align: center;
}

#hydraToolsShell .lib-game-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

#hydraToolsShell .lib-game-pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

#hydraToolsShell .lib-game-pick__title {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

#hydraToolsShell .lib-game-pick__meta {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}

#hydraToolsShell .lib-explorer__top {
  margin-bottom: 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  min-width: 0;
}

#hydraToolsShell .lib-explorer__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  padding: 8px 10px;
  min-width: 0;
  min-height: 44px;
}

#hydraToolsShell .lib-explorer__head--merged {
  gap: 6px;
  min-height: 48px;
  max-height: 52px;
}

#hydraToolsShell .lib-explorer__head--merged .lib-explorer__title {
  flex: 1 1 auto;
  min-width: 0;
}

#hydraToolsShell .lib-explorer__sync {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #64748b;
}

#hydraToolsShell .lib-explorer__sync--complete {
  color: #15803d;
}

#hydraToolsShell .lib-explorer__sync--running {
  color: #c2410c;
}

#hydraToolsShell .lib-explorer__sync--warn {
  color: #b45309;
}

#hydraToolsShell .lib-explorer__sync--pending {
  color: #475569;
}

#hydraToolsShell .lib-explorer__head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

#hydraToolsShell .lib-explorer__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  color: #475569;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#hydraToolsShell .lib-explorer__icon-btn--primary {
  border-color: transparent;
  background: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
  color: #fff;
}

#hydraToolsShell .lib-explorer__icon-btn--warn {
  border-color: rgba(180, 83, 9, 0.25);
  background: #fffbeb;
  color: #b45309;
}

#hydraToolsShell .lib-explorer__icon-btn:hover {
  background: #f8fafc;
}

#hydraToolsShell .lib-explorer__icon-btn--primary:hover {
  background: linear-gradient(135deg, #f97316 0%, #c2410c 100%);
}

#hydraToolsShell .lib-explorer__progress {
  height: 2px;
  background: rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

#hydraToolsShell .lib-explorer__progress > span {
  display: block;
  height: 100%;
  background: #ea580c;
  transition: width 0.25s ease;
}

#hydraToolsShell .lib-explorer__top.is-syncing {
  border-color: rgba(234, 88, 12, 0.2);
}

#hydraToolsShell .lib-explorer__back {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#hydraToolsShell .lib-explorer__back:hover {
  background: #fff7ed;
  border-color: rgba(249, 115, 22, 0.35);
  color: #c2410c;
}

#hydraToolsShell .lib-explorer__back:focus-visible {
  outline: 2px solid rgba(249, 115, 22, 0.55);
  outline-offset: 2px;
}

#hydraToolsShell .lib-explorer__back-mobile {
  display: none;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

#hydraToolsShell .lib-explorer__back-desktop {
  display: inline;
  white-space: nowrap;
}

#hydraToolsShell .lib-explorer__title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 430px) {
  #hydraToolsShell .lib-explorer__top {
    margin-bottom: 8px;
  }

  #hydraToolsShell .lib-explorer__head,
  #hydraToolsShell .lib-explorer__head--merged {
    padding: 6px 8px;
    min-height: 44px;
    max-height: 48px;
    gap: 5px;
  }

  #hydraToolsShell .lib-explorer__sync {
    font-size: 10px;
  }

  #hydraToolsShell .lib-explorer__meta {
    font-size: 10px;
  }

  #hydraToolsShell .lib-explorer__icon-btn {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  #hydraToolsShell .lib-explorer__head {
    gap: 6px;
  }

  #hydraToolsShell .lib-explorer__back {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
  }

  #hydraToolsShell .lib-explorer__back-mobile {
    display: inline;
  }

  #hydraToolsShell .lib-explorer__back-desktop {
    display: none;
  }

  #hydraToolsShell .lib-explorer__title {
    font-size: 14px;
  }

  #hydraToolsShell .lib-explorer__meta {
    font-size: 11px;
  }
}

#hydraToolsShell .lib-set-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

#hydraToolsShell .lib-set-row {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: #fff;
  min-width: 0;
}

#hydraToolsShell .lib-set-row__head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  min-width: 0;
}

#hydraToolsShell .lib-set-row__stt {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  color: #94a3b8;
  width: 22px;
}

#hydraToolsShell .lib-set-row__text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

#hydraToolsShell .lib-set-row__code {
  font-size: 12px;
  font-weight: 800;
  color: #c2410c;
}

#hydraToolsShell .lib-set-row__name {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#hydraToolsShell .lib-set-row__stats {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 10px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#hydraToolsShell .lib-set-row__stats--empty {
  color: #94a3b8;
}

#hydraToolsShell .lib-set-row__actions {
  flex: 0 0 auto;
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

#hydraToolsShell .lib-set-row-panel {
  padding: 0 10px 10px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

#hydraToolsShell .lib-set-row-panel__inner {
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#hydraToolsShell .lib-detail__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
  min-width: 0;
}

#hydraToolsShell .lib-detail__sticky {
  position: sticky;
  top: 0;
  z-index: 6;
  background: #f8fafc;
  padding-bottom: 4px;
  margin: 0 -14px 6px;
  padding-left: 14px;
  padding-right: 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

#hydraToolsShell .lib-detail__sticky--filters {
  margin-bottom: 4px;
}

#hydraToolsShell .lib-detail__head-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  padding-top: 2px;
}

#hydraToolsShell .lib-detail__controls {
  display: flex;
  flex: 0 0 auto;
  flex-shrink: 0;
  flex-wrap: nowrap;
  align-items: center;
  align-self: flex-start;
  gap: 3px;
  margin-top: 0;
  min-width: 0;
}

#hydraToolsShell .lib-detail__back-label {
  display: inline;
}

#hydraToolsShell .lib-detail__refresh-btn--icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  border-radius: 8px;
}

#hydraToolsShell .lib-filter-pill__sort-short {
  display: none;
}

#hydraToolsShell .lib-detail__back {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  padding: 2px 4px 2px 0;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
}

#hydraToolsShell .lib-detail__refresh-btn {
  flex: 0 0 auto;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  background: #fff;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  white-space: nowrap;
  align-self: center;
}

#hydraToolsShell .lib-detail__refresh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#hydraToolsShell .lib-detail__meta {
  margin: 0;
  font-size: 11px;
  color: #64748b;
  line-height: 1.3;
}

#hydraToolsShell .lib-detail__titles {
  flex: 1 1 auto;
  min-width: 0;
}

#hydraToolsShell .lib-detail__title {
  margin: 0;
  font-size: 14px;
  font-weight: 900;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}

#hydraToolsShell .lib-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

@media (min-width: 430px) {
  #hydraToolsShell .lib-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

#hydraToolsShell .lib-gcard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  background: #fff;
}

#hydraToolsShell .lib-gcard__img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  border-radius: 6px;
  background: #f8fafc;
}

#hydraToolsShell .lib-gcard__img--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #94a3b8;
}

#hydraToolsShell .lib-gcard__meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

#hydraToolsShell .lib-gcard__num {
  font-size: 11px;
  font-weight: 800;
  color: #0f172a;
}

#hydraToolsShell .lib-gcard__rarity {
  font-size: 10px;
  font-weight: 700;
  color: #c2410c;
}

#hydraToolsShell .lib-gcard__price {
  font-size: 12px;
  font-weight: 800;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

#hydraToolsShell .lib-gcard__link {
  font-size: 10px;
  color: #ea580c;
  text-decoration: none;
}

#hydraToolsShell .tools-dash-tile--library .tools-dash-tile__icon {
  color: #ea580c;
}

#hydraToolsShell .lib-empty__err {
  margin: 8px 0 12px;
  font-size: 12px;
  line-height: 1.4;
  color: #b45309;
  word-break: break-word;
}

/* Library launcher — owner status button */
#hydraToolsShell .tools-dash-tile--library.tools-dash-tile--has-status {
  grid-template-columns: 44px 1fr auto;
}

#hydraToolsShell .tools-dash-tile__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

#hydraToolsShell .tools-dash-tile__status-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(234, 88, 12, 0.28);
  border-radius: 999px;
  background: #fff7ed;
  color: #ea580c;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

#hydraToolsShell .tools-dash-tile__status-btn:hover {
  background: #ffedd5;
  border-color: rgba(234, 88, 12, 0.45);
}

#hydraToolsShell .tools-dash-tile__status-btn:focus-visible {
  outline: 2px solid rgba(249, 115, 22, 0.55);
  outline-offset: 2px;
}

#hydraToolsShell .tools-dash-tile--has-status .tools-dash-tile__arrow {
  font-size: 18px;
}

#hydraToolsShell .tools-dash-tile--library .tools-dash-tile__body {
  min-width: 0;
}

#hydraToolsShell .tools-dash-tile__sync {
  margin-top: 6px;
  min-width: 0;
}

#hydraToolsShell .tools-dash-tile__sync-bar {
  height: 3px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-bottom: 6px;
}

#hydraToolsShell .tools-dash-tile__sync-bar > span {
  display: block;
  height: 100%;
  background: #ea580c;
  border-radius: inherit;
  transition: width 0.25s ease;
}

#hydraToolsShell .tools-dash-tile__sync-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(234, 88, 12, 0.35);
  background: #fff7ed;
  color: #c2410c;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  max-width: 100%;
  -webkit-tap-highlight-color: transparent;
}

#hydraToolsShell .tools-dash-tile__sync-btn:disabled {
  opacity: 0.72;
  cursor: default;
}

#hydraToolsShell .tools-dash-tile__sync-btn:not(:disabled):hover {
  background: #ffedd5;
}

#hydraToolsShell .tools-dash-tile__sync-btn--ghost {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.12);
  color: #475569;
}

#hydraToolsShell .tools-dash-tile__sync-btn--ghost:not(:disabled):hover {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.2);
  color: #334155;
}

#hydraToolsShell .tools-dash-tile--syncing .tools-dash-tile__meta {
  color: #c2410c;
  font-weight: 600;
}

/* Library status bottom sheet */
body.lib-status-sheet-open {
  overflow: hidden;
}

.lib-status-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9020;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(15, 23, 42, 0.42);
  animation: lib-status-fade-in 180ms ease;
}

.lib-status-sheet {
  width: 100%;
  max-width: 480px;
  max-height: min(85vh, 640px);
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-radius: 20px 20px 0 0;
  background: #fff;
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.18);
  animation: lib-status-sheet-up 220ms ease;
  box-sizing: border-box;
}

@keyframes lib-status-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes lib-status-sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.lib-status-sheet__handle {
  width: 40px;
  height: 4px;
  margin: 0 auto 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.45);
}

.lib-status-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.lib-status-sheet__title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
}

.lib-status-sheet__close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.lib-status-sheet__body {
  min-width: 0;
}

.lib-status-sheet__loading {
  padding: 20px 0;
  text-align: center;
}

.lib-status-sheet__rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lib-status-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #f8fafc;
}

.lib-status-row__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.lib-status-row__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lib-status-row__text strong {
  font-size: 13px;
  color: #0f172a;
}

.lib-status-row__text span {
  font-size: 12px;
  line-height: 1.4;
  color: #475569;
  word-break: break-word;
}

.lib-status-row--ok {
  border-color: rgba(34, 197, 94, 0.28);
  background: #f0fdf4;
}

.lib-status-row--ok .lib-status-row__icon {
  background: #dcfce7;
  color: #15803d;
}

.lib-status-row--warn {
  border-color: rgba(245, 158, 11, 0.32);
  background: #fffbeb;
}

.lib-status-row--warn .lib-status-row__icon {
  background: #fef3c7;
  color: #b45309;
}

.lib-status-row--err {
  border-color: rgba(239, 68, 68, 0.3);
  background: #fef2f2;
}

.lib-status-row--err .lib-status-row__icon {
  background: #fee2e2;
  color: #b91c1c;
}

.lib-status-sheet__build {
  margin: 14px 0 0;
  font-size: 12px;
  text-align: center;
}

.lib-status-sheet__build strong {
  font-variant-numeric: tabular-nums;
  color: #0f172a;
}

.lib-status-sheet__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.lib-status-sheet__action {
  width: 100%;
  justify-content: center;
}

/* Library catalog error — user-friendly + owner details */
#hydraToolsShell .lib-empty--error {
  text-align: center;
  padding: 20px 16px;
}

#hydraToolsShell .lib-empty__title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

#hydraToolsShell .lib-empty--error .lib-muted {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.45;
}

#hydraToolsShell .lib-empty__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  margin-top: 4px;
}

#hydraToolsShell .lib-empty__detail-btn {
  width: 100%;
  justify-content: center;
}

#hydraToolsShell .lib-error-details {
  margin: 0 0 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #f8fafc;
  text-align: left;
  font-size: 12px;
  line-height: 1.45;
}

#hydraToolsShell .lib-error-details__line {
  margin: 0 0 10px;
  word-break: break-word;
}

#hydraToolsShell .lib-error-details__line code {
  font-size: 11px;
  color: #0f172a;
}

#hydraToolsShell .lib-error-details__label {
  margin: 0 0 6px;
  font-weight: 700;
  color: #334155;
}

#hydraToolsShell .lib-error-details__list {
  margin: 0 0 10px;
  padding-left: 18px;
  color: #475569;
}

#hydraToolsShell .lib-error-details__list li + li {
  margin-top: 4px;
}

#hydraToolsShell .lib-error-details__build {
  margin-bottom: 0;
}

#hydraToolsShell .lib-explorer__meta {
  flex: 0 0 auto;
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}

#hydraToolsShell .lib-bulk-sync {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: #fffbeb;
  min-width: 0;
}

#hydraToolsShell .lib-bulk-sync--compact {
  margin: 0;
  padding: 6px 10px 8px;
  border: none;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 0;
  background: #fffbeb;
}

#hydraToolsShell .lib-bulk-sync__row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 32px;
}

#hydraToolsShell .lib-bulk-sync__status {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#hydraToolsShell .lib-bulk-sync__status--complete {
  color: #15803d;
}

#hydraToolsShell .lib-bulk-sync__status--running {
  color: #c2410c;
}

#hydraToolsShell .lib-bulk-sync__status--warn {
  color: #b45309;
}

#hydraToolsShell .lib-bulk-sync__status--pending {
  color: #64748b;
}

#hydraToolsShell .lib-bulk-sync__btn {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

#hydraToolsShell .lib-bulk-sync__btn--primary {
  border-color: transparent;
  background: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
  color: #fff;
}

#hydraToolsShell .lib-bulk-sync__btn--ghost {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.12);
  color: #475569;
}

#hydraToolsShell .lib-bulk-sync__btn:disabled {
  opacity: 0.65;
  cursor: default;
}

#hydraToolsShell .lib-bulk-sync__summary {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

#hydraToolsShell .lib-bulk-sync__summary--complete {
  color: #15803d;
}

#hydraToolsShell .lib-bulk-sync__complete {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #15803d;
}

#hydraToolsShell .lib-bulk-sync__hint {
  margin: 0 0 8px;
  font-size: 12px;
  color: #64748b;
}

#hydraToolsShell .lib-bulk-sync__warn {
  margin: 0 0 8px;
  font-size: 12px;
  color: #b45309;
}

#hydraToolsShell .lib-bulk-sync__actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 0;
}

#hydraToolsShell .lib-bulk-sync--compact .lib-bulk-sync__bar {
  height: 4px;
  margin: 5px 0 0;
}

#hydraToolsShell .lib-bulk-sync__progress-text {
  margin: 0 0 6px;
  font-size: 12px;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#hydraToolsShell .lib-bulk-sync__bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
  margin-bottom: 8px;
}

#hydraToolsShell .lib-bulk-sync__bar > span {
  display: block;
  height: 100%;
  background: #ea580c;
  border-radius: 999px;
  transition: width 0.25s ease;
}

#hydraToolsShell .lib-set-row__stats--syncing {
  color: #ea580c;
  font-weight: 700;
}

#hydraToolsShell .lib-set-row__stats--error {
  color: #dc2626;
  font-weight: 700;
}

#hydraToolsShell .lib-detail-filters {
  margin-bottom: 0;
  min-width: 0;
  padding-top: 2px;
}

#hydraToolsShell .lib-filter-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 6px;
  padding-bottom: 0;
}

#hydraToolsShell .lib-filter-bar--compact {
  margin-bottom: 4px;
}

#hydraToolsShell .lib-filter-bar--two {
  justify-content: space-between;
  overflow: visible;
  gap: 8px;
}

#hydraToolsShell .lib-filter-sort {
  position: relative;
  flex: 0 0 auto;
}

#hydraToolsShell .lib-filter-bar--two .lib-filter-more {
  margin-left: auto;
}

#hydraToolsShell .lib-filter-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  background: #fff;
  padding: 0 8px;
  height: 30px;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
  cursor: pointer;
  line-height: 28px;
}

#hydraToolsShell .lib-filter-pill.is-active {
  border-color: #ea580c;
  color: #c2410c;
  background: #fff7ed;
}

#hydraToolsShell .lib-filter-pill--icon {
  min-width: 36px;
  letter-spacing: 1px;
}

#hydraToolsShell .lib-filter-more {
  position: relative;
  flex: 0 0 auto;
}

#hydraToolsShell .lib-filter-more__menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: auto;
  z-index: 12;
  min-width: 132px;
  padding: 4px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

#hydraToolsShell .lib-filter-more .lib-filter-more__menu {
  left: auto;
  right: 0;
}

@media (max-width: 430px) {
  #hydraToolsShell .lib-detail__back-label {
    display: none;
  }

  #hydraToolsShell .lib-detail__head-row {
    gap: 4px;
  }

  #hydraToolsShell .lib-detail__controls {
    gap: 2px;
  }

  #hydraToolsShell .lib-detail__refresh-btn--icon {
    width: 30px;
    height: 30px;
    min-width: 30px;
    font-size: 15px;
  }

  #hydraToolsShell .lib-filter-pill__sort-full {
    display: none;
  }

  #hydraToolsShell .lib-filter-pill__sort-short {
    display: inline;
  }

  #hydraToolsShell .lib-detail__title {
    font-size: 13px;
  }

  #hydraToolsShell .lib-filter-pill {
    height: 30px;
    line-height: 28px;
    padding: 0 6px;
  }

  #hydraToolsShell .lib-filter-pill--icon {
    min-width: 30px;
    width: 30px;
    padding: 0;
  }
}

#hydraToolsShell .lib-filter-more__item {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  border-radius: 6px;
  cursor: pointer;
}

#hydraToolsShell .lib-filter-more__item.is-active {
  color: #c2410c;
  font-weight: 800;
  background: #fff7ed;
}

#hydraToolsShell .lib-filter-more__item.is-checked {
  color: #0f172a;
  font-weight: 700;
}

#hydraToolsShell .lib-filter-more__sep {
  height: 1px;
  margin: 4px 6px;
  background: #eef2f6;
}

#hydraToolsShell .lib-filter-btn {
  flex: 0 0 auto;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  background: #fff;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
  cursor: pointer;
}

#hydraToolsShell .lib-filter-btn.is-active {
  border-color: #ea580c;
  color: #c2410c;
  background: #fff7ed;
}

#hydraToolsShell .lib-filter-btn--ghost {
  color: #64748b;
}

#hydraToolsShell .lib-filter-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}

#hydraToolsShell .lib-filter-chips--compact {
  gap: 4px;
  margin-bottom: 2px;
}

#hydraToolsShell .lib-filter-chip {
  flex: 0 0 auto;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 999px;
  background: #fff;
  padding: 0 9px;
  height: 30px;
  font-size: 11px;
  font-weight: 800;
  color: #475569;
  cursor: pointer;
  line-height: 28px;
}

#hydraToolsShell .lib-filter-chip.is-active {
  border-color: #ea580c;
  background: #ea580c;
  color: #fff;
}

#hydraToolsShell .lib-gcard__img-wrap {
  position: relative;
  width: 100%;
}

#hydraToolsShell .lib-gcard__img-wrap--zoom {
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#hydraToolsShell .lib-gcard__cond {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 1;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
}

#hydraToolsShell .lib-gcard__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
}

#hydraToolsShell .lib-gcard__prices {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1px 2px;
  width: 100%;
}

#hydraToolsShell .lib-gcard__price {
  flex: 1 1 auto;
  font-weight: 800;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

#hydraToolsShell .lib-gcard__price-alt {
  flex: 0 0 auto;
  flex-shrink: 0;
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  color: #16a34a;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  text-align: right;
}

#hydraToolsShell .lib-gcard__rarity--sar,
#hydraToolsShell .lib-gcard__rarity--mur {
  color: #16a34a;
}

#hydraToolsShell .lib-gcard__rarity--sr,
#hydraToolsShell .lib-gcard__rarity--ar {
  color: #7c3aed;
}

#hydraToolsShell .lib-gallery--compact {
  gap: 6px;
  margin-top: 0;
}

#hydraToolsShell .lib-gallery--compact .lib-gcard {
  padding: 5px 4px;
  gap: 3px;
}

#hydraToolsShell .lib-gallery--compact .lib-gcard__hit {
  gap: 3px;
}

#hydraToolsShell .lib-gallery--compact .lib-gcard__meta {
  gap: 0;
}

#hydraToolsShell .lib-gallery--compact .lib-gcard__prices {
  gap: 0 2px;
  line-height: 1.15;
}

#hydraToolsShell .lib-gallery--compact .lib-gcard__price {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#hydraToolsShell .lib-gallery--compact .lib-gcard__price-alt {
  font-size: 9px;
  letter-spacing: -0.02em;
}

@media (max-width: 430px) {
  #hydraToolsShell .lib-gallery--compact .lib-gcard__price {
    font-size: 9px;
  }

  #hydraToolsShell .lib-gallery--compact .lib-gcard__price-alt {
    font-size: 8.5px;
  }
}

#hydraToolsShell .lib-empty--compact {
  padding: 12px 0 20px;
}

@media (min-width: 430px) {
  #hydraToolsShell .lib-gallery--compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

#hydraToolsShell .lib-gcard__hit {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#hydraToolsShell .lib-gcard__hit:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  border-radius: 8px;
}

/* Card detail sheet — Hypercat parity (portaled to body) */
.lib-card-detail {
  position: fixed;
  inset: 0;
  z-index: 12040;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
}

.lib-card-detail.hidden {
  display: none !important;
}

html.lib-card-detail-open {
  overflow: hidden;
}

.lib-card-detail__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  margin: 0;
  padding: 0;
  background: rgba(15, 23, 42, 0.55);
  cursor: pointer;
}

.lib-card-detail__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  max-height: min(92dvh, 900px);
  background: #fff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lib-card-detail__x {
  position: absolute;
  top: max(8px, env(safe-area-inset-top, 0px));
  right: max(8px, env(safe-area-inset-right, 0px));
  z-index: 3;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lib-card-detail__scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}

.lib-card-detail__art {
  position: relative;
  width: 100%;
  aspect-ratio: 63 / 88;
  max-height: min(52dvh, 420px);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lib-card-detail__art--empty {
  color: #94a3b8;
  font-size: 12px;
}

.lib-card-detail__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.lib-card-detail__badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.95);
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  pointer-events: none;
}

.lib-card-detail__body {
  padding: 12px 14px 16px;
}

.lib-card-detail__name {
  margin: 0 0 8px;
  font-size: 11px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lib-card-detail__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  align-items: start;
  margin-bottom: 10px;
}

.lib-card-detail__col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.lib-card-detail__col--right {
  align-items: flex-end;
  text-align: right;
}

.lib-card-detail__num {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.lib-card-detail__sell {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.lib-card-detail__rarity {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #fef9c3;
  color: #a16207;
}

.lib-card-detail__rarity--sar,
.lib-card-detail__rarity--mur {
  background: #dcfce7;
  color: #15803d;
}

.lib-card-detail__rarity--sr,
.lib-card-detail__rarity--ar {
  background: #f3e8ff;
  color: #7e22ce;
}

.lib-card-detail__buy {
  font-size: 14px;
  font-weight: 700;
  color: #16a34a;
  font-variant-numeric: tabular-nums;
}

.lib-card-detail__buy--empty {
  color: #94a3b8;
}

.lib-card-detail__section--conds {
  border-top: 1px solid #eef2f6;
  padding-top: 8px;
  margin-bottom: 8px;
}

.lib-card-detail__cond-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  font-size: 13px;
  line-height: 1.3;
}

.lib-card-detail__cond-row + .lib-card-detail__cond-row {
  border-top: 1px solid #eef2f6;
}

.lib-card-detail__cond-rank {
  font-weight: 800;
  color: #0f172a;
}

.lib-card-detail__cond-price {
  font-weight: 600;
  color: #475569;
  font-variant-numeric: tabular-nums;
}

.lib-card-detail__cond-link {
  font-size: 12px;
  font-weight: 700;
  color: #2563eb;
  text-decoration: none;
}

.lib-card-detail__section--history {
  border-top: 1px solid #eef2f6;
  padding-top: 10px;
  margin-bottom: 10px;
}

.lib-card-detail__section-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
}

.lib-card-detail__history-loading,
.lib-card-detail__history-empty {
  margin: 0;
  padding: 8px 0 4px;
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
}

.lib-card-detail__history-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.lib-card-detail__kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: #f8fafc;
}

.lib-card-detail__kpi-label {
  font-size: 9px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.lib-card-detail__kpi-val {
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.lib-card-detail__chart-wrap {
  width: 100%;
  overflow: hidden;
}

.lib-card-detail__chart {
  display: block;
  width: 100%;
  height: auto;
}

.lib-card-detail__cardrush {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px 0 4px;
  border-top: 1px solid #eef2f6;
  font-size: 14px;
  font-weight: 700;
  color: #ea580c;
  text-align: center;
  text-decoration: none;
}

@media (min-width: 600px) {
  .lib-card-detail {
    align-items: center;
    padding: 16px;
  }

  .lib-card-detail__panel {
    border-radius: 16px;
    max-height: min(88dvh, 820px);
  }
}
