/* The shared deck view (TGG.Decks.Ui): used by the Deck Lab app and the website's public decklists.
   Built on the host's design tokens (both copy the site's: --surface, --text, --accent …), with fallbacks. */

.dv-scope {
    --dv-surface: var(--surface, #14141f);
    --dv-border: var(--surface-border, #262637);
    --dv-text: var(--text, #f2f2f8);
    --dv-muted: var(--text-muted, #a5a5ba);
    --dv-faint: var(--text-faint, #77778c);
    --dv-accent: var(--accent, #818cf8);
    --dv-accent-soft: var(--accent-soft, rgba(129, 140, 248, 0.14));
    --dv-radius: var(--radius-md, 16px);
    --dv-radius-sm: var(--radius-sm, 10px);
    --dv-card-radius: 4.75% / 3.5%;
    color: var(--dv-text);
}

.dv-muted { color: var(--dv-muted); }

/* ── Header ───────────────────────────────────────────────────────────── */

.dv-hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--dv-radius);
    min-height: 220px;
    display: flex;
    align-items: flex-end;
    background: #0d0d14;
    color: #fff;
    margin-bottom: 1.25rem;
    isolation: isolate;
}

.dv-hero--plain {
    min-height: 0;
    background: var(--dv-surface);
    border: 1px solid var(--dv-border);
    color: var(--dv-text);
}

.dv-hero-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
    z-index: -2;
}

.dv-hero-shade {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(to top, rgba(8, 8, 14, 0.92) 0%, rgba(8, 8, 14, 0.55) 45%, rgba(8, 8, 14, 0.15) 100%),
        linear-gradient(to right, rgba(8, 8, 14, 0.55), transparent 60%);
}

.dv-hero-body {
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.4rem 1.6rem;
    flex-wrap: wrap;
}

.dv-hero-text { min-width: 0; flex: 1 1 18rem; }

.dv-hero-eyebrow {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: 0.25rem;
}

.dv-hero-title-row { display: flex; align-items: center; gap: 0.35rem; min-width: 0; }

.dv-hero-title {
    margin: 0;
    font-size: clamp(1.6rem, 3.2vw, 2.4rem);
    line-height: 1.1;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.dv-hero:not(.dv-hero--plain) .dv-hero-title { text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5); }

.dv-hero-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }

.dv-hero-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.dv-hero-credit {
    position: absolute;
    right: 0.8rem;
    top: 0.6rem;
    font-size: 0.7rem;
    opacity: 0.65;
}

.dv-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: inherit;
    backdrop-filter: blur(6px);
    white-space: nowrap;
    text-decoration: none;
}

.dv-hero--plain .dv-chip { background: var(--dv-accent-soft); border-color: transparent; }
.dv-chip--ok { background: rgba(34, 197, 94, 0.22); border-color: rgba(34, 197, 94, 0.45); }
.dv-chip--warn { background: rgba(245, 158, 11, 0.24); border-color: rgba(245, 158, 11, 0.5); }
.dv-chip .mana-symbol { height: 0.95em; }

.dv-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    border-radius: var(--dv-radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.12);
    color: inherit;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    backdrop-filter: blur(6px);
}

.dv-button:hover { background: rgba(255, 255, 255, 0.22); }
.dv-hero--plain .dv-button { border-color: var(--dv-border); background: var(--dv-surface); }
.dv-button--primary { background: var(--dv-accent); border-color: var(--dv-accent); color: #fff; }
.dv-button--primary:hover { filter: brightness(1.08); background: var(--dv-accent); }
.dv-button svg { width: 1.05em; height: 1.05em; }

/* ── Page layout: list on the left, preview + stats on the right ─────── */

.dv-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 1.5rem;
    align-items: start;
}

.dv-aside {
    position: sticky;
    top: 4.25rem;
    display: grid;
    gap: 1rem;
}

