/* Lobby A. Scoped to the social and account surfaces so the combat board keeps
   its own layout and the Album/Glossary overlay keeps its established styles. */
body:is(.social-app-pending, .social-authenticated):not(.is-playing) {
  overflow-x: clip;
  background:
    linear-gradient(90deg, rgba(6, 14, 23, .87), rgba(7, 16, 26, .76)),
    url("./assets/library-volcanic-background-v1.png") center / cover fixed;
  color: #f1f1ed;
}

body:is(.social-app-pending, .social-authenticated):not(.is-playing) > .shell {
  width: min(1520px, calc(100% - 56px));
  padding-top: 0;
}

body:is(.social-app-pending, .social-authenticated):not(.is-playing) > .shell > .hero {
  position: relative;
  isolation: isolate;
  min-height: 70px;
  align-items: center;
  justify-content: flex-start;
  gap: 38px;
  margin-bottom: 28px;
  border-bottom: 0;
  background: transparent;
}

body:is(.social-app-pending, .social-authenticated):not(.is-playing) > .shell > .hero::before {
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  border-bottom: 1px solid #334253;
  background: rgba(9, 18, 28, .94);
  content: "";
  transform: translateX(-50%);
}

body:is(.social-app-pending, .social-authenticated):not(.is-playing) .hero h1 {
  margin: 0;
  color: #f5f6f3;
  font-family: "MdC Heavy", Impact, sans-serif;
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: -.035em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

body:is(.social-app-pending, .social-authenticated):not(.is-playing) .hero-copy,
body:is(.social-app-pending, .social-authenticated):not(.is-playing) .prototype-stamp { display: none; }

body:is(.social-app-pending, .social-authenticated):not(.is-playing) .library-entry {
  gap: 22px;
  padding: 0;
}

body:is(.social-app-pending, .social-authenticated):not(.is-playing) .library-entry__link {
  position: relative;
  min-height: 69px;
  padding: 0 8px;
  border: 0;
  color: #b9c5d1;
  font-size: .9rem;
  letter-spacing: 0;
  text-transform: none;
}

body:is(.social-app-pending, .social-authenticated):not(.is-playing) .library-entry__link[aria-current="page"] {
  color: #f1f1ed;
}

body:is(.social-app-pending, .social-authenticated):not(.is-playing) .library-entry__link[aria-current="page"]::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: #ff293a;
  content: "";
}

body:is(.social-app-pending, .social-authenticated):not(.is-playing) .library-entry__link:hover,
body:is(.social-app-pending, .social-authenticated):not(.is-playing) .library-entry__link:focus-visible {
  background: transparent;
  color: #fff;
}

.account-panel,
.social-panel {
  --lobby-line: #3c4e60;
  --lobby-soft: #c9d2dc;
  --lobby-muted: #93a3b5;
  --lobby-red: #ff293a;
  --lobby-yellow: #ffe529;
  --lobby-green: #48de73;
  --lobby-blue: #71c8ff;
  color: #f1f1ed;
}

