/* === FELT === */
.felt-texture {
    position: fixed; inset: 0; z-index: 0;
    background: radial-gradient(ellipse at 50% 30%, var(--felt-1), var(--felt-2) 55%, var(--felt-3) 100%);
}
.felt-texture::before {
    content: ''; position: absolute; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E");
    background-size: 200px; opacity: 0.7; pointer-events: none;
}

/* === LAYOUT === */
#game {
    position: relative; z-index: 1;
    width: 100%; max-width: 440px;
    height: 100dvh;
    display: flex; flex-direction: column;
    padding: calc(8px + env(safe-area-inset-top)) 8px calc(18px + env(safe-area-inset-bottom));
}
.native-app #game {
    padding-top: calc(var(--status-bar-h, 36px) + 8px);
}

/* Background branding */
.bg-brand {
    position: fixed; z-index: 0;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center; pointer-events: none;
}
.bg-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(2.5rem, 12vw, 4.5rem);
    font-weight: 700; font-style: italic;
    color: rgba(255,255,255,0.12);
    letter-spacing: 3px;
    white-space: nowrap;
}
.bg-dev {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: clamp(0.55rem, 2.5vw, 0.8rem);
    color: rgba(255,255,255,0.08);
    letter-spacing: 2px;
    margin-top: 4px;
    white-space: nowrap;
}

/* === SLOTS === */
.slots-zone {
    display: flex; justify-content: center;
    gap: var(--gap); flex: 1;
    align-items: flex-start; padding-top: 4px;
}
.slot {
    width: var(--card-w); min-height: var(--card-h);
    position: relative; cursor: pointer;
    touch-action: none;
}
.slot-base {
    position: absolute; top: 0; left: 0;
    width: 100%; height: var(--card-h);
    border-radius: var(--card-r);
    border: 1.5px dashed rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.05);
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.slot.has-cards .slot-base { border-color: transparent; background: transparent; }
.slot.selected .card:last-of-type {
    box-shadow: 0 0 0 2px var(--gold), 0 4px 16px rgba(201,168,76,0.35) !important;
}
.slot.drop-target .slot-base {
    border-color: rgba(201,168,76,0.5);
    background: rgba(201,168,76,0.06);
    box-shadow: inset 0 0 16px rgba(201,168,76,0.08);
}
.slot .card { position: absolute; left: 0; cursor: pointer; }
.slot .card-count {
    position: absolute; left: 50%; transform: translateX(-50%);
    font-size: 0.6rem; color: var(--text-dim);
    white-space: nowrap; font-variant-numeric: tabular-nums;
}

/* === BOTTOM BAR === */
.bottom-bar {
    display: flex; align-items: flex-end;
    justify-content: space-between;
    padding-top: 10px; gap: 8px;
}
.bottom-left { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; }
.ctrl-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px; color: var(--text-dim);
    padding: 10px 14px; cursor: pointer;
    font-family: inherit; font-size: 0.78rem; font-weight: 500;
    transition: all 0.15s;
    min-height: 40px;
}
.ctrl-btn:active { transform: scale(0.95); background: rgba(255,255,255,0.14); }

/* Center column */
.bottom-center {
    display: flex; flex-direction: column;
    align-items: center; gap: 6px;
    justify-content: flex-end;
}
.center-btn {
    width: calc(var(--card-w) + 24px); text-align: center;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Discard zone */
.discard-zone {
    position: relative; width: var(--card-w);
    height: var(--card-h); cursor: pointer;
}
.discard-label, .deck-label {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.85rem; font-weight: 600;
    font-variant-numeric: tabular-nums;
    z-index: 10; pointer-events: none;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.discard-label {
    color: rgba(200,175,100,0.85);
    white-space: nowrap;
    background: rgba(0,0,0,0.55);
    padding: 2px 8px; border-radius: 4px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}
.discard-zone .card { position: absolute; top: 0; left: 0; }

/* Deck */
.bottom-right { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.deck-stack {
    position: relative; width: var(--card-w); height: var(--card-h); cursor: pointer;
}
.deck-stack:active:not(.empty) .card { transform: translateY(1px); }
.deck-cards { position: relative; width: 100%; height: 100%; }
.deck-cards .card { position: absolute; top: 0; left: 0; }
.deck-label {
    color: rgba(200,175,100,0.6);
    text-align: center;
}
.deck-stack.empty { cursor: default; opacity: 0.3; }

/* Mode row above deck */
.mode-row {
    display: flex; gap: 6px;
    width: calc(var(--card-w) + 8px);
    justify-content: flex-end;
}
.mode-btn-ctrl {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px; color: var(--text-dim);
    cursor: pointer; font-family: inherit;
    transition: all 0.15s;
    display: flex; align-items: center; justify-content: center;
    height: 32px; font-size: 1.4rem;
    flex: 0 0 calc((100% - 6px) / 2);
}
.mode-btn-ctrl:active { transform: scale(0.93); background: rgba(255,255,255,0.14); }
#shield-btn {
    transition: opacity 0.15s;
}
.mode-label, .color-label {
    font-weight: 600;
}

/* Undo row above discard */
.undo-row {
    display: flex; gap: 6px;
    width: calc(var(--card-w) + 8px);
    justify-content: flex-start;
}
#undo-btn:disabled {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
}