@media (max-width: 1099px) {
    .dv-layout { grid-template-columns: minmax(0, 1fr); }
    .dv-aside { position: static; }
    .dv-preview { display: none; }
}

.dv-panel {
    background: var(--dv-surface);
    border: 1px solid var(--dv-border);
    border-radius: var(--dv-radius);
    padding: 1rem 1.1rem;
}

/* The deck picture (deckImage.js) — all the website shows of a shared deck. */
.dv-picture { padding: 0.5rem; }
.dv-picture img { display: block; width: 100%; height: auto; border-radius: calc(var(--dv-radius) - 4px); }
.dv-picture-status { margin: 0; padding: 3rem 1rem; text-align: center; color: var(--dv-muted); }
.dv-button:disabled { opacity: 0.55; cursor: default; }

.dv-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-bottom: 1rem;
}

.dv-segmented {
    display: inline-flex;
    border: 1px solid var(--dv-border);
    border-radius: var(--dv-radius-sm);
    overflow: hidden;
}

.dv-segmented button {
    border: 0;
    background: transparent;
    color: var(--dv-muted);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
}

.dv-segmented button + button { border-left: 1px solid var(--dv-border); }
.dv-segmented button[aria-pressed="true"] { background: var(--dv-accent-soft); color: var(--dv-accent); }

/* ── Zones (Main deck / Sideboard / Maybeboard) ───────────────────────── */

.dv-zone { margin-bottom: 1.75rem; }

.dv-zone-title {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin: 0 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--dv-border);
    font-size: 1.1rem;
    font-weight: 800;
}

.dv-zone-count { color: var(--dv-faint); font-weight: 600; font-size: 0.95rem; }

/* ── The list in columns ──────────────────────────────────────────────── */

.dv-columns { column-width: 230px; column-gap: 1.75rem; }

.dv-group { break-inside: avoid; margin-bottom: 1.1rem; }

.dv-group-title {
    margin: 0 0 0.3rem;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--dv-muted);
}

.dv-group-count { color: var(--dv-faint); font-weight: 600; margin-left: 0.2rem; }

.dv-lines { list-style: none; margin: 0; padding: 0; }

.dv-line {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.22rem 0.45rem;
    margin: 0 -0.45rem;
    border-radius: 6px;
    font-size: 0.93rem;
    line-height: 1.35;
    cursor: default;
}

.dv-line:hover, .dv-line:focus-visible { background: var(--dv-accent-soft); outline: none; }

.dv-scope[data-dv-tap-zoom] .dv-line[data-dv-image] { cursor: zoom-in; }

.dv-qty {
    min-width: 1.2em;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--dv-muted);
    font-weight: 700;
}

.dv-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dv-cost { white-space: nowrap; display: inline-flex; align-items: center; gap: 1px; }

.dv-scope .mana-symbol { height: 1em; width: 1em; vertical-align: -0.12em; }

/* ── Card images ──────────────────────────────────────────────────────── */

.dv-image-group { margin-bottom: 1.25rem; }

.dv-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(46%, 140px), 1fr));
    gap: 0.6rem;
}

.dv-card {
    position: relative;
    display: block;
    aspect-ratio: 488 / 680;
    border-radius: var(--dv-card-radius);
    overflow: hidden;
    background: var(--dv-accent-soft);
    box-shadow: 0 4px 14px -6px rgba(0, 0, 0, 0.45);
    transition: transform 0.12s ease;
}

.dv-card:hover, .dv-card:focus-visible { transform: translateY(-3px); outline: none; }
.dv-card img { width: 100%; height: 100%; object-fit: cover; display: block; }

.dv-card-missing {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 0.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--dv-muted);
}

.dv-card-qty {
    position: absolute;
    right: 6%;
    bottom: 5%;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: rgba(10, 10, 16, 0.85);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 800;
}

/* ── Preview + stats ──────────────────────────────────────────────────── */

