/* ── Test / Board Reference Page ─────────────────────────── */

.test-wrapper {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 20px 20px 40px;
    box-sizing: border-box;
    min-height: calc(100vh - 160px);
}

/* ── BOARD ────────────────────────────────────────────────── */

.board-outer {
    /* All card/zone sizes derive from --card-w so the board scales fluidly */
    --card-w: clamp(30px, 5.2vw, 52px);
    --card-h: calc(var(--card-w) * 1.4);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(4, 4, 4, 0.82);
    border: 1px solid rgba(255, 191, 0, 0.14);
    border-radius: 18px;
    padding: 14px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ── ZONE base ────────────────────────────────────────────── */

.zone {
    border-radius: 10px;
    border: 1px solid rgba(255, 191, 0, 0.12);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    position: relative;
}

.zone:hover {
    border-color: rgba(255, 191, 0, 0.5);
    box-shadow: 0 0 18px rgba(255, 191, 0, 0.15);
    background: rgba(255, 191, 0, 0.04);
}

.zone.active {
    border-color: #ffbf00;
    box-shadow: 0 0 28px rgba(255, 191, 0, 0.3);
    background: rgba(255, 191, 0, 0.07);
}

/* ── ZONE LABEL ───────────────────────────────────────────── */

.zone-label {
    font-family: 'HwyGothic', Arial, sans-serif;
    font-size: 0.52rem;
    letter-spacing: 3px;
    color: rgba(255, 191, 0, 0.35);
    text-transform: uppercase;
    pointer-events: none;
    user-select: none;
    /* Glow eases in shortly after hover and lingers on the way out */
    transition: color 0.5s ease 0.15s, text-shadow 0.5s ease 0.15s;
}

.zone.active .zone-label,
.zone:hover .zone-label {
    color: rgba(255, 220, 120, 0.9);
    text-shadow: 0 0 8px rgba(255, 191, 0, 0.7),
                 0 0 20px rgba(255, 191, 0, 0.35);
}

/* ── PLAYER LABELS ────────────────────────────────────────── */

.player-label {
    font-family: 'HwyGothic', Arial, sans-serif;
    font-size: 0.58rem;
    letter-spacing: 4px;
    color: #3a3a36;
    text-transform: uppercase;
    text-align: center;
    padding: 2px 0;
    user-select: none;
}

/* ── CARD PLACEHOLDER ─────────────────────────────────────── */

.card {
    flex-shrink: 0;
    width: var(--card-w);
    height: var(--card-h);
    border-radius: 5px;
    border: 1px solid rgba(255, 191, 0, 0.25);
    background: rgba(20, 18, 14, 0.9);
    pointer-events: none;
}

.card.face-down {
    background: linear-gradient(135deg, rgba(30, 25, 10, 0.95) 0%, rgba(15, 12, 5, 0.95) 100%);
    border-color: rgba(255, 191, 0, 0.2);
    background-image:
        repeating-linear-gradient(
            45deg,
            rgba(255, 191, 0, 0.04) 0px,
            rgba(255, 191, 0, 0.04) 1px,
            transparent 1px,
            transparent 8px
        );
}

.card.face-up {
    background: linear-gradient(160deg, rgba(35, 30, 12, 0.95) 0%, rgba(18, 14, 4, 0.95) 100%);
    border-color: rgba(255, 191, 0, 0.45);
    box-shadow: 0 2px 8px rgba(255, 191, 0, 0.12);
}

/* deck stack effect */
.deck-stack {
    position: relative;
    width: var(--card-w);
    height: var(--card-h);
    flex-shrink: 0;
}

.deck-stack .card {
    position: absolute;
}

.deck-stack .card:nth-child(1) { top: 4px; left: 4px; }
.deck-stack .card:nth-child(2) { top: 2px; left: 2px; }
.deck-stack .card:nth-child(3) { top: 0;   left: 0; }

/* ── OPPONENT SECTION ─────────────────────────────────────── */

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

.opp-top {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* ── HAND ZONES ───────────────────────────────────────────── */

.hand-zone {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    min-height: calc(var(--card-h) + 22px);
}

/* Hand/loop labels sit in the corner so they never push cards out of the row */
.hand-zone .zone-label,
.loop-zone .zone-label {
    position: absolute;
    right: 10px;
    bottom: 6px;
}

/* ── DECK ZONE ────────────────────────────────────────────── */

.deck-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    min-width: calc(var(--card-w) + 36px);
    min-height: calc(var(--card-h) + 22px);
}

/* ── BATTLEFIELD (the zone around a player's spaces) ──────── */

.field-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    min-height: calc(var(--card-h) + 22px);
    border-style: dashed;
    background: rgba(255, 191, 0, 0.015);
}

/* Battlefield label sits in the corner like the hand/loop labels */
.field-row .zone-label {
    position: absolute;
    right: 10px;
    bottom: 6px;
}

