:root {
  color-scheme: dark;
  --bg: #121923;
  --panel: #1d2635;
  --panel-2: #202c3d;
  --panel-3: #28374b;
  --line: #3a4a61;
  --text: #eef4ff;
  --muted: #9fb0ca;
  --gold: #e8c15d;
  --blue: #3e7bff;
  --green: #2db678;
  --red: #ef4d64;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-family: "Barlow", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(62, 123, 255, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(232, 193, 93, 0.12), transparent 30%),
    linear-gradient(180deg, #0d141f 0%, #121923 100%);
}

.app-stage {
  width: calc(1920px * var(--app-scale, 1));
  height: calc(1080px * var(--app-scale, 1));
  overflow: hidden;
}

.auth-landing {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.game-select {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(430px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid rgba(133, 157, 191, 0.22);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(35, 46, 64, 0.96), rgba(25, 34, 48, 0.98));
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 2rem;
}

.game-select-card {
  width: min(1220px, 100%);
  display: grid;
  gap: 18px;
  padding: 0;
}

.game-select-heading h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 2rem;
}

.game-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 18px;
}

.game-select-button {
  min-height: 196px;
  display: grid;
  grid-template-rows: 132px 64px;
  border: 1px solid rgba(133, 157, 191, 0.28);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  color: var(--text);
  background: rgba(13, 17, 23, 0.96);
  text-align: left;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.game-select-button:hover {
  transform: translateY(-1px);
  border-color: rgba(232, 193, 93, 0.52);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
}

.game-select-image {
  display: block;
  min-height: 0;
  background-image:
    linear-gradient(180deg, rgba(10, 12, 16, 0.1), rgba(10, 12, 16, 0.42)),
    var(--game-image);
  background-size: cover;
  background-position: center;
}

.game-select-content {
  display: grid;
  place-items: center;
  padding: 14px 20px;
  text-align: center;
}

.game-select-content strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.12rem;
}

.admin-entry {
  display: flex;
  justify-content: flex-end;
}

.admin-stage {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.admin-shell {
  width: min(920px, 100%);
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid rgba(133, 157, 191, 0.22);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(35, 46, 64, 0.96), rgba(25, 34, 48, 0.98));
  box-shadow: var(--shadow);
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
}

.admin-header h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 2rem;
}

.admin-header p {
  margin: 6px 0 0;
  color: #c7d3e5;
  line-height: 1.35;
}

.admin-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(133, 157, 191, 0.24);
  border-radius: 8px;
  background: rgba(18, 25, 35, 0.88);
}

.admin-panel-heading {
  display: grid;
  gap: 4px;
}

.admin-panel-heading strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
}

.admin-panel-heading span,
.admin-status {
  color: #c7d3e5;
  line-height: 1.35;
}

.admin-panel-controls {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.admin-status {
  min-height: 1.2em;
  margin: 0;
  font-weight: 700;
  white-space: pre-line;
}

.auth-message {
  min-height: 1.2em;
  margin: 0;
  color: #ffd5dc;
  font-weight: 700;
}

button,
input,
select {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr) 380px;
  gap: 0;
  width: 1920px;
  height: 1080px;
  min-height: 0;
  padding: 8px;
  transform: scale(var(--app-scale, 1));
  transform-origin: top left;
  position: relative;
}

.panel {
  background: linear-gradient(180deg, rgba(35, 46, 64, 0.95), rgba(25, 34, 48, 0.95));
  border: 1px solid rgba(133, 157, 191, 0.2);
  box-shadow: var(--shadow);
}

