/* Global (non-scoped) copy of Mat.razor.css + StatsView.razor.css.
   WORKAROUND for .NET 10 scoped-CSS-on-interactive-render bug (dotnet/aspnetcore#64390):
   panels/StatsView are child components rendered only AFTER the circuit connects, so the
   runtime drops their b-scope attribute and their scoped .razor.css never matches. These
   same rules served GLOBALLY apply regardless of scope. (No ::deep in source, safe to copy.)
   Mat's own board/toolbar elements also carry the scoped versions — identical, so no change. */

/* ===================== Mat.razor.css ===================== */
.matpage {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: #0e1512;
    font-family: system-ui, sans-serif;
    color: #e8efe9;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 7px 14px;
    background: linear-gradient(180deg, #18261e, #111a15);
    border-bottom: 1px solid #25382e;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    flex: 0 0 auto;
}

/* left cluster: exit + title + info */
.toolbar .tb-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

/* Logged-out hint: a blank board means saved decks are hidden, not lost — make that obvious. */
.toolbar .loginchip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    color: #e8d9a8;
    background: rgba(90, 68, 32, 0.55);
    border: 1px solid #6b5424;
    border-radius: 8px;
    padding: 4px 10px;
}

.toolbar .loginchip:hover { background: #6b5424; color: #fff6df; }

.toolbar .icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    color: #cfe;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #2e463a;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: background 0.12s, border-color 0.12s;
}

.toolbar .icon-btn:hover {
    background: #1f6f43;
    border-color: #2e9159;
}

.toolbar .icon-btn.info {
    width: 26px;
    height: 26px;
    font-size: 13px;
}

.toolbar .tb-title {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

/* shortcuts popover (replaces the old inline hint sentence) */
.toolbar .info-wrap {
    position: relative;
    display: inline-flex;
}

.toolbar .info-wrap .pop {
    position: absolute;
    top: 130%;
    left: 0;
    z-index: 20;
    width: 340px;
    padding: 10px 12px;
    background: #0b120e;
    border: 1px solid #2e463a;
    border-radius: 10px;
    color: #8aa394;
    font-size: 12px;
    line-height: 1.7;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 0.12s, transform 0.12s;
}

.toolbar .info-wrap .pop b {
    color: #e8efe9;
}

.toolbar .info-wrap .pop kbd {
    background: #14201a;
    border: 1px solid #2e463a;
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 0 5px;
    color: #cfe;
    font-family: inherit;
    font-size: 11px;
}

.toolbar .info-wrap:hover .pop,
.toolbar .info-wrap:focus-within .pop {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* divider between clusters */
.toolbar .vsep {
    width: 1px;
    align-self: stretch;
    background: #25382e;
    margin: 2px 0;
}

/* center: segmented panel-toggle group */
.toolbar .seg {
    display: flex;
    align-items: stretch;
    border: 1px solid #2e463a;
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.toolbar .seg button {
    appearance: none;
    cursor: pointer;
    background: transparent;
    color: #8aa394;
    border: none;
    border-right: 1px solid #25382e;
    padding: 6px 11px;
    font-size: 12.5px;
    font-family: inherit;
    transition: background 0.12s, color 0.12s;
}

.toolbar .seg button:last-child {
    border-right: none;
}

.toolbar .seg button:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e8efe9;
}

.toolbar .seg button.on {
    background: #2e9159;
    color: #fff;
    box-shadow: inset 0 0 0 1px #6fd39a;
}

.toolbar .spacer {
    flex: 1 1 auto;
}

/* right cluster: selects + board actions + primary */
.toolbar .tb-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar .ghost {
    appearance: none;
    cursor: pointer;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.03);
    color: #e8efe9;
    border: 1px solid #2e463a;
    border-radius: 8px;
    padding: 6px 11px;
    font-size: 12.5px;
    transition: background 0.12s, border-color 0.12s;
}

.toolbar .ghost:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: #3c5a49;
}

.toolbar .sel {
    appearance: none;
    cursor: pointer;
    font-family: inherit;
    background: #0c1611 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%238aa394' stroke-width='1.5'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 9px center;
    color: #e8efe9;
    border: 1px solid #2e463a;
    border-radius: 8px;
    padding: 6px 26px 6px 10px;
    font-size: 12.5px;
}

.toolbar .primary {
    appearance: none;
    cursor: pointer;
    font-family: inherit;
    background: linear-gradient(180deg, #2e9159, #1f6f43);
    color: #fff;
    font-weight: 600;
    border: 1px solid #6fd39a;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12.5px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transition: filter 0.12s;
}

.toolbar .primary:hover {
    filter: brightness(1.1);
}

.toolbar .primary.on {
    box-shadow: inset 0 0 0 1px #6fd39a, inset 0 0 12px rgba(111, 211, 154, 0.4);
}

/* Deck manager */
.deckmgr {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    overflow-y: auto;
}

.deckmgr .dhead {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8aa394;
    margin-bottom: 4px;
}

.drow {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border-radius: 6px;
}

.drow.on {
    background: rgba(255, 210, 74, 0.10);
    box-shadow: inset 0 0 0 1px rgba(255, 210, 74, 0.4);
}

.drow .dsel {
    background: none;
    border: 0;
    color: #ffd24a;
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
}

.drow .dname {
    flex: 1 1 auto;
    background: #0c1611;
    border: 1px solid #2e463a;
    border-radius: 6px;
    color: #e8efe9;
    padding: 5px 7px;
    font-size: 13px;
    font-family: inherit;
    min-width: 0;
}

.drow .dcount {
    font-size: 11px;
    color: #8aa394;
    min-width: 22px;
    text-align: right;
}

.drow .dmove {
    background: none;
    border: 0;
    color: #8aa394;
    cursor: pointer;
    font-size: 10px;
    padding: 0 1px;
    line-height: 1;
}

.drow .dmove:hover {
    color: #cfe;
}

.drow .ddel {
    background: none;
    border: 0;
    color: #b56;
    cursor: pointer;
    font-size: 13px;
    padding: 0 4px;
}

.drow .ddel:hover {
    color: #e88;
}

.deckmgr .add {
    margin-top: 10px;
    background: #1f6f43;
    color: #fff;
    border: 1px solid #2e9159;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    font-size: 13px;
}

.deckmgr .add:disabled {
    opacity: 0.45;
    cursor: default;
}

/* Commander row (active deck) + new-deck form + picker */
.cmdrow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(255, 210, 74, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 210, 74, 0.30);
}

.cmdrow .cmdname {
    flex: 1 1 auto;
    font-size: 12px;
    color: #ffd24a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cmdrow .cmdwarn {
    flex: 1 1 auto;
    font-size: 12px;
    color: #e8a;
}

.cmdset {
    background: #173a28;
    color: #cfe;
    border: 1px solid #2e463a;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 11px;
    flex: 0 0 auto;
}

.cmdset:hover {
    background: #1f6f43;
}

.newdeck {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
    background: #0c1611;
    box-shadow: inset 0 0 0 1px #25382e;
}

.newdeck .cmdname {
    font-size: 12px;
    color: #ffd24a;
}

.newdeck .cmdhint {
    font-size: 11px;
    color: #8aa394;
    line-height: 1.4;
}

.newdeckbtns {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.newdeckbtns .add {
    flex: 1 1 auto;
    margin-top: 0;
}

.newdeckbtns .cancel {
    background: none;
    color: #8aa394;
    border: 1px solid #2e463a;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
}

.newdeckbtns .cancel:hover {
    color: #cfe;
}

.cmdpicker {
    margin-top: 8px;
    border-radius: 8px;
    background: #0c1611;
    box-shadow: inset 0 0 0 1px #25382e;
    padding: 4px;
}

.cmdpicker .results {
    max-height: 320px;
}

.cifilter {
    display: inline-block;
    margin-left: 6px;
    color: #ffd24a;
    background: rgba(255, 210, 74, 0.12);
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 11px;
}

.mat {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

.searchpanel {
    position: absolute;
    top: 49px;
    right: 0;
    bottom: 0;
    width: 320px;
    background: #11201a;
    border-left: 1px solid #25382e;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
}

.searchpanel.wide { width: 460px; }
.searchpanel .sd-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 12px 12px; }

.searchhead {
    display: flex;
    gap: 6px;
    padding: 10px;
}

.syncbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-top: 1px solid #25382e;
    font-size: 11px;
    color: #8aa394;
}

.syncbar .counts {
    flex: 1 1 auto;
}

.syncbar button {
    background: #173a28;
    color: #cfe;
    border: 1px solid #2e463a;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 11px;
}