.field-space {
    width: calc(var(--card-w) + 8px);
    height: calc(var(--card-h) + 11px);
    border-radius: 7px;
    border: 1px dashed rgba(255, 191, 0, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    font-family: 'HwyGothic', Arial, sans-serif;
    font-size: 0.42rem;
    letter-spacing: 2px;
    color: rgba(255, 191, 0, 0.2);
    text-transform: uppercase;
    text-align: center;
    position: relative;
}

.field-space:hover {
    border-color: rgba(255, 191, 0, 0.5);
    border-style: solid;
    box-shadow: 0 0 14px rgba(255, 191, 0, 0.14);
    background: rgba(255, 191, 0, 0.04);
    color: rgba(255, 191, 0, 0.6);
}

.field-space.active {
    border-color: #ffbf00;
    border-style: solid;
    box-shadow: 0 0 22px rgba(255, 191, 0, 0.28);
    background: rgba(255, 191, 0, 0.07);
    color: #ffbf00;
}

/* card sitting in a field space */
.field-space .card {
    position: absolute;
    width: var(--card-w);
    height: var(--card-h);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ── MIDDLE SECTION ───────────────────────────────────────── */

.mid-section {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 8px;
}

.loop-zone {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    min-height: calc(var(--card-h) * 1.12 + 22px);
    background: rgba(255, 191, 0, 0.02);
    border-color: rgba(255, 191, 0, 0.2);
}

.loop-zone .zone-label {
    font-size: 0.6rem;
    letter-spacing: 5px;
}

/* cards on the loop are slightly larger */
.loop-zone .card {
    width: calc(var(--card-w) * 1.12);
    height: calc(var(--card-h) * 1.12);
}

.loop-zone .card.face-up {
    transform: rotate(-3deg);
}

.loop-zone .card.face-up:nth-child(2) {
    transform: rotate(2deg);
    margin-left: calc(var(--card-w) * -0.2);
}

.shared-column {
    display: flex;
    flex-direction: row;
    gap: 6px;
    flex-shrink: 0;
    align-self: stretch;
}

/* ── GRAVEYARD & EXILE ────────────────────────────────────── */

.pile-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    min-width: calc(var(--card-w) + 28px);
    align-self: stretch;
}

.pile-zone .card {
    width: calc(var(--card-w) * 0.92);
    height: calc(var(--card-h) * 0.92);
}

/* ── PLAYER SECTION ───────────────────────────────────────── */

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

.plr-bottom {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* ── INFO PANEL ───────────────────────────────────────────── */

.info-panel {
    flex: 0 0 clamp(220px, 24vw, 260px);
    background: rgba(8, 8, 8, 0.88);
    border: 1px solid rgba(255, 191, 0, 0.16);
    border-radius: 16px;
    padding: 24px 20px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    position: sticky;
    top: 160px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 260px;
}

.info-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 191, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'DragonSlayer', serif;
    font-size: 1.5rem;
    color: #ffbf00;
    flex-shrink: 0;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.info-panel.has-content .info-icon {
    border-color: #ffbf00;
    box-shadow: 0 0 18px rgba(255, 191, 0, 0.28);
}

.info-zone-name {
    font-family: 'DragonSlayer', serif;
    font-size: 1.3rem;
    color: #ffbf00;
    letter-spacing: 2px;
    margin: 0;
    line-height: 1.2;
}

.info-desc {
    font-family: 'HwyGothic', Arial, sans-serif;
    font-size: 0.82rem;
    color: rgba(240, 236, 230, 0.72);
    line-height: 1.7;
    margin: 0;
    letter-spacing: 0.3px;
}

.info-bullets {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-bullets li {
    font-family: 'HwyGothic', Arial, sans-serif;
    font-size: 0.78rem;
    color: rgba(240, 236, 230, 0.65);
    line-height: 1.5;
    padding-left: 16px;
    position: relative;
    letter-spacing: 0.3px;
}

.info-bullets li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: #ffbf00;
    font-size: 0.7rem;
}

.info-hint {
    font-family: 'HwyGothic', Arial, sans-serif;
    font-size: 0.68rem;
    color: #3a3a36;
    letter-spacing: 1px;
    text-align: center;
    margin-top: auto;
}

.info-divider {
    height: 1px;
    background: rgba(255, 191, 0, 0.1);
    border: none;
    margin: 0;
}

/* ── PAGE HEADER ──────────────────────────────────────────── */

.board-page-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    padding: 0 4px;
}

.board-page-title {
    font-family: 'DragonSlayer', serif;
    font-size: 1rem;
    color: rgba(255, 191, 0, 0.4);
    letter-spacing: 6px;
    margin: 0;
}

/* ── RESPONSIVE ───────────────────────────────────────────── */

@media only screen and (max-width: 900px) {
    .test-wrapper {
        flex-direction: column;
    }

    .info-panel {
        flex: none;
        width: 100%;
        position: static;
        min-height: auto;
        box-sizing: border-box;
    }
}

@media only screen and (max-width: 767px), only screen and (hover: none) {
    .test-wrapper {
        padding: 12px 12px 32px;
        gap: 14px;
    }

    .board-outer {
        --card-w: clamp(24px, 7vw, 44px);
        padding: 8px;
        gap: 4px;
    }

    .zone-label {
        letter-spacing: 2px;
    }

    .deck-stack .card:nth-child(1) { top: 3px; left: 3px; }
    .deck-stack .card:nth-child(2) { top: 1.5px; left: 1.5px; }

    .opp-top,
    .plr-bottom {
        gap: 5px;
    }

    .hand-zone {
        gap: 3px;
        padding: 6px 8px;
    }

    .deck-zone {
        min-width: calc(var(--card-w) + 26px);
        padding: 6px 8px;
        gap: 5px;
    }

    .field-row {
        gap: 4px;
        padding: 6px 8px;
    }

    .mid-section {
        gap: 5px;
    }

    .loop-zone {
        gap: 5px;
        padding: 8px 10px;
    }

    .shared-column {
        gap: 4px;
    }

    .pile-zone {
        min-width: calc(var(--card-w) + 14px);
        padding: 6px;
        gap: 4px;
    }
}