/* ============================================================
   LORCANA TCG — Training Game Styles
   Winterspell dark theme with Lorcana ink colors
   ============================================================ */

/* ── Ink Color Variables ────────────────────────────────── */
:root {
    --ink-amber:    #fbbf24;
    --ink-amethyst: #9b5de5;
    --ink-emerald:  #2d9e4f;
    --ink-ruby:     #e63946;
    --ink-sapphire: #0096c7;
    --ink-steel:    #8b9eb0;
    --tcg-bg:       #0a0e14;
    --tcg-surface:  rgba(15, 20, 30, 0.85);
    --tcg-border:   rgba(165, 216, 255, 0.12);
    --tcg-card-w:   82px;
    --tcg-card-h:   115px;
    --tcg-card-w-lg: 100px;
    --tcg-card-h-lg: 140px;
}

/* ── Game Container ─────────────────────────────────────── */
.tcg-game {
    min-height: 75vh;
    position: relative;
}

/* ── Inline icon (replaces emoji in buttons/labels) ───── */
.tcg-icon-inline {
    height: 1.1em;
    width: auto;
    vertical-align: -0.15em;
    display: inline;
    filter: drop-shadow(0 0 2px rgba(165,216,255,0.4));
}

/* ── Image load fallback placeholder ────────────────────── */
.tcg-img-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: linear-gradient(135deg, #1a1f2e 0%, #0d1117 100%);
    border-radius: 8px;
    opacity: 0.7;
}

/* ── Loading Screen ─────────────────────────────────────── */
.tcg-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}
.tcg-loading-inner {
    text-align: center;
}
.tcg-loading-hex {
    animation: tcg-pulse 1.5s ease-in-out infinite;
    margin-bottom: 1.5rem;
}
@keyframes tcg-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%      { opacity: 1; transform: scale(1.1); }
}
.tcg-loading-text {
    color: var(--ice-blue, #a5d8ff);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}
.tcg-loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(165,216,255,0.15);
    border-radius: 2px;
    margin: 0 auto;
    overflow: hidden;
}
.tcg-loading-fill {
    width: 30%;
    height: 100%;
    background: linear-gradient(90deg, var(--ink-sapphire), var(--ink-amethyst));
    border-radius: 2px;
    animation: tcg-load-bar 1.5s ease-in-out infinite;
}
@keyframes tcg-load-bar {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* ── Setup / Deck Selection ─────────────────────────────── */
.tcg-setup {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}
.tcg-setup-inner {
    max-width: 600px;
    width: 100%;
    text-align: center;
    padding: 2rem;
}
.tcg-setup-title {
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.tcg-setup-subtitle {
    color: var(--ice-blue, #a5d8ff);
    margin-bottom: 2rem;
    opacity: 0.8;
}
.tcg-color-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.tcg-color-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1rem;
    border: 2px solid var(--tcg-border);
    border-radius: 12px;
    background: var(--tcg-surface);
    cursor: pointer;
    transition: all 0.25s ease;
    color: #ccc;
    font-size: 0.9rem;
}
.tcg-color-btn:hover {
    border-color: var(--ink-color);
    background: rgba(165,216,255,0.05);
    transform: translateY(-2px);
}
.tcg-color-btn.selected {
    border-color: var(--ink-color);
    background: rgba(165,216,255,0.08);
    box-shadow: 0 0 20px rgba(var(--ink-color), 0.2), inset 0 0 20px rgba(0,0,0,0.2);
    color: #fff;
    transform: translateY(-2px);
}
.tcg-color-ink {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    transition: transform 0.25s, filter 0.25s;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
    pointer-events: none;
}
.tcg-color-btn:hover .tcg-color-ink {
    filter: drop-shadow(0 0 10px var(--ink-color));
}
.tcg-color-btn.selected .tcg-color-ink {
    transform: scale(1.2);
    filter: drop-shadow(0 0 18px var(--ink-color)) brightness(1.2);
}
.tcg-color-name { font-weight: 600; }

.tcg-selected-colors {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: #8b949e;
}
.tcg-sel-c1, .tcg-sel-c2 {
    font-weight: 700;
    color: #fff;
    transition: color 0.3s;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn-tcg {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.7rem 1.5rem;
    border: 1px solid rgba(251,191,36,0.3);
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
    background: linear-gradient(135deg, rgba(251,191,36,0.12) 0%, rgba(217,119,6,0.08) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fbbf24;
    text-shadow: 0 0 6px rgba(251,191,36,0.2);
    box-shadow: 0 0 10px rgba(251,191,36,0.06), inset 0 1px 0 rgba(255,255,255,0.06);
    position: relative;
    overflow: hidden;
}
.btn-tcg:not(:disabled):hover {
    transform: translateY(-1px);
    border-color: rgba(251,191,36,0.6);
    box-shadow: 0 0 18px rgba(251,191,36,0.15), 0 0 36px rgba(251,191,36,0.06);
    color: #fde68a;
}
.btn-tcg:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.btn-tcg-primary {
    background: linear-gradient(135deg, rgba(251,191,36,0.25), rgba(180,130,20,0.15));
    color: #fbbf24;
    border: 1px solid rgba(251,191,36,0.5);
}
.btn-tcg-primary:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(251,191,36,0.3), 0 0 40px rgba(251,191,36,0.1);
    color: #fde68a;
}
.btn-tcg-secondary {
    background: rgba(165,216,255,0.06);
    color: var(--ice-blue, #a5d8ff);
    border: 1px solid rgba(165,216,255,0.2);
}
.btn-tcg-secondary:not(:disabled):hover {
    background: rgba(165,216,255,0.12);
    border-color: rgba(165,216,255,0.4);
    box-shadow: 0 0 15px rgba(165,216,255,0.1);
}
.btn-tcg-end {
    background: linear-gradient(135deg, rgba(230,57,70,0.15), rgba(230,57,70,0.08));
    color: #fca5a5;
    border: 1.5px solid rgba(230,57,70,0.4);
    padding: 0.35rem 1rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-radius: 20px;
    text-shadow: 0 0 8px rgba(230,57,70,0.3);
}
.btn-tcg-end:not(:disabled):hover {
    background: linear-gradient(135deg, rgba(230,57,70,0.28), rgba(230,57,70,0.15));
    border-color: rgba(230,57,70,0.7);
    box-shadow: 0 0 20px rgba(230,57,70,0.2), 0 0 40px rgba(230,57,70,0.08);
    color: #fecaca;
}

/* ── Admin Test Mode Toggle ─────────────────────────────── */
.tcg-admin-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 1.25rem auto 0.5rem;
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, rgba(255,165,0,0.12), rgba(255,140,0,0.06));
    border: 1px solid rgba(255,165,0,0.35);
    border-radius: 12px;
    max-width: 360px;
}
.tcg-admin-toggle-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fbbf24;
    letter-spacing: 0.02em;
}
.tcg-admin-switch {
    width: 48px;
    height: 26px;
    border-radius: 13px;
    background: rgba(255,255,255,0.12);
    border: 2px solid rgba(255,255,255,0.2);
    cursor: pointer;
    position: relative;
    transition: background 0.25s, border-color 0.25s;
}
.tcg-admin-switch.active {
    background: rgba(251,191,36,0.35);
    border-color: rgba(251,191,36,0.7);
}
.tcg-admin-knob {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #94a3b8;
    position: absolute;
    top: 1px;
    left: 1px;
    transition: transform 0.25s, background 0.25s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.tcg-admin-switch.active .tcg-admin-knob {
    transform: translateX(22px);
    background: #fbbf24;
}
.tcg-admin-toggle-status {
    font-size: 0.78rem;
    font-weight: 700;
    color: #64748b;
    min-width: 28px;
    text-align: left;
    transition: color 0.25s;
}
.tcg-admin-toggle-status.on {
    color: #fbbf24;
}

/* Admin mode active indicator on game board */
.tcg-admin-badge {
    position: fixed;
    top: 72px;
    right: 16px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #000;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 6px;
    z-index: 100;
    letter-spacing: 0.06em;
    box-shadow: 0 2px 8px rgba(245,158,11,0.4);
    pointer-events: none;
}

/* Spectator banner on game board */
.tcg-spectator-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(125,211,252,0.15), rgba(96,165,250,0.08));
    border-bottom: 1px solid rgba(125,211,252,0.2);
    color: var(--accent, #7dd3fc);
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 6px 16px;
    z-index: 999;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.tcg-spectator-banner .spectator-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: specPulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(34,197,94,0.5);
}
@keyframes specPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}
.spectator-ranked-badge {
    background: rgba(251,191,36,0.15);
    color: #fbbf24;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.68rem;
    margin-left: 8px;
}

/* Ranked badge on game board */
.tcg-ranked-badge {
    position: fixed;
    top: 72px;
    left: 16px;
    background: linear-gradient(135deg, rgba(251,191,36,0.2), rgba(245,158,11,0.1));
    border: 1px solid rgba(251,191,36,0.3);
    color: #fbbf24;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 6px;
    z-index: 100;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(251,191,36,0.2);
}

/* Admin confirm button in log */
.tcg-admin-confirm-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin: 4px 0;
    background: linear-gradient(135deg, rgba(34,197,94,0.15), rgba(34,197,94,0.06));
    border: 1px solid rgba(34,197,94,0.3);
    border-radius: 8px;
    font-size: 0.72rem;
}
.tcg-admin-confirm-bar .card-name {
    font-weight: 600;
    color: #86efac;
    flex: 1;
}
.tcg-admin-confirm-bar .effect-tag {
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(251,191,36,0.2);
    color: #fbbf24;
    font-weight: 600;
}
.btn-confirm-card {
    background: rgba(34,197,94,0.2);
    border: 1px solid rgba(34,197,94,0.5);
    color: #86efac;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-confirm-card:hover {
    background: rgba(34,197,94,0.4);
}
.btn-confirm-card.confirmed {
    background: rgba(34,197,94,0.35);
    border-color: rgba(34,197,94,0.7);
    color: #22c55e;
    cursor: default;
}

/* ── Quick Rules ────────────────────────────────────────── */
.tcg-rules-brief {
    margin-top: 2rem;
    text-align: left;
    background: var(--tcg-surface);
    border: 1px solid var(--tcg-border);
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
}
.tcg-rules-brief h3 {
    color: var(--ink-amber);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}
.tcg-rules-brief ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.tcg-rules-brief li {
    color: #8b949e;
    font-size: 0.85rem;
    padding: 0.25rem 0;
    padding-left: 1rem;
    position: relative;
}
.tcg-rules-brief li::before {
    content: '◆';
    position: absolute;
    left: 0;
    color: var(--ink-sapphire);
    font-size: 0.6rem;
    top: 0.4rem;
}

/* ── Mulligan ───────────────────────────────────────────── */
.tcg-mulligan {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
}
.tcg-mulligan-inner {
    text-align: center;
    max-width: 700px;
    padding: 2rem;
}
.tcg-mulligan-inner h2 {
    color: #fff;
    margin-bottom: 0.5rem;
}
.tcg-mulligan-inner p {
    color: #8b949e;
    margin-bottom: 1.5rem;
}
.tcg-mulligan-hand {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.tcg-mulligan-hand .tcg-card.mulligan-selected {
    outline: 3px solid #f85149;
    outline-offset: 2px;
    opacity: 0.5;
    transform: translateY(-10px);
    transition: transform 0.2s, opacity 0.2s, outline 0.2s;
}
.tcg-mulligan-hand .tcg-card {
    transition: transform 0.2s, opacity 0.2s, outline 0.2s;
}
.tcg-mulligan-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* ── Game Board ─────────────────────────────────────────── */
.tcg-board {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0;
    padding-bottom: calc(var(--tcg-card-h) * 0.5 + 16px);
    padding-top: 52px; /* space for fixed action bar */
    min-height: 65vh;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow-x: hidden;
    overflow-y: visible;
}

/* ── Starfall Effect ────────────────────────────────────── */
.tcg-starfall-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
/* Wrapper: positioned at start, rotated to trajectory angle */
.tcg-meteor-wrap {
    position: absolute;
    transform: rotate(var(--angle, 35deg));
}
/* The meteor head + tail: translates along local X (forward) */
.tcg-meteor {
    position: relative;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #fff;
    box-shadow:
        0 0 6px 2px rgba(255,255,255,0.9),
        0 0 14px 4px rgba(180,200,255,0.5);
    animation: meteorFly var(--dur, 0.8s) linear forwards;
    opacity: 0;
}
/* Fire tail — stretches behind the head */
.tcg-meteor::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 100%;
    width: var(--tail-len, 100px);
    height: 2.5px;
    transform: translateY(-50%);
    background: linear-gradient(
        to left,
        rgba(255,255,255,0.95),
        rgba(255,220,130,0.8) 10%,
        rgba(255,160,60,0.5) 30%,
        rgba(255,80,20,0.2) 60%,
        transparent
    );
    border-radius: 1px;
    filter: blur(0.4px);
}
/* Bright flicker glow on the head */
.tcg-meteor::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.9), rgba(200,220,255,0) 65%);
    animation: meteorFlicker 0.12s ease-in-out infinite alternate;
}
@keyframes meteorFly {
    0%   { transform: translateX(0); opacity: 0; }
    4%   { opacity: var(--brightness, 0.9); }
    80%  { opacity: var(--brightness, 0.9); }
    100% { transform: translateX(var(--travel, 400px)); opacity: 0; }
}
@keyframes meteorFlicker {
    0%   { opacity: 0.5; transform: scale(0.7); }
    100% { opacity: 1;   transform: scale(1.4); }
}

/* ── Zones ──────────────────────────────────────────────── */
.tcg-zone {
    background: var(--tcg-surface);
    border: 1px solid var(--tcg-border);
    border-radius: 12px;
    padding: 0.6rem 0.8rem;
    overflow: visible;
    position: relative;
}
.tcg-bot-zone {
    border-top-color: rgba(230,57,70,0.2);
    z-index: 1;
}
.tcg-player-zone {
    border-bottom-color: rgba(45,158,79,0.2);
    overflow: visible;
    z-index: 2;
}

/* ── Player hand: fixed at bottom, 40% submerged to save space ── */
.tcg-player-zone .tcg-player-hand {
    position: fixed;
    bottom: calc(var(--tcg-card-h) * -0.40);
    left: 0;
    right: 0;
    z-index: 200;
    background: transparent;
    border-top: none;
    padding: 4px 6px 6px;
    margin-top: 0;
    justify-content: center;
    flex-wrap: nowrap;
    overflow: visible;
    height: calc(var(--tcg-card-h) * 0.52);
    transition: bottom 0.3s ease;
}
.tcg-player-zone .tcg-player-hand:hover,
.tcg-player-zone .tcg-player-hand:has(.selected) {
    bottom: 0;
}
.tcg-player-zone .tcg-player-hand .tcg-card {
    margin-left: calc(var(--tcg-card-w) * -0.3);
    margin-top: calc(var(--tcg-card-h) * -0.48);
}
.tcg-player-zone .tcg-player-hand .tcg-card.selected {
    margin-top: calc(var(--tcg-card-h) * -0.7);
    z-index: 35;
}

.tcg-zone-info {
    display: none; /* Stats moved to center bar */
}
.tcg-player-label {
    display: none; /* Removed — only 2 players, obvious who is who */
}
.bot-label { color: var(--ink-ruby); }
.player-label { color: var(--ink-emerald); }