.searchbox {
    flex: 1 1 auto;
    background: #0c1611;
    border: 1px solid #2e463a;
    border-radius: 6px;
    color: #e8efe9;
    padding: 7px 9px;
    font-size: 13px;
    font-family: inherit;
}

.searchhead button {
    background: #1f6f43;
    color: #fff;
    border: 1px solid #2e9159;
    border-radius: 6px;
    padding: 0 12px;
    cursor: pointer;
}

.searchstatus {
    padding: 0 12px 8px;
    font-size: 12px;
    color: #8aa394;
}

.searchstatus .err {
    color: #e88;
}

.results {
    flex: 1 1 auto;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px;
    align-content: start;
}

.result {
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    border-radius: 6px;
    line-height: 0;
    position: relative;
}

.result img {
    width: 100%;
    border-radius: 6px;
    display: block;
    transition: transform 0.08s ease;
}

.result:hover img {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Search result "+ Add" (click the card opens the reader; this button adds). Hover-revealed and
   click-through until shown, so it never blocks the card's click-to-open. */
.result .resadd {
    position: absolute;
    top: 4px; right: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 8px;
    border: 0;
    font-family: inherit;
    cursor: pointer;
    background: rgba(31, 111, 67, 0.95);
    color: #fff;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s ease;
}
.result .resadd:hover { background: rgba(46, 145, 89, 0.98); }
.result:hover .resadd { opacity: 1; pointer-events: auto; }

.result .prints {
    display: block;
    width: 100%;
    background: rgba(0, 0, 0, 0.55);
    color: #ffd24a;
    border: 0;
    border-radius: 0 0 6px 6px;
    font-size: 10px;
    padding: 2px 0;
    margin-top: -4px;
    cursor: pointer;
    line-height: 1.4;
}

.result .prints:hover {
    background: rgba(0, 0, 0, 0.75);
}

.printstrip {
    grid-column: 1 / -1;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 2px 2px 8px;
}

.printstrip img {
    height: 86px;
    border-radius: 4px;
    cursor: pointer;
    flex: 0 0 auto;
    border: 2px solid transparent;
}

.printstrip img:hover {
    border-color: #2e9159;
}

/* Library */
.savedlist {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.savedrow {
    display: flex;
    gap: 6px;
}

.savedrow .loadbtn {
    flex: 1 1 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0c1611;
    color: #e8efe9;
    border: 1px solid #2e463a;
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
}

.savedrow .loadbtn:hover {
    background: #173a28;
    border-color: #2e9159;
}

.savedrow .loadbtn .cc {
    color: #8aa394;
    font-size: 11px;
    background: #101814;
    border-radius: 10px;
    padding: 1px 7px;
}

.savedrow .ddel {
    background: none;
    border: 0;
    color: #b56;
    cursor: pointer;
    font-size: 13px;
    padding: 0 6px;
}

.savedrow .ddel:hover {
    color: #e88;
}

/* Zone breakdown chips (Stats panel) */
.zonebar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 2px 0 8px;
}

.zonebar .zchip {
    font-size: 11px;
    color: #cfe;
    background: #101c15;
    border: 1px solid #2e463a;
    border-radius: 10px;
    padding: 2px 9px;
}

.zonebar .zchip.over {
    color: #e8a;
    border-color: #7a3b3b;
    background: rgba(200, 80, 80, 0.14);
}

/* Stats panel */
.statspanel {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    overflow-y: auto;
}

.statspanel .dhead {
    font-size: 13px;
    font-weight: 600;
    color: #e8efe9;
    margin-bottom: 6px;
}

.legality {
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
    margin: 4px 0 6px;
}

.legality.ok {
    background: rgba(46, 145, 89, 0.18);
    border: 1px solid #2e9159;
    color: #8fe0ad;
}

.legality.bad {
    background: rgba(200, 80, 80, 0.16);
    border: 1px solid #7a3b3b;
    color: #e8a;
}

.sd-scroll .issue {
    font-size: 12px;
    color: #d9b27a;
    padding: 2px 2px;
}

.statgroup {
    margin: 8px 0 4px;
}

.statgroup .gtitle {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8aa394;
    margin-bottom: 4px;
}

.statrow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0;
}

.statrow .slabel {
    width: 84px;
    font-size: 12px;
    color: #cfe;
    flex: 0 0 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.statrow .sbar {
    flex: 1 1 auto;
    height: 12px;
    background: #0c1611;
    border-radius: 4px;
    overflow: hidden;
}

.statrow .sfill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #2e9159, #6fd39a);
    border-radius: 4px;
}

.statrow .scount {
    width: 28px;
    text-align: right;
    font-size: 12px;
    color: #e8efe9;
    flex: 0 0 auto;
}

/* Card reader overlay (double-click) */
.reader {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.66);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.readercard {
    display: flex;
    gap: 18px;
    max-width: 1060px;
    max-height: 88vh;
    padding: 18px;
    background: #14201a;
    border: 1px solid #2e463a;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.readerimg img {
    height: min(74vh, 600px);
    border-radius: 12px;
    display: block;
}

