:root {
    --bg-main: #0a0f1d;
    --bg-surface: #111827;
    --bg-surface-elevated: #1e293b;
    --bg-surface-hover: #28354f;
    --border-color: #2e3d5b;
    --border-highlight: #3b82f6;
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-gold: #f59e0b;
    --accent-blue: #38bdf8;
    --accent-emerald: #10b981;
    --accent-purple: #a855f7;
    --accent-rose: #f43f5e;
    
    --foil-gradient: linear-gradient(135deg, rgba(255,0,128,0.2) 0%, rgba(0,255,255,0.2) 50%, rgba(255,255,0,0.2) 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

h1, h2, h3, h4, .brand-font {
    font-family: 'Cinzel', serif;
    letter-spacing: 0.03em;
}

/* App Layout with Collapsed Sidebar by Default */
.app-container {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

@media (min-width: 768px) {
    .app-container {
        flex-direction: row;
    }
}

/* Sidebar */
.sidebar {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: width 0.2s ease;
    z-index: 50;
}

@media (min-width: 768px) {
    .sidebar {
        min-height: 100vh;
        border-right: 1px solid var(--border-color);
        border-bottom: none;
        position: sticky;
        top: 0;
        width: 64px; /* Collapsed by default */
        padding: 1rem 0.5rem;
    }

    .sidebar.expanded {
        width: 240px;
        padding: 1rem 0.75rem;
    }
}

.brand-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar:not(.expanded) .brand-header {
    justify-content: center;
}

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: bold;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

.brand-title {
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    background: linear-gradient(to right, #f8fafc, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: stretch;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    transition: all 0.2s ease;
}

.sidebar:not(.expanded) .nav-link {
    justify-content: center;
    padding: 0.65rem 0;
    width: 100%;
}

.nav-link .nav-icon {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    text-align: center;
    flex-shrink: 0;
    line-height: 1;
}

.sidebar:not(.expanded) .nav-link .nav-icon {
    margin: 0 auto;
}

.nav-link:hover {
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
}

.nav-link.active {
    background-color: #2563eb26;
    color: var(--accent-blue);
    border: 1px solid #3b82f640;
}

.main-content {
    flex: 1;
    padding: 1.25rem;
    max-width: 1700px;
    margin: 0 auto;
    width: 100%;
}

@media (min-width: 1024px) {
    .main-content {
        padding: 1.75rem 2rem;
    }
}

/* Panels */
.panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    gap: 1rem;
}

/* Stats Header */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-value.gold { color: var(--accent-gold); }
.stat-value.emerald { color: var(--accent-emerald); }
.stat-value.blue { color: var(--accent-blue); }

/* Filter Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    align-items: center;
}

.input-field, .select-field {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.55rem 0.85rem;
    border-radius: 8px;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
}

.input-field:focus, .select-field:focus {
    border-color: var(--border-highlight);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary { background-color: #2563eb; color: #ffffff; }
.btn-primary:hover { background-color: #1d4ed8; }
.btn-secondary { background-color: var(--bg-surface-elevated); border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-secondary:hover { background-color: var(--bg-surface-hover); }
.btn-danger { background-color: #dc262626; border: 1px solid #ef444450; color: #f87171; }
.btn-danger:hover { background-color: #dc2626; color: #fff; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

/* ========================================================= */
/* GATHERS-STYLE CARD GRID & TILES                           */
/* ========================================================= */
.gathers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 1.5rem 1.25rem;
    padding-top: 1rem;
}

.gathers-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: visible;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}

.gathers-card:hover {
    transform: translateY(-4px);
    border-color: #3b82f680;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.gathers-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 2.5 / 3.5;
    background-color: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gathers-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px 10px 0 0;
    transition: transform 0.25s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.gathers-card:hover .gathers-card-image {
    transform: scale(1.02);
}

/* Stacked card layers rendered behind and offset to create a 3D deck stack */
.gathers-card-stack-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    object-fit: cover;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: -2px -4px 12px rgba(0, 0, 0, 0.7);
    transition: transform 0.25s ease, filter 0.25s ease;
}

/* Layer offsets (up and to the right) */
.gathers-card-stack-layer-1 {
    transform: translate(6px, -7px) rotate(1.5deg);
    filter: brightness(0.82) contrast(0.95);
    z-index: 0;
}

.gathers-card-stack-layer-2 {
    transform: translate(12px, -14px) rotate(3deg);
    filter: brightness(0.68) contrast(0.9);
    z-index: -1;
}

.gathers-card-stack-layer-3 {
    transform: translate(18px, -21px) rotate(4.5deg);
    filter: brightness(0.52) contrast(0.85);
    z-index: -2;
}

.gathers-card:hover .gathers-card-stack-layer-1 {
    transform: translate(9px, -11px) rotate(2.5deg);
    filter: brightness(0.9);
}

.gathers-card:hover .gathers-card-stack-layer-2 {
    transform: translate(17px, -20px) rotate(5deg);
    filter: brightness(0.78);
}

.gathers-card:hover .gathers-card-stack-layer-3 {
    transform: translate(25px, -29px) rotate(7.5deg);
    filter: brightness(0.65);
}

/* Badge on top left of picture (shifted down onto the art frame below the card name) */
.gathers-badge-qty {
    position: absolute;
    top: 34px;
    left: 8px;
    background: rgba(245, 158, 11, 0.95);
    color: #000;
    font-weight: 800;
    font-size: 0.82rem;
    padding: 0.12rem 0.55rem;
    border-radius: 9999px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    z-index: 4;
    backdrop-filter: blur(4px);
}

.gathers-badge-foil {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    color: #fff;
    font-weight: 700;
    font-size: 0.7rem;
    padding: 0.12rem 0.45rem;
    border-radius: 9999px;
    z-index: 4;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* Information under picture */
.gathers-card-info {
    padding: 0.6rem 0.75rem 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
}

.gathers-title {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.gathers-title:hover {
    color: var(--accent-blue);
}

.gathers-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    margin-top: 0.1rem;
}

.gathers-set-rarity {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}

.rarity-letter {
    font-weight: 800;
    font-size: 0.78rem;
}

.rarity-m { color: #ea580c; } /* Mythic */
.rarity-r { color: #eab308; } /* Rare */
.rarity-u { color: #38bdf8; } /* Uncommon */
.rarity-c { color: #94a3b8; } /* Common */
.rarity-s { color: #10b981; } /* Special */

.gathers-price {
    font-weight: 700;
    color: #cbd5e1;
    font-size: 0.85rem;
}

/* Steppers row below info */
.gathers-steppers-row {
    display: flex;
    gap: 0.4rem;
    padding: 0.4rem 0.65rem 0.65rem;
}

.gathers-stepper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.15rem 0.3rem;
}

.gathers-stepper.trade {
    border-color: rgba(245, 158, 11, 0.4);
}

.gathers-stepper-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    line-height: 1;
}

.gathers-stepper-btn:hover {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
}

.gathers-stepper-val {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
}

.gathers-stepper.trade .gathers-stepper-val {
    color: var(--accent-gold);
}

/* Table View */
.table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.data-table th {
    background-color: var(--bg-surface-elevated);
    color: var(--text-secondary);
    padding: 0.8rem 1rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-surface);
}

.data-table tr:hover td {
    background-color: var(--bg-surface-hover);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 1rem;
}

.modal-content {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

/* Two-column layout with large readable card preview on the left */
.card-modal-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.card-modal-preview {
    width: 250px;
    min-width: 250px;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card-modal-preview-image {
    width: 100%;
    aspect-ratio: 2.5 / 3.5;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-modal-preview-image:hover {
    transform: scale(1.02);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.85);
}

/* Fullscreen Lightbox for Card Preview */
.card-fullscreen-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1.5rem;
    cursor: zoom-out;
    animation: fadeIn 0.15s ease-out;
}

.card-fullscreen-image {
    max-height: 90vh;
    max-width: 90vw;
    aspect-ratio: 2.5 / 3.5;
    object-fit: contain;
    border-radius: 18px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: default;
}

.card-fullscreen-hint {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.6);
    padding: 0.35rem 0.8rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
}

.card-modal-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    .card-modal-layout {
        flex-direction: column;
        align-items: center;
    }
    .card-modal-preview {
        width: 200px;
        min-width: 200px;
        position: static;
        margin-bottom: 1rem;
    }
}

/* Progress bar */
.progress-container {
    width: 100%;
    height: 10px;
    background-color: var(--bg-main);
    border-radius: 9999px;
    overflow: hidden;
    margin: 0.75rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
    transition: width 0.3s ease;
}

/* Condition Tags */
.cond-tag {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    border: 1px solid transparent;
}

.cond-unk { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border-color: rgba(148, 163, 184, 0.3); }
.cond-nm { background: rgba(16, 185, 129, 0.15); color: #34d399; border-color: rgba(16, 185, 129, 0.3); }
.cond-lp { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border-color: rgba(59, 130, 246, 0.3); }
.cond-mp { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border-color: rgba(245, 158, 11, 0.3); }
.cond-hp { background: rgba(239, 68, 68, 0.15); color: #f87171; border-color: rgba(239, 68, 68, 0.3); }
.cond-dmg { background: rgba(168, 85, 247, 0.15); color: #c084fc; border-color: rgba(168, 85, 247, 0.3); }

.card-location-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    background-color: var(--bg-surface-elevated);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    width: fit-content;
}

.location-subrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.85rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background-color: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ========================================================= */
/* DECK STATS & ANALYTICS DASHBOARD                          */
/* ========================================================= */
.deck-stats-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1.25rem;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.deck-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background-color: var(--bg-surface-elevated);
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid transparent;
    transition: background-color 0.15s ease;
}

.deck-stats-header:hover {
    background-color: #1e293b;
}

.deck-stats-header.expanded {
    border-bottom-color: var(--border-color);
}

.deck-stats-body {
    padding: 1.25rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    align-items: stretch;
}

.deck-stat-card {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.deck-stat-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #60a5fa;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Mana Curve Bar Chart */
.mana-curve-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    height: 180px;
    padding-top: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.mana-curve-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    position: relative;
}

.mana-curve-bar-container {
    width: 100%;
    max-width: 38px;
    display: flex;
    flex-direction: column-reverse;
    border-radius: 6px 6px 0 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
    min-height: 4px;
    transition: height 0.3s ease;
}

.mana-curve-segment {
    width: 100%;
    transition: height 0.3s ease;
}

.mana-curve-val-top {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
}

.mana-curve-lbl {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 0.4rem;
}

/* Color Legend & Donut Styles */
.stat-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.85rem;
    margin-top: 0.75rem;
    font-size: 0.78rem;
}

.stat-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-secondary);
}

.stat-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.donut-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
}