/* ── Lore Counter (uses Lore.svg) ──────────────────────── */
.tcg-lore-diamond {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: visible;
}
.tcg-lore-icon {
    height: 85.5px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 4px rgba(212,168,67,0.3));
    transition: filter 0.4s ease;
}
.tcg-lore-value {
    position: absolute;
    left: 50%;
    top: 56%;
    transform: translate(-50%, -50%);
    font-size: 1.125rem;
    font-weight: 800;
    font-family: 'Georgia', 'Times New Roman', serif;
    color: #fbbf24;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
    line-height: 1;
    pointer-events: none;
}
/* Glow when lore > 0 */
.tcg-lore-diamond.has-lore .tcg-lore-icon {
    filter: drop-shadow(0 0 8px rgba(251,191,36,0.4)) drop-shadow(0 0 16px rgba(251,191,36,0.15));
}
.tcg-lore-diamond.has-lore .tcg-lore-value {
    color: #fbbf24;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
/* Near-win glow (15+) */
.tcg-lore-diamond.near-win .tcg-lore-icon {
    filter: drop-shadow(0 0 12px rgba(251,191,36,0.6)) drop-shadow(0 0 24px rgba(251,191,36,0.3));
    animation: loreIconPulse 1.5s ease-in-out infinite;
}
.tcg-lore-diamond.near-win .tcg-lore-value {
    color: #fbbf24;
    font-size: 1.575rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
@keyframes loreIconPulse {
    0%, 100% { filter: drop-shadow(0 0 12px rgba(251,191,36,0.6)) drop-shadow(0 0 24px rgba(251,191,36,0.3)); }
    50% { filter: drop-shadow(0 0 18px rgba(251,191,36,0.8)) drop-shadow(0 0 36px rgba(251,191,36,0.4)); }
}

/* ── Lore Change Floating Indicator ────────────────────── */
.tcg-lore-change {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    font-weight: 900;
    pointer-events: none;
    z-index: 50;
    white-space: nowrap;
    animation: loreChangeFloat 2.2s ease-out forwards;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
    border-radius: 6px;
    padding: 1px 6px;
}
.tcg-lore-change.lore-gain {
    color: #4ade80;
    background: rgba(20, 120, 60, 0.85);
    border: 1px solid rgba(80, 220, 120, 0.5);
    box-shadow: 0 0 8px rgba(40, 180, 80, 0.6);
}
.tcg-lore-change.lore-loss {
    color: #ff6b6b;
    background: rgba(160, 40, 20, 0.85);
    border: 1px solid rgba(255, 120, 80, 0.5);
    box-shadow: 0 0 8px rgba(200, 60, 40, 0.6);
}
@keyframes loreChangeFloat {
    0%   { opacity: 0; transform: translateX(-50%) translateY(0) scale(0.5); }
    15%  { opacity: 1; transform: translateX(-50%) translateY(-4px) scale(1.15); }
    30%  { opacity: 1; transform: translateX(-50%) translateY(-8px) scale(1); }
    75%  { opacity: 1; transform: translateX(-50%) translateY(-18px) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-28px) scale(0.85); }
}

.tcg-zone-stats {
    display: flex;
    gap: 0.8rem;
    font-size: 0.8rem;
    color: #8b949e;
}
.tcg-stat { display: flex; align-items: center; gap: 0.2rem; }

/* Icon images (inkwell + playing-cards SVG) */
.tcg-icon-img          { height: 1.2em; width: auto; vertical-align: middle; object-fit: contain; }
.tcg-icon-deck         { height: 2.2em; filter: invert(1) opacity(0.7); }
.tcg-icon-inkwell      { height: 6.27em; }
.tcg-icon-inkwell-lg   { height: 3.6em; }
.tcg-ink-wrap          { position: relative; display: inline-flex; align-items: center; justify-content: center; overflow: visible; }
.tcg-ink-overlay       { position: absolute; font-size: 1.125em; font-weight: 700; color: #d4a843;
                         text-shadow: 0 1px 2px rgba(0,0,0,0.7), 0 0 6px rgba(212,168,67,0.5); white-space: nowrap;
                         left: 50%; top: 50%; transform: translate(-50%, -50%); }

/* ── Field ──────────────────────────────────────────────── */
.tcg-field-label {
    font-size: 0.7rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0.2rem 0;
}
.tcg-field {
    display: flex;
    gap: 0.5rem;
    min-height: calc(var(--tcg-card-h) * 1.2 + 10px);
    padding: 0.4rem;
    padding-bottom: calc(var(--tcg-card-h) * 0.15);
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    overflow: visible;
    flex-wrap: wrap;
    align-items: flex-start;
}
.tcg-field-small {
    min-height: calc(var(--tcg-card-h) * 1.2 + 5px);
}

/* ── Field Sub-Zones (Row Layout) ───────────────────────── */
.tcg-field-row {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    overflow: visible;
    position: relative;
}
.tcg-subfield-main {
    flex: 1;
    min-width: 0;
    overflow: visible;
    position: relative;
}
.tcg-subfield-aside {
    width: 30%;
    max-width: 280px;
    min-width: 100px;
    flex-shrink: 0;
    overflow: visible;
    position: relative;
}
.tcg-subfield-label {
    font-size: 0.6rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0.1rem 0;
    padding-left: 4px;
}
/* Location count badge */
.tcg-loc-count {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.75);
    color: #fbbf24;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 4px;
    line-height: 1.2;
}
/* Location group — loc card + chars on it */
.tcg-loc-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    position: relative;
}
.tcg-loc-chars {
    display: flex;
    gap: 2px;
    margin-top: -25px;
    z-index: 5;
    justify-content: center;
}
.tcg-loc-char-mini {
    width: calc(var(--tcg-card-w) * 0.55) !important;
    height: calc(var(--tcg-card-h) * 0.55) !important;
    border-radius: 4px !important;
    border: 1.5px solid rgba(255,255,255,0.3) !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.tcg-loc-char-mini .tcg-card-name {
    display: none;
}
.tcg-loc-char-mini .tcg-card-keywords {
    display: none;
}
.tcg-loc-char-mini .tcg-card-cost {
    font-size: 0.4rem;
    width: 12px;
    height: 12px;
    line-height: 12px;
}
/* Character-at-location badge */
.tcg-at-loc-badge {
    position: absolute;
    bottom: 2px;
    left: 2px;
    font-size: 0.6rem;
    line-height: 1;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.8));
}
/* Move button color */
.btn-tcg-move {
    background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(67,56,202,0.10));
    color: #a5b4fc;
    border: 1px solid rgba(99,102,241,0.4);
    text-shadow: 0 0 8px rgba(99,102,241,0.3);
}
.btn-tcg-move:hover {
    background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(67,56,202,0.18));
    border-color: rgba(99,102,241,0.7);
    box-shadow: 0 0 20px rgba(99,102,241,0.25);
    color: #c7d2fe;
}
/* Sing button color */
.btn-tcg-sing {
    background: linear-gradient(135deg, rgba(236,72,153,0.18), rgba(168,85,247,0.10));
    color: #f9a8d4;
    border: 1px solid rgba(236,72,153,0.4);
    text-shadow: 0 0 8px rgba(236,72,153,0.3);
}
.btn-tcg-sing:hover {
    background: linear-gradient(135deg, rgba(236,72,153,0.3), rgba(168,85,247,0.18));
    border-color: rgba(236,72,153,0.7);
    box-shadow: 0 0 20px rgba(236,72,153,0.25);
    color: #fbcfe8;
}
/* Boost button color */
.btn-tcg-boost {
    background: linear-gradient(135deg, rgba(245,158,11,0.18), rgba(217,119,6,0.10));
    color: #fcd34d;
    border: 1px solid rgba(245,158,11,0.4);
    text-shadow: 0 0 8px rgba(245,158,11,0.3);
}
.btn-tcg-boost:hover {
    background: linear-gradient(135deg, rgba(245,158,11,0.3), rgba(217,119,6,0.18));
    border-color: rgba(245,158,11,0.7);
    box-shadow: 0 0 20px rgba(245,158,11,0.25);
    color: #fde68a;
}

/* ── Location Picker Popup ──────────────────────────────── */
.tcg-loc-picker {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}
.tcg-loc-picker-inner {
    background: var(--tcg-surface, #161b22);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 1.2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}
.tcg-loc-picker-title {
    color: #e6edf3;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
}
.tcg-loc-picker-grid {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}
.tcg-loc-pick-item {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem;
    border-radius: 10px;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.tcg-loc-pick-item:hover {
    border-color: var(--ink-sapphire, #38bdf8);
    transform: scale(1.05);
    box-shadow: 0 0 16px rgba(56,189,248,0.3);
}
.tcg-loc-pick-img {
    width: 120px;
    height: 168px;
    border-radius: 8px;
    object-fit: cover;
}
.tcg-loc-pick-name {
    color: #c9d1d9;
    font-size: 0.75rem;
    text-align: center;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Boost cards-under badge */
.tcg-boost-count {
    position: absolute;
    bottom: 2px;
    left: 2px;
    background: rgba(245,158,11,0.85);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 4px;
    line-height: 1.2;
    pointer-events: none;
    z-index: 4;
}

/* Boost wrapper — card on top, facedown strip(s) peeking below */
.tcg-boost-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}
.tcg-boost-under {
    width: 90%;
    height: calc(var(--tcg-card-h) * 0.08);
    margin-top: -3px;
    border-radius: 0 0 4px 4px;
    background: linear-gradient(180deg, #2a2a3e 0%, #1a1a2e 100%);
    border: 1.5px solid rgba(245,158,11,0.4);
    border-top: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    pointer-events: none;
}

/* ── Hand ───────────────────────────────────────────────── */
.tcg-hand {
    display: flex;
    gap: 0;
    padding: 0.3rem;
    padding-left: calc(0.3rem + var(--tcg-card-w) * 0.45);
    overflow: visible;
    justify-content: center;
    flex-wrap: nowrap;
    touch-action: manipulation;
}
.tcg-hand .tcg-card {
    margin-left: calc(var(--tcg-card-w) * -0.45);
    transition: all 0.25s ease;
}
.tcg-hand .tcg-card:hover {
    transform: translateY(-18px) scale(1.08);
    z-index: 30;
    margin-left: 4px;
    margin-right: 4px;
}
.tcg-hand .tcg-card.selected {
    transform: translateY(-22px) scale(1.1);
    z-index: 35;
    margin-left: 4px;
    margin-right: 4px;
}
.tcg-bot-hand {
    position: fixed;
    top: calc(var(--tcg-card-h) * -0.60);
    left: 0;
    right: 0;
    z-index: 200;
    background: transparent;
    padding: 6px 6px 4px;
    justify-content: center;
    flex-wrap: nowrap;
    overflow: visible;
    height: calc(var(--tcg-card-h) * 0.52);
    transition: top 0.3s ease;
}
.tcg-bot-hand:hover {
    top: 0;
}
.tcg-bot-hand .tcg-card {
    margin-left: calc(var(--tcg-card-w) * -0.55);
    margin-bottom: calc(var(--tcg-card-h) * -0.48);
}

/* ── Card ───────────────────────────────────────────────── */
.tcg-card {
    width: var(--tcg-card-w);
    height: var(--tcg-card-h);
    border-radius: 6px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    border: 2px solid transparent;
    overflow: hidden;
    background: #1a1a2e;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}
.tcg-card:hover {
    transform: translateY(-4px);
    z-index: 10;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}
.tcg-card.selected {
    border-color: var(--ink-amber) !important;
    box-shadow: 0 0 20px rgba(251,191,36,0.4);
    transform: translateY(-8px);
    z-index: 20;
}
.tcg-card.targetable {
    border-color: var(--ink-ruby) !important;
    box-shadow: 0 0 15px rgba(230,57,70,0.4);
    animation: tcg-target-pulse 1s ease-in-out infinite;
    cursor: pointer;
    position: relative;
}
.tcg-card.targetable::after {
    content: '⚔';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: var(--ink-ruby);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    z-index: 25;
    box-shadow: 0 2px 8px rgba(230,57,70,0.6);
    animation: tcg-target-badge-pulse 1s ease-in-out infinite;
}
@keyframes tcg-target-pulse {
    0%, 100% { box-shadow: 0 0 10px rgba(230,57,70,0.3); }
    50%      { box-shadow: 0 0 25px rgba(230,57,70,0.6); }
}
@keyframes tcg-target-badge-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.15); }
}

/* Mobile: stronger targetable glow */
@media (max-width: 640px) {
    .tcg-card.targetable {
        box-shadow: 0 0 20px rgba(230,57,70,0.55), 0 0 40px rgba(230,57,70,0.25);
        border-width: 2.5px;
        transform: scale(1.05);
        z-index: 22;
    }
    .tcg-card.targetable::after {
        width: 20px;
        height: 20px;
        font-size: 11px;
        top: -6px;
        right: -6px;
    }
}

/* ── Target Banner (Pick an opponent) ───────────────────── */
.tcg-target-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.9rem 1.5rem;
    background: linear-gradient(135deg, rgba(230,57,70,0.92), rgba(180,30,40,0.95));
    border-bottom: 2px solid rgba(255,255,255,0.15);
    box-shadow: 0 4px 30px rgba(230,57,70,0.4), 0 0 60px rgba(230,57,70,0.15);
    backdrop-filter: blur(6px);
    animation: targetBannerSlide 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tcg-target-banner-icon {
    font-size: 1.6rem;
    animation: targetIconPulse 1.2s ease-in-out infinite;
}
.tcg-target-banner-text {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
    letter-spacing: 0.5px;
}
.tcg-target-banner-cancel {
    padding: 0.45rem 1.2rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(0,0,0,0.25);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    touch-action: manipulation;
    min-height: 40px;
}
.tcg-target-banner-cancel:hover {
    background: rgba(0,0,0,0.45);
}
@keyframes targetBannerSlide {
    0%   { transform: translateY(-100%); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}
@keyframes targetIconPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.2); }
}
@media (max-width: 640px) {
    .tcg-target-banner {
        padding: 0.7rem 1rem;
        gap: 0.6rem;
    }
    .tcg-target-banner-icon { font-size: 1.2rem; }
    .tcg-target-banner-text { font-size: 0.95rem; }
}

.tcg-card.playable {
    border-color: rgba(45,158,79,0.5);
}
.tcg-card.inkable-highlight {
    border-color: rgba(251,191,36,0.4);
}
.tcg-card.exerted {
    transform: rotate(12deg);
    opacity: 0.75;
}
.tcg-card.exerted:hover {
    transform: rotate(12deg) translateY(-4px);
}
.tcg-card.exerted.selected {
    transform: rotate(12deg) translateY(-8px);
}
.tcg-card.fresh {
    filter: brightness(0.7) saturate(0.6);
}
.tcg-card.damaged {
    border-color: rgba(230,57,70,0.5) !important;
}

/* Card Image */
.tcg-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    pointer-events: none;
}

/* Card Back (bot hand) */
.tcg-card.card-back {
    background: linear-gradient(135deg, #1a1a2e, #2d1b69);
    border: 2px solid rgba(155,93,229,0.3);
    cursor: default;
}
.tcg-card.card-back:hover {
    transform: none;
    box-shadow: none;
}
.tcg-card-back-pattern {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 8px,
        rgba(155,93,229,0.05) 8px,
        rgba(155,93,229,0.05) 16px
    );
}
.tcg-card-back-pattern::after {
    content: '';
    display: block;
    width: 36px;
    height: 36px;
    background: url('/svg/playing-cards.svg') center/contain no-repeat;
    opacity: 0.45;
    filter: drop-shadow(0 0 4px rgba(155,93,229,0.4));
}

/* Card Overlays */
.tcg-card-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2px 3px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 2;
}
.tcg-card-damage {
    position: absolute;
    top: 2px;
    right: 2px;
    display: flex;
    align-items: center;
    gap: 1px;
    background: rgba(180, 20, 30, 0.92);
    border: 1px solid rgba(255, 80, 80, 0.5);
    border-radius: 8px;
    padding: 1px 4px;
    z-index: 3;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(230, 57, 70, 0.6);
    animation: dmgPulse 2s ease-in-out infinite;
}
.tcg-card-damage .dmg-icon {
    font-size: 0.55rem;
    line-height: 1;
}
.tcg-card-damage .dmg-val {
    font-size: 0.7rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    line-height: 1;
}
@keyframes dmgPulse {
    0%, 100% { box-shadow: 0 0 6px rgba(230, 57, 70, 0.6); }
    50% { box-shadow: 0 0 12px rgba(230, 57, 70, 0.9), 0 0 4px rgba(255, 100, 100, 0.4); }
}

/* Strength buff overlay — swords +N (top-left) */
.tcg-card-strbuff {
    position: absolute;
    top: 2px;
    left: 2px;
    display: flex;
    align-items: center;
    gap: 1px;
    background: rgba(20, 120, 60, 0.92);
    border: 1px solid rgba(80, 220, 120, 0.5);
    border-radius: 8px;
    padding: 1px 4px;
    z-index: 3;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(40, 180, 80, 0.6);
    animation: strPulse 2s ease-in-out infinite;
}
.tcg-card-strbuff .strbuff-icon {
    font-size: 0.55rem;
    line-height: 1;
}
.tcg-card-strbuff .strbuff-val {
    font-size: 0.7rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    line-height: 1;
}
@keyframes strPulse {
    0%, 100% { box-shadow: 0 0 6px rgba(40, 180, 80, 0.6); }
    50% { box-shadow: 0 0 12px rgba(40, 180, 80, 0.9), 0 0 4px rgba(80, 220, 120, 0.4); }
}

