/* Riftbound Deckbuilder v0.6 — page-specific layout and interaction layer. */

.deckbuilder-page {
  min-height: 100dvh;
  overflow-x: hidden;
}

.compact-header {
  min-height: 62px;
  padding-block: 9px;
}

.compact-header .brand {
  color: inherit;
  text-decoration: none;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.1;
}

.brand-copy small {
  color: var(--text-soft);
  font-size: 10px;
  letter-spacing: .12em;
}

.icon-only {
  width: 40px;
  min-width: 40px;
  justify-content: center;
  padding: 0;
}

.builder-shell {
  width: min(1560px, calc(100% - 24px));
  margin: 12px auto 18px;
}

.builder-status {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--text-soft);
  font-size: 11px;
}

.builder-status > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.builder-status strong {
  color: var(--text);
  font-size: 12px;
}

.builder-status span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.builder-workspace {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 390px);
  gap: 12px;
  height: calc(100dvh - 134px);
  min-height: 640px;
  align-items: stretch;
}

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

.builder-panel-head {
  flex: 0 0 auto;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.panel-title-line,
.search-row,
.deck-topbar,
.deck-commandbar,
.deck-danger-actions {
  display: flex;
  align-items: center;
}

.panel-title-line {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.panel-title-line h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 600;
}

.result-count {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}

.search-row {
  gap: 8px;
}

.grow-field {
  flex: 1 1 auto;
  min-width: 0;
}

.search-row input,
.deck-name-field input {
  min-height: 38px;
}

.filter-drawer {
  position: relative;
  flex: 0 0 auto;
}

.filter-drawer > summary {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.filter-drawer > summary::-webkit-details-marker { display: none; }
.filter-drawer[open] > summary { border-color: var(--accent); }

.filter-grid {
  position: absolute;
  z-index: 30;
  top: calc(100% + 7px);
  right: 0;
  width: min(620px, calc(100vw - 36px));
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.filter-grid label {
  display: grid;
  gap: 4px;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 800;
}

.filter-grid select { min-height: 36px; }
.filter-reset { align-self: end; min-height: 36px; }

.compact-summary {
  display: flex;
  gap: 8px 14px;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 10px;
  color: var(--text-soft);
  overflow: hidden;
}

.compact-summary strong,
.compact-summary span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.catalog-scroll,
.deck-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.catalog-scroll { flex: 1 1 auto; }
.deck-scroll { flex: 1 1 auto; padding: 10px; }

.catalog-scroll::-webkit-scrollbar,
.deck-scroll::-webkit-scrollbar { width: 9px; }
.catalog-scroll::-webkit-scrollbar-thumb,
.deck-scroll::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}

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

.official-card {
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(29, 22, 14, .13);
}

.official-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 19px rgba(29, 22, 14, .17);
}

.compact-card-body { padding: 9px; }
.compact-card-body .card-title { font-size: 14px; }
.card-code { font-size: 9px; }
.card-subline { font-size: 9px; margin-top: 3px; }
.card-actions-row { gap: 5px; }
.card-add { min-height: 31px; font-size: 11px; }

.catalog-footer {
  padding: 4px 14px 16px;
  text-align: center;
}

.deck-panel {
  position: static;
  top: auto;
  max-height: none;
}

.deck-topbar {
  gap: 10px;
  justify-content: space-between;
}

.deck-name-field {
  flex: 1 1 auto;
  min-width: 0;
}

.deck-name-field input {
  font-weight: 800;
  background: var(--surface-2);
}

.deck-count {
  flex: 0 0 auto;
  min-width: 52px;
  height: 34px;
  font-size: 12px;
}

.compact-legality,
.deck-zone {
  margin: 0 0 8px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: clip;
}

.compact-legality > summary,
.deck-zone > summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  background: var(--surface-2);
}

.compact-legality > summary::-webkit-details-marker,
.deck-zone > summary::-webkit-details-marker { display: none; }

.compact-legality > summary::before,
.deck-zone > summary::before {
  content: "›";
  flex: 0 0 auto;
  color: var(--text-soft);
  font-size: 16px;
  transform: rotate(0deg);
  transition: transform .12s ease;
}

.compact-legality[open] > summary::before,
.deck-zone[open] > summary::before { transform: rotate(90deg); }

.compact-legality > summary > :first-child,
.deck-zone > summary > :first-child { margin-right: auto; }

.legality-list {
  margin: 0;
  padding: 9px 12px 10px 28px;
  font-size: 11px;
  line-height: 1.4;
  max-height: 180px;
  overflow-y: auto;
}

.deck-zone-list,
.deck-list { padding: 6px; }
.deck-list { max-height: none; min-height: 0; overflow: visible; }

.zone-empty {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface-2) 65%, transparent);
  font-size: 11px;
}

.deck-row {
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 7px;
  padding: 6px;
  border: 0;
  border-radius: 7px;
}

.deck-row + .deck-row { margin-top: 3px; }
.deck-row:hover { background: var(--surface-2); }
.deck-thumb { width: 34px; height: 47px; border-radius: 4px; }
.deck-row-title { font-size: 11px; }
.deck-row-meta { font-size: 9px; }
.quantity-controls { gap: 4px; }
.quantity-controls button { width: 25px; height: 25px; border-radius: 6px; }
.quantity-controls strong { font-size: 11px; }
.inline-badge { font-size: 8px; }

.deck-commandbar {
  flex: 0 0 auto;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}

.deck-file-actions,
.deck-danger-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.deck-commandbar .primary-button,
.deck-commandbar .secondary-button,
.text-danger-button {
  min-height: 34px;
  padding-inline: 10px;
  font-size: 11px;
}

.text-danger-button {
  border: 0;
  background: transparent;
  color: #a14c45;
  font-weight: 800;
}

.text-danger-button:disabled { opacity: .35; cursor: not-allowed; }
.deck-summary { display: flex; align-items: baseline; gap: 4px; }
.deck-summary strong { font-size: 15px; }
.deck-summary span { font-size: 9px; }

.compact-footer {
  margin-bottom: 10px;
  opacity: .72;
}

.account-dialog {
  max-height: min(760px, calc(100dvh - 32px));
  overflow: auto;
}

@media (max-width: 980px) {
  .builder-workspace {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .catalog-scroll,
  .deck-scroll {
    overflow: visible;
  }

  .catalog-panel,
  .deck-panel {
    min-height: 0;
  }

  .filter-grid {
    grid-template-columns: repeat(2, minmax(135px, 1fr));
  }
}

@media (max-width: 640px) {
  .builder-shell { width: min(100% - 12px, 1560px); margin-top: 6px; }
  .compact-header { min-height: 56px; padding-inline: 10px; }
  .brand-mark { width: 34px; height: 34px; font-size: 18px; }
  .brand-copy strong { font-size: 14px; }
  .brand-copy small { display: none; }
  .header-actions { gap: 5px; }
  .nav-button { padding-inline: 9px; }
  .builder-status { margin-bottom: 6px; }
  .builder-status .status-note { display: none; }
  .filter-grid { grid-template-columns: 1fr 1fr; right: -1px; }
  .compact-summary span:nth-child(n+2) { display: none; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; padding: 8px; }
  .compact-card-body { padding: 7px; }
  .card-subline { display: none; }
  .deck-commandbar { align-items: stretch; flex-direction: column; }
  .deck-file-actions { display: grid; grid-template-columns: repeat(3, 1fr); }
  .deck-danger-actions { justify-content: space-between; }
  .compact-footer { display: none; }
}

@media (max-width: 390px) {
  .card-grid { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: 1fr; }
}