.readerside {
    width: 440px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.readername {
    font-size: 17px;
    font-weight: 600;
    color: #e8efe9;
}

.readerbtns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.rbtn {
    background: #1f6f43;
    color: #fff;
    border: 1px solid #2e9159;
    border-radius: 6px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 13px;
}

.rbtn:hover { background: #258050; }
.rbtn.close { background: #173a28; color: #cfe; border-color: #2e463a; }
.rbtn.save { background: #1f6f43; }

.rlabel {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8aa394;
    margin-top: 4px;
}

.readernote {
    flex: 1 1 auto;
    min-height: 160px;
    background: #0c1611;
    border: 1px solid #2e463a;
    border-radius: 8px;
    color: #e8efe9;
    padding: 9px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}

.reader:focus { outline: none; }

.rtabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #2e463a;
    margin-top: 4px;
}

.rtab {
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    color: #8aa394;
    padding: 6px 9px;
    cursor: pointer;
    font-size: 12px;
}

.rtab:hover { color: #cfe; }

.rtab.on {
    color: #e8efe9;
    border-bottom-color: #2e9159;
}

.rtabbody {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow-y: auto;
}

.versions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}

.versions img {
    width: 100%;
    border-radius: 5px;
    cursor: pointer;
    border: 2px solid transparent;
    display: block;
}

.versions img:hover { border-color: #2e9159; }

/* Synergy badge on search results */
.synbadge {
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    padding: 3px 5px;
    border-radius: 9px;
    color: #06120b;
    box-shadow: 0 1px 3px rgba(0,0,0,.5);
    pointer-events: none;
}

.synbadge.syn-hi { background: #58c98a; }
.synbadge.syn-md { background: #c9b958; }
.synbadge.syn-lo { background: #8aa39a; }

/* Synergy "why" tooltip — shown when hovering the search result (the badge itself stays
   click-through so clicking the card still adds it). */
.syntip {
    position: absolute;
    top: 20px;
    left: 3px;
    right: 3px;
    z-index: 30;
    padding: 6px 8px;
    background: rgba(8, 16, 12, 0.97);
    border: 1px solid #2e9159;
    border-radius: 8px;
    color: #c8d8ce;
    font-size: 10.5px;
    line-height: 1.45;
    box-shadow: 0 6px 16px rgba(0,0,0,.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity .1s ease;
}
.syntip b { color: #9fe0bd; display: block; margin-bottom: 2px; }
.result:hover .syntip { opacity: 1; }

/* Detected combos */
.combocard {
    background: #16241b;
    border: 1px solid #244231;
    border-left: 3px solid #2e9159;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 6px;
}

.combocard.near { border-left-color: #c9b958; }

.combocard .cmbtn {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 5px;
    border: 1px solid #2e9159;
    background: #1b2d21;
    color: #cdebd9;
    cursor: pointer;
}

.combocard .cmbtn:hover { background: #244231; }

.combosep { border: 0; border-top: 1px solid #1c3225; margin: 14px 0; }

.combocard { cursor: pointer; transition: border-color .1s ease, background .1s ease; }
.combocard:hover { border-color: #2e9159; background: #1b2d21; }
.comborow { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.cmbtn.ghost { border-color: #2a3b32; background: transparent; color: #93b3a1; }
.combonote { font-size: 12px; margin-left: 4px; }
/* Compact result headline (was the full wall-of-text Produces string) */
.comboresult { font-size: 12px; font-weight: 600; color: #cdebd9; margin-top: 7px; display: flex; align-items: center; gap: 4px; line-height: 1.25; }
.cmore { font-size: 10px; font-weight: 600; color: #06120b; background: #58c98a; border-radius: 8px; padding: 1px 6px; }
.comboown { font-size: 10px; color: #8aa394; margin-left: auto; }

/* Piece thumbnails in the panel */
.combothumbs { display: flex; gap: 5px; flex-wrap: wrap; margin: 4px 0 2px; }
.cthumb {
    position: relative;
    width: 46px;
    aspect-ratio: 5 / 7;
    border-radius: 4px;
    overflow: hidden;
    background: #0e1813;
    border: 1px solid #244231;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cthumb.missing { border: 1px dashed #c9b958; opacity: .85; }
.cthumb.missing img { filter: grayscale(.7) brightness(.6); }
.cthumbname { font-size: 8px; color: #93b3a1; text-align: center; padding: 2px; line-height: 1.1; }
.needtag {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    font-size: 8px;
    font-weight: 700;
    text-align: center;
    background: #c9b958;
    color: #06120b;
}

/* Combo detail modal */
.combomodal {
    background: #11201a;
    border: 1px solid #244231;
    border-radius: 10px;
    width: min(680px, 92vw);
    max-height: 88vh;
    overflow-y: auto;
    padding: 16px 18px;
    color: #e8efe9;
}
.cmprod { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.prodchip { font-size: 12px; font-weight: 600; background: #1b3325; border: 1px solid #2e6f49; color: #9fe0bd; border-radius: 12px; padding: 3px 9px; }
.cmpieces { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cmpiece { width: 130px; display: flex; flex-direction: column; gap: 5px; align-items: center; }
.cmpiece img { width: 100%; border-radius: 7px; display: block; }
.cmpiece.missing img { filter: grayscale(.7) brightness(.6); outline: 2px dashed #c9b958; }
.cmpieceph { width: 100%; aspect-ratio: 5/7; border-radius: 7px; background: #0e1813; border: 1px solid #244231; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 11px; padding: 6px; color: #93b3a1; }
.cmpiecename { font-size: 11px; text-align: center; line-height: 1.2; }
.cmsteps { margin-bottom: 14px; }
.cmstep { font-size: 12px; color: #c8d8ce; padding: 4px 0; border-bottom: 1px solid #16261d; }
.cmnote { margin-bottom: 12px; }
.cmpiece img { cursor: zoom-in; }

/* Big single-card lightbox (above the combo modal) */
.lightbox-bg {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 4, 0.86);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    cursor: zoom-out;
}
.lightbox-img {
    max-width: 92vw;
    max-height: 92vh;
    border-radius: 14px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7);
}

/* Thesaurus "Similar cards" strip */

/* Thesaurus "Similar cards" strip */
/* Thesaurus "Similar cards" — visual grid + pagination */
.simgrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.simcard { cursor: pointer; }
.simcard.evo-warn .simimg { border-color: #c9b958; }
.simcard.evo-info .simimg { border-color: #5a7a6a; }

/* Budget swaps */
.simhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.budgetbtn {
    appearance: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 7px;
    border: 1px solid #2e463a;
    background: rgba(255,255,255,.03);
    color: #93b3a1;
    white-space: nowrap;
}
.budgetbtn:hover { color: #cfe; border-color: #3c5a49; }
.budgetbtn.on { background: #1f6f43; color: #fff; border-color: #6fd39a; }
.saveflag {
    position: absolute;
    top: 4px; right: 4px;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 8px;
    background: #58c98a;
    color: #06120b;
}
.simprice { color: #cdebd9; font-weight: 600; margin-right: 4px; }
.budgetcap { font-size: 11px; color: #93b3a1; white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; }
.budgetcap .fnum { width: 56px; background: #0c1611; border: 1px solid #2e463a; border-radius: 6px; color: #e8efe9; padding: 3px 6px; font-size: 11px; font-family: inherit; }

.simimg {
    position: relative;
    border-radius: 7px;
    overflow: hidden;
    border: 1px solid #244231;
    aspect-ratio: 5 / 7;
    background: #0e1813;
}

.simcard:hover .simimg { border-color: #2e9159; }
.simimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.simph { padding: 8px; font-size: 11px; color: #93b3a1; text-align: center; }

.simscore {
    position: absolute;
    top: 4px; left: 4px;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 8px;
    color: #06120b;
}
.simscore.syn-hi { background: #58c98a; }
.simscore.syn-md { background: #c9b958; }
.simscore.syn-lo { background: #8aa39a; }

.simadd {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 0;
    color: #fff;
    background: rgba(31, 111, 67, 0.95);
    border: 0;
    font-family: inherit;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;          /* invisible → don't intercept the card's click-to-open */
    transition: opacity .1s ease;
}
.simadd:hover { background: rgba(46, 145, 89, 0.98); }
.simcard:hover .simadd { opacity: 1; pointer-events: auto; }

.simcap { font-size: 11px; font-weight: 600; color: #e8efe9; margin-top: 3px; line-height: 1.2; }
.simreason { font-size: 10px; color: #93b3a1; line-height: 1.2; }

.simpager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 10px;
}
.simpginfo { font-size: 12px; color: #8aa394; }
.rbtn:disabled { opacity: .4; cursor: default; }

.rlinks {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rlinks a {
    text-decoration: none;
    text-align: center;
}

.readermeta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.readermeta .mchip {
    font-size: 11px;
    color: #cfe;
    background: #101c15;
    border: 1px solid #2e463a;
    border-radius: 10px;
    padding: 2px 9px;
}

.readerimg .textface {
    width: 320px;
    min-height: 440px;
    background: #f7f4ec;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #cfc7b5;
}

.readerimg .textface .tfhead {
    background: var(--band, #3d6fb4);
    color: #fff;
    font-weight: 600;
    padding: 12px 14px;
    font-size: 16px;
}

.readerimg .textface .tfbody {
    color: #222;
    padding: 12px 14px;
    font-size: 14px;
    white-space: pre-wrap;
}

/* MindDeck composer */
.composer {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    overflow-y: auto;       /* the side panel is fixed-height — let its content scroll */
    flex: 1 1 auto;
    min-height: 0;
}

.composer label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8aa394;
    margin-top: 4px;
}

.composer .body {
    min-height: 120px;
    resize: vertical;
}

.composer .swatches {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.composer .sw {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
}

.composer .sw.on {
    border-color: #fff;
}

.composer .add {
    margin-top: 10px;
    background: #1f6f43;
    color: #fff;
    border: 1px solid #2e9159;
    border-radius: 6px;
    padding: 9px;
    cursor: pointer;
    font-size: 13px;
}

.composer .add:disabled {
    opacity: 0.5;
    cursor: default;
}

.composer .cancel {
    background: none;
    color: #8aa394;
    border: 1px solid #2e463a;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    font-size: 13px;
}

.composer .cancel:hover {
    color: #cfe;
}

.composer code {
    background: #0c1611;
    border-radius: 4px;
    padding: 0 4px;
    color: #cfe;
}

.linklist {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.linkrow {
    background: #0c1611;
    border: 1px solid #2e463a;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.linkrow .linkends {
    font-size: 12px;
    color: #e8efe9;
}

.linkrow .linkends .arrow {
    font-weight: 700;
    padding: 0 4px;
}

.linkrow .linkedit {
    display: flex;
    align-items: center;
    gap: 6px;
}

.linkrow .linkedit .layoutsel {
    flex: 0 0 auto;
}

.linkrow .linkedit .dname {
    flex: 1 1 auto;
    min-width: 0;
}

.linkrow .linkedit .stepin {
    width: 44px;
    flex: 0 0 auto;
    background: #0c1611;
    border: 1px solid #2e463a;
    border-radius: 6px;
    color: #e8efe9;
    padding: 5px 4px;
    font-size: 12px;
    font-family: inherit;
}

.noterow {
    background: #0c1611;
    border: 1px solid #2e463a;
    border-radius: 8px;
    padding: 8px;
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.noterow .noteedit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.trayrow {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 10px;
    background: #14201a;
    border: 1px solid #25382e;
    border-radius: 10px;
}

.trayrow .tray-top { display: flex; align-items: center; gap: 8px; }
.trayrow .tray-top .dname { flex: 1 1 auto; min-width: 0; }

.trayrow .tray-bot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.trayrow .swatches { display: flex; flex-wrap: nowrap; gap: 6px; align-items: center; }

.trayrow .sw {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.trayrow .traydeck {
    flex: 0 0 auto;
    background: #1f6f43;
    color: #fff;
    border: 1px solid #2e9159;
    border-radius: 8px;
    padding: 6px 11px;
    font-size: 11.5px;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.trayrow .traydeck:hover { background: #258050; }

.trayrow .traydel {
    flex: 0 0 auto;
    background: transparent;
    border: 0;
    color: #8aa394;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 3px 4px;
    border-radius: 6px;
}
.trayrow .traydel:hover { color: #ff8a7a; background: rgba(214, 120, 120, 0.12); }

/* deck packages — clean cards (name + count on top, green Insert + bin below) */
.pkglist { display: flex; flex-direction: column; gap: 8px; }

.pkgrow {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 10px;
    background: #14201a;
    border: 1px solid #25382e;
    border-radius: 10px;
}

.pkgrow .pkg-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pkgrow .pkgname { font-size: 13px; font-weight: 600; color: #e8efe9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pkgrow .pkgcount { flex: 0 0 auto; font-size: 11px; color: #8aa394; }

.pkgrow .pkg-bot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.pkgrow .pkgins {
    flex: 1 1 auto;
    background: #1f6f43;
    color: #fff;
    border: 1px solid #2e9159;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
}
.pkgrow .pkgins:hover { background: #258050; }

.pkgrow .pkgexp {
    flex: 0 0 auto;
    background: transparent;
    border: 1px solid #2e463a;
    color: #cfe;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
}
.pkgrow .pkgexp:hover { background: rgba(255, 255, 255, 0.06); }

.pkgrow .pkgdel {
    flex: 0 0 auto;
    background: transparent;
    border: 0;
    color: #8aa394;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 3px 4px;
    border-radius: 6px;
}
.pkgrow .pkgdel:hover { color: #ff8a7a; background: rgba(214, 120, 120, 0.12); }

/* on-board sticky-note editor (double-click a post-it) */
.noteedit {
    position: fixed;
    z-index: 50;
    width: 210px;
    background: #1b2a22;
    border: 1px solid #2e9159;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.noteedit-ta {
    width: 100%;
    min-height: 72px;
    resize: vertical;
    box-sizing: border-box;
    background: #0c1611;
    border: 1px solid #2e463a;
    border-radius: 6px;
    color: #e8efe9;
    padding: 7px;
    font-size: 13px;
    font-family: inherit;
}
.noteedit-bar { display: flex; align-items: center; gap: 5px; }
.noteedit-sw { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.3); cursor: pointer; padding: 0; flex: 0 0 auto; }
.noteedit-del { background: transparent; border: 0; color: #8aa394; cursor: pointer; font-size: 14px; padding: 2px 4px; margin-left: auto; }
.noteedit-del:hover { color: #ff8a7a; }
.noteedit-done { background: #1f6f43; color: #fff; border: 1px solid #2e9159; border-radius: 6px; padding: 4px 11px; font-size: 11px; font-family: inherit; cursor: pointer; }
.noteedit-done:hover { background: #258050; }

/* right-click board menu (note / string / tray) */
.boardmenu-bg { position: fixed; inset: 0; z-index: 60; }
.boardmenu {
    position: fixed;
    z-index: 61;
    min-width: 150px;
    background: #1b2a22;
    border: 1px solid #2e463a;
    border-radius: 8px;
    padding: 5px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.bm-item {
    background: transparent;
    border: 0;
    color: #e8efe9;
    text-align: left;
    padding: 7px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12.5px;
    font-family: inherit;
}
.bm-item:hover { background: rgba(255, 255, 255, 0.06); }
.bm-del { color: #e8a; }
.bm-del:hover { background: rgba(214, 120, 120, 0.15); color: #ff8a7a; }
.bm-colors { display: flex; gap: 5px; padding: 4px 6px; }
.bm-sw { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.3); cursor: pointer; padding: 0; }

/* Floating action bar for a canvas multi-selection (marquee) */
.selbar {
    position: fixed;
    z-index: 62;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #1b2a22;
    border: 1px solid #2e9159;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.selbar-n { color: #cfe; font-size: 12.5px; font-weight: 600; padding-right: 4px; }
.selbar-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid #2e463a;
    color: #e8efe9;
    padding: 6px 11px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12.5px;
    font-family: inherit;
}
.selbar-btn:hover { background: rgba(255, 255, 255, 0.09); border-color: #3c5a49; }
.selbar-del { color: #e8a; }
.selbar-del:hover { background: rgba(214, 120, 120, 0.15); color: #ff8a7a; border-color: #6e3a3a; }
/* Touch multi-select mode (menu-entered tap-to-toggle): same bar, accented border + a solid "Done" so
   it reads as a mode toggle rather than a transient marquee action bar. Bottom-centered already (see
   .selbar above) so it's thumb-reachable on phones, above the hand. */
.selbar.selectbar { border-color: #6fd39a; bottom: 78px; }
.selbar-done { background: #2e9159; border-color: #2e9159; color: #fff; font-weight: 600; }
.selbar-done:hover { background: #34a566; border-color: #34a566; }
.selbar-name {
    background: #0f1a14;
    border: 1px solid #2e463a;
    color: #e8efe9;
    padding: 6px 9px;
    border-radius: 7px;
    font-size: 12.5px;
    font-family: inherit;
    width: 160px;
}
.selbar-name:focus { outline: none; border-color: #2e9159; }

/* empty-board quick-start dismiss (✕) */
.es-card { position: relative; }
.es-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: transparent;
    border: 0;
    color: #8aa394;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 4px;
}
.es-close:hover { color: #cfe; }

/* Notes panel — string colour swatches + active "Connect" state */
.composer .add.on { background: #2e9159; box-shadow: inset 0 0 0 1px #6fd39a; }
.strcolors { display: flex; gap: 7px; flex-wrap: wrap; padding: 2px 0; }
.strsw { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; flex: 0 0 auto; }
.strsw.on { border-color: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4); }

/* Suggest panel — "possible cuts" (redundant cards) */
.cutlist { display: flex; flex-direction: column; gap: 6px; }
.cutrow {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 7px 9px;
    border-radius: 8px;
    background: rgba(150, 110, 40, 0.13);
    border: 1px solid #5a4a2e;
    color: #e8d6a8;
    font-size: 12px;
    line-height: 1.35;
}
.cutrow .cuticon { flex: 0 0 auto; }
.cutrow .cuttext { flex: 1 1 auto; }
.cutrow .cuttext strong { color: #fff; }

/* Notes panel list */
.notelist { display: flex; flex-direction: column; gap: 6px; }
.noterow {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    background: #14201a;
    border: 1px solid #25382e;
    border-radius: 8px;
}
.noterow .notedot { width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto; border: 1px solid rgba(0, 0, 0, 0.3); }
.noterow .notetext { flex: 1 1 auto; font-size: 12px; color: #d6e2da; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.noterow .notedel { flex: 0 0 auto; background: transparent; border: 0; color: #8aa394; cursor: pointer; font-size: 13px; padding: 2px 4px; }
.noterow .notedel:hover { color: #ff8a7a; }

/* tray preset add-buttons (Tray / Deck / Side in one row) */
.traypresets { display: flex; gap: 6px; }
.traypresets .add { flex: 1 1 0; padding: 9px 4px; font-size: 12px; }

/* brew-mode indicator in the toolbar */
.brewtag {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    border-radius: 7px;
    background: rgba(143, 224, 173, 0.15);
    border: 1px solid #2e9159;
    color: #cfe;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}

.presetrow {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.preset {
    background: #173a28;
    color: #cfe;
    border: 1px solid #2e463a;
    border-radius: 6px;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 11px;
}

.preset:hover {
    background: #1f6f43;
}

/* ---- faceted search filters ---- */
.filters { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 2px; }
.frow { display: flex; gap: 8px; align-items: center; }
.ftoggle { background: #1b2a22; color: #cfe7d8; border: 1px solid #2f5e44; border-radius: 6px; padding: 3px 10px; cursor: pointer; font-size: 12px; }
.ftoggle.on { background: #245538; border-color: #3f8e5e; }
.fclear { background: none; color: #c79; border: none; cursor: pointer; font-size: 12px; }
.fgroup { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.flabel { color: #8aa595; font-size: 11px; min-width: 42px; text-transform: uppercase; letter-spacing: .5px; }
.fchip { background: #15211b; color: #cfe7d8; border: 1px solid #2c4a39; border-radius: 11px; padding: 2px 9px; cursor: pointer; font-size: 12px; }
.fchip:hover { border-color: #4f9e6e; }
.fchip.on { background: #2f7a4e; border-color: #58c184; color: #fff; }
.cchip::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--sw); margin-right: 5px; vertical-align: middle; border: 1px solid rgba(0,0,0,.4); }
.fnum { width: 50px; background: #101914; color: #e6efe9; border: 1px solid #2c4a39; border-radius: 5px; padding: 2px 5px; font-size: 12px; }
.fdash { color: #6f8a7c; }
.ftext { flex: 1; min-width: 120px; background: #101914; color: #e6efe9; border: 1px solid #2c4a39; border-radius: 5px; padding: 2px 7px; font-size: 12px; }
.fapply { background: #2f7a4e; color: #fff; border: none; border-radius: 5px; padding: 3px 12px; cursor: pointer; font-size: 12px; }

/* ---- deck stats modal ---- */
.fullstats { margin-left: 8px; background: #245538; color: #cfe7d8; border: 1px solid #3f8e5e; border-radius: 6px; padding: 2px 9px; cursor: pointer; font-size: 12px; }
.fullstats:hover { background: #2f7a4e; }
/* narrower modal for forms (Decks / Library / Create deck) */
.formmodal { width: min(480px, 94vw); max-height: 88vh; overflow-y: auto; background: #14201a; border: 1px solid #2f5e44; border-radius: 12px; padding: 16px 18px; box-shadow: 0 18px 60px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 4px; }
.smhead { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid #244736; padding-bottom: 10px; margin-bottom: 14px; }
.smtitle { font-size: 18px; font-weight: 700; color: #eaf5ee; }
.smsub { font-size: 12px; color: #8aa595; margin-top: 2px; }
.smclose { background: none; border: none; color: #9fc; color: #8aa595; font-size: 20px; cursor: pointer; line-height: 1; }
.smclose:hover { color: #fff; }
.smtiles { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.smtile { flex: 1; min-width: 120px; background: #1a2b22; border: 1px solid #2c4a39; border-radius: 9px; padding: 10px 12px; }
.smtile.good { border-color: #3f8e5e; background: #18301f; }
.smtile.warn { border-color: #a98a3a; background: #2c2715; }
.smtile.bad { border-color: #a8473a; background: #2e1b18; }
.smval { font-size: 22px; font-weight: 800; color: #f2f8f4; }
.smtlabel { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: #9ab3a4; margin-top: 2px; }
.smtsub { font-size: 11px; color: #7e988a; margin-top: 3px; }
.smgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px 22px; }
.smgroup { break-inside: avoid; }
.smgroup .gtitle { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: #8fd0a8; margin-bottom: 5px; border-bottom: 1px solid #20382a; padding-bottom: 3px; }

/* ---- building journal panel ---- */
.jhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.jhead .dhead { margin: 0; }
.jundo { margin-top: 0 !important; flex: 0 0 auto; padding: 6px 10px !important; font-size: 12px !important; }
.jlist { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.jrow {
    display: flex; align-items: center; gap: 9px;
    background: #0c1611; border: 1px solid #2e463a; border-radius: 8px;
    padding: 7px 8px; border-left-width: 3px;
}
.jrow.add { border-left-color: #2e9159; }
.jrow.remove { border-left-color: #c0563f; }
.jrow.move { border-left-color: #5a96c8; }
.jthumb { width: 30px; height: 42px; object-fit: cover; border-radius: 4px; flex: 0 0 auto; background: #243b4d; }
.jpair { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.jpair .jarrow { color: #8aa394; font-size: 13px; }
.jbody { display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; min-width: 0; }
.jlabel { font-size: 12px; color: #e8efe9; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.jk { font-weight: 600; }
.jk.add { color: #8fe0ad; }
.jk.remove { color: #e89a88; }
.jk.move { color: #9cc8e8; }
.jswap { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: #cdbb6a; font-weight: 700; }
.jzone { font-size: 11px; color: #8aa394; }
.jreason {
    background: #091310; border: 1px solid #243a30; border-radius: 6px;
    color: #e8efe9; padding: 4px 7px; font-size: 12px; font-family: inherit; min-width: 0; width: 100%;
}
.jreason::placeholder { color: #5c7567; }

/* Always-on legality banner (board overlay) */
.legbanner {
    position: absolute;
    left: 16px;
    top: 60px;
    z-index: 15;
    max-width: 520px;
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 9px 12px;
    background: rgba(40, 16, 14, 0.92);
    border: 1px solid #7a2f28;
    border-left: 3px solid #e0584a;
    border-radius: 10px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
    cursor: pointer;
}

.legbanner .legicon {
    color: #ff6a5a;
    font-size: 16px;
    line-height: 1.4;
}

.legbanner .legissues {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.legbanner .legissue {
    font-size: 12px;
    line-height: 1.4;
}

.legbanner .legissue.err {
    color: #f0b3ab;
}

.legbanner .legissue.warn {
    color: #e8d9a8;
}

/* Always-on compact stats panel (board overlay, top-right). Sits above the canvas but
   below modal backdrops, so opening a modal dims it rather than fighting it. */
.ministats {
    position: absolute;
    right: 16px;
    top: 60px;
    z-index: 14;
    width: 272px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    padding: 10px 12px 12px;
    background: rgba(13, 22, 17, 0.94);
    border: 1px solid #2c4a39;
    border-radius: 12px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}

.ministats .mshead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.ministats .mstitle {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #8fd0a8;
    font-weight: 700;
}

.ministats .msactions { display: flex; gap: 4px; }

.ministats .msbtn {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    color: #cfe;
    border: 1px solid #2e463a;
    font-size: 12px;
    line-height: 1;
    padding: 0;
}

.ministats .msbtn:hover { background: #1f6f43; border-color: #2e9159; }

.ministats .msempty { font-size: 12px; color: #7e988a; margin: 4px 0 0; }

/* The header doubles as the drag handle (ministats.js wires pointer events to it). */
.ministats .mshead { cursor: grab; touch-action: none; user-select: none; }
.ministats .msactions .msbtn { cursor: pointer; }

/* Collapsed: header strip only — drop the body's reserved height and the header's bottom gap. */
.ministats.collapsed { max-height: none; overflow: visible; }
.ministats.collapsed .mshead { margin-bottom: 0; }

/* ---- deck compare (Import/Export panel) ---- */
.cmpdiff { margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.cmpdiff .cmphead { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; margin: 8px 0 2px; }
.cmpdiff .cmphead.add { color: #6fcf97; }
.cmpdiff .cmphead.cut { color: #e08a7a; }
.cmpdiff .cmphead.chg { color: #d6b33a; }
.cmpdiff .cmprow { display: flex; gap: 8px; align-items: baseline; font-size: 13px; padding: 1px 4px; border-radius: 4px; }
.cmpdiff .cmprow:hover { background: rgba(255, 255, 255, 0.04); }
.cmpdiff .cmpq { flex: 0 0 auto; min-width: 42px; font-variant-numeric: tabular-nums; font-weight: 700; color: #cfe; }
.cmpdiff .cmprow.add .cmpq { color: #6fcf97; }
.cmpdiff .cmprow.cut .cmpq { color: #e08a7a; }
.cmpdiff .cmprow.chg .cmpq { color: #d6b33a; }
.cmpdiff .cmpn { color: #d8e6dd; }

/* ---- playtest (goldfish) toolbar cluster ---- */
.toolbar .playbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .playbar .vsep { width: 1px; align-self: stretch; background: #2e463a; margin: 2px 2px; }
.toolbar .playbar .ptc { font-size: 12px; color: #8aa394; white-space: nowrap; }
.toolbar .playbar .ptc b { color: #e8efe9; font-variant-numeric: tabular-nums; }
.toolbar .playbar .ptlife { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #8aa394; }
.toolbar .playbar .ptlife b { color: #e8efe9; min-width: 24px; text-align: center; font-variant-numeric: tabular-nums; }
.toolbar .playbar .ptlife button {
    width: 22px; height: 22px; border-radius: 6px; cursor: pointer;
    background: rgba(255,255,255,0.05); color: #cfe; border: 1px solid #2e463a;
    font-size: 13px; line-height: 1; padding: 0;
}
.toolbar .playbar .ptlife button:hover { background: #1f6f43; border-color: #2e9159; }
.toolbar .playbar .pthand { font-size: 12px; color: #cdbb6a; white-space: nowrap; }

/* ===================== StatsView.razor.css ===================== */
.statsview {
    --card: #16241c;
    --ink: #e8efe9;
    --muted: #8aa394;
    --line: #25382e;
    --line2: #2e463a;
    --green: #1f6f43;
    --green3: #6fd39a;
    --good: #3f8e5e;
    --warn: #a98a3a;
    --bad: #a8473a;
    color: var(--ink);
}

/* every text node in the view defaults to light ink (don't inherit Bootstrap's dark body colour) */
.statsview .smval,
.statsview .blabel,
.statsview .lrow { color: var(--ink); }

/* ---- hero tiles ---- */
.smtiles {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.smtile {
    flex: 1 1 130px;
    min-width: 120px;
    max-width: 240px;   /* so a lone tile that wraps to a new row doesn't stretch full-width */
    background: var(--card);
    border: 1px solid var(--line);
    border-top: 2px solid var(--line2);
    border-radius: 10px;
    padding: 12px 14px;
    user-select: none;
}

.smtile.good { border-top-color: var(--good); }
.smtile.warn { border-top-color: var(--warn); }
.smtile.bad { border-top-color: var(--bad); }

.smval {
    font-size: 26px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.smtile.warn .smval { color: #e0c06a; }
.smtile.bad .smval { color: #e07a6a; }

.smtlabel {
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-size: 10.5px;
    color: var(--muted);
    margin-top: 5px;
}

.smtsub {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 2px;
}

/* ---- chart grid (modal) ---- */
.smgrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px 18px;
}

.chart {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 16px;
}

.ctitle {
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-size: 11px;
    color: #8fd0a8;
    margin-bottom: 12px;
    padding-bottom: 7px;
    border-bottom: 1px solid #20382a;
}

/* column chart */
.col {
    display: flex;
    align-items: flex-end;
    gap: 7px;
    height: 130px;
}

.colbar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    height: 100%;
}

.colbar .v {
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.colbar .fill {
    width: 100%;
    border-radius: 3px 3px 0 0;
    background: linear-gradient(180deg, var(--green3), var(--green));
    min-height: 2px;
    transition: height 0.3s ease;
}

.colbar .x {
    font-size: 10.5px;
    color: var(--muted);
}

/* horizontal bar list */
.bars {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.brow {
    display: grid;
    grid-template-columns: 100px 1fr 26px;
    align-items: center;
    gap: 8px;
}

.blabel {
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btrack {
    height: 14px;
    background: #0c1611;
    border-radius: 7px;
    overflow: hidden;
    position: relative;
}

.bfill {
    display: block;
    height: 100%;
    border-radius: 7px;
    background: linear-gradient(90deg, var(--green), var(--green3));
    transition: width 0.3s ease;
}

/* Role bar below its target band → amber fill. */
.bfill.under {
    background: linear-gradient(90deg, #b9892f, #d8b24a);
}

/* Target marker: a tick at the band's low edge so "under the line" reads instantly. */
.bmark {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #f2f6f3;
    opacity: 0.85;
    transform: translateX(-1px);
}

.bcount {
    font-size: 12px;
    color: var(--muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.sw {
    width: 11px;
    height: 11px;
    border-radius: 3px;
    display: inline-block;
    margin-right: 6px;
    vertical-align: -1px;
}

.sw.light { outline: 1px solid var(--line); }

/* real game symbols (e.g. MTG mana pips) */
.sym {
    width: 14px;
    height: 14px;
    vertical-align: -2px;
    margin-right: 6px;
}

.smval .sym.big {
    width: 22px;
    height: 22px;
    vertical-align: -3px;
    margin-right: 3px;
}

/* donut */
.donut-wrap {
    display: flex;
    align-items: center;
    gap: 18px;
}

.donut {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    flex: 0 0 auto;
    -webkit-mask: radial-gradient(circle 34px at center, transparent 98%, #000 100%);
    mask: radial-gradient(circle 34px at center, transparent 98%, #000 100%);
}

.legend {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.lrow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
}

.lrow .c {
    color: var(--muted);
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

/* ---- compact (side panel) ---- */
.statsview.compact .smtiles {
    gap: 8px;
    margin-bottom: 12px;
}

.statsview.compact .smtile {
    flex: 1 1 80px;
    min-width: 70px;
    padding: 8px 10px;
}

.statsview.compact .smval {
    font-size: 18px;
}

.statsview.compact .smgrid {
    display: block;
}

.statsview.compact .chart {
    padding: 10px 12px;
}

.statsview.compact .col {
    height: 84px;
}

.statsview.compact .colbar .v {
    font-size: 10px;
}

/* ---- opening-hand odds (hypergeometric) ---- */
.odds {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 14px;
    margin-bottom: 16px;
}

.odds .oddshead {
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-size: 11px;
    color: #8fd0a8;
    margin-bottom: 9px;
}

.odds .oddsrows {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
}

.odds .oddrow {
    display: flex;
    align-items: baseline;
    gap: 7px;
}

.odds .opct {
    font-size: 18px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--green3);
    min-width: 42px;
}

.odds .olabel { font-size: 12.5px; color: var(--ink); }
.odds .osub { font-size: 11px; color: var(--muted); }

/* compact (side panel): stack the rows tight */
.statsview.compact .odds { padding: 9px 11px; margin-bottom: 12px; }
.statsview.compact .odds .oddsrows { flex-direction: column; gap: 5px; }
.statsview.compact .odds .opct { font-size: 15px; min-width: 38px; }

/* Role-analysis suggestions ("Add 3 more removal"). */
.guidance {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.guidance .gtitle {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--green3);
}

.guidance .gline {
    font-size: 12px;
    background: #2a1f0c;
    border: 1px solid #5a4420;
    color: #e8d9a8;
    padding: 3px 9px;
    border-radius: 12px;
}

/* ============================================================
   SearchModal — full-screen card search / lookup (three-pane)
   ============================================================ */
.sm-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(4,7,13,.62);
    display: flex; align-items: center; justify-content: center; padding: 24px; outline: none; }
.sm-modal { width: 97vw; max-width: 2100px; height: 93vh; background: #11201a;
    border: 1px solid rgba(255,255,255,.12); border-radius: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.6);
    overflow: hidden; display: flex; flex-direction: column; color: #e8efe9; font-size: 13px; }

.sm-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; background: #16241c;
    border-bottom: 1px solid rgba(255,255,255,.09); }
.sm-brand { font-weight: 600; color: #eaf5ee; letter-spacing: .3px; white-space: nowrap; }
.sm-brand .mk { color: #6fd39a; }
.sm-search { flex: 1; display: flex; align-items: center; gap: 8px; background: #0c1611;
    border: 1px solid rgba(255,255,255,.14); border-radius: 8px; padding: 8px 12px; color: #8aa394; }
.sm-search input { all: unset; flex: 1; color: #eaf5ee; font-size: 13px; }
.sm-go { all: unset; cursor: pointer; font-size: 14px; line-height: 1; }
.sm-go:hover { filter: brightness(1.4); }
.sm-clearbtn { color: #8aa394; font-size: 12px; }
.sm-clearbtn:hover { color: #eaf5ee; }
/* "Advanced" button in the quick-search rail head → opens the Find-a-card modal */
.searchhead { flex-wrap: wrap; }
.searchhead .advbtn { flex: 1 0 100%; margin-top: 5px; background: #1f6f43; border: 1px solid rgba(110,211,154,.4);
    color: #d8f0e2; border-radius: 7px; padding: 6px 10px; cursor: pointer; font-size: 12px; }
.searchhead .advbtn:hover { background: #25548a; }
.sm-gamechip { background: #173a28; color: #8aa394; padding: 5px 10px; border-radius: 7px;
    font-size: 12px; white-space: nowrap; }
.sm-x { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px;
    background: #173026; color: #8aa394; cursor: pointer; }
.sm-x:hover { background: #1f3a2a; color: #fff; }

.sm-body { display: flex; flex: 1; min-height: 0; }

.sm-filters { width: 214px; background: #0e1a14; border-right: 1px solid rgba(255,255,255,.08);
    padding: 13px; overflow-y: auto; flex-shrink: 0; }
.sm-fgrp { margin-bottom: 14px; }
.sm-flabel { font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; color: #6f7f99; margin-bottom: 6px; }
.sm-fctl { width: 100%; background: #16241c; border: 1px solid rgba(255,255,255,.12); border-radius: 7px;
    padding: 7px 9px; color: #dbe9e0; font-size: 12.5px; box-sizing: border-box; }
.sm-pips { display: flex; gap: 6px; }
.sm-pip { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
    font-weight: 700; font-size: 12px; border: 1px solid rgba(255,255,255,.18); cursor: pointer; user-select: none; }
.sm-pip.w { background: #efe7cf; color: #5b5230; } .sm-pip.u { background: #2f72c4; color: #fff; }
.sm-pip.b { background: #3a3940; color: #ddd; } .sm-pip.r { background: #cf4632; color: #fff; }
.sm-pip.g { background: #3a9b58; color: #fff; } .sm-pip.c { background: #9b958b; color: #2a2a2a; }
.sm-pip.on { outline: 2px solid #6fd39a; outline-offset: 1px; }
.sm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sm-tchip { padding: 4px 9px; border-radius: 7px; background: #16241c; border: 1px solid rgba(255,255,255,.14);
    color: #dbe9e0; font-size: 12px; cursor: pointer; }
.sm-tchip:hover { border-color: rgba(110,211,154,.5); }
.sm-tchip.on { background: #1f6f43; border-color: #2e9159; color: #d8f0e2; }
.sm-cchip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px 4px 8px; border-radius: 7px;
    background: #16241c; border: 1px solid rgba(255,255,255,.14); color: #dbe9e0; font-size: 12px; cursor: pointer; }
.sm-cchip::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--sw, #888);
    border: 1px solid rgba(0,0,0,.45); }
.sm-cchip.on { border-color: #6fd39a; box-shadow: 0 0 0 1px #6fd39a; color: #eaf5ee; }
/* colour match-mode toggle (Exactly / Within / Has all) */
.sm-cmode { display: inline-flex; margin-top: 7px; border: 1px solid rgba(255,255,255,.14); border-radius: 7px; overflow: hidden; }
.sm-cmode button { padding: 3px 9px; background: #16241c; border: 0; border-right: 1px solid rgba(255,255,255,.1);
    color: #8aa394; font-size: 11px; cursor: pointer; }
.sm-cmode button:last-child { border-right: 0; }
.sm-cmode button:hover { color: #dbe9e0; }
.sm-cmode button.on { background: #1f6f43; color: #fff; }
.sm-range { display: flex; align-items: center; gap: 7px; }
.sm-range .sm-fctl { width: 56px; text-align: center; }
/* cost/power range sliders */
.sm-sliders { display: flex; flex-direction: column; gap: 4px; }
.sm-slider1 { width: 100%; }
.sm-sliders input[type=range], .sm-slider1 { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 3px;
    background: #2a3d31; outline: none; cursor: pointer; }
.sm-sliders input[type=range]::-webkit-slider-thumb, .sm-slider1::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%;
    background: #2e9159; border: 1px solid #6fd39a; cursor: pointer; }
.sm-sliders input[type=range]::-moz-range-thumb, .sm-slider1::-moz-range-thumb {
    width: 14px; height: 14px; border-radius: 50%; background: #2e9159; border: 1px solid #6fd39a; cursor: pointer; }
/* ⚡ combo badge on grid cards */
.sm-gcard { position: relative; }
.sm-combobadge { position: absolute; top: 5px; left: 5px; z-index: 2; background: rgba(17,32,26,.92); color: #6fd39a;
    border: 1px solid #2e9159; border-radius: 11px; padding: 1px 7px; font-size: 11px; font-weight: 700; pointer-events: none; }
/* "in deck" badge on grid cards */
.sm-indeck { position: absolute; bottom: 5px; left: 5px; z-index: 2; background: rgba(31,111,67,.95); color: #fff;
    border-radius: 9px; padding: 1px 7px; font-size: 10px; font-weight: 700; pointer-events: none; }
/* per-option result counts on type chips */
.sm-cnt { margin-left: 5px; font-size: 10px; color: #6f8576; font-weight: 400; }
.sm-tchip.on .sm-cnt { color: #cde8d6; }
/* clarifies the per-option counts are catalog totals, not live result counts */
.sm-cnthint { margin-top: 5px; font-size: 9.5px; font-style: italic; color: #5f7268; letter-spacing: .3px; }
/* incremental "load more" row */
.sm-more { display: flex; justify-content: center; padding: 16px 0 6px; }
.sm-more button { padding: 9px 22px; border-radius: 9px; border: 1px solid #2e9159; background: #16241c; color: #6fd39a;
    font-size: 13px; font-weight: 600; cursor: pointer; }
.sm-more button:hover { background: #1f6f43; color: #fff; }
/* double-faced card flip — detail (always shown) + grid (on hover) */
.sm-dartwrap { position: relative; }
.sm-flip { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); z-index: 3;
    padding: 6px 14px; border-radius: 8px; border: 1px solid #2e9159; background: rgba(17,32,26,.92); color: #6fd39a;
    font-size: 12px; font-weight: 600; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.5); }
.sm-flip:hover { background: #1f6f43; color: #fff; }
.sm-gflip { position: absolute; top: 5px; right: 5px; z-index: 2; width: 22px; height: 22px; border-radius: 6px;
    border: 1px solid #2e9159; background: rgba(17,32,26,.9); color: #6fd39a; font-size: 12px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; padding: 0; opacity: 0; transition: opacity .12s; }
.sm-gcard:hover .sm-gflip { opacity: 1; }
.sm-clear { width: 100%; margin-top: 4px; padding: 8px; border-radius: 7px; background: #173026;
    border: 1px solid rgba(255,255,255,.12); color: #8aa394; font-size: 12px; cursor: pointer; }
.sm-clear:hover { background: #1f3a2a; color: #fff; }

.sm-results { flex: 1; overflow-y: auto; padding: 14px; min-width: 0; }
.sm-rmeta { display: flex; justify-content: space-between; align-items: center; color: #8aa394;
    font-size: 12px; margin-bottom: 10px; }
.sm-sortwrap { display: inline-flex; align-items: center; gap: 6px; }
.sm-sort { background: #16241c; border: 1px solid rgba(255,255,255,.14); border-radius: 6px;
    color: #dbe9e0; font-size: 12px; padding: 3px 7px; }
/* active-filter summary chips (under the results header) */
.sm-active { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 10px; }
.sm-fchip2 { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 3px 4px 3px 9px;
    border-radius: 12px; background: #16241c; border: 1px solid #2e463a; color: #cfe; }
.sm-fchip2 button { all: unset; cursor: pointer; color: #8aa394; width: 15px; height: 15px; display: grid;
    place-items: center; border-radius: 50%; font-size: 10px; }
.sm-fchip2 button:hover { background: #1f3a2a; color: #e8efe9; }
/* shimmer skeleton while a search is running */
.sm-skel { aspect-ratio: .72; border-radius: 7px; background-size: 200% 100%; animation: sm-shimmer 1.15s infinite linear;
    background-image: linear-gradient(100deg, #16241c 30%, #1f3a2a 50%, #16241c 70%); }
@keyframes sm-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
/* add-to-deck confirmation toast */
.sm-flash { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 1200;
    background: #1f6f43; color: #fff; padding: 9px 18px; border-radius: 9px; font-size: 13px; font-weight: 600;
    box-shadow: 0 10px 28px rgba(0,0,0,.55); animation: sm-flash-in .15s ease-out; }
@keyframes sm-flash-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
/* empty-state starter shortcut chips */
.sm-starters { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 14px; }
/* printing picker strip in the detail panel */
.sm-prdrow { cursor: pointer; }
.sm-prdrow:hover span { color: #e8efe9; }
.sm-prints { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; margin: 8px 0 4px; }
.sm-prints img { width: 100%; border-radius: 5px; cursor: pointer; border: 1px solid rgba(255,255,255,.1); }
.sm-prints img:hover { border-color: #6fd39a; }
.sm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 11px; }
.sm-gcard { position: relative; border-radius: 7px; overflow: hidden; border: 2px solid transparent;
    cursor: pointer; background: #0a0f17; transition: transform .08s; }
.sm-gcard img { width: 100%; display: block; }
.sm-gcard:hover { transform: translateY(-2px); border-color: rgba(110,211,154,.5); }
.sm-gcard.sel { border-color: #6fd39a; box-shadow: 0 0 0 2px rgba(111,211,154,.3); }
.sm-quickadd { position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; border-radius: 50%;
    border: none; background: rgba(20,40,70,.85); color: #d8f0e2; font-size: 16px; line-height: 1;
    cursor: pointer; opacity: 0; transition: opacity .1s; }
.sm-gcard:hover .sm-quickadd { opacity: 1; }
.sm-quickadd:hover { background: #2e9159; color: #fff; }

.sm-detail { width: 320px; background: #0e1a14; border-left: 1px solid rgba(255,255,255,.08);
    padding: 15px; overflow-y: auto; flex-shrink: 0; }
.sm-dart { width: 100%; border-radius: 9px; display: block; box-shadow: 0 8px 22px rgba(0,0,0,.5); }
.sm-dname { font-size: 17px; font-weight: 650; color: #eaf5ee; margin: 12px 0 4px; }
.sm-dmeta { display: flex; align-items: center; gap: 8px; color: #8aa394; font-size: 12.5px; flex-wrap: wrap; }
.sm-mpip { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center;
    font-weight: 700; font-size: 11px; }
.sm-mpip.w { background: #efe7cf; color: #5b5230; } .sm-mpip.u { background: #2f72c4; color: #fff; }
.sm-mpip.b { background: #3a3940; color: #ddd; } .sm-mpip.r { background: #cf4632; color: #fff; }
.sm-mpip.g { background: #3a9b58; color: #fff; } .sm-mpip.c { background: #9b958b; color: #2a2a2a; }
.sm-otext { background: #0e1622; border: 1px solid rgba(255,255,255,.08); border-radius: 8px;
    padding: 10px 12px; margin: 11px 0; font-size: 13px; line-height: 1.45; color: #dbe9e0; white-space: pre-wrap; }
.sm-legal { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 11px; }
.sm-lchip { font-size: 11px; padding: 3px 8px; border-radius: 5px; background: #16281c; color: #7fd49a;
    border: 1px solid rgba(120,210,150,.3); }
.sm-drow { display: flex; justify-content: space-between; color: #8aa394; font-size: 12.5px;
    padding: 7px 0; border-top: 1px solid rgba(255,255,255,.07); }
.sm-ititle { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: #b69cff; margin: 13px 0 7px; }
.sm-combo { background: #181230; border: 1px solid rgba(150,120,230,.3); border-radius: 7px;
    padding: 8px 10px; margin-bottom: 6px; font-size: 12px; color: #d9d0f5; cursor: pointer; }
.sm-combo:hover { border-color: rgba(150,120,230,.65); background: #1d1840; }
.sm-combo b { display: block; margin-bottom: 2px; }
.sm-combo small { color: #9a8fc0; }

/* ComboModal — clean reusable combo view (opens on top of the search modal / combo panel) */
.cm-overlay { position: fixed; inset: 0; z-index: 1100; background: rgba(4,7,13,.7);
    display: flex; align-items: center; justify-content: center; padding: 24px; outline: none; }
.cm-modal { width: min(920px, 95vw); max-height: 90vh; overflow-y: auto; background: #11201a;
    border: 1px solid rgba(255,255,255,.14); border-radius: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.6); color: #e8efe9; }
.cm-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #16241c;
    border-bottom: 1px solid rgba(255,255,255,.09); position: sticky; top: 0; }
.cm-title { font-size: 17px; font-weight: 650; color: #eaf5ee; flex: 1; }
.cm-pop { font-size: 11.5px; color: #c2b6ec; background: #1c1440; border: 1px solid rgba(150,120,230,.35);
    padding: 3px 10px; border-radius: 12px; white-space: nowrap; }
.cm-x { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px;
    background: #173026; color: #8aa394; cursor: pointer; }
.cm-x:hover { background: #1f3a2a; color: #fff; }
.cm-pieces { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; padding: 20px 16px; }
.cm-piece { width: 200px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cm-piece img { width: 100%; border-radius: 10px; box-shadow: 0 8px 22px rgba(0,0,0,.5); }
.cm-noimg { width: 100%; aspect-ratio: .72; border-radius: 10px; background: #1a2c22;
    border: 1px solid rgba(255,255,255,.12); display: grid; place-items: center; text-align: center; padding: 8px; font-size: 13px; color: #dbe9e0; }
.cm-have { font-size: 12px; color: #7fd49a; }
.cm-missing { font-size: 11px; color: #8a93a6; }
.cm-add { font-size: 12.5px; padding: 6px 16px; border-radius: 7px; background: #1f6f43;
    border: 1px solid rgba(110,211,154,.4); color: #d8f0e2; cursor: pointer; }
.cm-add:hover { background: #25548a; }
.cm-howtitle { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: #b69cff; padding: 2px 18px; }
.cm-how { font-size: 13.5px; line-height: 1.55; color: #dbe9e0; padding: 6px 18px 10px; white-space: pre-wrap; }
.cm-steps { margin: 4px 18px 12px; padding-left: 38px; color: #dbe9e0; font-size: 13.5px; line-height: 1.55; }
.cm-steps li { margin-bottom: 7px; padding-left: 4px; }
.cm-steps li::marker { color: #b69cff; font-weight: 700; }
.cm-addall { display: block; margin: 6px 18px 18px; padding: 11px; border-radius: 9px; border: none;
    background: linear-gradient(180deg, #2e9159, #1f6f43); color: #fff; font-weight: 600; text-align: center;
    cursor: pointer; width: calc(100% - 36px); font-size: 13.5px; }
.cm-addall:hover { filter: brightness(1.1); }
.cm-loading { color: #8aa394; padding: 30px; }
.sm-syn { display: flex; gap: 6px; flex-wrap: wrap; }
.sm-stag { font-size: 11px; padding: 3px 8px; border-radius: 12px; background: #16241c; color: #8aa394; }
.sm-add { margin-top: 14px; padding: 11px; border-radius: 9px; text-align: center; font-weight: 600;
    font-size: 13.5px; cursor: pointer; color: #fff; background: linear-gradient(180deg, #2e9159, #1f6f43); }
.sm-add:hover { filter: brightness(1.1); }
.sm-empty { color: #6f7f99; font-size: 13px; padding: 18px 6px; text-align: center; }
.sm-empty.sm-small { padding: 8px 6px; font-size: 12px; text-align: left; }

@media (max-width: 860px) {
    .sm-filters { width: 168px; }
    .sm-detail { width: 240px; }
}
/* narrow / mobile: stack the three panes into one scrolling column, full-screen */
@media (max-width: 640px) {
    .sm-modal { width: 100vw; max-width: none; height: 100vh; border-radius: 0; }
    .sm-body { flex-direction: column; overflow-y: auto; }
    .sm-filters { width: auto; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.08); }
    .sm-results { overflow-y: visible; }
    .sm-detail { width: auto; border-left: 0; border-top: 1px solid rgba(255,255,255,.08); }
    .sm-head { flex-wrap: wrap; }
    .sm-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}

/* backdrop for the remaining centered modals (Decks manager; ComboPanel's detail modal has its own scoped copy) */
.statsmodal-bg { position: fixed; inset: 0; background: rgba(4,10,7,0.72); display: flex; align-items: center; justify-content: center; z-index: 100; }

/* ---- < 1024px: panels are bottom sheets ---- */
.drawer-scrim { display: none; }

@media (max-width: 1023.98px) {
    .drawer-scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(4, 10, 7, 0.45);
        z-index: 19;
    }
    .searchpanel {
        position: fixed;
        top: auto;
        left: 0;
        right: 0;
        bottom: 52px;               /* clears the bottom rail */
        width: auto;
        height: min(68vh, 560px);
        border-left: none;
        border-top: 1px solid #2f5e44;
        border-radius: 14px 14px 0 0;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.45);
        z-index: 20;
    }
    .searchpanel::before {          /* drag-handle affordance */
        content: "";
        display: block;
        width: 44px;
        height: 4px;
        border-radius: 2px;
        background: #2e463a;
        margin: 8px auto 2px;
        flex: 0 0 auto;
    }
    .searchpanel.wide { width: auto; }
    /* Decks manager (a centered .formmodal) becomes a bottom sheet like the drawer panels */
    .statsmodal-bg { align-items: flex-end; }              /* pin to bottom instead of centering */
    .statsmodal-bg .formmodal {
        width: 100%;
        max-width: none;
        max-height: 68vh;
        border-radius: 14px 14px 0 0;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.45);
        overflow-y: auto;
        box-sizing: border-box;
        margin: 0;
    }
    .statsmodal-bg .formmodal::before {                    /* drag-handle affordance */
        content: ""; display: block; width: 44px; height: 4px; border-radius: 2px;
        background: #2e463a; margin: 8px auto 2px;
    }
}

.searchpanel.deckbar .db-grid { display: flex; flex-direction: column; gap: 10px; padding: 12px; overflow-y: auto; }
.searchpanel.deckbar .db-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #8aa394; }
/* the deckbar reuses the toolbar's .ghost/.sel button vocabulary outside .toolbar — restyle here */
.searchpanel.deckbar .ghost {
    appearance: none; cursor: pointer; font-family: inherit;
    background: rgba(255, 255, 255, 0.03); color: #cfe;
    border: 1px solid #2e463a; border-radius: 8px;
    padding: 9px 12px; font-size: 13px; text-align: left;
}
.searchpanel.deckbar .ghost:hover { background: rgba(255, 255, 255, 0.07); border-color: #3c5a49; }
.searchpanel.deckbar .ghost.on { background: #2e9159; color: #fff; box-shadow: inset 0 0 0 1px #6fd39a; }
.searchpanel.deckbar .sel {
    appearance: none; cursor: pointer; font-family: inherit;
    background: #0c1611; color: #cfe; border: 1px solid #2e463a;
    border-radius: 8px; padding: 8px 10px; font-size: 13px;
}