/* Strength debuff overlay — swords -N (top-left, red) */
.tcg-card-strdebuff {
    position: absolute;
    top: 2px;
    left: 2px;
    display: flex;
    align-items: center;
    gap: 1px;
    background: rgba(160, 40, 20, 0.92);
    border: 1px solid rgba(255, 120, 80, 0.5);
    border-radius: 8px;
    padding: 1px 4px;
    z-index: 3;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(200, 60, 40, 0.6);
}
.tcg-card-strdebuff .strbuff-icon {
    font-size: 0.55rem;
    line-height: 1;
}
.tcg-card-strdebuff .strbuff-val {
    font-size: 0.7rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    line-height: 1;
}

/* Lore buff overlay — diamond icon (bottom-left) */
.tcg-card-lorebuff {
    position: absolute;
    bottom: 2px;
    left: 2px;
    display: flex;
    align-items: center;
    gap: 1px;
    background: rgba(20, 80, 160, 0.92);
    border: 1px solid rgba(80, 160, 255, 0.5);
    border-radius: 8px;
    padding: 1px 4px;
    z-index: 3;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(40, 120, 220, 0.6);
    animation: lorePulse 2s ease-in-out infinite;
}
.tcg-card-lorebuff .lorebuff-icon {
    font-size: 0.55rem;
    line-height: 1;
    color: #7dd3fc;
}
.tcg-card-lorebuff .lorebuff-val {
    font-size: 0.7rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    line-height: 1;
}
@keyframes lorePulse {
    0%, 100% { box-shadow: 0 0 6px rgba(40, 120, 220, 0.6); }
    50% { box-shadow: 0 0 12px rgba(40, 120, 220, 0.9), 0 0 4px rgba(80, 160, 255, 0.4); }
}

/* Lore debuff overlay — diamond icon (bottom-left, red) */
.tcg-card-loredebuff {
    position: absolute;
    bottom: 2px;
    left: 2px;
    display: flex;
    align-items: center;
    gap: 1px;
    background: rgba(160, 40, 20, 0.92);
    border: 1px solid rgba(255, 120, 80, 0.5);
    border-radius: 8px;
    padding: 1px 4px;
    z-index: 3;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(200, 60, 40, 0.6);
}
.tcg-card-loredebuff .lorebuff-icon {
    font-size: 0.55rem;
    line-height: 1;
    color: #fca5a5;
}
.tcg-card-loredebuff .lorebuff-val {
    font-size: 0.7rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    line-height: 1;
}

/* Willpower buff overlay — shield +N (bottom-right, teal/cyan) */
.tcg-card-wpbuff {
    position: absolute;
    bottom: 2px;
    right: 2px;
    display: flex;
    align-items: center;
    gap: 1px;
    background: rgba(20, 120, 140, 0.92);
    border: 1px solid rgba(80, 200, 220, 0.5);
    border-radius: 8px;
    padding: 1px 4px;
    z-index: 3;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(40, 160, 180, 0.6);
    animation: wpPulse 2s ease-in-out infinite;
}
.tcg-card-wpbuff .wpbuff-icon {
    font-size: 0.55rem;
    line-height: 1;
}
.tcg-card-wpbuff .wpbuff-val {
    font-size: 0.7rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    line-height: 1;
}
@keyframes wpPulse {
    0%, 100% { box-shadow: 0 0 6px rgba(40, 160, 180, 0.6); }
    50% { box-shadow: 0 0 12px rgba(40, 160, 180, 0.9), 0 0 4px rgba(80, 200, 220, 0.4); }
}

/* Willpower debuff overlay — shield -N (bottom-right, red) */
.tcg-card-wpdebuff {
    position: absolute;
    bottom: 2px;
    right: 2px;
    display: flex;
    align-items: center;
    gap: 1px;
    background: rgba(160, 40, 20, 0.92);
    border: 1px solid rgba(255, 120, 80, 0.5);
    border-radius: 8px;
    padding: 1px 4px;
    z-index: 3;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(200, 60, 40, 0.6);
}
.tcg-card-wpdebuff .wpbuff-icon {
    font-size: 0.55rem;
    line-height: 1;
}
.tcg-card-wpdebuff .wpbuff-val {
    font-size: 0.7rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    line-height: 1;
}

.tcg-card-keywords {
    position: absolute;
    top: 2px;
    left: 2px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    z-index: 2;
}

.tcg-beta-tag {
    font-size: 0.55em;
    font-weight: 600;
    color: #f59e0b;
    vertical-align: middle;
    opacity: 0.85;
}
.tcg-keyword-badge {
    font-size: 0.5rem;
    padding: 0 3px;
    border-radius: 2px;
    background: rgba(0,0,0,0.7);
    color: #fde68a;
    font-weight: 700;
    white-space: nowrap;
}

/* Color-coded card borders */
.tcg-card[data-color="Amber"]    { border-color: rgba(251,191,36,0.3); }
.tcg-card[data-color="Amethyst"] { border-color: rgba(155,93,229,0.3); }
.tcg-card[data-color="Emerald"]  { border-color: rgba(45,158,79,0.3); }
.tcg-card[data-color="Ruby"]     { border-color: rgba(230,57,70,0.3); }
.tcg-card[data-color="Sapphire"] { border-color: rgba(0,150,199,0.3); }
.tcg-card[data-color="Steel"]    { border-color: rgba(139,158,176,0.3); }