.donut-svg {
    transform: rotate(-90deg);
    overflow: visible;
}

.donut-segment {
    transition: stroke-dasharray 0.4s ease, stroke-width 0.2s ease;
    cursor: pointer;
}

.donut-segment:hover {
    filter: brightness(1.2);
}

.donut-center-text {
    position: absolute;
    text-align: center;
    pointer-events: none;
}

.donut-center-val {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.donut-center-lbl {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* Quick Metrics Row */
.quick-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.quick-metric-tile {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-direction: column;
}

.quick-metric-val {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--accent-gold);
}

.quick-metric-lbl {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.badge-trade { background-color: rgba(16, 185, 129, 0.85); color: #fff; }
.badge-foil { background: linear-gradient(135deg, #f59e0b, #ec4899); color: #fff; }
.badge-qty { background-color: rgba(59, 130, 246, 0.9); color: #fff; font-size: 0.8rem; }

/* ========================================================= */
/* PLAYTEST / SAMPLE HAND SIMULATOR                          */
/* ========================================================= */
.playtest-modal {
    max-width: 1080px;
    width: 95vw;
}

.playtest-hand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.85rem;
    padding: 0.5rem 0 1rem;
    min-height: 220px;
    align-items: flex-start;
}

.playtest-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    cursor: pointer;
    position: relative;
}

.playtest-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.75);
    border-color: #3b82f6;
    z-index: 5;
}

.playtest-card-img {
    width: 100%;
    aspect-ratio: 2.5 / 3.5;
    object-fit: cover;
    display: block;
}

.playtest-card-fallback {
    width: 100%;
    aspect-ratio: 2.5 / 3.5;
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    text-align: center;
    font-size: 0.78rem;
}

.playtest-card-meta {
    padding: 0.4rem 0.5rem;
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    background: var(--bg-surface);
}

.playtest-card-title {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.playtest-card-type {
    color: var(--text-muted);
    font-size: 0.68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playtest-stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    align-items: center;
    padding: 0.65rem 1rem;
    background: var(--bg-main);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 0.82rem;
    margin-bottom: 1rem;
}

/* Playtest Hand Rating Bar & Feedback Tracker */
.playtest-rating-panel {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.playtest-rating-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.playtest-ratio-bar-wrap {
    width: 100%;
    height: 24px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    border: 1px solid var(--border-color);
    position: relative;
}

.playtest-ratio-good {
    background: linear-gradient(90deg, #10b981, #059669);
    height: 100%;
    transition: width 0.35s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.playtest-ratio-bad {
    background: linear-gradient(90deg, #dc2626, #ef4444);
    height: 100%;
    transition: width 0.35s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.btn-rate-good {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #34d399;
    font-weight: 700;
}

.btn-rate-good:hover {
    background: #10b981;
    color: #fff;
}

.btn-rate-bad {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #f87171;
    font-weight: 700;
}

.btn-rate-bad:hover {
    background: #ef4444;
    color: #fff;
}

.playtest-mulligan-analytics {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.65rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.playtest-tier-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.playtest-tier-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    letter-spacing: 0.02em;
}

.playtest-tier-badge.tier-legendary {
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.5);
    color: #c084fc;
}

.playtest-tier-badge.tier-great {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #34d399;
}

.playtest-tier-badge.tier-good {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.5);
    color: #60a5fa;
}

.playtest-tier-badge.tier-warning {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.5);
    color: #fbbf24;
}

.playtest-tier-badge.tier-danger {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #f87171;
}

.playtest-ev-metric {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.playtest-ev-metric strong {
    color: var(--text-primary);
    font-weight: 700;
}

.playtest-tier-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.playtest-odds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.playtest-odds-card {
    background: var(--bg-card, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 0.4rem 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.2rem;
}

.playtest-odds-card .odds-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.playtest-odds-card .odds-val {
    font-size: 0.88rem;
    font-weight: 700;
}

/* ==========================================================================
   Trade Portal - Counter & Pile Styles
   ========================================================================== */
.trade-counter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface-elevated, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 8px;
    padding: 3px 6px;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.trade-counter-btn {
    background: var(--bg-surface, #0f172a);
    border: 1px solid var(--border-color, #334155);
    color: var(--text-primary, #f8fafc);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    line-height: 1;
    padding: 0;
}

.trade-counter-btn:hover:not(:disabled) {
    background: var(--accent-blue, #3b82f6);
    color: #fff;
    border-color: var(--accent-blue, #3b82f6);
    transform: scale(1.05);
}

.trade-counter-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.trade-counter-value {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--text-primary);
    text-align: center;
}

.trade-counter-sub {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
}

.trade-counter.has-active-count {
    border-color: var(--accent-gold, #f59e0b);
    background: rgba(245, 158, 11, 0.12);
}

.trade-counter.has-active-count .trade-counter-value {
    color: var(--accent-gold, #f59e0b);
}

/* Trade Piles Layout */
.trade-piles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.trade-pile-card {
    background: var(--bg-surface-elevated, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 12px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    transition: all 0.2s ease;
    position: relative;
}

.trade-pile-card:hover {
    border-color: var(--accent-blue, #3b82f6);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.trade-pile-card.selected-pile {
    border-color: var(--accent-gold, #f59e0b);
    background: rgba(245, 158, 11, 0.04);
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.15);
}