/* Browsers give form controls (button/input/select/textarea) their own UI
   font by default instead of inheriting the page's -- summary too, since the
   "More" menu uses it as a button. Reset once here rather than repeating
   font-family on every rule below. */
button, input, select, textarea, summary {
  font-family: inherit;
}

/* ---- page shell + hero: scoped to this page only (.page-shell.my-decks-shell),
   so the wider max-width and shorter hero never leak onto other tool pages
   that share .page-shell/.tool-card-feature. The extra ".dc-shell-ready"
   qualifier isn't for scoping -- it's to out-specificity site-shell.css's
   ".dc-shell-ready .page-shell" (max-width: 1040px), which is injected by
   site-nav.js and therefore always ends up last in the cascade, after this
   file, regardless of <link> order in the page's own <head>. */
.dc-shell-ready .page-shell.my-decks-shell {
  width: 100%;
  max-width: 1280px;
  padding-inline: 16px;
}
@media (min-width: 640px) {
  .dc-shell-ready .page-shell.my-decks-shell { padding-inline: 24px; }
}
@media (min-width: 1024px) {
  .dc-shell-ready .page-shell.my-decks-shell { padding-inline: 32px; }
}

.my-decks-hero {
  padding: 22px 26px;
}
.my-decks-hero .page-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin-top: 6px;
}
.my-decks-hero .page-intro {
  max-width: 68ch;
  font-size: 0.92rem;
  margin-top: 6px;
}