/* ── Center Bar ─────────────────────────────────────────── */
.tcg-center-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0 1rem;
    height: 38px;
    background: linear-gradient(90deg, rgba(230,57,70,0.08), var(--tcg-surface) 30%, var(--tcg-surface) 70%, rgba(45,158,79,0.08));
    border: 1px solid var(--tcg-border);
    border-radius: 8px;
    flex-wrap: nowrap;
    overflow: visible;
    position: relative;
    z-index: 10;
}
/* Side stat groups */
.tcg-bar-side {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
    overflow: visible;
}
.tcg-bar-bot .tcg-lore-value { color: #fbbf24; }
.tcg-bar-bot .tcg-lore-diamond.has-lore .tcg-lore-value { color: #fbbf24; }
.tcg-bar-player .tcg-lore-value { color: #fbbf24; }
.tcg-bar-player .tcg-lore-diamond.has-lore .tcg-lore-value { color: #fbbf24; }
/* Center info */
.tcg-bar-center {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
    min-width: 0;
}
.tcg-turn-badge {
    font-weight: 700;
    color: #fff;
    font-size: 0.9rem;
    white-space: nowrap;
}
.tcg-phase-badge {
    font-size: 0.75rem;
    color: var(--ink-amber);
    padding: 0.15rem 0.6rem;
    border-radius: 10px;
    background: rgba(251,191,36,0.1);
    border: 1px solid rgba(251,191,36,0.2);
    white-space: nowrap;
}
.tcg-message {
    color: var(--ice-blue, #a5d8ff);
    font-size: 0.85rem;
    text-align: center;
}

/* ── Floating Controls Dock (right edge — End Turn half-circle) ── */
.tcg-controls-dock {
    position: fixed;
    right: -2px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 210;
}

/* ── Edge Buttons (tab hooks anchored at screen edge) ── */
.tcg-edge-btn {
    position: fixed;
    right: -2px;
    z-index: 210;
    width: 26px;
    height: 38px;
    border-radius: 6px 0 0 6px;
    border: 1.5px solid rgba(139,158,176,0.3);
    border-right: none;
    background: linear-gradient(135deg, rgba(15,20,30,0.92), rgba(26,26,46,0.92));
    color: #c9d1d9;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    box-shadow: -2px 0 10px rgba(0,0,0,0.4);
    transition: all 0.25s ease;
    font-family: inherit;
    padding: 0 2px 0 0;
    writing-mode: vertical-lr;
}
.tcg-edge-btn:hover {
    width: 32px;
    border-color: rgba(251,191,36,0.5);
    box-shadow: -2px 0 16px rgba(251,191,36,0.15);
}
.tcg-edge-log {
    top: 30%;
    font-size: 0.8rem;
    writing-mode: horizontal-tb;
}
.tcg-edge-log.active {
    width: 40px;
    border-color: var(--ink-amber, #fbbf24);
    color: var(--ink-amber, #fbbf24);
    box-shadow: -2px 0 12px rgba(251,191,36,0.3);
}
.tcg-edge-help {
    top: calc(30% + 44px);
    border-color: rgba(251,191,36,0.3);
    color: var(--ink-amber, #fbbf24);
    font-weight: 800;
    font-size: 0.9rem;
    writing-mode: horizontal-tb;
}
.tcg-edge-help:hover {
    border-color: var(--ink-amber, #fbbf24);
    box-shadow: -2px 0 18px rgba(251,191,36,0.3);
}
.tcg-dock-btn {
    width: 36px;
    height: 52px;
    border-radius: 26px 0 0 26px;
    border: 2px solid rgba(34,197,94,0.5);
    border-right: none;
    background: linear-gradient(135deg, rgba(15,20,30,0.92), rgba(26,26,46,0.92));
    color: #86efac;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    box-shadow: -3px 0 14px rgba(0,0,0,0.5);
    transition: all 0.25s ease;
    position: relative;
    font-family: inherit;
    padding: 0 4px 0 0;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.tcg-dock-btn:hover {
    width: 42px;
    border-color: rgba(34,197,94,0.8);
    box-shadow: -3px 0 20px rgba(34,197,94,0.25);
    color: #bbf7d0;
}
.tcg-dock-btn:active { width: 32px; }

/* Dock — End Turn */
.tcg-dock-end {
    /* styles merged into .tcg-dock-btn above */
}
.tcg-dock-end:not(:disabled):hover {
    border-color: rgba(34,197,94,0.8);
    box-shadow: -3px 0 20px rgba(34,197,94,0.25);
    color: #bbf7d0;
}
.tcg-dock-end:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: rgba(139,158,176,0.2);
    color: #484f58;
}

/* Dock — Log (legacy, now .tcg-edge-log) */
.tcg-dock-log {
    font-size: 1rem;
}
.tcg-dock-log.active {
    border-color: var(--ink-amber, #fbbf24);
    color: var(--ink-amber, #fbbf24);
    box-shadow: 0 0 12px rgba(251,191,36,0.3);
}
.tcg-dock-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 0.55rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    background: rgba(88,166,255,0.25);
    color: #58a6ff;
    pointer-events: none;
}

/* Dock — Help (legacy, now .tcg-edge-help) */
.tcg-dock-help {
    border-color: rgba(251,191,36,0.4);
    color: var(--ink-amber, #fbbf24);
    font-weight: 800;
    font-size: 1.2rem;
}
.tcg-dock-help:hover {
    border-color: var(--ink-amber, #fbbf24);
    box-shadow: 0 0 18px rgba(251,191,36,0.3);
}

/* Hide old standalone help button (now in dock) */
.tcg-help-btn:not(.tcg-dock-help) { display: none !important; }

/* Hide old mobile log button (now in dock) */
.tcg-log-mobile-btn { display: none !important; }

/* Old action bar hidden (End Turn now in dock) */
.tcg-action-bar { display: none !important; }

.tcg-card-actions {
    display: none !important;
}
.tcg-card-actions .btn-tcg {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}
.btn-tcg-ink {
    background: linear-gradient(135deg, rgba(251,191,36,0.2), rgba(180,130,20,0.12));
    color: #fbbf24;
    border: 1px solid rgba(251,191,36,0.4);
    text-shadow: 0 0 8px rgba(251,191,36,0.3);
}
.btn-tcg-ink:hover {
    background: linear-gradient(135deg, rgba(251,191,36,0.35), rgba(180,130,20,0.2));
    border-color: rgba(251,191,36,0.7);
    box-shadow: 0 0 20px rgba(251,191,36,0.25), 0 0 40px rgba(251,191,36,0.08);
    color: #fde68a;
}
.btn-tcg-play {
    background: linear-gradient(135deg, rgba(34,197,94,0.18), rgba(22,163,74,0.10));
    color: #86efac;
    border: 1px solid rgba(34,197,94,0.4);
    text-shadow: 0 0 8px rgba(34,197,94,0.3);
}
.btn-tcg-play:hover {
    background: linear-gradient(135deg, rgba(34,197,94,0.3), rgba(22,163,74,0.18));
    border-color: rgba(34,197,94,0.7);
    box-shadow: 0 0 20px rgba(34,197,94,0.25);
    color: #bbf7d0;
}
.btn-tcg-quest {
    background: linear-gradient(135deg, rgba(59,130,246,0.18), rgba(37,99,235,0.10));
    color: #93c5fd;
    border: 1px solid rgba(59,130,246,0.4);
    text-shadow: 0 0 8px rgba(59,130,246,0.3);
}
.btn-tcg-quest:hover {
    background: linear-gradient(135deg, rgba(59,130,246,0.3), rgba(37,99,235,0.18));
    border-color: rgba(59,130,246,0.7);
    box-shadow: 0 0 20px rgba(59,130,246,0.25);
    color: #bfdbfe;
}
.btn-tcg-challenge {
    background: linear-gradient(135deg, rgba(239,68,68,0.18), rgba(185,28,28,0.10));
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,0.4);
    text-shadow: 0 0 8px rgba(239,68,68,0.3);
}
.btn-tcg-challenge:hover {
    background: linear-gradient(135deg, rgba(239,68,68,0.3), rgba(185,28,28,0.18));
    border-color: rgba(239,68,68,0.7);
    box-shadow: 0 0 20px rgba(239,68,68,0.25);
    color: #fecaca;
}
.btn-tcg-cancel {
    background: rgba(139,158,176,0.1);
    color: #8b949e;
    border: 1px solid rgba(139,158,176,0.25);
}
.btn-tcg-cancel:hover {
    background: rgba(139,158,176,0.2);
    border-color: rgba(139,158,176,0.5);
}
.btn-tcg-shift {
    background: linear-gradient(135deg, rgba(155,93,229,0.18), rgba(108,46,183,0.10));
    color: #d8b4fe;
    border: 1px solid rgba(155,93,229,0.4);
    text-shadow: 0 0 8px rgba(155,93,229,0.3);
}
.btn-tcg-shift:hover {
    background: linear-gradient(135deg, rgba(155,93,229,0.3), rgba(108,46,183,0.18));
    border-color: rgba(155,93,229,0.7);
    box-shadow: 0 0 20px rgba(155,93,229,0.25);
    color: #e9d5ff;
}
/* Activated ability button */
.btn-tcg-ability {
    background: linear-gradient(135deg, rgba(139,92,246,0.18), rgba(109,40,217,0.10));
    color: #d8b4fe;
    border: 1px solid rgba(139,92,246,0.4);
    text-shadow: 0 0 8px rgba(139,92,246,0.3);
    font-size: 0.7rem;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.btn-tcg-ability:hover {
    background: linear-gradient(135deg, rgba(139,92,246,0.3), rgba(109,40,217,0.18));
    border-color: rgba(139,92,246,0.7);
    box-shadow: 0 0 20px rgba(139,92,246,0.25);
    color: #e9d5ff;
}

/* ── Log Panel ──────────────────────────────────────────── */
.tcg-log-panel {
    position: fixed;
    top: 30%;
    right: 34px;
    width: 360px;
    max-height: 480px;
    z-index: 209;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(13, 17, 23, 0.92);
    border: 1px solid rgba(100, 120, 150, 0.2);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.04);
    display: none;
}
.tcg-log-panel.open {
    display: block;
}
/* Log toolbar (title + buttons) */
.tcg-log-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 0.7rem;
    background: rgba(22, 27, 34, 0.6);
    border-bottom: 1px solid rgba(100,120,150,0.15);
}
.tcg-log-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #c9d1d9;
    letter-spacing: 0.02em;
    margin-right: auto;
}
.tcg-log-tool-btn {
    background: none;
    border: 1px solid rgba(100,120,150,0.15);
    border-radius: 5px;
    color: #484f58;
    font-size: 0.7rem;
    padding: 2px 6px;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
}
.tcg-log-tool-btn:hover { color: #c9d1d9; border-color: rgba(100,120,150,0.35); background: rgba(255,255,255,0.04); }

.tcg-log-content {
    max-height: 420px;
    overflow-y: auto;
    padding: 0.4rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(100,120,150,0.3) transparent;
}
.tcg-log-content::-webkit-scrollbar { width: 5px; }
.tcg-log-content::-webkit-scrollbar-track { background: transparent; }
.tcg-log-content::-webkit-scrollbar-thumb { background: rgba(100,120,150,0.3); border-radius: 3px; }
.tcg-log-content::-webkit-scrollbar-thumb:hover { background: rgba(100,120,150,0.5); }

/* ── Log Entries ── */
.tcg-log-entry {
    font-size: 0.78rem;
    line-height: 1.45;
    color: #8b949e;
    padding: 0.3rem 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,0.025);
    transition: background 0.15s;
}
.tcg-log-entry:hover { background: rgba(255,255,255,0.025); }
.tcg-log-entry.player-log { color: #7ee787; border-left: 3px solid rgba(126,231,135,0.4); }
.tcg-log-entry.bot-log { color: #ff7b72; border-left: 3px solid rgba(255,123,114,0.4); }
.tcg-log-entry.system-log { color: #d2a8ff; border-left: 3px solid rgba(210,168,255,0.3); font-style: italic; }

/* ── Log Action Icons (prepended to messages) ── */
.tcg-log-entry .log-icon {
    display: inline-block;
    width: 1.2em;
    text-align: center;
    margin-right: 0.2em;
    font-style: normal;
    opacity: 0.8;
}

/* ── Turn Separator ── */
.tcg-log-turn-sep {
    text-align: center;
    padding: 0.45rem 0.9rem;
    margin: 0.15rem 0;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #58a6ff;
    background: linear-gradient(90deg, transparent, rgba(88,166,255,0.08), transparent);
    border-top: 1px solid rgba(88,166,255,0.15);
    border-bottom: 1px solid rgba(88,166,255,0.15);
    position: relative;
}
.tcg-log-turn-sep::before,
.tcg-log-turn-sep::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 28%;
    height: 1px;
    background: rgba(88,166,255,0.2);
}
.tcg-log-turn-sep::before { left: 4%; }
.tcg-log-turn-sep::after { right: 4%; }
.tcg-log-turn-sep.player-turn { color: #7ee787; background: linear-gradient(90deg, transparent, rgba(126,231,135,0.06), transparent); border-color: rgba(126,231,135,0.12); }
.tcg-log-turn-sep.player-turn::before, .tcg-log-turn-sep.player-turn::after { background: rgba(126,231,135,0.15); }
.tcg-log-turn-sep.bot-turn { color: #ff7b72; background: linear-gradient(90deg, transparent, rgba(255,123,114,0.06), transparent); border-color: rgba(255,123,114,0.12); }
.tcg-log-turn-sep.bot-turn::before, .tcg-log-turn-sep.bot-turn::after { background: rgba(255,123,114,0.15); }

/* ── Log Card References — Type Badges + Hover Preview ──── */
.log-card-ref {
    font-weight: 600;
    cursor: pointer;
    color: #e6edf3;
    border-bottom: 1px dotted rgba(255,255,255,0.25);
    transition: all 0.15s;
    padding: 0 1px;
}
.log-card-ref:hover {
    color: #fff;
    border-bottom-color: #fff;
    text-shadow: 0 0 8px rgba(255,255,255,0.2);
}
.log-type-badge {
    display: inline-block;
    font-size: 0.56rem;
    font-weight: 700;
    padding: 1px 4px;
    margin-left: 3px;
    border-radius: 4px;
    vertical-align: middle;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.log-type-character { background: rgba(100, 160, 255, 0.2); color: #7cb8ff; border: 1px solid rgba(100,160,255,0.15); }
.log-type-action    { background: rgba(255, 180, 50, 0.2);  color: #ffb832; border: 1px solid rgba(255,180,50,0.15); }
.log-type-song      { background: rgba(200, 100, 255, 0.2); color: #d88fff; border: 1px solid rgba(200,100,255,0.15); }
.log-type-item      { background: rgba(80, 220, 180, 0.2);  color: #5ee8b7; border: 1px solid rgba(80,220,180,0.15); }
.log-type-location  { background: rgba(255, 100, 100, 0.2); color: #ff8a8a; border: 1px solid rgba(255,100,100,0.15); }

/* ── Log Card Hover Preview (tooltip on hover) ── */
.tcg-log-hover-preview {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.7));
}
.tcg-log-hover-preview.visible {
    opacity: 1;
}
.tcg-log-hover-preview img {
    display: block;
    width: 320px;
    height: auto;
    border-radius: 12px;
}

/* ── Log Card Preview Overlay (click-to-view, all devices) ── */
.tcg-log-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: logPopupIn 0.2s ease-out;
    cursor: pointer;
}
.tcg-log-preview-card {
    position: relative;
    max-width: 85vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: default;
    overflow: visible;
}
.tcg-log-preview-card img {
    width: 100%;
    max-width: 320px;
    max-height: calc(90vh - 100px);
    object-fit: contain;
    height: auto;
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 215, 0, 0.15);
    display: block;
    flex-shrink: 1;
}
.tcg-log-preview-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.tcg-log-preview-close {
    padding: 6px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ccc;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
}
.tcg-log-preview-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}
@keyframes logPopupIn {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── Admin "Working" Confirm Button (in card preview) ── */
.tcg-card-working-btn {
    padding: 8px 20px;
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.5);
    border-radius: 8px;
    color: #86efac;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.tcg-card-working-btn:hover {
    background: rgba(34, 197, 94, 0.4);
    border-color: #22c55e;
    color: #fff;
    transform: scale(1.05);
}
.tcg-card-working-btn.confirmed {
    background: rgba(34, 197, 94, 0.5);
    border-color: #22c55e;
    color: #fff;
    pointer-events: none;
}

/* ── Card Report Button (in card preview) ──────────────── */
.tcg-card-report-btn {
    padding: 8px 20px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 8px;
    color: #fca5a5;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.tcg-card-report-btn:hover, .tcg-card-report-btn:active {
    background: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
    color: #fff;
}

/* ── Card "Correct" Confirm Button (in card preview) ──── */
.tcg-card-correct-btn {
    padding: 8px 20px;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    border-radius: 8px;
    color: #86efac;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.tcg-card-correct-btn:hover, .tcg-card-correct-btn:active {
    background: rgba(34, 197, 94, 0.3);
    border-color: #22c55e;
    color: #fff;
}
.tcg-card-correct-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

/* ── Card Report Modal ──────────────────────────────────── */
.tcg-report-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: logPopupIn 0.2s ease-out;
}
.tcg-report-box {
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 90vw;
    max-width: 420px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.tcg-report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: rgba(239, 68, 68, 0.1);
    border-bottom: 1px solid rgba(239, 68, 68, 0.2);
    font-weight: 600;
    font-size: 15px;
    color: #fca5a5;
}
.tcg-report-close {
    background: none;
    border: none;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
}
.tcg-report-close:hover { color: #fff; }
.tcg-report-body { padding: 16px 18px 18px; }
.tcg-report-card-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
}
.tcg-report-card-thumb {
    width: 60px;
    height: auto;
    border-radius: 6px;
    flex-shrink: 0;
}
.tcg-report-card-info strong {
    display: block;
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.3;
}
.tcg-report-card-info small {
    color: #666;
    font-size: 11px;
}
.tcg-report-comment {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
    margin-bottom: 12px;
    box-sizing: border-box;
}
.tcg-report-comment::placeholder { color: #555; }
.tcg-report-comment:focus {
    outline: none;
    border-color: rgba(239, 68, 68, 0.4);
}
.tcg-report-submit {
    display: block;
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.tcg-report-submit:hover { filter: brightness(1.1); }
.tcg-report-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.tcg-report-status {
    text-align: center;
    font-size: 13px;
    margin-top: 8px;
    min-height: 18px;
}

/* ── Game Over — Magical Disney Snow Theme ──────────────── */
.tcg-gameover { display: none !important; } /* hide old overlay */

.go-magic-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    overflow: hidden;
}
.go-magic-overlay.go-visible { opacity: 1; }

/* Win = warm golden aurora, Lose = cool blue frost */
.go-magic-overlay.go-win {
    background: radial-gradient(ellipse at 50% 30%, rgba(255,215,0,0.15) 0%, rgba(10,10,30,0.95) 70%),
                linear-gradient(180deg, #0a0a1e 0%, #1a0a2e 50%, #0a0a1e 100%);
}
.go-magic-overlay.go-lose {
    background: radial-gradient(ellipse at 50% 30%, rgba(100,160,255,0.1) 0%, rgba(5,5,20,0.97) 70%),
                linear-gradient(180deg, #050514 0%, #0a1028 50%, #050514 100%);
}

/* ── Snowflakes ── */
.go-snow-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.go-snowflake {
    position: absolute;
    top: -30px;
    color: rgba(200, 220, 255, 0.8);
    text-shadow: 0 0 6px rgba(165, 216, 255, 0.4);
    animation: goSnowFall linear infinite;
    pointer-events: none;
}
.go-win .go-snowflake {
    color: rgba(255, 230, 160, 0.7);
    text-shadow: 0 0 8px rgba(255, 200, 50, 0.3);
}
@keyframes goSnowFall {
    0%   { transform: translateY(-30px) rotate(0deg); }
    100% { transform: translateY(110vh) rotate(360deg); }
}

/* ── Sparkles ── */
.go-sparkle-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.go-sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 6px 2px rgba(165, 216, 255, 0.6), 0 0 12px 4px rgba(165, 216, 255, 0.3);
    animation: goSparkle ease-in-out infinite;
}
.go-win .go-sparkle {
    box-shadow: 0 0 6px 2px rgba(255, 215, 0, 0.6), 0 0 12px 4px rgba(255, 215, 0, 0.3);
}
@keyframes goSparkle {
    0%, 100% { opacity: 0; transform: scale(0); }
    50%      { opacity: 1; transform: scale(1.5); }
}

/* ── Inner card ── */
.go-magic-inner {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2.5rem 3rem;
    border-radius: 24px;
    max-width: 420px;
    width: 90%;
    animation: goCardAppear 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}
.go-win .go-magic-inner {
    background: linear-gradient(160deg, rgba(30, 20, 60, 0.9), rgba(60, 30, 80, 0.85));
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 0 60px rgba(255, 215, 0, 0.12), 0 20px 60px rgba(0, 0, 0, 0.5),
                inset 0 1px 0 rgba(255, 215, 0, 0.15);
}
.go-lose .go-magic-inner {
    background: linear-gradient(160deg, rgba(15, 20, 50, 0.92), rgba(20, 30, 70, 0.88));
    border: 1px solid rgba(100, 160, 255, 0.2);
    box-shadow: 0 0 60px rgba(100, 160, 255, 0.08), 0 20px 60px rgba(0, 0, 0, 0.5),
                inset 0 1px 0 rgba(165, 216, 255, 0.1);
}
@keyframes goCardAppear {
    0% { opacity: 0; transform: scale(0.5) rotateX(15deg); }
    100% { opacity: 1; transform: scale(1) rotateX(0deg); }
}

/* Glow orb behind card */
.go-magic-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    animation: goGlowPulse 3s ease-in-out infinite;
}
.go-win .go-magic-glow {
    background: radial-gradient(circle, rgba(255, 215, 0, 0.15) 0%, transparent 70%);
}
.go-lose .go-magic-glow {
    background: radial-gradient(circle, rgba(100, 160, 255, 0.1) 0%, transparent 70%);
}
@keyframes goGlowPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    50%      { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
}

/* Stars */
.go-magic-stars {
    font-size: 2rem;
    letter-spacing: 0.5rem;
    margin-bottom: 0.5rem;
    animation: goStarsShimmer 2s ease-in-out infinite;
}
.go-win .go-magic-stars { color: #ffd700; text-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
.go-lose .go-magic-stars { color: #6488b0; text-shadow: 0 0 10px rgba(100, 160, 255, 0.3); }
@keyframes goStarsShimmer {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.6; }
}

/* Title */
.go-magic-title {
    font-size: 2.4rem;
    font-weight: 900;
    margin: 0 0 0.3rem;
    letter-spacing: 2px;
    animation: goTitleGlow 2.5s ease-in-out infinite;
}
.go-win .go-magic-title {
    color: #ffd700;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.5);
}
.go-lose .go-magic-title {
    color: #a5d8ff;
    text-shadow: 0 0 20px rgba(165, 216, 255, 0.3), 0 2px 8px rgba(0, 0, 0, 0.5);
}
@keyframes goTitleGlow {
    0%, 100% { filter: brightness(1); }
    50%      { filter: brightness(1.2); }
}

/* Divider */
.go-magic-divider {
    color: rgba(255, 255, 255, 0.25);
    font-size: 0.9rem;
    letter-spacing: 4px;
    margin: 0.5rem 0;
}

/* Message */
.go-magic-msg {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    font-weight: 500;
    margin: 0 0 1.5rem;
    line-height: 1.5;
}

/* Stats */
.go-magic-stats {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.8rem;
}
.go-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}
.go-stat-val {
    font-size: 1.8rem;
    font-weight: 900;
}
.go-win .go-stat-val { color: #ffd700; text-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
.go-lose .go-stat-val { color: #a5d8ff; text-shadow: 0 0 10px rgba(165, 216, 255, 0.3); }
.go-stat-label {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Play Again button */
.go-magic-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 2.2rem;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 1px;
    transition: transform 0.2s, box-shadow 0.2s;
    animation: goBtnPulse 2s ease-in-out infinite;
}
.go-win .go-magic-btn {
    background: linear-gradient(135deg, #ffd700, #f0a500);
    color: #1a0a2e;
    box-shadow: 0 4px 30px rgba(255, 215, 0, 0.3), 0 0 60px rgba(255, 215, 0, 0.1);
}
.go-lose .go-magic-btn {
    background: linear-gradient(135deg, #4a9eff, #2860c0);
    color: #fff;
    box-shadow: 0 4px 30px rgba(74, 158, 255, 0.3), 0 0 60px rgba(74, 158, 255, 0.1);
}
.go-magic-btn:hover {
    transform: scale(1.05);
}
.go-win .go-magic-btn:hover {
    box-shadow: 0 6px 40px rgba(255, 215, 0, 0.5), 0 0 80px rgba(255, 215, 0, 0.2);
}
.go-lose .go-magic-btn:hover {
    box-shadow: 0 6px 40px rgba(74, 158, 255, 0.5), 0 0 80px rgba(74, 158, 255, 0.2);
}
@keyframes goBtnPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.03); }
}

/* ── Mobile adjustments ── */
@media (max-width: 640px) {
    .go-magic-inner {
        padding: 1.8rem 1.5rem;
        border-radius: 18px;
    }
    .go-magic-title { font-size: 1.8rem; }
    .go-magic-stars { font-size: 1.5rem; }
    .go-stat-val { font-size: 1.4rem; }
    .go-magic-btn { font-size: 0.95rem; padding: 0.7rem 1.8rem; }
    .go-magic-stats { gap: 1rem; }
}

/* ── Card Zoom ──────────────────────────────────────────── */
.tcg-card-zoom {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.9);
    cursor: pointer;
}
.tcg-card-zoom img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 0 60px rgba(251,191,36,0.2);
}

/* ── Card Hover Preview (x4, floating/smart positioning) ── */
.tcg-hover-preview {
    position: fixed;
    z-index: 190;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}
/* Mobile: full-screen backdrop mode */
.tcg-hover-preview.mode-mobile {
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    cursor: pointer;
    padding-bottom: calc(var(--tcg-card-h) * 0.52 + 10px);
}
.tcg-hover-preview.mode-mobile.visible {
    pointer-events: auto;
}
/* PC: floating panel, no backdrop */
.tcg-hover-preview.mode-pc {
    background: none;
}
.tcg-hover-preview.visible {
    opacity: 1;
}
.tcg-hover-preview img {
    width: 328px;
    height: auto;
    border-radius: 12px;
    filter: drop-shadow(0 8px 30px rgba(0,0,0,0.8));
    pointer-events: none;
    transition: transform 0.2s ease;
}
/* Card wrap for positioning stat badges relative to the card image */
.tcg-preview-card-wrap {
    position: relative;
    display: inline-block;
}
/* Stat overlay badges on the zoomed preview */
.tcg-preview-stats {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
    pointer-events: none;
}
.tcg-prev-badge {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}
.tcg-prev-badge .prev-badge-icon { font-size: 0.9rem; }
.tcg-prev-badge .prev-badge-val { font-size: 0.85rem; }
.tcg-prev-damage { background: rgba(180, 20, 30, 0.9); border: 1px solid rgba(255, 80, 80, 0.5); }
.tcg-prev-strbuff { background: rgba(20, 120, 60, 0.9); border: 1px solid rgba(80, 220, 120, 0.5); }
.tcg-prev-strdebuff { background: rgba(160, 40, 20, 0.9); border: 1px solid rgba(255, 120, 80, 0.5); }
.tcg-prev-wpbuff { background: rgba(20, 80, 160, 0.9); border: 1px solid rgba(80, 160, 255, 0.5); }
.tcg-prev-wpdebuff { background: rgba(160, 40, 20, 0.9); border: 1px solid rgba(255, 120, 80, 0.5); }
.tcg-prev-lorebuff { background: rgba(20, 80, 160, 0.9); border: 1px solid rgba(80, 160, 255, 0.5); }
.tcg-prev-loredebuff { background: rgba(160, 40, 20, 0.9); border: 1px solid rgba(255, 120, 80, 0.5); }
.tcg-prev-ward { background: rgba(0, 150, 199, 0.9); border: 1px solid rgba(80, 200, 255, 0.5); }
.tcg-prev-exerted { background: rgba(180, 120, 20, 0.9); border: 1px solid rgba(255, 200, 80, 0.5); }
/* Location cards: rotate 90° in preview so landscape art is readable */
.tcg-hover-preview.preview-location img {
    transform: rotate(90deg);
}
/* Mobile position overrides */
.tcg-hover-preview.mode-mobile.pos-top {
    align-items: flex-start;
    padding-top: 8%;
}
.tcg-hover-preview.mode-mobile.pos-bottom {
    align-items: flex-end;
    padding-bottom: 8%;
}
.tcg-hover-preview.mode-mobile.pos-center {
    align-items: center;
}

/* ── Card Preview Marketplace Links ─────────────────────── */
.tcg-preview-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 8px;
    max-width: 328px;
    pointer-events: auto;
}
.tcg-market-link {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    background: var(--ml-color, #666);
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.15s, transform 0.15s;
    pointer-events: auto;
}
.tcg-market-link:hover {
    opacity: 1;
    transform: scale(1.08);
}

/* In mobile mode, wrap content in a column */
.tcg-hover-preview.mode-mobile {
    flex-direction: column;
}

/* ── Zoom Hint ──────────────────────────────────────────── */
.tcg-zoom-hint {
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    font-style: italic;
    text-align: center;
    margin: 0.3rem 0;
    animation: tcg-hint-pulse 2s ease-in-out infinite;
}
@keyframes tcg-hint-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ── Card Detail Panel (floating, non-modal) ─────────── */
.tcg-mobile-detail {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 190;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: transparent;
    padding: 0 10px calc(var(--tcg-card-h) * 0.52 + 16px) 10px;
    pointer-events: none;
}
.tcg-mobile-detail > * {
    pointer-events: auto;
}
.tcg-mobile-detail-card {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tcg-mobile-detail-card img {
    width: min(42vw, 260px);
    height: auto;
    border-radius: 10px;
    filter: drop-shadow(0 4px 24px rgba(0,0,0,0.7));
}
/* Location cards: rotate but keep natural size, no squeeze */
.tcg-mobile-detail.preview-location .tcg-mobile-detail-card {
    width: min(42vw, 260px);
    aspect-ratio: 5/7;
    align-items: center;
    justify-content: center;
    overflow: visible;
    position: relative;
    z-index: 0;
}
.tcg-mobile-detail.preview-location .tcg-mobile-detail-card img {
    transform: rotate(90deg);
    width: min(55vw, 340px);
    max-width: none;
    pointer-events: none;
}
/* Lift actions above location card overflow */
.tcg-mobile-detail.preview-location .tcg-mobile-detail-actions {
    position: relative;
    z-index: 10;
}
.tcg-mobile-detail-name {
    display: none;
}
.tcg-mobile-detail-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
    justify-content: center;
    max-width: 160px;
    min-width: 100px;
    background: rgba(22,27,34,0.88);
    backdrop-filter: blur(8px);
    border-radius: 10px;
    padding: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.tcg-mobile-action-btn {
    text-align: center;
    font-size: 0.8rem;
    padding: 8px 14px;
    border-radius: 8px;
    white-space: nowrap;
    line-height: 1.3;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tcg-mobile-info {
    color: #8b949e;
    font-size: 0.75rem;
    padding: 4px 8px;
}
/* Stats bar in detail panel (field cards) — sits inside actions column */
.tcg-mobile-detail-stats {
    display: flex;
    gap: 6px;
    padding: 2px 0 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #e6edf3;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}
.tcg-mobile-stat {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.08);
}
.tcg-mobile-stat.stat-str { color: #ff6b6b; }
.tcg-mobile-stat.stat-wp { color: #4dabf7; }
.tcg-mobile-stat.stat-lore { color: #ffd43b; }
.tcg-mobile-stat.stat-dmg { color: #ff4444; background: rgba(255,68,68,0.12); }
.tcg-mobile-detail-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(22,27,34,0.9);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: flex-start;
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
    transition: background 0.2s, border-color 0.2s;
}
.tcg-mobile-detail-close:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.4);
}

/* Desktop adjustments for detail panel */
@media (min-width: 641px) {
    .tcg-mobile-detail {
        gap: 16px;
    }
    .tcg-mobile-detail-card img {
        width: min(28vw, 320px);
    }
    .tcg-mobile-detail.preview-location .tcg-mobile-detail-card {
        width: min(28vw, 320px);
    }
    .tcg-mobile-detail.preview-location .tcg-mobile-detail-card img {
        width: min(38vw, 360px);
    }
    .tcg-mobile-detail.preview-location .tcg-mobile-detail-actions {
        z-index: 10;
    }
    .tcg-mobile-detail-actions {
        max-width: 180px;
    }
    .tcg-mobile-action-btn {
        font-size: 0.85rem;
        padding: 10px 18px;
        border-radius: 8px;
        cursor: pointer;
    }
    .tcg-zoom-hint { display: none; }
}

/* ── Field Action Bar (compact bottom bar for field cards) ── */
.tcg-mobile-field-bar {
    position: fixed;
    bottom: calc(var(--tcg-card-h) + 20px);
    left: 0;
    right: 0;
    z-index: 175;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(22,27,34,0.96), rgba(30,36,44,0.97));
    border-top: 1px solid rgba(251,191,36,0.3);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4), 0 0 30px rgba(251,191,36,0.08);
    backdrop-filter: blur(10px);
    animation: mfbSlideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes mfbSlideUp {
    0%   { transform: translateY(100%); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}
.tcg-mfb-label {
    color: #e6edf3;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
    flex-shrink: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.tcg-mfb-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    padding: 2px 0;
}
.tcg-mfb-buttons .btn-tcg {
    font-size: 0.78rem;
    padding: 8px 14px;
    border-radius: 8px;
    white-space: nowrap;
    min-height: 38px;
    min-width: 38px;
    touch-action: manipulation;
    flex-shrink: 0;
}

/* ── Action Mode Indicator (floating pill + card glow) ── */
.tcg-action-mode-pill {
    position: fixed;
    bottom: calc(var(--tcg-card-h) + 24px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 190;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(251,191,36,0.92), rgba(245,158,11,0.95));
    box-shadow: 0 4px 24px rgba(251,191,36,0.4), 0 0 40px rgba(251,191,36,0.15);
    backdrop-filter: blur(8px);
    animation: ampSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes ampSlideUp {
    0%   { transform: translateX(-50%) translateY(40px) scale(0.8); opacity: 0; }
    100% { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}
.tcg-amp-label {
    color: #1a1a2e;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(255,255,255,0.2);
}
.tcg-amp-cancel {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(26,26,46,0.3);
    background: rgba(26,26,46,0.2);
    color: #1a1a2e;
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    transition: background 0.2s, transform 0.15s;
}
.tcg-amp-cancel:active {
    transform: scale(0.9);
    background: rgba(26,26,46,0.4);
}

/* Card glow when in action mode */
.tcg-card.action-active {
    transform: translateY(-10px) scale(1.2) !important;
    z-index: 50 !important;
    border-color: var(--ink-amber) !important;
    box-shadow:
        0 0 20px rgba(251,191,36,0.5),
        0 0 40px rgba(251,191,36,0.25),
        0 8px 30px rgba(0,0,0,0.4) !important;
    animation: actionCardGlow 1.5s ease-in-out infinite !important;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease !important;
}
@keyframes actionCardGlow {
    0%, 100% {
        box-shadow:
            0 0 15px rgba(251,191,36,0.4),
            0 0 30px rgba(251,191,36,0.2),
            0 8px 25px rgba(0,0,0,0.35);
    }
    50% {
        box-shadow:
            0 0 30px rgba(251,191,36,0.6),
            0 0 60px rgba(251,191,36,0.3),
            0 12px 35px rgba(0,0,0,0.4);
    }
}

/* ── Chapter Filter ─────────────────────────────────────── */
.tcg-chapter-filter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.5rem 0 1rem;
}
.tcg-chapter-select {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: #e0e0e0;
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
    cursor: pointer;
    max-width: 200px;
}
.tcg-chapter-select:focus {
    outline: none;
    border-color: var(--ink-amber, #fbbf24);
    box-shadow: 0 0 0 2px rgba(251,191,36,0.2);
}
.tcg-chapter-select option {
    background: #1a1a2e;
    color: #e0e0e0;
}

/* ── Effects ────────────────────────────────────────────── */
.tcg-card.just-played {
    animation: tcg-card-enter 0.4s ease-out;
}
@keyframes tcg-card-enter {
    0% { opacity: 0; transform: scale(0.5) translateY(30px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
.tcg-card.just-damaged {
    animation: tcg-card-shake 0.3s ease;
}
@keyframes tcg-card-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
.tcg-card.banished {
    animation: tcg-card-banish 0.5s ease-out forwards;
}
@keyframes tcg-card-banish {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.3) translateY(20px); }
}

/* Turn announcement flash */
.tcg-turn-flash {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    z-index: 300;
    pointer-events: none;
    padding: 0.3em 0.8em;
    border-radius: 12px;
    animation: tcg-turn-announce 1.5s ease-out forwards;
}
.tcg-turn-flash.turn-player {
    color: #2de04f;
    text-shadow: 0 0 40px rgba(45,224,79,0.6), 0 2px 8px rgba(0,0,0,0.5);
    background: radial-gradient(ellipse at center, rgba(45,224,79,0.15) 0%, transparent 70%);
}
.tcg-turn-flash.turn-bot {
    color: #e63946;
    text-shadow: 0 0 40px rgba(230,57,70,0.6), 0 2px 8px rgba(0,0,0,0.5);
    background: radial-gradient(ellipse at center, rgba(230,57,70,0.15) 0%, transparent 70%);
}
@keyframes tcg-turn-announce {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
    15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
    30%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    75%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* Lore gain flash */
.tcg-lore-flash {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    font-weight: 900;
    color: var(--ink-amber);
    text-shadow: 0 0 30px rgba(251,191,36,0.6);
    z-index: 60;
    pointer-events: none;
    animation: tcg-lore-up 2.2s ease-out forwards;
}
@keyframes tcg-lore-up {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
    25% { opacity: 1; transform: translate(-50%, -70%) scale(1.2); }
    70% { opacity: 1; transform: translate(-50%, -75%) scale(1.1); }
    100% { opacity: 0; transform: translate(-50%, -120%) scale(0.8); }
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
    :root {
        --tcg-card-w: 62px;
        --tcg-card-h: 87px;
    }
    .tcg-color-grid { grid-template-columns: repeat(2, 1fr); }
    .tcg-setup-title { font-size: 1.3rem; }
    .tcg-zone { padding: 0.4rem; }
    .tcg-hand { gap: 0; padding-left: calc(0.3rem + var(--tcg-card-w) * 0.45); }
    .tcg-hand .tcg-card { margin-left: calc(var(--tcg-card-w) * -0.5); }
    .tcg-hand .tcg-card:hover { transform: translateY(-12px) scale(1.06); margin-left: 2px; margin-right: 2px; }
    .tcg-hand .tcg-card.selected { transform: translateY(-16px) scale(1.08); margin-left: 2px; margin-right: 2px; }

    /* ── Mobile 2-row stacked hand ── */
    .tcg-hand.tcg-hand-stacked {
        flex-direction: column;
        align-items: center;
        padding-left: 0;
        gap: 0;
    }
    .tcg-hand-row {
        display: flex;
        justify-content: center;
        flex-wrap: nowrap;
        padding-left: calc(0.3rem + var(--tcg-card-w) * 0.45);
    }
    .tcg-hand-row .tcg-card {
        margin-left: calc(var(--tcg-card-w) * -0.5);
    }
    /* Back row: behind, peek ~45% visible above front row */
    .tcg-hand-back-row {
        position: relative;
        z-index: 1;
        margin-bottom: calc(var(--tcg-card-h) * -0.55);
    }
    .tcg-hand-back-row .tcg-card {
        transform: scale(0.88);
        opacity: 0.85;
    }
    .tcg-hand-back-row .tcg-card:hover {
        transform: translateY(-14px) scale(1.02);
        z-index: 50;
        opacity: 1;
        margin-left: 2px;
        margin-right: 2px;
    }
    .tcg-hand-back-row .tcg-card.selected {
        transform: translateY(-18px) scale(1.04);
        z-index: 55;
        opacity: 1;
        margin-left: 2px;
        margin-right: 2px;
    }
    /* Front row: in front, slightly smaller */
    .tcg-hand-front-row {
        position: relative;
        z-index: 5;
    }
    .tcg-hand-front-row .tcg-card {
        transform: scale(0.92);
    }
    .tcg-hand-front-row .tcg-card:hover {
        transform: translateY(-12px) scale(1.04);
        z-index: 30;
        margin-left: 2px;
        margin-right: 2px;
    }
    .tcg-hand-front-row .tcg-card.selected {
        transform: translateY(-16px) scale(1.06);
        z-index: 35;
        margin-left: 2px;
        margin-right: 2px;
    }
    /* Adjust fixed hand when stacked: taller, back row peeks above */
    .tcg-player-zone .tcg-player-hand.tcg-hand-stacked {
        height: auto;
        bottom: calc(var(--tcg-card-h) * -0.45);
        padding-bottom: 0;
    }
    .tcg-player-zone .tcg-player-hand.tcg-hand-stacked:hover,
    .tcg-player-zone .tcg-player-hand.tcg-hand-stacked:has(.selected) {
        bottom: 0;
    }
    /* Back row: fixed above front, 5mm (14px) gap from bottom edge */
    .tcg-player-zone .tcg-player-hand.tcg-hand-stacked .tcg-hand-back-row {
        margin-bottom: calc(var(--tcg-card-h) * -0.52);
    }
    .tcg-player-zone .tcg-player-hand.tcg-hand-stacked .tcg-hand-front-row {
        margin-bottom: 14px;
    }
    /* Override the margin-top that the fixed hand applies to direct .tcg-card children */
    .tcg-player-zone .tcg-player-hand.tcg-hand-stacked .tcg-hand-row .tcg-card {
        margin-top: 0;
    }
    .tcg-bot-hand { top: calc(var(--tcg-card-h) * -0.65); height: calc(var(--tcg-card-h) * 0.45); padding: 4px 4px 2px; }
    .tcg-bot-hand .tcg-card { margin-left: calc(var(--tcg-card-w) * -0.6); margin-bottom: calc(var(--tcg-card-h) * -0.52); }
    .tcg-field { gap: 0.3rem; min-height: calc(var(--tcg-card-h) * 1.2 + 5px); }
    .tcg-field-row { flex-direction: column; }
    .tcg-subfield-aside { width: 100%; max-width: none; }
    .tcg-field-small { min-height: calc(var(--tcg-card-h) * 1.2 - 5px); }
    .tcg-loc-pick-img { width: 80px; height: 112px; }
    .tcg-loc-pick-name { font-size: 0.65rem; max-width: 80px; }
    .tcg-loc-chars { margin-top: -18px; }
    .tcg-loc-char-mini { width: calc(var(--tcg-card-w) * 0.5) !important; height: calc(var(--tcg-card-h) * 0.5) !important; }
    .tcg-card-name { font-size: 0.45rem; padding: 1px 2px; }
    .tcg-log-panel { width: 280px; right: 50px; max-height: 60vh; }
    .tcg-log-panel.open { z-index: 115; }
    .tcg-log-content { max-height: calc(60vh - 40px); }
    .tcg-log-entry { font-size: 0.72rem; padding: 0.25rem 0.6rem; }
    .tcg-log-turn-sep { font-size: 0.62rem; padding: 0.35rem 0.6rem; }
    /* Mobile card preview (report button visible) */
    .tcg-log-preview-card img { max-width: 240px; max-height: calc(80vh - 100px); }
    .tcg-log-preview-actions { gap: 6px; margin-top: 8px; }
    .tcg-card-report-btn, .tcg-card-correct-btn { padding: 6px 14px; font-size: 12px; }
    .tcg-log-preview-close { padding: 4px 12px; font-size: 0.75rem; }
    /* Mobile dock adjustments */
    .tcg-controls-dock { right: -2px; }
    .tcg-dock-btn { width: 36px; height: 52px; font-size: 0.7rem; border-radius: 26px 0 0 26px; }
    .tcg-dock-btn:hover { width: 42px; }
    .tcg-dock-end { }
    .tcg-dock-help { font-size: 1rem; }
    .tcg-edge-btn { width: 24px; height: 34px; font-size: 0.75rem; }
    .tcg-edge-btn:hover { width: 30px; }
    .tcg-edge-log { top: 28%; }
    .tcg-edge-help { top: calc(28% + 40px); font-size: 0.8rem; }
    .tcg-center-bar { padding: 0.2rem 0.3rem; font-size: 0.7rem; flex-wrap: nowrap; justify-content: space-between; gap: 0.15rem; height: auto; }
    .tcg-bar-center { order: 0; width: auto; flex: 0 1 auto; justify-content: center; gap: 0.2rem; min-width: 0; }
    .tcg-bar-center .tcg-message { display: none; }
    .tcg-bar-side { justify-content: center; gap: 0.3rem; }
    .tcg-bar-side .tcg-zone-stats { gap: 0.5rem; font-size: 0.65rem; }
    .tcg-lore-diamond-shape { width: 22px; height: 22px; border-width: 2px; }
    .tcg-lore-icon { height: 36px; transform: scale(1.7); margin: 8px; }
    .tcg-lore-value { font-size: 0.7rem; color: #fbbf24 !important; text-shadow: 0 1px 3px rgba(0,0,0,0.5) !important; }
    .tcg-lore-diamond.has-lore .tcg-lore-value { color: #fbbf24 !important; text-shadow: 0 1px 3px rgba(0,0,0,0.5) !important; }
    .tcg-icon-inkwell { height: 2.6em; transform: scale(1.6); margin: 6px; }
    .tcg-icon-deck { height: 1.6em; }
    .tcg-turn-badge { font-size: 0.6rem; }
    .tcg-phase-badge { font-size: 0.55rem; }
    .tcg-zone-stats { font-size: 0.65rem; gap: 0.2rem; }
    .tcg-rules-sheet { max-width: 100vw; max-height: 95vh; border-radius: 12px; }
    .tcg-rules-body { padding: 1rem; }
    .tcg-rs-grid { grid-template-columns: 1fr; }
    .tcg-rs-table { font-size: 0.75rem; }

    .tcg-deck-stack { right: 8px; bottom: calc(var(--tcg-card-h) * -0.24); }
    .tcg-deck-stack:hover { bottom: 6px; }
    .tcg-deck-cards { width: calc(var(--tcg-card-w) * 0.6); height: calc(var(--tcg-card-h) * 0.6); }
    .tcg-deck-label { font-size: 0.65rem; }
    .tcg-banish-stack { left: 8px; bottom: calc(var(--tcg-card-h) * -0.24); }
    .tcg-banish-stack:hover { bottom: 6px; }
    .tcg-banish-cards { width: calc(var(--tcg-card-w) * 0.6); height: calc(var(--tcg-card-h) * 0.6); }
    .tcg-banish-label { font-size: 0.65rem; }
    .tcg-hover-preview img { width: 328px; }
    .tcg-preview-links { max-width: 328px; }
    .tcg-market-link { font-size: 0.6rem; padding: 2px 7px; }


    .tcg-chapter-filter { flex-wrap: wrap; }
    .tcg-chapter-select { max-width: 160px; font-size: 0.75rem; }

    /* ── Mobile: Detail panel stacks vertically ── */
    .tcg-mobile-detail {
        flex-direction: column;
        gap: 6px;
        padding: 0 10px calc(var(--tcg-card-h) * 0.52 + 12px) 10px;
    }
    .tcg-mobile-detail-card img {
        width: min(42vw, 220px);
    }
    .tcg-mobile-detail.preview-location .tcg-mobile-detail-card {
        width: min(42vw, 220px);
    }
    .tcg-mobile-detail.preview-location .tcg-mobile-detail-card img {
        width: min(52vw, 290px);
    }
    .tcg-mobile-detail-actions {
        flex-direction: row;
        flex-wrap: wrap;
        max-width: 100%;
        min-width: 0;
        justify-content: center;
    }
    .tcg-mobile-detail-close {
        align-self: center;
    }
}
@media (min-width: 900px) {
    :root {
        --tcg-card-w: var(--tcg-card-w-lg);
        --tcg-card-h: var(--tcg-card-h-lg);
    }
}

/* ══════════════════════════════════════════════════════════════
   RULES REFERENCE SHEET — ? Help Button & Modal
   ══════════════════════════════════════════════════════════════ */

/* ── Player Deck Stack (fixed bottom-right, 40% submerged) ── */
.tcg-deck-stack {
    position: fixed;
    bottom: calc(var(--tcg-card-h) * -0.28);
    right: 14px;
    z-index: 201;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    transition: opacity 0.3s ease, bottom 0.3s ease;
}
.tcg-deck-stack:hover {
    bottom: 8px;
    pointer-events: auto;
}
.tcg-deck-stack.hidden { display: none; }
.tcg-deck-cards {
    position: relative;
    width: calc(var(--tcg-card-w) * 0.7);
    height: calc(var(--tcg-card-h) * 0.7);
}
.tcg-deck-card-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(135deg, #1a1a2e, #2d1b69);
    border: 1.5px solid rgba(155,93,229,0.35);
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.tcg-deck-card-layer:nth-child(1) { top: 0; left: 0; }
.tcg-deck-card-layer:nth-child(2) { top: -2px; left: 1px; }
.tcg-deck-card-layer:nth-child(3) { top: -4px; left: 2px; }
.tcg-deck-card-layer:nth-child(4) { top: -6px; left: 3px; }
.tcg-deck-card-layer .tcg-deck-star {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: rgba(155,93,229,0.45);
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 6px,
        rgba(155,93,229,0.04) 6px,
        rgba(155,93,229,0.04) 12px
    );
    border-radius: 4px;
}
.tcg-deck-label {
    margin-top: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(155,93,229,0.9);
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
    letter-spacing: 0.5px;
    pointer-events: none;
}

/* ── Player Banish Pile (fixed bottom-left, 40% submerged) ── */
.tcg-banish-stack {
    position: fixed;
    bottom: calc(var(--tcg-card-h) * -0.28);
    left: 14px;
    z-index: 201;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    transition: opacity 0.3s ease, bottom 0.3s ease;
}
.tcg-banish-stack:hover {
    bottom: 8px;
    pointer-events: auto;
}
.tcg-banish-stack.hidden { display: none; }
.tcg-banish-cards {
    position: relative;
    width: calc(var(--tcg-card-w) * 0.7);
    height: calc(var(--tcg-card-h) * 0.7);
}
.tcg-banish-card-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 5px;
    border: 1.5px solid rgba(230,57,70,0.35);
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
    overflow: hidden;
}
.tcg-banish-card-layer:nth-child(1) { top: 0; left: 0; }
.tcg-banish-card-layer:nth-child(2) { top: -2px; left: -1px; }
.tcg-banish-card-layer:nth-child(3) { top: -4px; left: -2px; }
.tcg-banish-card-layer img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    filter: brightness(0.6) saturate(0.7);
}
.tcg-banish-card-layer:last-child img {
    filter: brightness(0.8) saturate(0.85);
}
.tcg-banish-card-layer .tcg-banish-empty {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a0a0e, #2e1215);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: rgba(230,57,70,0.35);
}
.tcg-banish-label {
    margin-top: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(230,57,70,0.9);
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
    letter-spacing: 0.5px;
    pointer-events: none;
}

/* ── Card Fly Animation (draw / banish / retrieve) ─────── */
.tcg-card-fly {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    border-radius: 6px;
    overflow: hidden;
    backface-visibility: hidden;
}
.tcg-card-fly img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}
/* Face-down card back for the flying clone */
.tcg-card-fly-back {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #1a1a2e, #2d1b69);
    border: 1.5px solid rgba(155,93,229,0.4);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: rgba(155,93,229,0.5);
    backface-visibility: hidden;
}
/* 3D flip container */
.tcg-card-fly-flip {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
}
.tcg-card-fly-flip.flipped {
    transform: rotateY(180deg);
}
.tcg-card-fly-flip .tcg-card-fly-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 6px;
    overflow: hidden;
}
.tcg-card-fly-flip .tcg-card-fly-face.front {
    transform: rotateY(180deg);
}
.tcg-card-fly-flip .tcg-card-fly-face.back {
    background: linear-gradient(135deg, #1a1a2e, #2d1b69);
    border: 1.5px solid rgba(155,93,229,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: rgba(155,93,229,0.5);
}
.tcg-card-fly-flip .tcg-card-fly-face.front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Stack Preview Overlay (for retrieve/revive/ink from stack) ── */
.tcg-stack-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 9500;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.tcg-stack-preview-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
.tcg-stack-preview-card {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.8), 0 0 30px rgba(155,93,229,0.3);
    transition: transform 0.5s cubic-bezier(0.22,1,0.36,1), opacity 0.3s ease;
    transform: scale(0.3) translateY(200px);
    opacity: 0;
}
.tcg-stack-preview-overlay.visible .tcg-stack-preview-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}
.tcg-stack-preview-card img {
    width: 240px;
    height: auto;
    display: block;
}
.tcg-stack-preview-label {
    text-align: center;
    margin-top: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

/* Help Button — old standalone styles removed, now in .tcg-dock-help */

/* ── Rules Overlay ──────────────────────────────────────── */
.tcg-rules-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(6px);
    padding: 1rem;
}

/* ── Rules Sheet ────────────────────────────────────────── */
.tcg-rules-sheet {
    background: linear-gradient(180deg, rgba(15,20,30,0.98), rgba(10,14,20,0.98));
    border: 1px solid rgba(165,216,255,0.12);
    border-radius: 16px;
    max-width: 720px;
    width: 100%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(251,191,36,0.05);
}
.tcg-rules-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(165,216,255,0.1);
    flex-shrink: 0;
}
.tcg-rules-title {
    flex: 1;
    font-size: 1.25rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}
.tcg-rules-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #8b949e;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-family: inherit;
}
.tcg-rules-close:hover {
    background: rgba(230,57,70,0.15);
    border-color: rgba(230,57,70,0.3);
    color: #e63946;
}

/* ── Language Toggle ────────────────────────────────────── */
.tcg-lang-toggle {
    display: flex;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(165,216,255,0.15);
}
.tcg-lang-btn {
    padding: 0.3rem 0.7rem;
    border: none;
    background: rgba(255,255,255,0.03);
    color: #8b949e;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.tcg-lang-btn.active {
    background: rgba(251,191,36,0.15);
    color: var(--ink-amber, #fbbf24);
}
.tcg-lang-btn:hover:not(.active) {
    background: rgba(255,255,255,0.06);
    color: #ccc;
}

/* ── Rules Body ─────────────────────────────────────────── */
.tcg-rules-body {
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    flex: 1;
}
.tcg-rules-body::-webkit-scrollbar { width: 5px; }
.tcg-rules-body::-webkit-scrollbar-thumb { background: rgba(165,216,255,0.15); border-radius: 3px; }

/* ── Section ────────────────────────────────────────────── */
.tcg-rules-section {
    margin-bottom: 1.5rem;
}
.tcg-rules-section:last-child { margin-bottom: 0; }
.tcg-rs-heading {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink-amber, #fbbf24);
    margin: 0 0 0.6rem 0;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid rgba(251,191,36,0.15);
}
.tcg-rs-text {
    font-size: 0.85rem;
    color: #b8c0cc;
    line-height: 1.5;
}

/* ── Turn Steps ─────────────────────────────────────────── */
.tcg-rs-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.tcg-rs-step {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}
.tcg-rs-step-num {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 50%;
    background: rgba(251,191,36,0.12);
    border: 1px solid rgba(251,191,36,0.25);
    color: var(--ink-amber);
    font-weight: 800;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tcg-rs-step strong {
    color: #fff;
    font-size: 0.85rem;
}
.tcg-rs-step-desc {
    color: #8b949e;
    font-size: 0.8rem;
}

/* ── Actions Grid ───────────────────────────────────────── */
.tcg-rs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
}
.tcg-rs-card {
    padding: 0.8rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(165,216,255,0.08);
    transition: border-color 0.2s;
}
.tcg-rs-card:hover { border-color: rgba(165,216,255,0.2); }
.tcg-rs-card-icon {
    font-size: 1.3rem;
    margin-bottom: 0.3rem;
}
.tcg-rs-card-title {
    font-weight: 700;
    color: #fff;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}
.tcg-rs-card-desc {
    font-size: 0.78rem;
    color: #8b949e;
    line-height: 1.4;
}
.tcg-rs-ink          { border-left: 3px solid var(--ink-amber); }
.tcg-rs-play         { border-left: 3px solid var(--ink-emerald); }
.tcg-rs-quest        { border-left: 3px solid var(--ink-sapphire); }
.tcg-rs-challenge    { border-left: 3px solid var(--ink-ruby); }

/* ── Tables ─────────────────────────────────────────────── */
.tcg-rs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.tcg-rs-table thead th {
    text-align: left;
    color: #8b949e;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid rgba(165,216,255,0.1);
}
.tcg-rs-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.tcg-rs-table tbody tr:hover {
    background: rgba(255,255,255,0.02);
}
.tcg-rs-table td {
    padding: 0.5rem 0.6rem;
    color: #b8c0cc;
    vertical-align: top;
    line-height: 1.4;
}
.tcg-rs-kw { white-space: nowrap; }
.tcg-rs-kw-fr {
    color: #8b949e;
    font-style: italic;
    font-size: 0.78rem;
    white-space: nowrap;
}

/* Keyword Badges */
.tcg-rs-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.75rem;
    color: #fff;
}
.badge-amber    { background: rgba(251,191,36,0.2); color: var(--ink-amber); border: 1px solid rgba(251,191,36,0.25); }
.badge-amethyst { background: rgba(155,93,229,0.2); color: var(--ink-amethyst); border: 1px solid rgba(155,93,229,0.25); }
.badge-emerald  { background: rgba(45,158,79,0.2);  color: var(--ink-emerald); border: 1px solid rgba(45,158,79,0.25); }
.badge-ruby     { background: rgba(230,57,70,0.2);  color: var(--ink-ruby); border: 1px solid rgba(230,57,70,0.25); }
.badge-sapphire { background: rgba(0,150,199,0.2);  color: var(--ink-sapphire); border: 1px solid rgba(0,150,199,0.25); }
.badge-steel    { background: rgba(139,158,176,0.2); color: var(--ink-steel); border: 1px solid rgba(139,158,176,0.25); }

/* ── Glossary ───────────────────────────────────────────── */
.tcg-rs-glossary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.6rem;
}
.tcg-rs-term {
    padding: 0.6rem 0.8rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(165,216,255,0.06);
    border-radius: 8px;
}
.tcg-rs-term strong {
    color: #fff;
    font-size: 0.82rem;
}
.tcg-rs-fr-tag {
    font-size: 0.7rem;
    color: #8b949e;
    font-style: italic;
    margin-left: 0.4rem;
}
.tcg-rs-term p {
    color: #8b949e;
    font-size: 0.75rem;
    margin: 0.3rem 0 0 0;
    line-height: 1.35;
}

/* ── Tips ───────────────────────────────────────────────── */
.tcg-rs-tips {
    list-style: none;
    padding: 0;
    margin: 0;
}
.tcg-rs-tips li {
    padding: 0.35rem 0 0.35rem 1.2rem;
    position: relative;
    font-size: 0.82rem;
    color: #b8c0cc;
    line-height: 1.4;
}
.tcg-rs-tips li::before {
    content: '✦';
    position: absolute;
    left: 0;
    color: var(--ink-amber);
    font-size: 0.65rem;
    top: 0.45rem;
}

/* ══════════════════════════════════════════════════════════
   COMBAT ANIMATION OVERLAY
   ══════════════════════════════════════════════════════════ */
.tcg-combat-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.82);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.tcg-combat-arena {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    position: relative;
    width: 100%;
    max-width: 600px;
}
.tcg-combat-card {
    position: relative;
    width: calc(var(--tcg-card-w) * 2);
    border-radius: 10px;
    overflow: visible;
    z-index: 2;
    opacity: 0;
}
.tcg-combat-card img {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
    display: block;
}
.tcg-combat-stat {
    position: absolute;
    bottom: 8px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.2rem;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.4);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}
.tcg-combat-str {
    left: 8px;
    background: rgba(220, 50, 50, 0.9);
}
.tcg-combat-wp {
    right: 8px;
    background: rgba(50, 120, 220, 0.9);
}

/* Center FX area — sits between the two cards */
.tcg-combat-fx {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
}
.tcg-combat-clash {
    font-size: 3rem;
    filter: drop-shadow(0 0 12px rgba(255, 200, 50, 0.8));
}
.tcg-combat-dmg-text {
    font-size: 2.2rem;
    font-weight: 900;
    color: #ff4444;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.5);
    margin-top: 0.3rem;
    white-space: nowrap;
}

/* Combat result banner */
.tcg-combat-result {
    margin-top: 1rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    opacity: 0;
    text-align: center;
    min-height: 2rem;
}

/* ── COMBAT ANIMATIONS ──────────────────────────────────── */

/* Phase 1: Cards appear — attacker drops from top, defender rises from bottom */
.tcg-combat-attacker.combat-enter {
    animation: combatEnterTop 0.8s ease-out forwards;
}
.tcg-combat-defender.combat-enter {
    animation: combatEnterBottom 0.8s ease-out forwards;
}
@keyframes combatEnterTop {
    from { opacity: 0; transform: translateY(-100px) scale(0.6); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes combatEnterBottom {
    from { opacity: 0; transform: translateY(100px) scale(0.6); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Phase 2: Attacker charges downward toward defender (bot attacks) */
.tcg-combat-attacker.combat-charge {
    animation: combatChargeDown 0.5s ease-in forwards;
    z-index: 5;
}
@keyframes combatChargeDown {
    0%   { transform: translateY(0); }
    70%  { transform: translateY(calc(50% + 1.25rem)) rotate(3deg); }
    100% { transform: translateY(calc(50% + 1.25rem)) rotate(0deg); }
}

/* Phase 2: Attacker charges upward toward defender (player attacks from bottom) */
.tcg-combat-defender.combat-charge-up {
    animation: combatChargeUp 0.5s ease-in forwards;
    z-index: 5;
}
@keyframes combatChargeUp {
    0%   { transform: translateY(0); }
    70%  { transform: translateY(calc(-50% - 1.25rem)) rotate(-3deg); }
    100% { transform: translateY(calc(-50% - 1.25rem)) rotate(0deg); }
}

/* Phase 2b: Defender gets hit — shake + flash */
.tcg-combat-defender.combat-hit,
.tcg-combat-attacker.combat-hit {
    animation: combatHitShake 0.5s ease-out forwards;
}
@keyframes combatHitShake {
    0%   { transform: translateY(0); filter: brightness(1); }
    15%  { transform: translateY(8px) rotate(-2deg); filter: brightness(2.5); }
    30%  { transform: translateY(-4px) rotate(1.5deg); filter: brightness(1.8); }
    50%  { transform: translateY(5px) rotate(-1deg); filter: brightness(1.3); }
    100% { transform: translateY(3px) rotate(0deg); filter: brightness(1); }
}

/* Phase 3: FX pop between cards */
.tcg-combat-fx.combat-fx-show {
    animation: combatFxPop 0.6s ease-out forwards;
}
@keyframes combatFxPop {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
    50%  { opacity: 1; transform: translate(-50%, -50%) scale(1.25); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Phase 4: Attacker bounces back to original position (top card — bot attacks) */
.tcg-combat-attacker.combat-bounce-back {
    animation: combatBounceBack 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes combatBounceBack {
    0%   { transform: translateY(calc(50% + 1.25rem)); }
    50%  { transform: translateY(-15px); }
    100% { transform: translateY(0); }
}

/* Phase 4: Attacker bounces back down (bottom card — player attacks) */
.tcg-combat-defender.combat-bounce-back-down {
    animation: combatBounceBackDown 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes combatBounceBackDown {
    0%   { transform: translateY(calc(-50% - 1.25rem)); }
    50%  { transform: translateY(15px); }
    100% { transform: translateY(0); }
}

/* Result text fade in */
.tcg-combat-result.combat-result-show {
    animation: combatResultIn 0.5s ease-out forwards;
}
@keyframes combatResultIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Fade out overlay */
.tcg-combat-overlay.combat-fade-out {
    animation: combatFadeOut 0.7s ease-in forwards;
}
@keyframes combatFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* Ward shield flash */
.tcg-combat-dmg-text.combat-ward {
    color: #4fc3f7;
    text-shadow: 0 0 15px rgba(79, 195, 247, 0.8), 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Damage shown on the card being hit (defender) */
.tcg-combat-hit-dmg {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2.2rem;
    font-weight: 900;
    color: #ff4444;
    text-shadow: 0 0 14px rgba(255, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.6);
    z-index: 10;
    animation: hitDmgPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    white-space: nowrap;
}
.tcg-combat-hit-dmg.combat-ward {
    color: #4fc3f7;
    text-shadow: 0 0 15px rgba(79, 195, 247, 0.8), 0 2px 4px rgba(0, 0, 0, 0.5);
}
.tcg-combat-hit-dmg.combat-no-dmg {
    color: #aaa;
    text-shadow: 0 0 8px rgba(150, 150, 150, 0.5), 0 2px 4px rgba(0, 0, 0, 0.5);
}
@keyframes hitDmgPop {
    0%   { opacity: 0; transform: translateX(-50%) scale(0.3) translateY(-10px); }
    60%  { opacity: 1; transform: translateX(-50%) scale(1.3) translateY(5px); }
    100% { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
}

/* Damage shown on attacker card (counter-damage) */
.tcg-combat-atk-dmg {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.8rem;
    font-weight: 900;
    color: #ff4444;
    text-shadow: 0 0 12px rgba(255, 0, 0, 0.7), 0 2px 4px rgba(0, 0, 0, 0.6);
    z-index: 10;
    animation: atkDmgPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    white-space: nowrap;
}
.tcg-combat-atk-dmg.combat-ward {
    color: #4fc3f7;
    text-shadow: 0 0 15px rgba(79, 195, 247, 0.8), 0 2px 4px rgba(0, 0, 0, 0.5);
}
@keyframes atkDmgPop {
    0%   { opacity: 0; transform: translateX(-50%) scale(0.3) translateY(10px); }
    60%  { opacity: 1; transform: translateX(-50%) scale(1.3) translateY(-5px); }
    100% { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
}

/* Banished text */
.tcg-combat-result .banished-label {
    color: #ff6b6b;
}
/* Survived text */
.tcg-combat-result .survived-label {
    color: #4fc3f7;
}

/* ── Mobile adjustments ── */
@media (max-width: 640px) {
    .tcg-combat-arena {
        gap: 1.5rem;
    }
    .tcg-combat-card {
        width: calc(var(--tcg-card-w) * 1.8);
    }
    .tcg-combat-stat {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }
    .tcg-combat-clash {
        font-size: 2.2rem;
    }
    .tcg-combat-dmg-text {
        font-size: 1.6rem;
    }
    .tcg-combat-result {
        font-size: 1.1rem;
    }
}

/* ══════════════════════════════════════════════════════════
   ZONE CARD PICKER (discard / ink / deck selection)
   ══════════════════════════════════════════════════════════ */
.tcg-zone-picker {
    position: fixed;
    inset: 0;
    z-index: 455;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
}
.tcg-zone-picker-inner {
    background: #1a1d23;
    border: 1px solid #3d4450;
    border-radius: 12px;
    padding: 1.2rem;
    max-width: 580px;
    width: 94%;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    animation: effectPickerIn 0.3s ease-out;
}
.tcg-zone-picker-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    justify-content: center;
}
.tcg-zone-picker-source-img {
    width: 80px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.tcg-zone-picker-info { text-align: center; }
.tcg-zone-picker-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #e8e8e8;
}
.tcg-zone-picker-desc {
    font-size: 0.9rem;
    color: #ffd700;
    margin-top: 0.2rem;
    font-weight: 600;
}
.tcg-zone-picker-label {
    font-size: 0.85rem;
    color: #8b949e;
    text-align: center;
    font-style: italic;
}
.tcg-zone-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.6rem;
    max-height: 50vh;
    overflow-y: auto;
    padding: 0.3rem;
}
.tcg-zone-pick-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem;
    background: #252830;
    border: 2px solid #3d4450;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.tcg-zone-pick-item:hover {
    border-color: #58a6ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.25);
}
.tcg-zone-pick-item.selected {
    border-color: #ffd700;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}
.tcg-zone-pick-img {
    width: 80px;
    border-radius: 6px;
}
.tcg-zone-pick-name {
    font-size: 0.65rem;
    color: #b8c0cc;
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
}
.tcg-zone-pick-cost {
    font-size: 0.6rem;
    color: #fbbf24;
    font-weight: 700;
}
@media (max-width: 640px) {
    .tcg-zone-picker-inner { padding: 1rem; max-width: 96%; }
    .tcg-zone-picker-source-img { width: 60px; }
    .tcg-zone-picker-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
    .tcg-zone-pick-img { width: 65px; }
}

/* ══════════════════════════════════════════════════════════
   EFFECT TARGET PICKER
   ══════════════════════════════════════════════════════════ */
.tcg-effect-picker {
    position: fixed;
    inset: 0;
    z-index: 450;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
}
.tcg-effect-picker-inner {
    background: #1a1d23;
    border: 1px solid #3d4450;
    border-radius: 12px;
    padding: 1.2rem;
    max-width: 520px;
    width: 92%;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    animation: effectPickerIn 0.3s ease-out;
}
@keyframes effectPickerIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.tcg-effect-picker-card {
    text-align: center;
}
.tcg-effect-picker-card img {
    width: 120px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.tcg-effect-picker-info {
    text-align: center;
}
.tcg-effect-picker-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #e8e8e8;
}
.tcg-effect-picker-desc {
    font-size: 0.9rem;
    color: #ffd700;
    margin-top: 0.3rem;
    font-weight: 600;
}
.tcg-effect-picker-label {
    font-size: 0.85rem;
    color: #8b949e;
    text-align: center;
    font-style: italic;
}
.tcg-effect-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.6rem;
    max-height: 40vh;
    overflow-y: auto;
    padding: 0.3rem;
}
.tcg-effect-pick-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem;
    background: #252830;
    border: 2px solid #3d4450;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.tcg-effect-pick-item:hover {
    border-color: #58a6ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.25);
}
.tcg-effect-pick-item.enemy-target {
    border-color: #da3633;
}
.tcg-effect-pick-item.enemy-target:hover {
    border-color: #ff6b6b;
    box-shadow: 0 4px 12px rgba(218, 54, 51, 0.3);
}
.tcg-effect-pick-img {
    width: 80px;
    border-radius: 6px;
}
.tcg-effect-pick-name {
    font-size: 0.7rem;
    color: #b8c0cc;
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
}

/* ── Effect Flash ── */
.tcg-effect-flash {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.3);
    z-index: 460;
    font-size: 1.8rem;
    font-weight: 900;
    color: #4fc3f7;
    text-shadow: 0 0 15px rgba(79, 195, 247, 0.6), 0 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    animation: effectFlashPop 2.2s ease-out forwards;
    white-space: nowrap;
}
@keyframes effectFlashPop {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
    15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
    30%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80%  { opacity: 1; transform: translate(-50%, -55%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -65%) scale(0.9); }
}

/* ── Mobile effect picker ── */
@media (max-width: 640px) {
    .tcg-effect-picker-inner {
        padding: 1rem;
        max-width: 95%;
    }
    .tcg-effect-picker-card img {
        width: 90px;
    }
    .tcg-effect-picker-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }
    .tcg-effect-pick-img {
        width: 65px;
    }
    .tcg-effect-flash {
        font-size: 1.3rem;
    }
}

/* ── Ink Animation (card flies to ink symbol) ──────────── */
.tcg-ink-fly-clone {
    box-shadow: 0 0 20px rgba(165, 216, 255, 0.6), 0 0 40px rgba(165, 216, 255, 0.3);
}

/* Ink symbol bounce when "eating" a card */
.ink-eat-bounce {
    display: inline-block;
    animation: inkEatBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes inkEatBounce {
    0%   { transform: scale(1); }
    30%  { transform: scale(2); }
    50%  { transform: scale(1.6); }
    70%  { transform: scale(2.1); }
    100% { transform: scale(1); }
}

/* ── Golden Explosion Particles ────────────────────────── */
.tcg-gold-particle {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    background: radial-gradient(circle, #ffe066 0%, #d4a843 60%, #b8860b 100%);
    box-shadow: 0 0 6px 2px rgba(255,215,0,0.7), 0 0 12px 4px rgba(212,168,67,0.4);
    animation: goldExplode var(--particle-duration, 0.9s) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.tcg-gold-particle.tcg-gold-spark {
    width: 4px;
    height: 4px;
    background: #fff8dc;
    box-shadow: 0 0 4px 1px rgba(255,248,220,0.9), 0 0 8px 2px rgba(255,215,0,0.5);
}
.tcg-gold-ring {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    border: 2px solid rgba(212,168,67,0.7);
    border-radius: 50%;
    animation: goldRingExpand 0.7s ease-out forwards;
}

@keyframes goldExplode {
    0%   { opacity: 1; transform: translate(0, 0) scale(1); }
    20%  { opacity: 1; transform: translate(var(--dx), var(--dy)) scale(1.3); }
    60%  { opacity: 0.8; transform: translate(calc(var(--dx) * 1.4), calc(var(--dy) * 1.4 + 10px)) scale(0.9); }
    100% { opacity: 0; transform: translate(calc(var(--dx) * 1.2), calc(var(--dy) * 1.4 + 30px)) scale(0.3); }
}
@keyframes goldRingExpand {
    0%   { width: 0; height: 0; opacity: 0.9; border-width: 3px; }
    60%  { opacity: 0.5; border-width: 2px; }
    100% { width: 80px; height: 80px; opacity: 0; border-width: 0.5px; }
}

/* ══════════════════════════════════════════════════════════
   TRIGGERED ABILITY POPUP
   ══════════════════════════════════════════════════════════ */

/* Glow on the card that triggered */
.tcg-card.trigger-glow {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.4), 0 0 60px rgba(255, 215, 0, 0.2) !important;
    border-color: #ffd700 !important;
    animation: triggerGlowPulse 1s ease-in-out infinite;
    z-index: 50 !important;
}
@keyframes triggerGlowPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.4); }
    50%      { box-shadow: 0 0 30px rgba(255, 215, 0, 1), 0 0 60px rgba(255, 215, 0, 0.6), 0 0 80px rgba(255, 215, 0, 0.3); }
}

/* Fullscreen overlay */
.tcg-trigger-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: triggerOverlayIn 0.3s ease-out;
}
@keyframes triggerOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Popup container */
.tcg-trigger-popup {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #1a1d23 0%, #252830 100%);
    border: 2px solid #ffd700;
    border-radius: 16px;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.3), 0 16px 48px rgba(0, 0, 0, 0.6);
    animation: triggerPopupIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 320px;
    width: 90%;
}
@keyframes triggerPopupIn {
    0%   { opacity: 0; transform: scale(0.3) translateY(40px); }
    50%  { opacity: 1; transform: scale(1.05) translateY(-5px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Card image — 1.5x scale with float animation */
.tcg-trigger-card-img {
    width: calc(var(--tcg-card-w, 82px) * 1.5);
    height: calc(var(--tcg-card-h, 115px) * 1.5);
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.5);
    animation: triggerCardFloat 2s ease-in-out infinite;
}
@keyframes triggerCardFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

/* Label — "⚡ Ability Triggered!" */
.tcg-trigger-label {
    font-size: 1.1rem;
    font-weight: 800;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    animation: triggerLabelPulse 1.5s ease-in-out infinite;
}
@keyframes triggerLabelPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.7; }
}

/* Effect description */
.tcg-trigger-desc {
    font-size: 1rem;
    font-weight: 700;
    color: #4fc3f7;
    text-shadow: 0 0 8px rgba(79, 195, 247, 0.4);
    text-align: center;
}

/* Button row */
.tcg-trigger-btns {
    display: flex;
    gap: 0.8rem;
    margin-top: 0.3rem;
}
.tcg-trigger-btns .btn-tcg {
    min-width: 100px;
    font-size: 0.95rem;
    padding: 0.5rem 1.2rem;
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .tcg-trigger-popup {
        padding: 1rem 1.2rem;
        max-width: 280px;
    }
    .tcg-trigger-card-img {
        width: calc(var(--tcg-card-w, 60px) * 1.5);
        height: calc(var(--tcg-card-h, 84px) * 1.5);
    }
    .tcg-trigger-label {
        font-size: 0.95rem;
    }
    .tcg-trigger-desc {
        font-size: 0.85rem;
    }
    .tcg-trigger-btns .btn-tcg {
        min-width: 80px;
        font-size: 0.85rem;
    }
}

/* ═══════════════════════════════════════════════════════════
   ⚔ OPPONENT TOGGLE — vs Bot / vs Player
   ═══════════════════════════════════════════════════════════ */

.tcg-opponent-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 12px 0 8px;
}
.tcg-opp-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #6e7681;
    cursor: pointer;
    transition: color 0.25s;
    user-select: none;
}
.tcg-opp-label.active {
    color: #e6edf3;
}
.tcg-opp-switch {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: rgba(255,255,255,0.08);
    border: 1.5px solid rgba(255,255,255,0.15);
    position: relative;
    cursor: pointer;
    transition: background 0.25s, border-color 0.25s;
}
.tcg-opp-switch.active {
    background: rgba(230,57,70,0.15);
    border-color: rgba(230,57,70,0.4);
}
.tcg-opp-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #8b949e;
    transition: transform 0.25s, background 0.25s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.tcg-opp-switch.active .tcg-opp-knob {
    transform: translateX(20px);
    background: #e63946;
}

/* ── PvP Search Section ────────────────────────────────── */
.tcg-pvp-section {
    margin: 8px 0 12px;
    animation: fadeSlideDown 0.3s ease;
}
@keyframes fadeSlideDown {
    0%   { opacity: 0; transform: translateY(-8px); }
    100% { opacity: 1; transform: translateY(0); }
}
.tcg-pvp-search-wrap {
    position: relative;
    max-width: 340px;
    margin: 0 auto;
}
.tcg-pvp-search {
    width: 100%;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1.5px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.05);
    color: #e6edf3;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.tcg-pvp-search::placeholder { color: #6e7681; }
.tcg-pvp-search:focus {
    border-color: rgba(251,191,36,0.4);
}
.tcg-pvp-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    background: rgba(22,27,34,0.97);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 0 0 10px 10px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}
.tcg-pvp-results.open { display: block; }
.tcg-pvp-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.15s;
}
.tcg-pvp-result:hover {
    background: rgba(255,255,255,0.06);
}
.tcg-pvp-result-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #e6edf3;
    flex-shrink: 0;
    overflow: visible;
}
.tcg-pvp-result-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tcg-pvp-result-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #e6edf3;
}
.tcg-pvp-result-tag {
    font-size: 0.7rem;
    color: #6e7681;
    margin-left: auto;
}
.tcg-pvp-result-tag.friend { color: #2d9e4f; }
.tcg-pvp-result-tag.not-friend { color: #8b949e; }
.tcg-pvp-result-tag.pending { color: #d29922; }
.tcg-pvp-add-friend-btn {
    background: rgba(45,158,79,0.15);
    border: 1px solid rgba(45,158,79,0.3);
    color: #2d9e4f;
    font-size: 0.85rem;
    font-weight: 700;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}
.tcg-pvp-add-friend-btn:hover {
    background: rgba(45,158,79,0.3);
    transform: scale(1.1);
}
.tcg-pvp-add-friend-btn:disabled {
    cursor: default;
    opacity: 0.7;
    transform: none;
}
.tcg-pvp-add-friend-btn.sent {
    background: rgba(45,158,79,0.2);
    border-color: rgba(45,158,79,0.5);
    color: #3fb950;
}
.tcg-pvp-no-results {
    padding: 12px 14px;
    color: #6e7681;
    font-size: 0.8rem;
    text-align: center;
}

/* ── Invite Confirmation ────────────────────────────────── */
.tcg-pvp-invited {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 10px;
    background: rgba(45,158,79,0.1);
    border: 1px solid rgba(45,158,79,0.25);
    color: #2d9e4f;
    font-size: 0.85rem;
    font-weight: 600;
    max-width: 340px;
    margin: 0 auto;
}
.tcg-pvp-invited-icon { font-size: 1rem; }
.tcg-pvp-cancel-invite {
    background: none;
    border: none;
    color: #8b949e;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.2s;
}
.tcg-pvp-cancel-invite:hover { color: #e63946; }

/* ── PvP Status Lights ──────────────────────────────────── */
.tcg-pvp-status {
    display: flex;
    gap: 20px;
    justify-content: center;
    max-width: 340px;
    margin: 10px auto 0;
    padding: 10px 16px;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
}
.tcg-pvp-status-light {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: #6e7681;
    transition: color 0.3s;
}
.tcg-pvp-status-light .tcg-pvp-light-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 1.5px solid rgba(255,255,255,0.15);
    flex-shrink: 0;
    transition: all 0.4s ease;
}
.tcg-pvp-status-light.active .tcg-pvp-light-dot {
    background: #3fb950;
    border-color: #2d9e4f;
    box-shadow: 0 0 8px rgba(63,185,80,0.6), 0 0 16px rgba(63,185,80,0.3);
}
.tcg-pvp-status-light.active {
    color: #e6edf3;
}
.tcg-pvp-status-light.active .tcg-pvp-light-dot {
    animation: pvpLightPulse 2s ease-in-out infinite;
}
@keyframes pvpLightPulse {
    0%, 100% { box-shadow: 0 0 6px rgba(63,185,80,0.5); }
    50% { box-shadow: 0 0 14px rgba(63,185,80,0.8), 0 0 24px rgba(63,185,80,0.3); }
}

/* ── PvP Waiting Spinner ────────────────────────────────── */
.tcg-pvp-waiting {
    text-align: center;
    color: #a5d8ff;
    font-size: 0.85rem;
    margin-top: 8px;
    animation: pvpWaitPulse 2s ease-in-out infinite;
}
@keyframes pvpWaitPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ── PvP Turn Indicator on Board ────────────────────────── */
.tcg-pvp-turn-badge {
    position: absolute;
    top: 8px;
    right: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    z-index: 20;
}
.tcg-pvp-turn-badge.your-turn {
    background: rgba(63,185,80,0.15);
    color: #3fb950;
    border: 1px solid rgba(63,185,80,0.3);
}
.tcg-pvp-turn-badge.opp-turn {
    background: rgba(165,216,255,0.1);
    color: #a5d8ff;
    border: 1px solid rgba(165,216,255,0.2);
}

.tcg-pvp-login-prompt {
    text-align: center;
    color: #8b949e;
    font-size: 0.85rem;
}
.tcg-pvp-login-prompt a {
    color: var(--ink-amber);
    text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════
   🃏 MODE TABS — Normal / Custom Deck
   ═══════════════════════════════════════════════════════════ */

.tcg-mode-tabs {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 16px 0 20px;
}

.tcg-mode-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 28px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary, #8b949e);
    cursor: pointer;
    transition: all 0.25s;
    min-width: 160px;
}

.tcg-mode-tab:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
}

.tcg-mode-tab.active {
    border-color: #7c3aed;
    background: rgba(124, 58, 237, 0.1);
    color: var(--text-primary, #e6edf3);
}

.tcg-mode-icon {
    font-size: 1.3rem;
}

.tcg-mode-label {
    font-weight: 700;
    font-size: 0.95rem;
}

.tcg-mode-desc {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* ── Custom Deck Selection ────────────────────────── */
.tcg-custom-section {
    text-align: center;
    padding: 8px 0;
}

.tcg-custom-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.tcg-custom-login-prompt {
    padding: 24px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.tcg-custom-login-prompt a {
    color: #58a6ff;
}

.tcg-custom-deck-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    padding: 8px 0;
}

.tcg-custom-deck-card {
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px 20px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 160px;
    text-align: center;
}

.tcg-custom-deck-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
}

.tcg-custom-deck-card.selected {
    border-color: #7c3aed;
    background: rgba(124, 58, 237, 0.12);
    box-shadow: 0 0 16px rgba(124, 58, 237, 0.3);
}

.tcg-cdc-name {
    font-weight: 700;
    font-size: 0.92rem;
    margin-bottom: 6px;
}

.tcg-cdc-colors {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 4px;
}

.tcg-cdc-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.tcg-cdc-count {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ── Diamond Reward Animation (Game Over) ─────────── */
.go-diamond-reward {
    margin-top: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fbbf24;
    animation: diamondPop 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.go-diamond-reward .diamond-icon {
    margin-right: 4px;
}

@keyframes diamondPop {
    0% {
        opacity: 0;
        transform: translateY(12px) scale(0.7);
    }
    60% {
        transform: translateY(-4px) scale(1.15);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Item Drop Reward ─────────────────────────────── */
.go-item-drop {
    margin-top: 10px;
    padding: 8px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    animation: itemDropSlide 0.8s 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.go-item-drop-common  { border-color: #9ca3af; }
.go-item-drop-rare    { border-color: #3b82f6; background: rgba(59, 130, 246, 0.12); }
.go-item-drop-epic    { border-color: #a855f7; background: rgba(168, 85, 247, 0.12); }
.go-item-drop-legendary { border-color: #f59e0b; background: rgba(245, 158, 11, 0.15); }

.go-drop-icon { font-size: 1.3rem; }
.go-drop-name { flex: 1; }
.go-drop-badge {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0.8;
}

@keyframes itemDropSlide {
    0% { opacity: 0; transform: translateY(20px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Mode Tabs Responsive ─────────────────────────── */
@media (max-width: 640px) {
    .tcg-mode-tabs {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    .tcg-mode-tab {
        min-width: 240px;
        padding: 10px 20px;
        flex-direction: row;
        gap: 10px;
    }
    .tcg-mode-icon {
        font-size: 1.1rem;
    }
    .tcg-mode-label {
        font-size: 0.88rem;
    }
    .tcg-custom-deck-grid {
        flex-direction: column;
        align-items: center;
    }
    .tcg-custom-deck-card {
        width: 90%;
        max-width: 280px;
    }
}

/* ── Ink Reveal Overlay (show inked card for 15 seconds) ── */
.tcg-ink-reveal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
    cursor: pointer;
}
.tcg-ink-reveal.visible {
    opacity: 1;
    pointer-events: auto;
}
.tcg-ink-reveal-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    animation: inkRevealPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: default;
}
.tcg-ink-reveal-img {
    width: 220px;
    max-height: 320px;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(165, 216, 255, 0.5), 0 4px 24px rgba(0,0,0,0.6);
    border: 2px solid rgba(165, 216, 255, 0.4);
}
.tcg-ink-reveal-img.tcg-location-rotate {
    transform: rotate(90deg);
}
.tcg-ink-reveal-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: #a5d8ff;
    text-shadow: 0 1px 6px rgba(0,0,0,0.8);
    letter-spacing: 0.5px;
}
/* Rainbow countdown bar */
.tcg-ink-reveal-bar-track {
    width: 220px;
    height: 5px;
    border-radius: 3px;
    background: rgba(255,255,255,0.15);
    overflow: hidden;
    margin-top: 2px;
}
.tcg-ink-reveal-bar-fill {
    width: 100%;
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #ff0000, #ff8800, #ffff00, #00ff00, #0088ff, #8800ff, #ff0088);
    background-size: 300% 100%;
    animation: inkRevealCountdown 15s linear forwards, inkRevealRainbow 2s linear infinite;
}
@keyframes inkRevealCountdown {
    0%   { width: 100%; }
    100% { width: 0%; }
}
@keyframes inkRevealRainbow {
    0%   { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}
@keyframes inkRevealPop {
    0%   { transform: scale(0.4); opacity: 0; }
    60%  { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* ══════════════════════════════════════════════════════════════
   OPPONENT (BOT) DECK & BANISH STACKS — Top corners
   ══════════════════════════════════════════════════════════════ */
.tcg-deck-stack-bot {
    position: fixed;
    top: calc(var(--tcg-card-h) * -0.28);
    right: 14px;
    bottom: auto;
    z-index: 201;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    transition: opacity 0.3s ease, top 0.3s ease;
}
.tcg-deck-stack-bot:hover {
    top: 8px;
    pointer-events: auto;
}
.tcg-deck-stack-bot.hidden { display: none; }
.tcg-deck-stack-bot .tcg-deck-cards {
    width: calc(var(--tcg-card-w) * 0.55);
    height: calc(var(--tcg-card-h) * 0.55);
}
.tcg-deck-stack-bot .tcg-deck-label {
    order: -1;
    margin-bottom: 4px;
    margin-top: 0;
    color: rgba(230,57,70,0.9);
}
.tcg-deck-stack-bot .tcg-deck-card-layer {
    background: linear-gradient(135deg, #1a0a0e, #2e1b30);
    border-color: rgba(230,57,70,0.35);
}

.tcg-banish-stack-bot {
    position: fixed;
    top: calc(var(--tcg-card-h) * -0.28);
    left: 14px;
    bottom: auto;
    z-index: 201;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    transition: opacity 0.3s ease, top 0.3s ease;
}
.tcg-banish-stack-bot:hover {
    top: 8px;
    pointer-events: auto;
}
.tcg-banish-stack-bot.hidden { display: none; }
.tcg-banish-stack-bot .tcg-banish-cards {
    width: calc(var(--tcg-card-w) * 0.55);
    height: calc(var(--tcg-card-h) * 0.55);
}
.tcg-banish-stack-bot .tcg-banish-label {
    order: -1;
    margin-bottom: 4px;
    margin-top: 0;
}

/* ── Zone Browser Overlay (click to view all cards in a pile) ─── */
.tcg-zone-browser {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(6px);
}
.tcg-zone-browser-inner {
    background: linear-gradient(145deg, #1a1a2e, #0d0d1a);
    border: 1px solid rgba(155,93,229,0.3);
    border-radius: 16px;
    padding: 1.2rem;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.tcg-zone-browser-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(155,93,229,0.15);
}
.tcg-zone-browser-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #e0e0e0;
    flex: 1;
}
.tcg-zone-browser-count {
    background: rgba(230,57,70,0.25);
    color: #e63946;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}
.tcg-zone-browser-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.tcg-zone-browser-close:hover { color: #fff; }
.tcg-zone-browser-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
}
.tcg-zone-browser-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}
.tcg-zone-browser-card img {
    width: 100%;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    transition: transform 0.2s ease;
}
.tcg-zone-browser-card:hover img {
    transform: scale(1.05);
}
.tcg-zone-browser-name {
    font-size: 0.6rem;
    color: #aaa;
    margin-top: 4px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* ── Hide game launcher on TCG page until game starts ── */
.tcg-game ~ .game-launcher,
.tcg-game ~ .game-menu-panel { display: none !important; }
.tcg-game ~ .game-launcher.tcg-menu-mode {
    display: flex !important;
    width: auto;
    height: 36px;
    border-radius: 18px;
    padding: 0 14px;
    gap: 6px;
    bottom: 14px;
    left: 14px;
    animation: none;
}
.tcg-game ~ .game-launcher.tcg-menu-mode .game-launcher-icon { display: none; }
.tcg-game ~ .game-launcher.tcg-menu-mode .game-launcher-pulse { display: none; }
.tcg-game ~ .game-launcher.tcg-menu-mode .game-launcher-label {
    position: static;
    transform: none;
    font-size: 0.7rem;
    animation: none;
}
.tcg-game ~ .game-launcher.tcg-menu-mode .tcg-menu-hamburger {
    display: block;
    font-size: 16px;
    line-height: 1;
    color: rgba(251, 191, 36, 0.9);
}
.tcg-menu-hamburger { display: none; }
.tcg-game ~ .game-menu-panel.tcg-menu-mode-panel {
    display: flex !important;
    bottom: 14px;
    padding-bottom: 50px;
}

/* ── Mobile adjustments for bot stacks ── */
@media (max-width: 640px) {
    .tcg-deck-stack-bot { right: 8px; top: calc(var(--tcg-card-h) * -0.24); }
    .tcg-deck-stack-bot:hover { top: 6px; }
    .tcg-deck-stack-bot .tcg-deck-cards { width: calc(var(--tcg-card-w) * 0.45); height: calc(var(--tcg-card-h) * 0.45); }
    .tcg-deck-stack-bot .tcg-deck-label { font-size: 0.6rem; }
    .tcg-banish-stack-bot { left: 8px; top: calc(var(--tcg-card-h) * -0.24); }
    .tcg-banish-stack-bot:hover { top: 6px; }
    .tcg-banish-stack-bot .tcg-banish-cards { width: calc(var(--tcg-card-w) * 0.45); height: calc(var(--tcg-card-h) * 0.45); }
    .tcg-banish-stack-bot .tcg-banish-label { font-size: 0.6rem; }
    .tcg-zone-browser-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
}