.dv-preview img {
    display: block;
    width: 100%;
    aspect-ratio: 488 / 680;
    border-radius: var(--dv-card-radius);
    box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.6);
}

.dv-stats { display: grid; gap: 1rem; }

.dv-stat-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 0;
}

.dv-stat-row div { min-width: 0; }
.dv-stat-row dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dv-faint); font-weight: 700; }
.dv-stat-row dd { margin: 0.1rem 0 0; font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.dv-curve { display: flex; align-items: flex-end; gap: 0.35rem; height: 84px; }

.dv-curve-bar {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: 0.15rem;
}

.dv-curve-fill {
    display: block;
    width: 100%;
    border-radius: 4px 4px 2px 2px;
    background: linear-gradient(to top, var(--dv-accent), color-mix(in srgb, var(--dv-accent) 65%, #fff));
}

.dv-curve-count { font-size: 0.72rem; color: var(--dv-muted); min-height: 1em; }
.dv-curve-label { font-size: 0.72rem; color: var(--dv-faint); font-weight: 700; }

.dv-colour-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--dv-border); }
.dv-colour-bar span { display: block; height: 100%; }
.dv-colour--w { background: #f3eccb; }
.dv-colour--u { background: #2f7fd1; }
.dv-colour--b { background: #4b4048; }
.dv-colour--r { background: #dd3b2f; }
.dv-colour--g { background: #23955a; }

.dv-colour-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.9rem;
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    font-size: 0.82rem;
    color: var(--dv-muted);
}

.dv-types { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.2rem; font-size: 0.88rem; }
.dv-types li { display: flex; justify-content: space-between; }
.dv-types-count { font-weight: 700; font-variant-numeric: tabular-nums; }

.dv-stats--compact { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; }
.dv-stats--compact .dv-curve { height: 60px; }

@media (max-width: 599px) {
    .dv-stats--compact { grid-template-columns: minmax(0, 1fr); }
    .dv-hero { min-height: 170px; border-radius: var(--dv-radius-sm); }
    .dv-hero-body { padding: 1rem 1.1rem; }
    .dv-columns { column-width: auto; column-count: 1; }
}

/* ── Tap to zoom (phones) ─────────────────────────────────────────────── */

.dv-lightbox {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(5, 5, 10, 0.82);
    cursor: zoom-out;
}

.dv-lightbox[hidden] { display: none; }

.dv-lightbox img {
    width: min(88vw, 420px);
    aspect-ratio: 488 / 680;
    border-radius: var(--dv-card-radius);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
}

/* ── Website extras: text view, warnings, the public decklists' tiles ── */

.dv-text {
    margin: 0;
    white-space: pre-wrap;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

.dv-warnings { font-size: 0.88rem; }
.dv-warnings ul { margin: 0.4rem 0 0; padding-left: 1.1rem; color: var(--dv-muted); }

.dv-hero-eyebrow-link { color: inherit; text-decoration: none; }
.dv-hero-eyebrow-link:hover { text-decoration: underline; }

.dv-segmented--wrap { flex-wrap: wrap; }

.dv-deck-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 1rem;
}

.dv-deck-tile {
    display: flex;
    flex-direction: column;
    border-radius: var(--dv-radius);
    overflow: hidden;
    background: var(--dv-surface);
    border: 1px solid var(--dv-border);
    color: var(--dv-text);
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.dv-deck-tile:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -18px rgba(0, 0, 0, 0.5); }

.dv-deck-tile-art { aspect-ratio: 16 / 7; background: var(--dv-accent-soft); overflow: hidden; }
.dv-deck-tile-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; display: block; }

.dv-deck-tile-body { display: grid; gap: 0.2rem; padding: 0.75rem 0.9rem 0.9rem; }
.dv-deck-tile-name { font-size: 1.05rem; }
.dv-deck-tile-meta { display: inline-flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; font-size: 0.84rem; color: var(--dv-muted); }
