/* ============================================================ Deck Forge – Theme */
:root {
    --bg: #12151c;
    --bg-2: #181c25;
    --panel: #1e2330;
    --panel-2: #262c3b;
    --line: #313849;
    --text: #e6e8ee;
    --muted: #949bb0;
    --accent: #c9a227;
    --accent-2: #e2bd4a;
    --danger: #e0565b;
    --ok: #4fbf7f;
    --warn: #e0a03a;
    --felt: #173a2c;
    --felt-2: #1d4636;

    --w: #f3ecd2;
    --u: #4a90d9;
    --b: #8a7d8f;
    --r: #e0533d;
    --g: #3fa45f;
    --c: #b4b4b4;

    --common: #c8c8c8;
    --uncommon: #9fc3d6;
    --rare: #d8b24a;
    --mythic: #e2642b;

    --radius: 8px;
    --card-w: 150px;
    --card-peek: 28px;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0; font-weight: 600; }
h2 { font-size: 1.05rem; margin: 1.2rem 0 .6rem; font-weight: 600; }
h2:first-child { margin-top: 0; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.1rem 0 .4rem; }
code, kbd { font-family: Consolas, monospace; background: var(--panel-2); padding: 0 4px; border-radius: 3px; font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.ok { color: var(--ok); }
.error { color: var(--danger); }
.right { text-align: right; justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break { word-break: break-all; }

/* ============================================================ Layout */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 190px;
    flex: none;
    background: var(--bg-2);
    border-right: 1px solid var(--line);
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--text); padding: 4px 8px 18px; }
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 22px; height: 28px; border-radius: 4px;
    background: linear-gradient(160deg, var(--accent-2), #8a6a12);
    box-shadow: 4px -3px 0 -1px #6d5410;
}

.nav-item { display: block; padding: 8px 12px; border-radius: 6px; color: var(--muted); }
.nav-item:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--panel-2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }

.app-version { margin-top: auto; padding: 0 8px 6px; font-size: .75rem; color: var(--muted); font-family: Consolas, monospace; }
.arena-list { list-style: none; padding: 0; margin: 10px 0 0; max-height: 50vh; overflow: auto; }
.arena-list li { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.sidebar-foot { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: 6px; padding: 0 8px; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sync-dot.ok { background: var(--ok); }
.sync-dot.warn { background: var(--warn); }
.sync-dot.running { background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.content { flex: 1; min-width: 0; padding: 20px 24px; }

.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }

.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }

/* ============================================================ Controls */
.btn {
    background: var(--accent);
    color: #1b1608;
    border: 0;
    border-radius: 6px;
    padding: 7px 14px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: var(--accent-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); font-weight: 500; }
.btn-secondary:hover { background: #303749; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #ef6b70; }
.btn-danger-outline { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-sm { padding: 4px 10px; font-size: .85rem; }

.icon-btn {
    background: transparent; border: 0; color: var(--muted); cursor: pointer;
    font-size: 1rem; padding: 2px 6px; border-radius: 4px; line-height: 1;
}
.icon-btn:hover { color: var(--text); background: var(--panel-2); }
.icon-btn.danger:hover { color: var(--danger); }
.icon-btn.xs { font-size: .75rem; padding: 2px 4px; }
.icon-btn.fav { font-size: 1.3rem; }
.icon-btn.fav.on { color: var(--accent-2); }

.link-btn { background: none; border: 0; color: var(--accent-2); cursor: pointer; font: inherit; font-size: .85rem; padding: 0; margin-left: auto; }

.input {
    background: var(--bg-2);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 10px;
    font: inherit;
    min-width: 0;
}
.input:focus { outline: none; border-color: var(--accent); }
textarea.input { width: 100%; resize: vertical; margin: 8px 0; }
.input.mono, .mono { font-family: Consolas, monospace; font-size: .85rem; }
.input-sm { padding: 3px 6px; font-size: .85rem; }
.input-xs { padding: 1px 4px; font-size: .75rem; }
.small-input { width: 130px; }

.check { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.check input { accent-color: var(--accent); }

.filter-bar, .form-row { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }

.callout { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; border: 1px solid; }
.callout.warn { background: #3a2e14; border-color: #6b5321; }
.callout.info { background: #172434; border-color: #29425f; color: #c3d2e4; }

.badge { font-size: .72rem; padding: 1px 6px; border-radius: 10px; font-weight: 600; margin-left: 6px; }
.badge-error { background: #4a1f22; color: #ff9da1; }
.badge-ok { background: #183a28; color: #8fe0b2; }

.chip { display: inline-block; background: var(--panel-2); border-radius: 4px; padding: 0 5px; margin: 2px; font-size: .75rem; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.kv.compact { gap: 1px 10px; font-size: .85rem; }

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.log-list { list-style: none; padding: 0; margin: 0; font-family: Consolas, monospace; font-size: .78rem; color: var(--muted); max-height: 300px; overflow: auto; }
.log-list li { padding: 2px 0; }
.error-list { color: var(--danger); font-size: .85rem; max-height: 200px; overflow: auto; }
.help { background: var(--bg-2); border-radius: 6px; padding: 8px; color: var(--muted); margin: 4px 0; }

/* ============================================================ Mana & Seltenheit */
.mana-cost { display: inline-flex; gap: 2px; vertical-align: middle; }
.mana {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%;
    font-size: 10px; font-weight: 700; color: #1a1a1a;
    background: var(--c); box-shadow: 0 1px 1px rgba(0,0,0,.5);
    flex: none;
}
.mana-w { background: var(--w); }
.mana-u { background: var(--u); color: #fff; }
.mana-b { background: var(--b); color: #fff; }
.mana-r { background: var(--r); color: #fff; }
.mana-g { background: var(--g); color: #fff; }
.mana-c, .mana-generic { background: #c9c6bf; }
.mana-hybrid { background: linear-gradient(135deg, #c9c6bf 50%, #8a8a8a 50%); font-size: 8px; }
.color-pips { display: inline-flex; gap: 2px; }
.color-pips .mana { width: 12px; height: 12px; }

.rarity-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--common); }
.r-uncommon { background: var(--uncommon); }
.r-rare { background: var(--rare); }
.r-mythic { background: var(--mythic); }
.r-basic, .r-special { background: #666; }

/* ============================================================ Wildcards / Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.tile-value { font-size: 1.7rem; font-weight: 600; }
.tile-sub { color: var(--muted); font-size: .85rem; }
.wc-row { display: flex; gap: 6px; margin: 8px 0 4px; }

.wc-badges { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.wc { font-size: .78rem; font-weight: 700; padding: 1px 7px; border-radius: 10px; border: 1px solid transparent; }
.wc-common { background: #2c2f36; color: var(--common); }
.wc-uncommon { background: #1f3340; color: var(--uncommon); }
.wc-rare { background: #3d3216; color: var(--rare); }
.wc-mythic { background: #432213; color: var(--mythic); }
.wc-complete { background: #183a28; color: #8fe0b2; }
.wc-short { border-color: var(--danger); }

/* ============================================================ Deckliste */
.deck-layout { display: grid; grid-template-columns: 200px 1fr; gap: 20px; }
.folder-list { display: flex; flex-direction: column; gap: 2px; }
.folder-title { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 4px; }
.folder {
    display: flex; justify-content: space-between; background: none; border: 0; color: var(--text);
    padding: 6px 10px; border-radius: 6px; cursor: pointer; font: inherit; text-align: left;
}
.folder span { color: var(--muted); font-size: .8rem; }
.folder:hover { background: var(--panel); }
.folder.active { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--accent); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); border-radius: 10px; padding: 1px 8px; font-size: .78rem; cursor: pointer; }
.tag.active { border-color: var(--accent); color: var(--accent-2); }

.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.deck-tile {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; cursor: pointer; position: relative; transition: transform .1s, border-color .1s;
}
.deck-tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.deck-art { height: 100px; background: linear-gradient(135deg, #2a3142, #1b202b); position: relative; overflow: hidden; }
.deck-art img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.deck-format { position: absolute; left: 8px; bottom: 6px; background: rgba(0,0,0,.65); padding: 0 6px; border-radius: 4px; font-size: .75rem; }
.deck-fav { position: absolute; right: 8px; top: 4px; color: var(--accent-2); text-shadow: 0 1px 2px #000; }
.deck-info { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 5px; }
.deck-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-meta { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: .85rem; }
.deck-actions { position: absolute; right: 4px; top: 70px; display: none; gap: 2px; background: rgba(0,0,0,.6); border-radius: 6px; }
.deck-tile:hover .deck-actions { display: flex; }

/* ============================================================ Deckbauer */
.builder-head { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.deck-title { font-size: 1.25rem; font-weight: 600; width: 280px; }

.builder {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr) 280px;
    gap: 14px;
    align-items: start;
}

.browser, .stats {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 10px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto;
}
.browser > .input { width: 100%; }
.browser-opts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 8px 0; font-size: .82rem; }
.target-row { display: flex; align-items: center; gap: 6px; color: var(--muted); margin-bottom: 6px; }
.target-row select { flex: 1; }

.result-list { list-style: none; margin: 0; padding: 0; }
.result {
    display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 5px;
    cursor: grab; user-select: none;
}
.result:hover { background: var(--panel-2); }
.result-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owned { font-size: .72rem; min-width: 18px; text-align: center; border-radius: 8px; padding: 0 4px; background: #3a1f22; color: #ff9da1; }
.owned-1, .owned-2, .owned-3 { background: #3d3216; color: var(--rare); }
.owned-4 { background: #183a28; color: #8fe0b2; }

/* --- Arbeitsflaeche (Arena-Ansicht und freier Tisch) */
.work-area {
    background: radial-gradient(ellipse at top, var(--felt-2), var(--felt) 70%);
    border: 1px solid #2a5a45;
    border-radius: var(--radius);
    padding: 10px;
    min-height: calc(100vh - 110px);
    box-shadow: inset 0 0 40px rgba(0,0,0,.45);
    min-width: 0;
}
.view-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.work-area .hint { margin: 6px 0 10px; color: #a9c7ba; }
.tabs { display: flex; background: rgba(0,0,0,.35); border-radius: 8px; padding: 3px; }
.tab {
    background: none; border: 0; color: #b8d4c8; padding: 5px 14px; border-radius: 6px;
    cursor: pointer; font: inherit; font-weight: 600;
}
.tab.active { background: var(--accent); color: #1b1608; }
.deck-search { display: flex; align-items: center; gap: 6px; }
.deck-search .input { width: 260px; }
.trash {
    margin-left: auto; border: 1px dashed #6b8f80; color: #b8d4c8; border-radius: 6px;
    padding: 4px 14px; font-size: 1rem;
}
.trash.drop-hover { border-color: var(--danger); color: #fff; background: rgba(224, 86, 91, .35); }

/* Drag & Drop */
/* Ziehbares soll beim Greifen keinen Text markieren (nur Eingabefelder bleiben markierbar) */
[data-drag], [data-drag] * { touch-action: none; user-select: none; -webkit-user-select: none; }
[data-drag] input, [data-drag] textarea { user-select: text; -webkit-user-select: text; }
.is-dragging, .is-dragging * { cursor: grabbing !important; user-select: none; }
.drag-ghost {
    position: fixed; z-index: 1000; pointer-events: none; opacity: .9;
    transform: rotate(-3deg); box-shadow: 0 12px 30px rgba(0,0,0,.6); margin: 0 !important;
}
.card-ghost {
    aspect-ratio: 488 / 680; border-radius: 9px; background: #222; overflow: hidden;
    transform: rotate(-4deg) scale(1.04); box-shadow: 0 18px 40px rgba(0,0,0,.7), 0 0 0 2px var(--accent);
    opacity: .95;
}
.card-ghost img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.card-ghost-name {
    position: absolute; inset: 0; padding: 8px; font-size: .8rem; font-weight: 600; color: #fff;
    background: linear-gradient(#3a3f4c, #262a33);
}
.card-ghost .qty-badge { top: 6px; right: 6px; font-size: .85rem; padding: 1px 8px; }
.drag-source { opacity: .35; }
.drop-hover { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Suche im Deck */
.pile-card.dim { opacity: .25; filter: grayscale(.8); }
.pile-card.hit { box-shadow: 0 0 0 3px var(--accent-2), 0 0 18px rgba(226, 189, 74, .8); z-index: 4; }

/* Arena-Ansicht */
.arena-view { display: flex; flex-direction: column; gap: 14px; }
.arena-zone {
    background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.08);
    border-radius: var(--radius); padding: 8px 10px 12px; min-height: 120px;
}
.arena-zone.zone-sideboard { background: rgba(40, 70, 120, .25); }
.arena-zone.zone-commander, .arena-zone.zone-companion { background: rgba(120, 80, 20, .25); }
.zone-head { display: flex; gap: 8px; align-items: center; font-weight: 600; margin-bottom: 8px; }
.arena-columns { display: flex; gap: 10px; overflow-x: auto; align-items: flex-start; padding-bottom: 4px; }
.arena-col { flex: none; width: var(--card-w); }
.col-head { font-size: .78rem; color: #b8d4c8; margin-bottom: 4px; display: flex; justify-content: space-between; }

/* Freier Tisch */
.free-canvas {
    position: relative; overflow: auto; height: calc(100vh - 190px); min-height: 420px;
    border-radius: 6px; background-image: radial-gradient(rgba(255,255,255,.06) 1px, transparent 1px);
    background-size: 24px 24px;
    /* Keine Scrollbars - verschoben wird mit mittlerer Maustaste/freier Flaeche, Mausrad oder beim Ziehen am Rand */
    scrollbar-width: none;
    cursor: grab;
}
.free-canvas::-webkit-scrollbar { display: none; }
.free-canvas.is-panning, .free-canvas.is-panning * { cursor: grabbing !important; user-select: none; }
.free-sizer { position: relative; }
.free-surface { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.free-surface .free-pile { cursor: grab; }
.zoom-controls { display: inline-flex; align-items: center; gap: 2px; background: rgba(0,0,0,.25); border-radius: 6px; padding: 1px 2px; }
.zoom-value {
    background: none; border: 0; color: inherit; font: inherit; font-size: .78rem; min-width: 44px;
    cursor: pointer; padding: 2px 4px; border-radius: 4px;
}
.zoom-value:hover { background: var(--panel-2); }
.free-pile {
    position: absolute;
    width: calc(var(--card-w) + 16px);
    background: rgba(0, 0, 0, .25);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: var(--radius);
    padding: 4px 8px 10px;
}
.free-pile.moving { pointer-events: none; z-index: 50; box-shadow: 0 14px 34px rgba(0,0,0,.6); opacity: .92; }
.free-pile.is-target { box-shadow: 0 0 0 1px var(--accent) inset; }
.free-pile.role-sideboard { background: rgba(40, 70, 120, .35); }
.free-pile.role-maybe { background: rgba(0, 0, 0, .15); border-style: dashed; }
.free-pile.role-commander, .free-pile.role-companion { background: rgba(120, 80, 20, .35); }
.free-pile { cursor: grab; }
.free-pile .pile-head { padding: 3px 0; }
.free-pile .pile-name { cursor: grab; }
.pile-head { display: flex; align-items: center; gap: 6px; }
.pile-head .input { width: 100%; }
.pile-name { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; }
.pile-count { background: rgba(0,0,0,.4); border-radius: 10px; padding: 0 7px; font-size: .8rem; }

.pile-body { position: relative; min-height: 60px; }
.pile-empty { color: rgba(255,255,255,.35); font-size: .82rem; text-align: center; padding: 18px 4px; border: 1px dashed rgba(255,255,255,.15); border-radius: 6px; }

.pile-card { position: relative; cursor: grab; user-select: none; transition: opacity .1s; }

/* Kaskade: Karten liegen ueberlappend wie ein aufgefaecherter Stapel */
.cascade .pile-card {
    width: var(--card-w);
    aspect-ratio: 488 / 680;
    margin-bottom: calc(var(--card-peek) - var(--card-w) * 680 / 488);
    border-radius: 7px;
    background: #222;
    box-shadow: 0 -1px 4px rgba(0,0,0,.6);
    transition: transform .08s;
}
.cascade .pile-card:last-child { margin-bottom: 0; }
.cascade .pile-card:hover { transform: translateY(-6px); z-index: 5; }
.cascade .card-img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 7px; }
.pile-card-label.behind {
    position: absolute; inset: 0; padding: 6px 8px; font-size: .78rem; font-weight: 600;
    background: linear-gradient(#3a3f4c, #262a33); border-radius: 7px; border: 1px solid #555;
}

.listing .pile-card { margin-bottom: 2px; }
.listing .pile-card-label {
    display: flex; align-items: center; gap: 5px; background: rgba(0,0,0,.35); border-radius: 5px;
    padding: 3px 6px 3px 6px; font-size: .82rem; padding-right: 30px;
}
.pile-card-label.unknown { padding: 6px; font-size: .78rem; color: var(--muted); background: #222; border-radius: 6px; }

.qty-badge {
    position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.8); color: #fff;
    font-size: .75rem; font-weight: 700; padding: 0 6px; border-radius: 8px; z-index: 2;
}
.listing .qty-badge { top: 3px; }
.missing-badge {
    position: absolute; top: 22px; right: 4px; background: var(--danger); color: #fff;
    font-size: .68rem; font-weight: 700; padding: 0 5px; border-radius: 8px; z-index: 2;
}
.listing .missing-badge { position: static; margin-left: 4px; }
.pile-card-actions {
    position: absolute; left: 4px; top: 3px; display: none; gap: 2px; z-index: 3;
}
.pile-card:hover .pile-card-actions { display: flex; }
.pile-card-actions button {
    width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.8); color: #fff;
    cursor: pointer; font-weight: 700; line-height: 1; padding: 0;
}
.pile-card-actions button:hover { background: var(--accent); color: #000; }
.listing .pile-card-actions { left: auto; right: 34px; }

/* --- Statistik */
.stat-counts { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; gap: 4px; }
.stat-counts div { background: var(--bg-2); border-radius: 6px; padding: 6px 0; }
.stat-counts strong { display: block; font-size: 1.15rem; }
.stat-counts span { font-size: .72rem; color: var(--muted); }

.issues { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.issue { font-size: .8rem; padding: 4px 8px; border-radius: 5px; }
.issue-error { background: #3a1f22; color: #ffb3b6; }
.issue-warning { background: #3a2e14; color: #f5d08a; }
.issue-info { background: #183a28; color: #9fe6bd; }

.curve { display: flex; align-items: flex-end; gap: 4px; height: 110px; padding-top: 14px; }
.curve-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.curve-bar { width: 100%; background: linear-gradient(var(--accent-2), #8a6a12); border-radius: 3px 3px 0 0; min-height: 1px; }
.curve-n { font-size: .72rem; color: var(--muted); }
.curve-x { font-size: .72rem; color: var(--muted); border-top: 1px solid var(--line); width: 100%; text-align: center; }

.color-bars { display: flex; flex-direction: column; gap: 4px; }
.color-row { display: flex; align-items: center; gap: 6px; }
.color-bar { flex: 1; height: 8px; background: var(--bg-2); border-radius: 4px; overflow: hidden; }
.fill { height: 100%; }
.fill-w { background: var(--w); } .fill-u { background: var(--u); } .fill-b { background: var(--b); }
.fill-r { background: var(--r); } .fill-g { background: var(--g); }

.prob-table { width: 100%; border-collapse: collapse; margin: 4px 0; }
.prob-table th, .prob-table td { text-align: center; padding: 2px; border-bottom: 1px solid var(--line); }
.prob-table th:first-child, .prob-table td:first-child { text-align: left; color: var(--muted); }
.prob-table td.good { color: var(--ok); font-weight: 600; }

.sample-hand { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; }
.sample-card { font-size: .72rem; background: var(--bg-2); border-radius: 4px; min-height: 30px; }
.sample-card .card-img { width: 100%; border-radius: 4px; display: block; }

.missing-list { list-style: none; padding: 0; margin: 6px 0; }
.missing-list li { display: flex; align-items: center; gap: 6px; padding: 2px 0; }

/* --- Vorschau */
.preview {
    position: fixed; right: 300px; bottom: 16px; z-index: 50; width: 300px;
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,.6); overflow: hidden; pointer-events: none;
}
.preview-img { width: 100%; display: block; }
.preview-text { padding: 8px 12px 12px; }
.preview-name { font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.rules { white-space: pre-line; font-size: .82rem; margin: 6px 0; }

/* --- Menue */
.menu { position: relative; }
.menu-pop {
    position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; min-width: 230px;
    background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 4px;
    box-shadow: 0 8px 20px rgba(0,0,0,.5); display: flex; flex-direction: column;
}
.menu-pop button {
    background: none; border: 0; color: var(--text); text-align: left; padding: 7px 10px;
    border-radius: 5px; cursor: pointer; font: inherit;
}
.menu-pop button:hover { background: var(--panel); }

/* --- Versionen */
.versions { display: grid; grid-template-columns: 240px 1fr; gap: 14px; min-height: 260px; }
.version-list { list-style: none; margin: 0; padding: 0; border-right: 1px solid var(--line); max-height: 420px; overflow: auto; }
.version-list li { padding: 6px 8px; cursor: pointer; border-radius: 5px; display: flex; flex-direction: column; }
.version-list li:hover { background: var(--panel-2); }
.version-list li.active { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--accent); }
.diff-list { list-style: none; padding: 0; margin: 0; font-family: Consolas, monospace; font-size: .85rem; }
.diff-list .plus { color: var(--ok); }
.diff-list .minus { color: var(--danger); }

/* ============================================================ Sammlung */
.collection-table { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); height: calc(100vh - 260px); overflow: auto; }
.ct-row {
    display: grid; grid-template-columns: minmax(180px, 2fr) 110px minmax(140px, 2fr) 60px 40px 120px;
    gap: 10px; align-items: center; padding: 0 12px; height: 38px; border-bottom: 1px solid var(--line);
}
.ct-row.has { background: rgba(79, 191, 127, .05); }
.ct-head { position: sticky; top: 0; background: var(--panel-2); z-index: 1; color: var(--muted); font-size: .8rem; text-transform: uppercase; }
.owned-editor { display: flex; gap: 4px; align-items: center; }
.pip { width: 16px; height: 16px; border-radius: 3px; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; padding: 0; }
.pip.on { background: var(--accent); border-color: var(--accent); }
.pip:hover { border-color: var(--accent-2); }

/* ============================================================ Einstellungen */
.format-box { border-top: 1px solid var(--line); padding: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.set-chips { line-height: 1.6; }

/* ============================================================ Modal & Toasts */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100;
    display: flex; align-items: flex-start; justify-content: center; padding-top: 8vh;
}
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: min(480px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.modal-wide { width: min(820px, 94vw); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; }
.modal-body { padding: 14px 16px; max-height: 70vh; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
    background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--accent);
    padding: 10px 14px; border-radius: 8px; max-width: 380px; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.5);
}
.toast-success { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--danger); }

#blazor-error-ui {
    background: #4a1f22; color: #fff; bottom: 0; display: none; left: 0; padding: .6rem 1.25rem;
    position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
#blazor-error-ui .reload { color: #fff; text-decoration: underline; }

/* ============================================================ Responsive */
@media (max-width: 1300px) {
    .builder { grid-template-columns: 260px minmax(0, 1fr); }
    .stats { grid-column: 1 / -1; position: static; max-height: none; }
    .preview { right: 16px; }
}
@media (max-width: 800px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; }
    .sidebar-foot { margin-top: 0; }
    .builder, .deck-layout { grid-template-columns: 1fr; }
    .browser { position: static; max-height: 50vh; }
    .content { padding: 12px; }
}

/* Kartensprache DE/EN (Sidebar) */
.lang-switch { margin-top: auto; margin-bottom: 8px; display: inline-flex; align-self: flex-start; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.lang-switch + .app-version { margin-top: 0; }
.lang-switch button { background: transparent; color: var(--muted); border: 0; padding: 4px 12px; font: inherit; font-size: .8rem; cursor: pointer; }
.lang-switch button + button { border-left: 1px solid var(--line); }
.lang-switch button:hover { color: var(--text); }
.lang-switch button.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }

/* Stapel: Rollenzeile + Kontextmenue (Rechtsklick / ⋯) */
.pile-role { font-size: .72rem; color: var(--muted); margin: 0 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-backdrop { position: fixed; inset: 0; z-index: 900; }
.ctx-menu {
    position: fixed; z-index: 901; min-width: 220px; max-width: 280px; overflow-y: auto;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,.5); padding: 4px; outline: none;
}
.ctx-menu > button {
    display: block; width: 100%; text-align: left; background: transparent; border: 0; color: var(--text);
    font: inherit; font-size: .88rem; padding: 6px 10px 6px 26px; border-radius: 5px; cursor: pointer; position: relative;
}
.ctx-menu > button:hover, .ctx-menu > button:focus-visible { background: var(--panel-2); outline: none; }
.ctx-menu > button.checked::before { content: "✓"; position: absolute; left: 9px; color: var(--accent); }
.ctx-menu > button.danger { color: var(--danger); }
.ctx-title { padding: 6px 10px 4px; font-weight: 600; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-label { padding: 4px 10px 2px; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 2px; }

/* Deckliste: Ordner anlegen */
.folder-title-row { display: flex; align-items: center; justify-content: space-between; }
.folder-add { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 5px; font: inherit; font-size: .72rem; letter-spacing: 0; text-transform: none; padding: 1px 7px; cursor: pointer; }
.folder-add:hover { color: var(--text); border-color: var(--accent); }
.folder-list > .input { margin: 2px 0 4px; }

/* --- Sammlung aus Arena lesen (ArenaCollectionScan) */
.scan-steps { margin: 0 0 14px; padding-left: 22px; display: grid; gap: 10px; }
.scan-steps li { color: var(--muted); }
.scan-steps li.current { color: inherit; }
.scan-steps li.done { color: var(--ok); }
.scan-steps .btn { margin-right: 6px; }
.scan-status { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 6px 0; }
.spinner {
    width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.2); border-top-color: var(--accent);
    animation: spin .8s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.progress { height: 6px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden; margin-bottom: 10px; }
.progress > div { height: 100%; background: var(--accent); transition: width .3s; }
.scan-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 6px; margin: 10px 0; text-align: center; }
.scan-summary > div { background: rgba(0,0,0,.25); border-radius: 6px; padding: 6px 4px; display: flex; flex-direction: column; }
.scan-summary span { font-size: .75rem; color: var(--muted); }
.scan-summary .plus strong { color: var(--ok); }
.scan-summary .minus strong { color: var(--danger); }
.scan-diff { max-height: 300px; overflow: auto; }
.scan-diff li { display: flex; gap: 10px; padding: 1px 0; }
.anchors { background: rgba(0,0,0,.2); border-radius: 6px; padding: 8px 10px; margin: 8px 0; display: grid; gap: 6px; }

/* ------------------------------------------------ Nutzerkonten */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.auth-card { width: min(560px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.auth-card h1 { margin: 6px 0 12px; }
.auth-brand { margin-bottom: 8px; }
.login-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.login-btn { justify-content: center; padding: 11px 16px; font-size: 1rem; }
.login-google { background: #fff; color: #1f1f1f; }
.login-discord { background: #5865f2; color: #fff; }
.callout.error { background: #3a1a1c; border-color: #6b2a2e; color: #f1c4c6; }

.avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar-initial { display: inline-grid; place-items: center; background: var(--panel-2); color: var(--text); font-size: .8rem; font-weight: 700; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin: 8px 0 4px; border-top: 1px solid var(--line); font-size: .85rem; min-width: 0; }
.user-chip .ellipsis { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-switch + .user-chip { margin-top: 0; }
.nav-badge { margin-left: 6px; background: var(--accent); color: #1b1f2a; border-radius: 9px; padding: 0 7px; font-size: .72rem; font-weight: 700; }

.section-title { margin: 22px 0 10px; font-size: 1rem; color: var(--muted); }
.users-table td { vertical-align: middle; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.actions-cell { white-space: nowrap; text-align: right; }
.actions-cell .btn + .btn { margin-left: 4px; }
.row-pending { background: rgba(201, 162, 39, .07); }
.row-blocked { opacity: .6; }
.badge.status-pending { background: #3a2e14; color: var(--warn); }
.badge.status-approved { background: #163324; color: var(--ok); }
.badge.status-blocked { background: #3a1a1c; color: var(--danger); }

.provider-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; background: var(--bg-2); }
.provider-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.provider-steps { margin: 6px 0 10px; padding-left: 18px; }
.provider-steps code.copyable { user-select: all; }
.provider-form { display: grid; gap: 8px; }
.provider-form label { display: grid; gap: 3px; }

.personal-settings { display: grid; gap: 4px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row > span { display: grid; gap: 2px; }
.setting-row select { min-width: 180px; }
.setting-row input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }
.welcome { max-width: 760px; }
@media (max-width: 640px) {
    .setting-row { flex-direction: column; align-items: stretch; }
    .actions-cell { white-space: normal; }
}
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 8px; border-bottom: 1px solid var(--line); }
.panel + .panel, .panel + .section-title { margin-top: 14px; }

/* Deck-Editor: Filter (Treffer hervorheben + verschieben) */
.deck-filter { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; margin: 6px 0 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.filter-label { width: 82px; flex: none; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.chip-toggle {
    display: inline-flex; align-items: center; gap: 5px; background: var(--bg-2); color: var(--muted);
    border: 1px solid var(--line); border-radius: 14px; padding: 2px 10px; font: inherit; font-size: .8rem; cursor: pointer; line-height: 1.5;
}
.chip-toggle:hover { color: var(--text); border-color: var(--muted); }
.chip-toggle.on { background: rgba(201, 162, 39, .18); border-color: var(--accent); color: var(--text); }
.chip-toggle.mv { min-width: 34px; justify-content: center; }
.chip-toggle .mana-cost { display: inline-flex; }
.filter-move { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.filter-move select, .filter-move input { width: auto; min-width: 160px; }
@media (max-width: 640px) { .filter-label { width: 100%; } }
/* Sammlungssuche im Deck-Editor: dieselben Filter-Buttons, schmale Spalte */
.collection-filter { margin: 0 0 8px; }
.collection-filter-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.collection-filter-head .ellipsis { flex: 1; min-width: 0; }
.collection-filter .deck-filter { margin: 6px 0 0; padding: 6px 8px; }
.collection-filter .filter-label { width: 100%; }
.collection-filter .chip-toggle { padding: 1px 8px; font-size: .76rem; }

/* Sammlung aus Arena lesen: Abschnitt Player.log */
.scan-section { font-size: .9rem; margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.scan-decks-head { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.scan-decks { list-style: none; margin: 4px 0 0; padding: 0; max-height: 220px; overflow: auto; }
.scan-decks li { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.scan-decks li .check { flex: 1; min-width: 0; display: flex; gap: 6px; }

.badge-warn { background: #3a2e14; color: var(--warn); }

/* ------------------------------------------------ Probehand-Tab + Statistik markierter Stapel */
.sample-tab { display: flex; flex-direction: column; gap: 12px; }
.sample-source { margin: 0; }
.sample-play h3, .sample-sim h3, .sample-sim h4 { margin: 10px 0 6px; }
.sample-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sample-toolbar h3 { margin: 0 6px 0 0; }
.sample-toolbar .input { width: auto; }
.hand-row { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 6px; }
.hand-card { position: relative; flex: 0 0 auto; width: clamp(110px, 12vw, 180px); aspect-ratio: 488 / 680; border-radius: 9px;
    background: var(--bg-2); overflow: hidden; transition: transform .12s ease, box-shadow .12s ease; }
.hand-card:hover { transform: translateY(-6px); box-shadow: 0 10px 22px rgba(0,0,0,.45); }
.hand-card .card-img { width: 100%; height: 100%; display: block; }
.hand-card-name { display: block; padding: 8px; font-size: .8rem; font-weight: 600; }
.hand-card.is-land { outline: 1px solid rgba(255,255,255,.08); }
.hand-row.choosing .hand-card { cursor: pointer; }
.hand-row.choosing .hand-card:hover { box-shadow: 0 0 0 3px var(--danger), 0 10px 22px rgba(0,0,0,.45); }
.hand-card.small-card { width: clamp(80px, 8vw, 120px); }
.turn-badge { position: absolute; top: 4px; left: 4px; z-index: 2; background: rgba(0,0,0,.7); color: #fff; font-size: .7rem; font-weight: 700; padding: 0 6px; border-radius: 8px; }

.sim-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; text-align: center; }
.sim-kpis div { background: var(--bg-2); border-radius: 6px; padding: 8px 4px; }
.sim-kpis strong { display: block; font-size: 1.3rem; }
.sim-kpis span { font-size: .75rem; color: var(--muted); }
.sim-dist { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding-top: 16px; max-width: 520px; }
.sim-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.sim-bar { width: 100%; background: var(--panel-2); border-radius: 3px 3px 0 0; min-height: 1px; }
.sim-col.good .sim-bar { background: linear-gradient(var(--accent-2), #8a6a12); }
.sim-n { font-size: .7rem; color: var(--muted); white-space: nowrap; }
.sim-x { font-size: .75rem; color: var(--muted); border-top: 1px solid var(--line); width: 100%; text-align: center; }
.sim-colors { max-width: 420px; }
.prob-table td.warn { color: var(--warn); }

.stats-source { font-size: .82rem; margin-bottom: 8px; padding: 6px 8px; border-radius: 6px; background: var(--bg-2); }
.stats-source.marked { background: rgba(79, 191, 127, .14); box-shadow: inset 3px 0 0 var(--ok); }
.free-pile.is-marked { box-shadow: 0 0 0 2px var(--ok); }
.free-pile.is-marked.is-target { box-shadow: 0 0 0 2px var(--ok), 0 0 0 1px var(--accent) inset; }
@media (max-width: 640px) { .sim-kpis { grid-template-columns: 1fr; } }