.account-panel .eyebrow,
.social-panel .eyebrow,
.social-panel .zone-label {
  color: var(--lobby-yellow);
  font-family: "MdC Display", "Arial Narrow", sans-serif;
  font-size: .98rem;
  font-weight: 400;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.social-panel .panel-copy,
.account-panel .panel-copy { color: var(--lobby-soft); }

.social-panel .button,
.account-panel .button {
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid #596b7e;
  border-radius: 0;
  background: #122234;
  color: #f1f1ed;
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.social-panel .button--primary,
.account-panel .button--primary {
  border-color: #ff5262;
  background: var(--lobby-red);
  color: #0c1520;
}

.social-panel .button--secondary,
.account-panel .button--secondary {
  border-color: var(--lobby-yellow);
  background: var(--lobby-yellow);
  color: #101920;
}

.social-panel .button--ghost,
.account-panel .button--ghost { background: #0b1623; color: #d7e0e8; }
.social-panel .button:hover:not(:disabled),
.account-panel .button:hover:not(:disabled) { filter: brightness(1.13); transform: none; }
.social-panel button:focus-visible,
.social-panel a:focus-visible,
.social-panel input:focus-visible,
.social-panel select:focus-visible,
.account-panel button:focus-visible,
.account-panel input:focus-visible { outline: 3px solid var(--lobby-yellow); outline-offset: 2px; }
.social-panel input,
.social-panel select,
.account-panel input { border-color: #4b5e71; border-radius: 0; background: #091522; color: #f1f1ed; }
.social-panel input::placeholder,
.account-panel input::placeholder { color: #8293a5; }
.social-panel .form-status,
.account-panel .form-status { color: var(--lobby-muted); }
.social-panel .form-status--error,
.account-panel .form-status--error { color: #ff9ca7; }
.social-panel .form-status--success,
.account-panel .form-status--success { color: var(--lobby-green); }

/* Signed-out entrance. The original forms, validation, and status regions remain. */
.account-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 455px);
  gap: clamp(25px, 5vw, 90px);
  align-items: center;
  min-height: min(690px, calc(100dvh - 140px));
  padding: clamp(25px, 4vw, 65px);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.account-panel__intro { align-items: center; }
.account-panel__intro h2 {
  max-width: 670px;
  margin: 15px 0 20px;
  color: #f1f1ed;
  font-family: "MdC Heavy", Impact, sans-serif;
  font-size: clamp(4rem, 7.7vw, 8rem);
  font-weight: 400;
  line-height: .94;
  text-transform: uppercase;
}
.account-panel__intro .panel-copy { max-width: 45ch; font-size: 1.07rem; }
.account-panel__signal { display: none; }
.account-panel .auth-view {
  grid-column: 2;
  grid-row: 1;
  margin-top: 0;
  padding: 28px;
  border: 1px solid #63778a;
  background: #101d2de8;
  box-shadow: 13px 13px 0 #050e18ab;
}
.account-panel .auth-view .zone-label { color: var(--lobby-yellow); font-family: "MdC Display", "Arial Narrow", sans-serif; font-size: 1rem; letter-spacing: .1em; }
.account-panel .auth-view h3 { margin: 8px 0 7px; color: #f1f1ed; font-family: "MdC Heavy", Impact, sans-serif; font-size: 2.3rem; font-weight: 400; text-transform: uppercase; }
.account-panel .auth-view .panel-copy { margin-bottom: 20px; font-size: .8rem; }
.account-panel .auth-form { grid-template-columns: 1fr; gap: 15px; }
.account-panel .auth-form label { color: #d3dce4; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.account-panel .auth-form .button { margin-top: 6px; }
.account-panel .auth-view__footer { align-items: flex-start; flex-wrap: wrap; }

/* Main dashboard. */
#social-lobby-panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.social-panel__header { align-items: end; margin-bottom: 18px; }
.social-panel__header .eyebrow { margin-bottom: 8px; }
.social-panel__header h2 {
  margin: 0 0 9px;
  font-family: "MdC Heavy", Impact, sans-serif;
  font-size: clamp(3.25rem, 5.4vw, 5.7rem);
  font-weight: 400;
  letter-spacing: -.025em;
  line-height: .92;
  text-transform: uppercase;
}
.social-panel__header .panel-copy { font-size: .93rem; }
.social-panel__actions { display: grid; justify-items: end; gap: 10px; min-width: 255px; }
.social-panel__actions .status {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--lobby-green);
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.social-panel__actions .status::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  content: "";
}
.social-panel__actions > a.button { width: 255px; }
.lobby-music {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 255px;
  min-height: 54px;
  padding: 7px 10px;
  border: 1px solid rgba(132, 164, 177, .28);
  border-radius: 9px;
  background: rgba(7, 17, 28, .72);
}
.lobby-music__toggle {
  display: grid;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(145, 193, 185, .45);
  border-radius: 50%;
  background: rgba(98, 152, 136, .13);
  color: var(--lobby-green);
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
}
.lobby-music__toggle:hover,
.lobby-music__toggle[aria-pressed="true"] {
  background: rgba(98, 152, 136, .25);
  box-shadow: 0 0 14px rgba(98, 193, 160, .14);
}
.lobby-music__toggle:focus-visible,
.lobby-music__volume input:focus-visible { outline: 2px solid var(--lobby-green); outline-offset: 3px; }
.lobby-music__volume { display: grid; min-width: 0; flex: 1; gap: 5px; }
.lobby-music__volume-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lobby-music__volume-heading label,
.lobby-music__volume-heading output { color: var(--lobby-muted); font-size: .65rem; font-weight: 800; }
.lobby-music__volume-heading output { color: var(--lobby-green); font-variant-numeric: tabular-nums; }
.lobby-music__volume input { width: 100%; height: 14px; margin: 0; accent-color: var(--lobby-green); cursor: pointer; }
.social-panel__actions > #social-logout-button {
  min-height: 28px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--lobby-muted);
  font-size: .68rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.lobby-tabs {
  gap: 0;
  margin: 0 0 19px;
  padding: 0;
  overflow-x: auto;
  border: 0;
  border-bottom: 1px solid #687b8d;
  border-radius: 0;
  background: transparent;
}
.lobby-tab {
  position: relative;
  min-height: 49px;
  padding: 11px 24px;
  border: 0;
  border-radius: 0;
  background: #0b1724d9;
  color: #aab9c9;
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.lobby-tab.is-active { border: 0; background: #172638; color: #fff; }
.lobby-tab.is-active::after { position: absolute; right: 0; bottom: 0; left: 0; height: 3px; background: var(--lobby-red); content: ""; }
.lobby-tab__count { color: var(--lobby-yellow); font-size: .73rem; }
.lobby-tab:focus-visible { outline: 3px solid var(--lobby-yellow); outline-offset: -3px; }
.social-grid {
  grid-template-columns: minmax(350px, 1.25fr) minmax(300px, 1fr) minmax(265px, .8fr);
  gap: 18px;
  margin-top: 0;
}
.social-card {
  min-height: 455px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--lobby-line);
  border-radius: 0;
  background: linear-gradient(145deg, #132335f4, #0a1522f4);
  box-shadow: 0 20px 45px #0004;
  clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 15px, 100% 100%, 15px 100%, 0 calc(100% - 15px));
}
.social-card__heading {
  align-items: flex-start;
  justify-content: flex-start;
  gap: 13px;
  min-height: 83px;
  margin: 0 0 17px;
  padding: 18px 20px 13px;
  border-bottom: 1px solid #35485a;
}
.social-card__heading > div { min-width: 0; }
.social-card__heading h3 {
  margin: 2px 0 0;
  color: #f1f1ed;
  font-family: "MdC Heavy", Impact, sans-serif;
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1.05;
  text-transform: uppercase;
}
.social-card__heading small { display: block; margin-top: 3px; color: var(--lobby-muted); font-size: .7rem; }
.social-card__index,
.social-card__count,
.social-card__glyph {
  display: grid;
  min-width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid #65788a;
  border-radius: 0;
  color: var(--lobby-yellow);
  font-family: "MdC Display", "Arial Narrow", sans-serif;
  font-size: 1.05rem;
  font-weight: 400;
}
.social-card__count,
.social-card__glyph { margin-left: auto; padding: 0 7px; }
.social-card > :not(.social-card__heading) { margin-right: 20px; margin-left: 20px; }
.social-card > :last-child { margin-bottom: 20px; }
.social-card .inline-form { align-items: stretch; }
.social-card .inline-form input { min-height: 42px; }
.social-card .inline-form .button { white-space: nowrap; }
.social-result { min-height: 22px; margin-top: 7px; margin-bottom: 0; }
.search-result-card { border-color: #52687d; border-radius: 0; background: #112236; color: #d6e0e9; }
.social-list { gap: 0; }
.social-list__label {
  margin: 17px 0 5px;
  color: #a9bac9;
  font-size: .66rem;
  letter-spacing: .14em;
}
.social-row { gap: 9px; padding: 12px 0; border-top-color: #314456; }
.social-row__identity strong { color: #f0f3f2; }
.social-row__identity small { color: var(--lobby-muted); }
.social-card--friends .social-row__identity { grid-template-columns: 36px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; }
.social-card--friends .social-row__identity::before { display: grid; grid-row: 1 / 3; width: 36px; height: 36px; place-items: center; border: 1px solid #64788b; background: #193044; color: var(--lobby-yellow); font-family: "MdC Heavy", Impact, sans-serif; font-size: 1.1rem; content: "✦"; }
.social-row__meta { flex-wrap: wrap; }
.presence-dot--available { color: var(--lobby-green); }
.presence-dot--preparing { color: var(--lobby-yellow); }
.presence-dot--combat { color: var(--lobby-blue); }
.social-empty { color: var(--lobby-muted); }
.social-card--code .panel-copy { color: #aabaca; }
.code-actions { display: grid; gap: 8px; }
.code-actions .button { width: 100%; }
.created-code {
  border-color: #8a8149;
  border-radius: 0;
  background: #242616ab;
}
.created-code strong { color: var(--lobby-yellow); font-family: "MdC Heavy", Impact, sans-serif; font-size: 2rem; }
.created-code small { color: #b6c1cb; }
.social-card--code #join-code-form { margin-top: 12px; }

/* The existing history and deck editor remain fully functional inside tabs. */
.match-history-panel,
.custom-decks-panel { margin-top: 0; padding: 24px; border: 1px solid var(--lobby-line); background: #0d1a29ed; }
.match-history-header h3,
.custom-decks-header h3,
.custom-deck-editor__heading h4,
.custom-deck-list-panel h4 {
  color: #f1f1ed;
  font-family: "MdC Heavy", Impact, sans-serif;
  font-weight: 400;
  text-transform: uppercase;
}
.match-history-header h3,
.custom-decks-header h3 { font-size: 2rem; }
.match-history-filter,
.custom-decks-panel label { color: var(--lobby-soft); }
.match-history-filter select { border-color: #4b5e71; background: #091522; color: #f1f1ed; }
.match-history-refresh,
.social-panel .icon-button { border-color: #596d81; border-radius: 0; background: #142638; color: var(--lobby-yellow); }
.match-history-overview { margin-top: 20px; }
.match-history-stat,
.match-history-card,
.custom-deck-list-panel,
.custom-deck-editor,
.custom-deck-champion,
.custom-deck-builder,
.custom-deck-picker,
.custom-deck-selection,
.custom-deck-card-item,
.custom-deck-selected-item,
.custom-deck-list-item {
  border-color: #3e5265;
  border-radius: 0;
  background: #0d1c2c;
}
.match-history-stat strong,
.custom-deck-rules strong,
.custom-deck-card-quantity { color: var(--lobby-yellow); }
.match-history-stat--wins strong,
.match-history-card--win .match-history-result { color: var(--lobby-green); }
.match-history-stat--losses strong,
.match-history-card--loss .match-history-result { color: #ff8e9a; }
.match-history-card__type,
.match-history-empty__glyph { color: var(--lobby-yellow); }
.match-history-card--win::before { background: var(--lobby-green); }
.match-history-card--loss::before { background: var(--lobby-red); }
.match-history-card--active::before { background: var(--lobby-yellow); }
.match-history-player__role,
.custom-deck-rules { border-color: #536b80; border-radius: 0; background: #13283b; }
.match-history-player__role { color: var(--lobby-yellow); }
.custom-deck-list-item { color: #f1f1ed; }
.custom-deck-list-item:hover,
.custom-deck-list-item.is-active { border-color: var(--lobby-yellow); background: #253044; }
.custom-deck-list-item strong,
.custom-deck-card-item strong,
.custom-deck-selected-item strong,
.custom-deck-section-heading h5,
.custom-deck-picker__heading h6 { color: #f1f1ed; }
.custom-deck-validation { border-radius: 0; color: #ff9ca7; }
.custom-deck-validation--ready { border-color: var(--lobby-green); color: var(--lobby-green); }
.custom-deck-form-actions .button--primary { min-width: 150px; }

/* The preparation panel is reached from invitations and codes. */
.prep-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.prep-actions .button { flex: 1 1 140px; min-height: 44px; }
.social-prep-panel { border-color: var(--lobby-line); border-radius: 0; background: #0d1a29ed; }
.social-prep-panel .social-panel__header h2 { font-size: clamp(2.5rem, 4.5vw, 4rem); }
.social-prep-panel .social-panel__header .status { display: inline-flex; }
.social-prep-panel .social-panel__header .status::before { display: none; }
.social-prep-panel .prep-format-card,
.social-prep-panel .prep-deck-card,
.social-prep-panel .prep-rivals,
.social-prep-panel .prep-player,
.social-prep-panel .hand-size-option { border-color: #42566a; border-radius: 0; background: #102033; }
.social-prep-panel .hand-size-option.is-selected { border-color: var(--lobby-yellow); background: #2c2b20; }

@media (max-width: 1050px) {
  .social-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .social-card--friends { grid-row: auto; }
  .social-card--code { grid-column: 1 / -1; min-height: 0; }
}

@media (max-width: 700px) {
  body:is(.social-app-pending, .social-authenticated):not(.is-playing) > .shell { width: calc(100% - 30px); }
  body:is(.social-app-pending, .social-authenticated):not(.is-playing) > .shell > .hero { min-height: 59px; flex-direction: row; align-items: center; gap: 8px; margin-bottom: 24px; }
  body:is(.social-app-pending, .social-authenticated):not(.is-playing) .hero h1 { font-size: .9rem; }
  body:is(.social-app-pending, .social-authenticated):not(.is-playing) .library-entry { gap: 5px; margin-left: auto; }
  body:is(.social-app-pending, .social-authenticated):not(.is-playing) .library-entry__link { min-height: 58px; padding: 0 4px; font-size: .72rem; }
  .account-panel { grid-template-columns: 1fr; gap: 26px; min-height: 0; padding: 12px 0 45px; }
  .account-panel__intro h2 { font-size: clamp(3.7rem, 15vw, 5.7rem); }
  .account-panel .auth-view { grid-column: 1; grid-row: auto; box-shadow: none; }
  .social-panel__header { flex-direction: column; align-items: stretch; }
  .social-panel__header h2 { font-size: clamp(3.1rem, 13vw, 5rem); }
  .social-panel__actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; min-width: 0; width: 100%; }
  .social-panel__actions > a.button { order: -1; width: 100%; }
  .social-panel__actions > .lobby-music { flex: 1 1 100%; width: 100%; }
  .social-panel__actions > #social-logout-button { min-height: 44px; margin-left: auto; }
  .lobby-tab { flex: 0 0 auto; padding: 10px 13px; font-size: .69rem; }
  .social-grid { grid-template-columns: 1fr; }
  .social-card,
  .social-card--code { grid-column: auto; min-height: 0; }
  .social-card__heading { min-height: 76px; padding: 14px 15px 11px; }
  .social-card > :not(.social-card__heading) { margin-right: 15px; margin-left: 15px; }
  .social-row { align-items: flex-start; }
  .social-row__meta { justify-content: flex-start; }
  .match-history-panel,
  .custom-decks-panel { padding: 17px; }
  .match-history-header { flex-direction: column; }
  .match-history-header__actions { width: 100%; }
  .match-history-list { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  body:is(.social-app-pending, .social-authenticated):not(.is-playing) .hero h1 { font-size: .77rem; }
  body:is(.social-app-pending, .social-authenticated):not(.is-playing) .library-entry__link { font-size: .6rem; }
  .social-card .inline-form { flex-wrap: wrap; }
  .social-card .inline-form .button { flex: 1; }
}

/* Deck Mesa: use the lobby shell, volcanic background, fonts and straight-edged controls. */
body.is-deck-building #social-lobby-panel > .social-panel__header { display: none; }
body.is-deck-building #social-lobby-panel > .social-panel__header .eyebrow,
body.is-deck-building #social-lobby-status,
body.is-deck-building #social-presence-status { display: none; }
body.is-deck-building #social-lobby-title { font-size: clamp(1.25rem, 2vw, 1.75rem); line-height: 1; }
body.is-deck-building #social-lobby-panel .social-panel__actions { display: flex; align-items: center; justify-content: end; gap: 7px; min-width: 0; width: auto; }
body.is-deck-building #social-lobby-panel .social-panel__actions > a.button,
body.is-deck-building #social-lobby-panel .social-panel__actions > #social-logout-button { width: auto; min-height: 32px; margin: 0; padding: 5px 9px; }
body.is-deck-building #social-lobby-panel .lobby-tabs { margin-bottom: 8px; }
.custom-decks-panel { padding: 12px; }
.custom-decks-header { align-items: center; margin-top: 0; }
.custom-decks-header h3 { margin-top: 1px; font-size: clamp(1.45rem, 2.2vw, 1.85rem); line-height: 1; }
.custom-decks-header__actions .status { white-space: nowrap; }
.custom-decks-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; margin-top: 7px; }
.custom-deck-list-panel,
.custom-deck-editor { padding: 8px; border: 1px solid var(--lobby-line); border-radius: 0; background: #0a1929e8; }
.custom-deck-list-panel { display: flex; align-items: center; gap: 10px; }
.custom-deck-list-panel__heading { display: flex; flex: 0 0 105px; align-items: center; justify-content: space-between; gap: 5px; margin-bottom: 0; }
.custom-deck-list-panel__heading h4 { margin: 1px 0 0; font-size: 1rem; }
.custom-deck-list-panel__heading .zone-label,
.custom-deck-editor__heading .zone-label,
.custom-deck-picker .zone-label,
.custom-deck-selection .zone-label { font-size: .78rem; }
.custom-deck-list { display: flex; flex: 1 1 auto; min-width: 0; gap: 7px; max-height: none; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; }
.custom-deck-list-item { display: grid; flex: 0 0 clamp(185px, 22vw, 250px); grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 58px; padding: 5px; border: 1px solid #3e5265; border-radius: 0; background: #102033; transform: none; }
.custom-deck-list-item:hover,
.custom-deck-list-item.is-active { border-color: var(--lobby-yellow); background: #263143; transform: none; }
.custom-deck-list-art { position: relative; display: grid; width: 42px; height: 46px; place-items: center; overflow: hidden; background: linear-gradient(145deg, #16628a, #11243c 65%, #9a7142); color: var(--lobby-yellow); font-family: "MdC Heavy", Impact, sans-serif; font-size: 1.3rem; }
.custom-deck-list-art img { width: 100%; height: 100%; object-fit: cover; }
.custom-deck-list-art:not(.custom-deck-card-art--fallback) .custom-deck-card-art__fallback { display: none; }
.custom-deck-list-copy { min-width: 0; }
.custom-deck-list-copy strong,
.custom-deck-list-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.custom-deck-list-item strong { color: #f1f1ed; font-size: .82rem; }
.custom-deck-list-item small { margin-top: 4px; color: var(--lobby-soft); font-size: .72rem; }
.custom-deck-editor__heading { display: none; }
.custom-deck-editor__heading h4 { margin-top: 2px; font-size: 1.1rem; }
.custom-deck-form { gap: 6px; }
.custom-deck-meta { grid-template-columns: minmax(0, 1.25fr) minmax(215px, .75fr); gap: 10px; align-items: center; }
.custom-deck-meta > label { min-width: 0; }
.custom-deck-meta > label span,
.custom-deck-filter-primary label,
.custom-deck-filters label,
.custom-deck-champion label { color: var(--lobby-soft); font-size: .72rem; font-weight: 850; letter-spacing: .055em; text-transform: uppercase; }
.custom-deck-meta input { min-height: 36px; padding: 7px 10px; }
.custom-deck-rules { min-height: 48px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 8px; padding: 6px 9px; border: 1px solid #536b80; border-radius: 0; background: #13283b; }
.custom-deck-rules strong { font-family: "MdC Heavy", Impact, sans-serif; font-size: 1.15rem; font-weight: 400; }
.custom-deck-rules span,
.custom-deck-rules small { color: var(--lobby-soft); font-size: .7rem; }
.custom-deck-builder { display: block; padding: 0; border: 0; border-radius: 0; background: transparent; }
.custom-deck-builder-grid { grid-template-columns: minmax(0, 1.88fr) minmax(260px, .94fr); gap: 9px; align-items: stretch; }
.custom-deck-picker,
.custom-deck-selection { min-width: 0; padding: 10px; border: 1px solid #3e5265; border-radius: 0; background: #0d1c2c; }
.custom-deck-picker__heading { align-items: center; margin-bottom: 7px; }
.custom-deck-picker__heading h5,
.custom-deck-selection__heading h6 { margin: 1px 0 0; color: #f1f1ed; font-family: "MdC Heavy", Impact, sans-serif; font-size: 1.12rem; font-weight: 400; text-transform: uppercase; }
.custom-deck-validation { border-radius: 0; font-size: .7rem; }
.custom-deck-filter-primary { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(130px, .6fr); gap: 7px; align-items: end; }
.custom-deck-filter-primary .search-field { width: 100%; min-width: 0; }
.custom-deck-filter-primary .input-with-icon { position: relative; display: block; width: 100%; }
.custom-deck-filter-primary .input-with-icon > svg { position: absolute; z-index: 1; top: 50%; left: 10px; width: 16px; height: 16px; fill: none; stroke: var(--lobby-soft); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; transform: translateY(-50%); }
.custom-deck-filter-primary .input-with-icon input { width: 100%; padding-left: 33px; }
.custom-deck-filter-primary input,
.custom-deck-filter-primary select,
.custom-deck-filters select,
.custom-deck-champion select { min-height: 35px; padding-block: 6px; border-color: #4b5e71; border-radius: 0; background: #091522; color: #f1f1ed; font-size: .75rem; }
.custom-deck-filter-primary .input-with-icon input { min-height: 35px; }
#custom-deck-more-filters { display: none; }
.custom-deck-filters { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; margin: 7px 0 4px; }
.custom-deck-filters[hidden] { display: none; }
.custom-deck-filter-summary { min-height: 28px; }
.custom-deck-filter-summary span { color: var(--lobby-soft); font-size: .73rem; }
.custom-deck-filter-summary .filter-reset { min-height: 27px; padding: 3px 8px; border-radius: 0; color: var(--lobby-yellow); }
.custom-deck-card-library { grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; align-items: start; gap: 8px; max-height: min(54vh, 540px); overflow-y: auto; padding-right: 3px; }
.custom-deck-card-item { display: grid; min-width: 0; min-height: 195px; grid-template-columns: 140px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; align-self: start; align-items: stretch; gap: 0; padding: 0; overflow: hidden; border: 1px solid #43596d; border-radius: 0; background: #091827; }
.custom-deck-card-art { position: relative; display: grid; width: 140px; height: auto; aspect-ratio: 840 / 1163; grid-row: 1 / 3; align-self: start; place-items: center; overflow: hidden; border-right: 2px solid var(--lobby-red); background: linear-gradient(145deg, #2b789c, #162b49 60%, #7d6951); color: #f1f1ed; font-family: "MdC Heavy", Impact, sans-serif; font-size: 2.3rem; }
.custom-deck-card-art img { display: block; width: 100%; height: 100%; object-fit: contain; }
.custom-deck-card-art .custom-deck-card-art__fallback { color: var(--lobby-yellow); font-family: "MdC Heavy", Impact, sans-serif; font-size: 2.3rem; }
.custom-deck-card-art:not(.custom-deck-card-art--fallback) .custom-deck-card-art__fallback { display: none; }
.custom-deck-card-content { display: grid; min-width: 0; align-content: start; gap: 4px; padding: 8px 9px 5px; }
.custom-deck-card-content strong { display: block; overflow: hidden; color: #f1f1ed; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.custom-deck-card-content small { margin: 0; color: var(--lobby-soft); font-size: .7rem; line-height: 1.2; }
.custom-deck-card-item__stats { display: flex; justify-content: space-between; gap: 3px; padding: 3px 0; border-top: 1px solid #2f455a; border-bottom: 1px solid #2f455a; color: var(--lobby-soft); font-size: .7rem; font-weight: 850; }
.custom-deck-card-item__stats b { color: var(--lobby-yellow); }
.custom-deck-card-item__keywords { overflow: hidden; color: var(--lobby-blue); font-size: .72rem; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.custom-deck-card-item__effect { color: #d9e1e9; font-size: .7rem; line-height: 1.25; white-space: pre-wrap; }
.custom-deck-card-actions { grid-column: 2; justify-content: space-between; min-height: 35px; padding: 4px 8px; border-top: 1px solid #2f455a; }
.custom-deck-card-actions .button { min-height: 28px; padding: 4px 8px; border-color: var(--lobby-yellow); border-radius: 0; background: #25271d; color: var(--lobby-yellow); font-size: .7rem; }
.custom-deck-card-quantity { color: var(--lobby-yellow); font-size: .75rem; }
.custom-deck-selection { display: flex; min-height: 0; flex-direction: column; }
.custom-deck-selection .custom-deck-picker__heading { margin-bottom: 7px; }
.custom-deck-champion { display: grid; gap: 6px; padding: 7px; border: 1px solid #726d47; border-radius: 0; background: #17232c; }
.custom-deck-champion .custom-deck-section-heading h5 { margin: 1px 0 0; font-size: .92rem; }
.custom-deck-champion-preview { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 8px; align-items: center; }
.custom-deck-champion-art { position: relative; display: grid; width: 62px; height: 76px; place-items: center; overflow: hidden; background: linear-gradient(145deg, #16628a, #132b47 65%, #8d673f); color: var(--lobby-yellow); font-family: "MdC Heavy", Impact, sans-serif; font-size: 2rem; }
.custom-deck-champion-art img { width: 100%; height: 100%; object-fit: cover; }
.custom-deck-champion-art img[hidden] { display: none; }
.custom-deck-champion-art:has(img:not([hidden])) > span { display: none; }
.custom-deck-champion-copy { min-width: 0; }
.custom-deck-champion-copy strong { display: block; overflow: hidden; color: #f1f1ed; font-size: .84rem; text-overflow: ellipsis; white-space: nowrap; }
.custom-deck-champion-copy small { display: block; margin-top: 4px; color: var(--lobby-soft); font-size: .7rem; line-height: 1.25; }
.custom-deck-champion label { max-width: none; }
.custom-deck-champion select { width: 100%; }
.custom-deck-selection__heading { display: flex; justify-content: space-between; gap: 5px; margin: 9px 0 5px; padding-bottom: 5px; border-bottom: 1px solid #354d60; }
.custom-deck-selection__heading h6 { font-size: .9rem; }
.custom-deck-selection__heading span { color: var(--lobby-muted); font-size: .68rem; }
.custom-deck-selected-cards { align-content: start; gap: 4px; max-height: min(29vh, 290px); min-height: 68px; overflow-y: auto; }
.custom-deck-selected-item { padding: 5px 6px; border: 1px solid #304658; border-radius: 0; background: #091827; }
.custom-deck-selected-item strong { font-size: .75rem; }
.custom-deck-selected-item small { margin-top: 2px; color: var(--lobby-soft); font-size: .65rem; }
.custom-deck-selected-actions input { width: 44px; min-height: 29px; padding: 4px; font-size: .72rem; }
.custom-deck-selected-actions .button { min-height: 29px; padding: 4px 6px; border-radius: 0; font-size: .68rem; }
.custom-deck-form-actions { gap: 5px; margin-top: auto; padding-top: 8px; }
.custom-deck-form-actions .button { min-width: 0; min-height: 34px; flex: 1 1 auto; padding: 6px 7px; font-size: .68rem; }
.custom-deck-form-actions .form-status { flex-basis: 100%; font-size: .72rem; }

.custom-deck-card-cost { color: var(--lobby-yellow) !important; font-weight: 850; }
.custom-deck-selected-item .custom-deck-card-cost { display: block; margin-top: 2px; font-size: .65rem; line-height: 1.2; }
.custom-deck-champion-abilities { display: grid; gap: 7px; max-height: min(27vh, 230px); overflow-y: auto; overscroll-behavior: contain; }
.custom-deck-champion-ability-group { display: grid; gap: 4px; }
.custom-deck-champion-ability-group > strong { color: var(--lobby-yellow); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; }
.custom-deck-champion-ability-group ul { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.custom-deck-champion-ability-group li { padding: 5px 6px; border-left: 2px solid #64839b; background: #0d1a29; }
.custom-deck-champion-ability-group li p { margin: 0; color: #f1f1ed; font-size: .7rem; line-height: 1.3; white-space: pre-wrap; }
.custom-deck-champion-ability-group li small,
.custom-deck-champion-abilities > small { display: block; margin-top: 4px; color: var(--lobby-soft); font-size: .64rem; line-height: 1.25; }
.custom-deck-card-preview[hidden] { display: none; }
.custom-deck-card-preview { position: fixed; z-index: 10000; display: grid; width: min(390px, calc(100vw - 24px)); max-height: min(70vh, 520px); grid-template-columns: 92px minmax(0, 1fr); gap: 10px; overflow: auto; padding: 10px; border: 1px solid var(--lobby-yellow); background: #091827f5; box-shadow: 0 14px 42px #000b; pointer-events: none; }
.custom-deck-card-preview__art { width: 92px; height: 128px; min-height: 0; aspect-ratio: auto; grid-row: 1; align-self: start; overflow: hidden; border: 0; }
.custom-deck-card-preview__art img { width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; }
.custom-deck-card-preview__content { display: grid; min-width: 0; align-content: start; gap: 5px; }
.custom-deck-card-preview__content > strong { color: #f1f1ed; font-size: .9rem; }
.custom-deck-card-preview__content > small { color: var(--lobby-soft); font-size: .69rem; line-height: 1.25; }
.custom-deck-card-preview__content > .custom-deck-card-cost { color: var(--lobby-yellow); }
.custom-deck-card-preview__effect { margin: 2px 0 0; color: #f1f1ed; font-size: .72rem; line-height: 1.35; white-space: pre-wrap; }

@media (max-width: 560px) and (orientation: portrait) {
  .custom-deck-card-preview { grid-template-columns: 68px minmax(0, 1fr); gap: 7px; padding: 8px; }
  .custom-deck-card-preview__art { width: 68px; height: 95px; }
  .custom-deck-champion-abilities { max-height: 160px; }
}

@media (max-width: 1020px) {
  .custom-deck-card-library { grid-template-columns: minmax(0, 1fr); }
  .custom-deck-builder-grid { grid-template-columns: minmax(0, 1.6fr) minmax(240px, .9fr); }
}

@media (orientation: landscape) and (max-width: 980px) and (max-height: 600px) {
  body.is-deck-building #social-lobby-panel > .social-panel__header { display: none; }
  body.is-deck-building #social-lobby-panel .lobby-tabs { margin-top: 0; margin-bottom: 5px; }
  body.is-deck-building #social-lobby-panel .lobby-tab { min-height: 35px; padding: 6px 10px; font-size: .7rem; }
  .custom-decks-panel { padding: 9px; }
  .custom-decks-header { flex-direction: row; gap: 8px; }
  .custom-decks-header h3 { font-size: 1.15rem; }
  .custom-decks-header__actions { width: auto; gap: 5px; }
  .custom-decks-header__actions .status { display: none; }
  .custom-decks-header__actions .button { min-height: 32px; padding: 5px 8px; }
  .custom-decks-layout { gap: 6px; margin-top: 6px; }
  .custom-deck-list-panel { padding: 5px; }
  .custom-deck-list-panel__heading { margin-bottom: 3px; }
  .custom-deck-list-panel__heading h4 { font-size: .82rem; }
  .custom-deck-list-item { flex-basis: 145px; min-height: 42px; grid-template-columns: 30px minmax(0, 1fr); gap: 4px; padding: 3px; }
  .custom-deck-list-art { width: 30px; height: 33px; font-size: 1rem; }
  .custom-deck-list-item strong { font-size: .72rem; }
  .custom-deck-list-item small { font-size: .62rem; }
  .custom-deck-editor { padding: 6px; }
  .custom-deck-editor__heading { margin-bottom: 4px; }
  .custom-deck-editor__heading h4 { font-size: .9rem; }
  .custom-deck-form { gap: 5px; }
  .custom-deck-meta { grid-template-columns: minmax(0, 1.15fr) minmax(150px, .85fr); gap: 6px; }
  .custom-deck-meta input { min-height: 30px; }
  .custom-deck-rules { min-height: 36px; padding: 3px 5px; }
  .custom-deck-rules strong { font-size: .9rem; }
  .custom-deck-rules small { display: none; }
  .custom-deck-builder-grid { grid-template-columns: minmax(0, 1.58fr) minmax(192px, .9fr); gap: 6px; }
  .custom-deck-picker, .custom-deck-selection { padding: 5px; }
  .custom-deck-picker { display: flex; min-height: 0; flex-direction: column; }
  .custom-deck-picker__heading { margin-bottom: 4px; }
  .custom-deck-picker__heading h5 { font-size: .88rem; }
  .custom-deck-validation { min-height: 22px; padding: 2px 5px; font-size: .61rem; }
  .custom-deck-filter-primary { grid-template-columns: minmax(0, 1fr) minmax(80px, .48fr) auto; gap: 4px; }
  .custom-deck-filter-primary input, .custom-deck-filter-primary select { min-height: 29px; }
  #custom-deck-more-filters { display: block; min-height: 29px; padding: 4px 5px; font-size: .62rem; white-space: nowrap; }
  .custom-deck-filters { display: none; }
  .custom-deck-filters:not([hidden]) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .custom-deck-filters select { min-height: 29px; padding: 4px; font-size: .65rem; }
  .custom-deck-filter-summary { min-height: 23px; }
  .custom-deck-card-library { min-height: 230px; max-height: none; flex: 1 1 230px; grid-template-columns: minmax(0, 1fr); gap: 5px; overflow-y: auto; overscroll-behavior-y: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
  .custom-deck-card-item { min-height: 145px; grid-template-columns: 104px minmax(0, 1fr); }
  .custom-deck-card-art { width: 104px; }
  .custom-deck-card-content { gap: 2px; padding: 4px 5px; }
  .custom-deck-card-content strong { font-size: .72rem; }
  .custom-deck-card-content small, .custom-deck-card-item__stats, .custom-deck-card-item__keywords, .custom-deck-card-item__effect { font-size: .68rem; }
  .custom-deck-card-actions { min-height: 29px; padding: 2px 4px; }
  .custom-deck-card-actions .button { min-height: 24px; padding: 2px 5px; font-size: .62rem; }
  .custom-deck-champion { gap: 4px; padding: 4px; }
  .custom-deck-champion-preview { grid-template-columns: 43px minmax(0, 1fr); gap: 4px; }
  .custom-deck-champion-art { width: 43px; height: 51px; font-size: 1.5rem; }
  .custom-deck-champion-copy strong { font-size: .72rem; }
  .custom-deck-champion-copy small { font-size: .62rem; }
  .custom-deck-champion select { min-height: 29px; padding: 4px; font-size: .65rem; }
  .custom-deck-selection__heading { margin: 5px 0 3px; }
  .custom-deck-selected-cards { max-height: 104px; min-height: 0; }
  .custom-deck-selected-item { padding: 3px 4px; }
  .custom-deck-selected-item strong { font-size: .66rem; }
  .custom-deck-selected-item small:not(.custom-deck-card-cost) { display: none; }
  .custom-deck-selected-item .custom-deck-card-cost { display: block; }
  .custom-deck-selected-actions input { width: 34px; min-height: 25px; }
  .custom-deck-selected-actions .button { min-height: 25px; padding: 2px 4px; font-size: .6rem; }
  .custom-deck-form-actions .button { min-height: 29px; padding: 4px; font-size: .6rem; }
}

@media (max-width: 560px) and (orientation: portrait) {
  .custom-decks-header { align-items: stretch; flex-direction: column; }
  .custom-deck-meta, .custom-deck-builder-grid { grid-template-columns: 1fr; }
  .custom-deck-filter-primary { grid-template-columns: minmax(0, 1fr) minmax(100px, .5fr); }
  .custom-deck-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .custom-deck-card-library { grid-template-columns: minmax(0, 1fr); max-height: 460px; }
  .custom-deck-card-item { min-height: 145px; grid-template-columns: 104px minmax(0, 1fr); }
  .custom-deck-card-art { width: 104px; }
  .custom-deck-selected-cards { max-height: 190px; }
}