.left-rail,
.catalog-panel {
  min-height: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.left-rail {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.catalog-panel {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.workspace {
  min-height: 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  border-top: 1px solid rgba(133, 157, 191, 0.2);
  border-bottom: 1px solid rgba(133, 157, 191, 0.2);
  background: linear-gradient(180deg, rgba(25, 34, 48, 0.9), rgba(20, 27, 39, 0.96));
}

.leader-panel,
.panel-block,
.main-deck-panel,
.summary-panel {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(133, 157, 191, 0.16);
  border-radius: var(--radius-md);
  padding: 14px;
}

.main-deck-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.leader-panel {
  display: block;
}

.workspace-lower .leader-panel,
.workspace-lower .summary-panel {
  padding: 8px;
}

.workspace-lower {
  flex: 0 0 184px;
  min-height: 0;
  grid-template-columns: 124px minmax(0, 1fr);
}

.workspace-lower .leader-panel {
  min-width: 0;
  overflow: hidden;
}

.workspace-lower .hero-card {
  height: 100%;
  max-height: 168px;
  max-width: 120px;
  margin: 0 auto;
}

.workspace-lower .leader-card-frame {
  height: 100%;
}

.workspace-lower .leader-card-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hero-card {
  min-height: auto;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(145deg, #2f4566, #142033);
  border: 1px solid rgba(232, 193, 93, 0.5);
}

.hero-card-inner {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.cost-bubble {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.9);
  display: grid;
  place-items: center;
  font-family: "Space Grotesk", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  background: rgba(13, 20, 31, 0.72);
}

.hero-chip {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(13, 20, 31, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.85rem;
  color: var(--muted);
}

.hero-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hero-title h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 2rem;
}

.hero-title p {
  margin: 0;
  color: #dce8ff;
  max-width: 18ch;
}

.leader-card-image {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: contain;
  background: rgba(7, 11, 18, 0.78);
  cursor: pointer;
}

.leader-card-frame {
  position: relative;
  overflow: hidden;
}

.leader-card-image:hover {
  filter: brightness(1.08);
}

.leader-empty-slot {
  height: 100%;
  min-height: 0;
}

.leader-copy h1 {
  font-size: 1.05rem;
}

.leader-copy .meta-copy,
.leader-copy .body-copy {
  display: none;
}

.hover-preview {
  display: grid;
  align-items: stretch;
  justify-items: center;
  min-height: 514px;
  padding: 2px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(133, 157, 191, 0.16);
}

.hover-preview-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}

.leader-copy h1,
.deck-title-line h2,
.section-heading h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.meta-copy,
.body-copy,
.note-list,
.stat-card span,
.field span,
.section-heading span,
.status-pill,
.validation-banner {
  color: var(--muted);
}

.body-copy,
.meta-copy {
  margin: 0 0 10px;
  line-height: 1.45;
}

.section-heading,
.toolbar,
.deck-title-line,
.catalog-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.deck-zone-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 8px;
  margin: 8px 0;
}

.deck-zone-tab {
  min-height: 34px;
  border: 1px solid rgba(133, 157, 191, 0.2);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  font-weight: 700;
}

.deck-zone-tab.active {
  border-color: rgba(232, 193, 93, 0.58);
  background: rgba(232, 193, 93, 0.16);
}

.deck-zone-tab.counter-only {
  cursor: default;
  opacity: 1;
}

.deck-zone-tab.counter-only:disabled {
  opacity: 1;
}

body[data-game="riftbound"] .toolbar {
  grid-template-columns: minmax(0, 1fr) auto;
}

body[data-game="riftbound"] .toolbar .deck-title-line.riftbound-hidden-title,
body[data-game="riftbound"] .toolbar .validation-banner {
  display: none;
}

body[data-game="riftbound"] .toolbar .deck-zone-tabs {
  margin: 0;
}

body[data-game="riftbound"] .toolbar .deck-zone-tab {
  min-height: 32px;
  padding: 5px 8px;
}

.button-grid,
.filter-grid,
.stat-grid,
.workspace-lower {
  display: grid;
  gap: 12px;
}

.button-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wide-button {
  grid-column: 1 / -1;
}

.summary-panel .section-heading .button {
  min-height: 0;
  padding: 6px 10px;
  font-size: 0.76rem;
}

.button {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 700;
  color: white;
  transition: transform 120ms ease, opacity 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button:disabled:hover {
  transform: none;
}

.button.primary {
  background: linear-gradient(180deg, #3d79fb, #2458d1);
}

.button.secondary,
.button.subtle {
  background: #36455d;
}

.button.danger {
  background: linear-gradient(180deg, #ff5f70, #cb3148);
}

.icon-button {
  border: 0;
  border-radius: 10px;
  background: rgba(12, 18, 27, 0.82);
  color: white;
  cursor: pointer;
}

.app-menu {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 80;
}

.hamburger-button {
  width: 30px;
  height: 30px;
  display: grid;
  gap: 3px;
  align-content: center;
  justify-content: center;
  border: 1px solid rgba(145, 165, 194, 0.24);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.hamburger-button span {
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.app-menu-panel {
  position: absolute;
  top: 46px;
  right: 0;
  width: 154px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(145, 165, 194, 0.24);
  border-radius: 12px;
  background: rgba(24, 34, 49, 0.98);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.38);
}

.app-menu-panel .button {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.82rem;
  text-align: left;
}

.field {
  display: grid;
  gap: 8px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid rgba(145, 165, 194, 0.2);
  border-radius: 12px;
  background: rgba(12, 18, 27, 0.65);
  color: var(--text);
  padding: 12px;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.auth-panel,
.preview-text-panel {
  display: grid;
  gap: 10px;
}

.preview-info-block {
  flex: 0 0 248px;
  height: 248px;
  min-height: 248px;
}

.preview-text-panel {
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.preview-text-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.preview-text-heading span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.preview-text-heading .button {
  min-height: 0;
  padding: 5px 9px;
  font-size: 0.72rem;
}

.preview-text-panel p {
  min-height: 0;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  white-space: pre-line;
  line-height: 1.35;
  font-size: 0.9rem;
  color: #dce8ff;
  border: 1px solid rgba(145, 165, 194, 0.2);
  border-radius: 8px;
  background: rgba(12, 18, 27, 0.65);
}

.account-card {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid rgba(145, 165, 194, 0.2);
  border-radius: 8px;
  background: rgba(12, 18, 27, 0.65);
}

.account-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.account-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-name-controls,
.saved-deck-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.deck-controls-block .field {
  gap: 3px;
}

.deck-controls-block .field span {
  line-height: 1.05;
}

.deck-name-controls .button,
.saved-deck-controls .button {
  padding-inline: 12px;
}

.default-active {
  background: linear-gradient(180deg, #f0cb69, #b78321);
  color: #172033;
}

.import-panel {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 0;
}

.hover-preview .field {
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.hover-preview .field textarea {
  min-height: 0;
  height: 100%;
  resize: none;
}

.info-stack {
  gap: 14px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.toolbar-select {
  width: auto;
  min-width: 148px;
  border: 1px solid rgba(145, 165, 194, 0.2);
  border-radius: 12px;
  background: #36455d;
  color: white;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
}

.toolbar {
  gap: 10px;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  justify-content: stretch;
  align-items: center;
}

.toolbar .deck-title-line {
  gap: 10px;
  justify-content: flex-start;
}

.status-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(12, 18, 27, 0.65);
  border: 1px solid rgba(145, 165, 194, 0.2);
  font-weight: 700;
}

.validation-banner {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  visibility: hidden;
}

.validation-banner.notice-active {
  visibility: visible;
}

.validation-banner.valid {
  background: rgba(45, 182, 120, 0.12);
  border-color: rgba(45, 182, 120, 0.35);
  color: #c8f7df;
}

.validation-banner.invalid {
  background: rgba(239, 77, 100, 0.12);
  border-color: rgba(239, 77, 100, 0.35);
  color: #ffd5dc;
}

.card-grid {
  display: grid;
  gap: 4px;
}

.deck-grid {
  margin-top: 8px;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-template-rows: repeat(5, auto);
  flex: 1;
  align-content: start;
  justify-content: stretch;
  overflow: visible;
  min-width: 0;
}

.deck-grid.union-ip-picker-grid {
  display: block;
  overflow: hidden;
  padding-right: 0;
}

.union-ip-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  align-content: start;
}

.union-ip-button {
  height: 82px;
  min-height: 0;
  border: 1px solid rgba(145, 165, 194, 0.26);
  border-radius: 7px;
  padding: 0;
  display: block;
  position: relative;
  text-align: left;
  color: var(--text);
  background: rgba(16, 24, 36, 0.78);
  cursor: pointer;
  overflow: hidden;
}

.union-ip-button:hover,
.union-ip-button:focus-visible {
  border-color: rgba(232, 193, 93, 0.58);
  background: rgba(18, 27, 40, 0.92);
}

.union-ip-image {
  display: block;
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(180deg, rgba(8, 12, 18, 0.04), rgba(8, 12, 18, 0.7)),
    var(--union-ip-image);
  background-size: auto 118%;
  background-position: 82% center;
  transform: scale(1.02);
  transition: transform 140ms ease;
}

.union-ip-content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  background: linear-gradient(180deg, rgba(10, 14, 21, 0), rgba(10, 14, 21, 0.92) 28%, rgba(10, 14, 21, 0.96));
}

.union-ip-button:hover .union-ip-image,
.union-ip-button:focus-visible .union-ip-image {
  transform: scale(1.08);
}

.union-ip-button strong {
  font-size: 0.82rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.union-ip-button span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.deck-grid.riftbound-deck-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-template-rows: auto auto auto;
  grid-template-areas:
    "legend rune rune location location location . . . ."
    "main main main main main main main main main main"
    "side side side side side side side side . .";
  gap: 4px;
  overflow: hidden;
  align-content: start;
  justify-content: stretch;
  padding-right: 0;
}

.deck-grid.riftbound-freestyle-grid {
  grid-template-areas:
    "legend rune rune location location location . . . ."
    "main main main main main main main main main main"
    "side side side side side side side side . .";
  grid-template-rows: auto auto auto;
  overflow: auto;
  padding-right: 4px;
}

.riftbound-freestyle-zone-grid {
  grid-template-columns: repeat(10, minmax(0, 1fr));
}

.riftbound-zone-section {
  display: grid;
  grid-template-rows: minmax(0, auto);
  gap: 0;
  min-height: 0;
  margin-bottom: 0;
  align-content: start;
  overflow: hidden;
}

.riftbound-zone-heading {
  display: none;
  justify-content: space-between;
  align-items: center;
  min-height: 21px;
  padding: 0 2px;
}

.riftbound-zone-heading strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.82rem;
}

.riftbound-zone-heading span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.riftbound-zone-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
  min-height: 0;
  align-content: start;
  overflow: hidden;
}

.riftbound-zone-main {
  grid-area: main;
  min-height: 620px;
}

.riftbound-zone-side {
  grid-area: side;
}

.riftbound-zone-legend {
  grid-area: legend;
}

.riftbound-zone-rune {
  grid-area: rune;
}

.riftbound-zone-location {
  grid-area: location;
}

.riftbound-deck-grid .riftbound-zone-legend,
.riftbound-deck-grid .riftbound-zone-rune,
.riftbound-deck-grid .riftbound-zone-location {
  min-height: 160px;
}

.riftbound-zone-side .riftbound-zone-grid {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.riftbound-deck-grid .riftbound-zone-main .riftbound-zone-grid {
  grid-template-rows: repeat(4, auto);
}

.riftbound-deck-grid .riftbound-zone-side .riftbound-zone-grid,
.riftbound-deck-grid .riftbound-zone-legend .riftbound-zone-grid,
.riftbound-deck-grid .riftbound-zone-rune .riftbound-zone-grid,
.riftbound-deck-grid .riftbound-zone-location .riftbound-zone-grid {
  grid-template-rows: auto;
}

.riftbound-zone-legend .riftbound-zone-grid {
  grid-template-columns: minmax(0, 1fr);
}

.riftbound-rune-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.riftbound-location-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
}

.riftbound-freestyle-grid .riftbound-zone-main .riftbound-zone-grid {
  grid-template-columns: repeat(10, minmax(0, 1fr));
}

.riftbound-deck-grid .card-tile,
.riftbound-deck-grid .empty-card-slot {
  justify-self: center;
  align-self: start;
  width: 100%;
  height: auto;
  aspect-ratio: 744 / 1039;
}

.riftbound-deck-grid .riftbound-zone-main .card-tile,
.riftbound-deck-grid .riftbound-zone-main .empty-card-slot {
  width: 100%;
  height: auto;
  align-self: start;
}

.riftbound-deck-grid .card-image {
  width: 100%;
  height: 100%;
  aspect-ratio: inherit;
}

.riftbound-deck-grid .card-tile {
  overflow: hidden;
}

.riftbound-deck-grid .landscape-card .card-image {
  aspect-ratio: 1039 / 744;
}

.riftbound-deck-grid .stack-count {
  right: 2px;
  bottom: 2px;
  min-width: 20px;
  padding: 2px 5px;
  font-size: 0.68rem;
}

.deck-grid.freestyle-grid {
  grid-template-rows: none;
  grid-auto-rows: auto;
  overflow: auto;
  padding-right: 4px;
}

.catalog-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
  flex: 1;
  min-height: 0;
  align-content: start;
}

.catalog-grid .card-tile,
.catalog-grid .card-image {
  height: 100%;
}

.catalog-grid .card-image {
  object-fit: contain;
}

.catalog-pager {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  gap: 6px;
}

.catalog-pager span {
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.pager-button {
  padding: 6px 0;
  background: #36455d;
}

.pager-button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
  transform: none;
}

.card-tile {
  border: 0;
  border-radius: 7px;
  padding: 0;
  background: transparent;
  min-height: 0;
  display: block;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.stack-count {
  position: absolute;
  right: 4px;
  bottom: 4px;
  min-width: 24px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(12, 18, 27, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.42);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.card-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
}

.deck-card-tile {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.deck-card-tile:active {
  cursor: grabbing;
}

.deck-card-tile.dragging {
  opacity: 0.45;
}

.drag-ghost {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.04);
  opacity: 0.96;
  border-radius: 7px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.drag-ghost .card-image {
  height: 100%;
}

.card-image {
  display: block;
  width: 100%;
  aspect-ratio: 600 / 838;
  object-fit: contain;
  background: rgba(7, 11, 18, 0.78);
}

.card-tile.landscape-card .card-image {
  object-fit: contain;
  background: rgba(7, 11, 18, 0.78);
  transform: rotate(-90deg) scale(1.35);
  transform-origin: center;
}

.owned-card .card-image,
.owned-card .leader-card-image {
  filter: grayscale(1) brightness(0.62);
  opacity: 0.5;
}

.owned-stamp {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 154%;
  height: auto;
  transform: translate(-50%, -50%) rotate(-53deg);
  filter: drop-shadow(0 4px 7px rgba(0, 0, 0, 0.45));
  opacity: 0.92;
  pointer-events: none;
  z-index: 2;
}

.owned-card .owned-stamp {
  display: block;
}

.empty-card-slot {
  aspect-ratio: 600 / 838;
  border-radius: 7px;
  border: 1px solid rgba(145, 165, 194, 0.22);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0)),
    rgba(12, 18, 27, 0.48);
}

.hidden {
  display: none;
}

body[data-game="lorcana"] .workspace-lower,
body[data-game="cookie-run"] .workspace-lower,
body[data-game="riftbound"] .workspace-lower {
  display: none;
}

body[data-game="union-arena"] .workspace-lower {
  grid-template-columns: minmax(0, 1fr);
}

body[data-game="union-arena"] .workspace-lower .leader-panel {
  display: none;
}

.summary-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.stat-card {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(133, 157, 191, 0.15);
  padding: 7px;
  display: grid;
  gap: 2px;
}

.stat-card strong {
  font-size: 1.1rem;
}

.curve-bars {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 3px;
  align-items: end;
  min-height: 0;
  overflow: hidden;
}

.curve-bar {
  display: grid;
  grid-template-rows: 10px minmax(5px, 1fr) 10px;
  gap: 1px;
  justify-items: center;
  align-items: end;
  min-height: 0;
  overflow: hidden;
}

.curve-bar-fill {
  width: 86%;
  min-height: 6px;
  border-radius: 999px 999px 12px 12px;
  background: linear-gradient(180deg, #f0cb69, #2a68ff);
}

.curve-bar-label {
  font-size: 0.56rem;
  line-height: 1;
  color: var(--muted);
}

.note-list {
  margin: 16px 0 0;
  padding-left: 20px;
  line-height: 1.5;
}

.filter-grid {
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.catalog-topbar {
  display: flex;
  align-items: center;
}

.catalog-topbar .button {
  min-height: 0;
  padding: 6px 10px;
  font-size: 0.72rem;
}


.search-field {
  grid-column: 1 / -1;
}

.search-field-heading {
  display: block;
}

.cost-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.catalog-panel {
  gap: 6px;
}

.catalog-panel .field {
  gap: 4px;
}

.catalog-panel .field input,
.catalog-panel .field select {
  padding: 7px 9px;
}

.catalog-panel .field span,
.catalog-actions span {
  font-size: 0.75rem;
}

.catalog-actions {
  gap: 8px;
  justify-content: flex-end;
}