.my-decks-status-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  background: var(--surface, #111115);
  border: 1px solid var(--border, rgba(255,255,255,0.06));
  border-radius: var(--radius-md, 16px);
  padding: 12px 18px;
  margin-bottom: 16px;
}
.my-decks-status-bar p { margin: 0; font-size: 0.88rem; color: var(--muted, #9a978f); }
.my-decks-status-bar strong { color: var(--text, #e8e8ea); }
.my-decks-status-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- toolbar: one coherent row -- search grows, sort/filter take a fixed
   share, Add deck stays the strongest, fixed-width action at the end. ---- */
.my-decks-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 16px;
}
.my-decks-toolbar-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  display: inline-flex; color: var(--muted, #9a978f); pointer-events: none;
}
.my-decks-toolbar-icon svg { width: 15px; height: 15px; display: block; }

.my-decks-search-field {
  position: relative; flex: 1 1 260px; min-width: 200px;
}
.my-decks-search-field input[type="search"] {
  width: 100%; height: 42px; box-sizing: border-box;
  padding: 0 14px 0 38px; border-radius: 10px;
  border: 1px solid var(--border-strong, rgba(255,255,255,0.12));
  background: rgba(255,255,255,0.03); color: var(--text, #e8e8ea); font-size: 0.9rem;
}

.my-decks-select-wrap {
  position: relative; flex: 0 1 auto; min-width: 168px;
}
.my-decks-select-wrap--sort { flex-basis: 190px; }
.my-decks-select-wrap--filter { flex-basis: 150px; }
.my-decks-select-wrap select {
  width: 100%; height: 42px; box-sizing: border-box; appearance: none;
  padding: 0 30px 0 38px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border-strong, rgba(255,255,255,0.12));
  background: rgba(255,255,255,0.03); color: var(--text, #e8e8ea); font-size: 0.9rem;
}
.my-decks-select-chevron {
  position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  display: inline-flex; color: var(--muted, #9a978f); pointer-events: none;
}
.my-decks-select-chevron svg { width: 14px; height: 14px; display: block; }

.my-decks-search-field input[type="search"]:focus-visible,
.my-decks-select-wrap select:focus-visible {
  outline: none; border-color: var(--accent, #c9a84c);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.16);
}

.my-decks-add-btn { flex: 0 0 auto; height: 42px; padding: 0 18px; margin-left: auto; }

@media (max-width: 860px) {
  .my-decks-toolbar { row-gap: 10px; }
  .my-decks-search-field { flex-basis: 100%; }
  .my-decks-select-wrap { flex: 1 1 160px; }
  .my-decks-add-btn { margin-left: 0; flex: 1 1 100%; }
}

/* ---- deck library: a single-column list of horizontal cards, not a
   multi-column grid -- reads well whether there's 1 deck or 50. ---- */
.my-decks-list {
  display: flex; flex-direction: column; gap: 14px;
}

.my-deck-card {
  display: flex;
  min-height: 160px;
  background: var(--surface, #111115);
  border: 1px solid var(--border, rgba(255,255,255,0.06));
  border-radius: 14px;
  transition: border-color 150ms ease, background 150ms ease;
  /* Deliberately NOT overflow:hidden here -- the "More" actions menu below
     is an absolutely-positioned child of this card, and hiding overflow on
     an ancestor of an absolutely-positioned element clips it even though
     it renders outside the card's own box. Each child that needs its
     background-image clipped to the card's rounded corners gets its own
     matching border-radius instead (see .my-deck-card-art below). */
  isolation: isolate;
}
.my-deck-card:hover {
  border-color: var(--border-strong, rgba(255,255,255,0.14));
  background: rgba(255,255,255,0.035);
}
.my-deck-card.is-clickable { cursor: pointer; }
.my-deck-card.is-clickable:focus-visible {
  outline: 2px solid var(--accent, #c9a84c);
  outline-offset: 2px;
}
/* Interactive controls inside the card keep their own default cursor so they
   don't inherit the card-wide pointer intent. */
.my-deck-card.is-clickable :is(button, a, summary, input, select) { cursor: pointer; }
.my-deck-card.is-clickable .my-deck-card-title-input { cursor: text; }

/* Loading affordances: a spinner shared by the running-audit button and the
   busy status toast, so a slow first audit reads clearly as in-progress. */
.my-decks-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  flex: 0 0 16px;
  box-sizing: border-box;
  border: 2px solid rgba(201, 168, 76, 0.28);
  border-top-color: var(--accent, #c9a84c);
  border-radius: 50%;
  animation: my-decks-spin 0.75s linear infinite;
}
.my-decks-spinner--sm { width: 13px; height: 13px; flex-basis: 13px; }
@keyframes my-decks-spin { to { transform: rotate(360deg); } }

.my-decks-toast.my-decks-toast--busy { display: flex; align-items: center; gap: 10px; }
.my-decks-toast .my-decks-spinner { border-color: rgba(255,255,255,0.22); border-top-color: var(--accent, #c9a84c); }

.my-deck-card-actions .secondary.is-loading {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  cursor: progress; opacity: 0.9;
}
.my-deck-card-actions .secondary.is-loading .my-decks-spinner {
  border-color: rgba(255,255,255,0.25); border-top-color: var(--accent, #c9a84c);
}

@media (prefers-reduced-motion: reduce) {
  .my-decks-spinner { animation-duration: 1.6s; }
}

.my-deck-card-art {
  flex: 0 0 150px;
  position: relative;
  background: rgba(255,255,255,0.04);
  background-size: cover;
  background-position: center;
  border-radius: 14px 0 0 14px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.my-deck-card-art-fallback { color: var(--muted, #9a978f); opacity: 0.55; }
.my-deck-card-art.has-image .my-deck-card-art-fallback { display: none; }

.my-deck-card-body {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 20px;
  padding: 18px 22px;
}
.my-deck-card-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.my-deck-card-title {
  font-size: 1.15rem; font-weight: 700; margin: 0; color: var(--text, #e8e8ea);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.my-deck-card-title-input {
  font-size: 1.15rem; font-weight: 700; width: 100%;
  background: rgba(255,255,255,0.05); border: 1px solid var(--accent, #c9a84c);
  border-radius: 6px; padding: 2px 6px; color: var(--text);
}
.my-deck-card-commanders {
  color: var(--muted, #9a978f); font-size: 0.88rem; margin: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.my-deck-card-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px 16px;
  font-size: 0.78rem; color: var(--muted, #9a978f); margin-top: 2px;
}
.my-deck-card-meta-item { display: inline-flex; align-items: center; gap: 5px; }
.my-deck-card-meta-item svg { flex: none; opacity: 0.85; }
a.my-deck-card-meta-item { color: inherit; text-decoration: none; }
a.my-deck-card-meta-item:hover { color: var(--text, #e8e8ea); }

/* Compact "source changed" status line -- a small dot + text + a single
   action, never a boxed callout nested inside the card. */
.my-deck-card-status {
  display: flex; align-items: center; gap: 8px; font-size: 0.78rem;
  color: #7ef0c8; margin-top: 2px;
}
.my-deck-card-status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.my-deck-card-status-action {
  padding: 3px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 700;
  border: 1px solid rgba(126, 240, 200, 0.4); background: rgba(126, 240, 200, 0.12);
  color: #7ef0c8; cursor: pointer; transition: background 150ms ease;
}
.my-deck-card-status-action:hover { background: rgba(126, 240, 200, 0.24); }

/* ---- actions: Open (primary) + Run audit (secondary) stay on one line;
   the overflow menu is an icon-only trigger, not a third equally-weighted
   button. ---- */
.my-deck-card-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.my-deck-card-actions .primary,
.my-deck-card-actions .secondary {
  height: 40px; padding: 0 16px; border-radius: 9px; font-size: 0.85rem; font-weight: 650;
  cursor: pointer; white-space: nowrap; transition: background 150ms ease, border-color 150ms ease, filter 150ms ease;
}
.my-deck-card-actions .primary {
  border: 1px solid var(--accent, #c9a84c); background: var(--accent, #c9a84c); color: #14140f;
}
.my-deck-card-actions .primary:hover { filter: brightness(1.06); }
.my-deck-card-actions .secondary {
  border: 1px solid var(--border-strong, rgba(255,255,255,0.12)); background: rgba(255,255,255,0.02); color: var(--text, #e8e8ea);
}
.my-deck-card-actions .secondary:hover { background: rgba(255,255,255,0.06); border-color: var(--border-strong, rgba(255,255,255,0.2)); }

.my-deck-card-more { position: relative; }
.my-deck-card-more > summary {
  list-style: none; width: 40px; height: 40px; border-radius: 9px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong, rgba(255,255,255,0.1)); color: var(--muted, #9a978f);
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.my-deck-card-more > summary::-webkit-details-marker { display: none; }
.my-deck-card-more > summary:hover,
.my-deck-card-more[open] > summary {
  background: rgba(255,255,255,0.06); color: var(--text, #e8e8ea); border-color: var(--border-strong, rgba(255,255,255,0.2));
}
.my-deck-card-more .actions-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; min-width: 180px;
  background: var(--surface, #16161a); border: 1px solid var(--border-strong, rgba(255,255,255,0.12));
  border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 2px;
  box-shadow: 0 10px 26px rgba(0,0,0,0.4);
}
.my-deck-card-more .actions-dropdown button {
  border: none; background: none; text-align: left; padding: 8px 9px; border-radius: 6px;
  color: var(--text, #e8e8ea); font-size: 0.85rem; cursor: pointer;
}
.my-deck-card-more .actions-dropdown button:hover { background: rgba(255,255,255,0.06); }
.my-deck-card-more .actions-dropdown button.destructive { color: #ff8a8a; }
.actions-dropdown-sep { height: 1px; margin: 4px 2px; background: var(--border, rgba(255,255,255,0.08)); }

button:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent, #c9a84c); outline-offset: 2px;
}

/* ---- tablet: art stays beside the content, but actions drop underneath
   the metadata instead of squeezing onto the same row. ---- */
@media (max-width: 1024px) and (min-width: 641px) {
  .my-deck-card-body { flex-direction: column; align-items: stretch; gap: 12px; }
  .my-deck-card-actions { justify-content: flex-start; }
}

/* ---- mobile: the whole card stacks; artwork goes full width on top,
   "Open deck" becomes the clear full-width primary action. ---- */
@media (max-width: 640px) {
  .my-deck-card { flex-direction: column; min-height: 0; }
  .my-deck-card-art {
    flex-basis: auto; width: 100%; aspect-ratio: 16 / 9;
    border-radius: 14px 14px 0 0;
  }
  .my-deck-card-body { flex-direction: column; align-items: stretch; padding: 16px; gap: 14px; }
  .my-deck-card-actions { flex-wrap: wrap; }
  .my-deck-card-actions .primary { flex: 1 1 100%; height: 44px; }
  .my-deck-card-actions .secondary { flex: 1 1 auto; height: 44px; }
  .my-deck-card-more { flex: 0 0 44px; }
  .my-deck-card-more > summary { width: 44px; height: 44px; }
}

.my-decks-state {
  text-align: center; padding: 48px 20px; color: var(--muted, #9a978f);
  background: var(--surface, #111115); border: 1px solid var(--border, rgba(255,255,255,0.06));
  border-radius: var(--radius-md, 16px);
}
.my-decks-state h2 { color: var(--text, #e8e8ea); margin: 0 0 8px; font-size: 1.1rem; }
.my-decks-state p { margin: 0 0 16px; }

.my-decks-skeleton { display: flex; flex-direction: column; gap: 14px; }
.my-decks-skeleton-card {
  height: 160px; border-radius: 14px;
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.07) 37%, rgba(255,255,255,0.03) 63%);
  background-size: 400% 100%; animation: dc-skeleton-shine 1.4s ease infinite;
}
@keyframes dc-skeleton-shine { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.my-decks-offline-banner {
  background: rgba(255, 190, 90, 0.12); border: 1px solid rgba(255, 190, 90, 0.35);
  color: #ffd18a; border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; font-size: 0.88rem;
}

/* .dc-confirm-dialog and Account settings styling now live in auth-ui.css --
   both the dialog and its trigger (site-nav.js's account dropdown) need to
   work from any page, not just My Decks, and auth-ui.js is the module
   that's already loaded site-wide. */
