/* Cinzel: a classic Roman/Trajan-style serif used for the heroic player
   name plates. Falls back to system serifs if Google Fonts is blocked. */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700;900&display=swap');

.header {
    text-align: center;
}

/* === Lobby (starting screen at /) === */
.lobby {
    max-width: 900px;
    margin: 40px auto;
    padding: 30px 40px;
    background-color: cornsilk;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.lobby-title {
    text-align: center;
    margin: 0 0 5px;
    font-size: 3em;
    color: blueviolet;
}

.lobby-subtitle {
    text-align: center;
    margin: 0 0 25px;
    color: #555;
    font-weight: normal;
}

.battle-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.battle-item {
    background: white;
    border-radius: 12px;
    padding: 18px 22px;
    margin: 12px 0;
    border: 1px solid #d8d0bc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.battle-name {
    font-size: 1.25em;
    font-weight: bold;
    color: #222;
}

.battle-meta {
    color: #777;
    font-size: 0.85em;
    margin-top: 3px;
}

.restart-form {
    margin: 8px 0 0;
    display: inline-block;
}

.btn-restart {
    background: transparent;
    border: 1px solid #c8a87a;
    color: #8b5a2b;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8em;
    cursor: pointer;
    transition: background-color .12s ease-in-out, color .12s ease-in-out;
}

.btn-restart:hover {
    background: #8b5a2b;
    color: white;
}

.battle-players {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.join-link {
    flex: 1 1 200px;
    padding: 12px 16px;
    background: linear-gradient(135deg, blueviolet 0%, #6a2bd9 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    text-align: center;
    transition: transform .12s ease-in-out, box-shadow .12s ease-in-out;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.join-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(138, 43, 226, 0.35);
    color: white;
    text-decoration: none;
}

/* Highlight the player whose turn is active so visitors can see at a glance
   which side is waiting for them. */
.join-link.their-turn {
    background: linear-gradient(135deg, #C76C37 0%, blueviolet 100%);
    box-shadow: 0 0 0 2px rgba(199, 108, 55, 0.4), 0 4px 14px rgba(199, 108, 55, 0.35);
}

.join-label {
    font-size: 0.75em;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.join-name {
    font-size: 1.15em;
    font-weight: bold;
}

.phase-badge {
    margin-top: 4px;
    font-size: 0.75em;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.phase-wait { opacity: 0.55; }
.phase-won { color: gold; }
.phase-lost { color: #ffa0a0; }

.lobby-actions {
    text-align: center;
    margin-top: 30px;
}

.btn-create {
    display: inline-block;
    padding: 14px 28px;
    background: linear-gradient(135deg, #C76C37 0%, blueviolet 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: bold;
    transition: transform .12s ease-in-out, box-shadow .12s ease-in-out;
}

.btn-create:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(199, 108, 55, 0.4);
    color: white;
    text-decoration: none;
}

.empty {
    text-align: center;
    color: #888;
    font-style: italic;
    padding: 30px;
    background: white;
    border-radius: 10px;
    border: 1px dashed #ccc;
}

.header-box {
    text-align: center;
    display: inline-block;
    background-color: blueviolet;
    color: paleturquoise;
    width: 200px;
    border: 7px double #1C6EA4;
    border-radius: 12px;
    padding: 15px 4px 20px;
    font-size: 10pt;


    background: rgba(138,43,226,1);
    background: -moz-linear-gradient(-45deg, rgba(138,43,226,1) 0%, rgba(138,43,226,1) 22%, rgba(199,108,55,1) 36%, rgba(138,43,226,1) 57%, rgba(41,14,66,1) 100%);
    background: -webkit-gradient(left top, right bottom, color-stop(0%, rgba(138,43,226,1)), color-stop(22%, rgba(138,43,226,1)), color-stop(36%, rgba(199,108,55,1)), color-stop(57%, rgba(138,43,226,1)), color-stop(100%, rgba(41,14,66,1)));
    background: -webkit-linear-gradient(-45deg, rgba(138,43,226,1) 0%, rgba(138,43,226,1) 22%, rgba(199,108,55,1) 36%, rgba(138,43,226,1) 57%, rgba(41,14,66,1) 100%);
    background: -o-linear-gradient(-45deg, rgba(138,43,226,1) 0%, rgba(138,43,226,1) 22%, rgba(199,108,55,1) 36%, rgba(138,43,226,1) 57%, rgba(41,14,66,1) 100%);
    background: -ms-linear-gradient(-45deg, rgba(138,43,226,1) 0%, rgba(138,43,226,1) 22%, rgba(199,108,55,1) 36%, rgba(138,43,226,1) 57%, rgba(41,14,66,1) 100%);
    background: linear-gradient(135deg, rgba(138,43,226,1) 0%, rgba(138,43,226,1) 22%, rgba(199,108,55,1) 36%, rgba(138,43,226,1) 57%, rgba(41,14,66,1) 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#8a2be2', endColorstr='#290e42', GradientType=1 );
}

.footer {
    position: fixed;
    bottom: 5px;
    left: 25px;
}

.p0 {
    padding: 0px;
}

.m0 {
    margin: 0px;
}

.mb10 {
    margin-bottom: 10px;
}

/* === Game table: technological-modern · epic · golden-age retro ===
   Deep nebula background, faint engineering grid, gold trim, ornate
   corner brackets in pure CSS. Cards float over a star-blue field with
   a warm amber glow seeping in from the bottom. */
.game-table {
    background:
        /* faint blueprint grid */
        linear-gradient(rgba(212, 175, 55, 0.035) 1px, transparent 1px) 0 0 / 32px 32px,
        linear-gradient(90deg, rgba(212, 175, 55, 0.035) 1px, transparent 1px) 0 0 / 32px 32px,
        /* color wash */
        radial-gradient(ellipse at 30% 0%, rgba(78, 50, 130, 0.45) 0%, transparent 65%),
        radial-gradient(ellipse at 70% 100%, rgba(199, 108, 55, 0.22) 0%, transparent 65%),
        linear-gradient(160deg, #1c1138 0%, #0a0a1d 50%, #14112e 100%);
    border-radius: 22px;
    margin: 30px;
    min-height: 200px;
    height: 100%;
    padding: 26px;
    position: relative;
    z-index: 50;
    text-align: center;
    border: 1px solid rgba(212, 175, 55, 0.55);
    box-shadow:
        inset 0 0 100px rgba(212, 175, 55, 0.07),
        inset 0 0 0 1px rgba(212, 175, 55, 0.22),
        0 0 0 4px rgba(0, 0, 0, 0.45),
        0 0 50px rgba(138, 43, 226, 0.18),
        0 14px 40px rgba(0, 0, 0, 0.55);
}

/* Gold corner brackets — old-tome / heraldic flourish without an image. */
.game-table::before,
.game-table::after {
    content: '';
    position: absolute;
    width: 56px;
    height: 56px;
    pointer-events: none;
    border-color: #d4af37;
    border-style: solid;
    border-width: 0;
    filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.45));
}

.game-table::before {
    top: 12px;
    left: 12px;
    border-top-width: 2px;
    border-left-width: 2px;
    border-top-left-radius: 14px;
}

.game-table::after {
    bottom: 12px;
    right: 12px;
    border-bottom-width: 2px;
    border-right-width: 2px;
    border-bottom-right-radius: 14px;
}

/* Opponent's table panel — cool deep navy with gold trim. */
.opponent-side {
    background:
        linear-gradient(135deg, rgba(45, 70, 105, 0.92) 0%, rgba(28, 45, 75, 0.92) 100%);
    border-radius: 16px;
    margin: 30px auto;
    width: fit-content;
    min-height: 200px;
    height: 80%;
    padding: 18px 22px;
    z-index: 100;
    position: relative;
    text-align: center;
    border: 1px solid rgba(212, 175, 55, 0.45);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.10),
        inset 0 0 35px rgba(0, 0, 0, 0.4),
        0 4px 18px rgba(0, 0, 0, 0.45);
}

/* Player's battlefield panel — warm deep moss-green, paired with the
   opponent's cool navy across the table. Sized like .opponent-side
   (`fit-content` width + 80% height) so it hugs the 5 table positions
   and mirrors the opponent's panel above. */
.battlefield {
    background:
        linear-gradient(135deg, rgba(60, 90, 60, 0.92) 0%, rgba(35, 60, 45, 0.92) 100%);
    border-radius: 16px;
    margin: 30px auto 0;
    width: fit-content;
    min-height: 200px;
    height: 80%;
    padding: 18px 22px;
    text-align: center;
    border: 1px solid rgba(212, 175, 55, 0.45);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.10),
        inset 0 0 35px rgba(0, 0, 0, 0.4),
        0 4px 18px rgba(0, 0, 0, 0.45);
}

/* Opponent and player rows inside the game-table both use a
   1fr auto 1fr grid so the centre column (the battlefield panel)
   stays page-centred. The opponent has HQ in column 1 (left of panel);
   the player has HQ in column 3 (right of panel). Mirror symmetry across
   the table. */
.opponent-area,
.player-area {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin: 30px 30px 0;
}

.opponent-area {
    margin: 0 30px 30px;
}

.opponent-area .opponent-side {
    grid-column: 2;
    margin: 0;
}

.opponent-area .headquarters {
    grid-column: 1;
    justify-self: end;
    margin-right: 30px;
    width: 170px;
}

/* Heroic title plates for both players. Shared styling: white,
   oversized, Cinzel serif (Roman / Trajan-style), soft glow.
   The two areas position the plate at opposite corners of the table —
   opponent at the top-right, device user at the bottom-left — so they
   read as mirror reflections across the playing field. */
.player-name {
    position: absolute;
    width: 33.33%;
    margin: 0;
    text-align: center;
    color: white;
    font-family: 'Cinzel', 'Trajan Pro', 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    font-size: 3em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow:
        0 0 18px rgba(255, 255, 255, 0.35),
        0 0 6px rgba(212, 175, 55, 0.5),
        0 2px 8px rgba(0, 0, 0, 0.6);
}

.player-area .player-name {
    bottom: 20px;
    left: 0;
}

.opponent-area .player-name {
    top: 20px;
    right: 0;
}

.player-area .battlefield {
    grid-column: 2;
    margin: 0; /* grid centering supersedes auto margins */
}

.player-area .headquarters {
    grid-column: 3;
    justify-self: start;
    margin-left: 30px;
    width: 170px; /* one card-outer width — locks the HQ container's right edge to the rightmost (visible top-of-pile) card */
}

/* Player's table-positions row matches the opponent's: shrinks to fit
   exactly 5 positions instead of forcing a 1000px floor. This is what
   gives the two battlefield panels identical width. */
.player-area .player-table-position {
    min-width: auto;
    white-space: nowrap;
}

.card {
     -webkit-text-size-adjust: none;
    font-family: sans-serif;
    padding: 10px;
    width: 150px;
    height: 215px;
    display: inline-block;
    border-radius: 5px;
    margin: 5px;
    vertical-align: middle;
    transition: all .2s ease-in-out;
    z-index: 130;
    border: 0px;
}

.grow {
    transition: all .2s ease-in-out;
    border-radius: 5px;
    z-index: 160;
}

/* State indicators below use `outline` instead of `border` so the card's
   layout box stays the same size in every state — no more siblings shifting
   on hover or selection. `outline-offset: -Npx` draws the outline inside the
   element's edge, mimicking the look of an inset border. */
.grow:hover {
    transform: scale(1.8);
    transform-origin: center center;
    z-index: 160;
    position: relative;
    border-radius: 5px;
    outline: 5px solid aqua;
    outline-offset: -5px;
    transition-delay: 0.5s;
}

/* Subtle in-place affordance on hover — purely a "you're inspecting me" signal.
   No outline or pointer cursor: those are reserved for cards the player can
   actually act with right now (see the phase-scoped rule below). The big
   readable copy of the card still shows in #card-preview regardless. */
.card.card-full:hover {
    transform: scale(1.06);
    transform-origin: center center;
    z-index: 160;
    position: relative;
}

/* Aqua "playable" outline + pointer cursor: only the cards the player can
   actually use as the actor in the current phase.
   - phase-play  → cards in your hand (ship)
   - phase-attack → cards on your battlefield row
   Target selection (valid-target, can-fly, etc.) already has its own visual
   language elsewhere in this file. */
.game-table.phase-play .player-ship .card.card-full:hover,
.game-table.phase-attack .player-table-position .card.card-full:hover {
    cursor: pointer;
    outline: 3px solid aqua;
    outline-offset: -3px;
}

/* Knockout dead cards: NO in-place expansion on hover — they're absolutely
   stacked over the placeholder and growing them would break the pile look.
   The big readable preview in #card-preview still appears via the JS
   hover handler, which is exactly the "zoom in the bottom-left corner"
   the player wants. */
.knockout .card.card-full:hover {
    transform: none;
}

#card-preview {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 320px;
    z-index: 500;
    pointer-events: none;
    opacity: 0;
    transform: translateY(24px) scale(0.92);
    transform-origin: bottom left;
    transition: opacity 0.25s ease-out,
                transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 0.35s ease-out;
    border-radius: 10px;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    background-color: white;
    overflow: hidden;
}

#card-preview.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

#card-preview img {
    width: 100%;
    display: block;
}

/* MK-style "FATALITY" announcer: pops the latest battle-log message big
   and centered for 2s, then fades out. The element exists in the DOM but
   stays invisible/non-interactive until JS adds .visible. */
#battle-flash {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 1000;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(1.4);
    opacity: 0;
    transition: opacity 0.25s ease-out, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    max-width: 80vw;
    text-align: center;
    text-transform: uppercase;
    font-family: sans-serif;
    font-weight: 900;
    font-size: 4em;
    line-height: 1.05;
    letter-spacing: 0.04em;
    color: #FFD700;
    text-shadow:
        0 0 18px rgba(255, 0, 0, 0.85),
        0 0 36px rgba(255, 0, 0, 0.55),
        4px 4px 0 #000,
        -2px -2px 0 #000,
        2px -2px 0 #000,
        -2px 2px 0 #000;
}

#battle-flash.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.background-deck {
    background: -webkit-radial-gradient(center, ellipse cover, rgba(138,43,226,1) 0%, rgba(7,7,8,1) 10%, rgba(199,108,55,1) 36%, rgba(26,23,28,1) 55%, rgba(26,23,28,1) 76%, rgba(138,43,226,1) 93%, rgba(138,43,226,1) 100%);
    background: -o-radial-gradient(center, ellipse cover, rgba(138,43,226,1) 0%, rgba(7,7,8,1) 10%, rgba(199,108,55,1) 36%, rgba(26,23,28,1) 55%, rgba(26,23,28,1) 76%, rgba(138,43,226,1) 93%, rgba(138,43,226,1) 100%);
    background: -ms-radial-gradient(center, ellipse cover, rgba(138,43,226,1) 0%, rgba(7,7,8,1) 10%, rgba(199,108,55,1) 36%, rgba(26,23,28,1) 55%, rgba(26,23,28,1) 76%, rgba(138,43,226,1) 93%, rgba(138,43,226,1) 100%);
    background: radial-gradient(ellipse at center, rgba(138,43,226,1) 0%, rgba(7,7,8,1) 10%, rgba(199,108,55,1) 36%, rgba(26,23,28,1) 55%, rgba(26,23,28,1) 76%, rgba(138,43,226,1) 93%, rgba(138,43,226,1) 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#8a2be2', endColorstr='#8a2be2', GradientType=1 );
    border: 1px solid #eee;
}

.background-red {
    background-color: red;
    background-color: black;
}

.background-yellow {
    background-color: yellow;
    background-color: black;
}

.background-green {
    background-color: green;
    background-color: black;
}

.background-blue {
    background-color: blue;
    background-color: black;
}

.background-gray {
    background-color: gray;
    background-color: black;
}

.card-name {
    color: white;
    text-transform: uppercase;
    font-weight: bold;
    margin-top: -5px;
    z-index: 100;
    position: relative;
    text-shadow: 1px 0 black, 0 2px black, 2px 0 black, 0 -1px black;
    text-align: center;
    font-family: sans-serif;
    font-size: 10pt;
}

.card-suit-name {
    color: white;
    text-transform: uppercase;
    margin-top: -3px;
    z-index: 100;
    position: absolute;
    width: 146px;
    text-shadow: 1px 0 black, 0 2px black, 2px 0 black, 0 -1px black;
    text-align: center;
    font-family: sans-serif;
    font-size:12px;
    transform: scale(0.733);
}

.card-content {
    background-color: white;
    position: relative;
    top: 10px;
    padding: 7px;
    text-align: center;
    height: 180px;
}

.card-description {
    margin-top: 1px;
}

.card-short-description {
    text-transform: uppercase;
    font-weight: bold;
    font-size:10px;
    transform: scale(0.733);
}

.card-long-description {
    padding: 2px 2px;
    font-size:7px;
    transform: scale(0.733);
    margin-top: -4px;
}

.card-image img {
    width: 100%;
    margin-top: 4px;
    margin-bottom: -5px;
}

.card-set-container {
    max-width: 80%;
    text-align: center;
    margin: auto;
    padding: 40px;
}

.card-pp {
    position: absolute;
    border-radius: 100px;
    border: 1px solid #aaa;
    padding: 2px;
    margin-left: 1px;
    margin-top: 1px;
    width: 26px;
    height: 24px;
    text-align: center;
    vertical-align: middle;
    font-size: 13pt;
    color: white;
    font-weight: bold;
    text-shadow: 1px 0 black, 0 2px black, 2px 0 black, 0 -1px black;
    padding-top: 5px;
    padding-left: 3px;
}

.card-pp-container {
    position: absolute;
    top: -26px;
    left: -6px;
    border-radius: 100px;
    padding: 2px;
    width: 35px;
    height: 35px;
    vertical-align: middle;
    background-color: black;
}

.card-suit {
    position: absolute;
    border-radius: 100px;
    border: 1px solid #aaa;
    margin-left: 1px;
    padding: 2px;
    margin-top: 1px;
    width: 26px;
    height: 24px;
    vertical-align: middle;
    font-size: 13pt;
    padding-top: 5px;
    padding-left: 3px;
    text-overflow: clip;
    color: white;
    text-shadow: 1px 0 black, 0 2px black, 2px 0 black, 0 -1px black;
}

.card-suit-container {
    position: absolute;
    top: -25px;
    right: -5px;
    border-radius: 100px;
    padding: 2px;
    width: 35px;
    height: 35px;
    vertical-align: middle;
    background-color: black;
}

.card-faction {
    position: absolute;
    border-radius: 100px;
    border: 1px solid #aaa;
    padding: 2px;
    margin-top: 1px;
    margin-left: 1px;
    width: 26px;
    height: 24px;
    text-align: center;
    vertical-align: middle;
    font-size: 13pt;
    color: white;
    font-weight: bold;
    text-shadow: 1px 0 black, 0 2px black, 2px 0 black, 0 -1px black;
    padding-top: 5px;
    padding-left: 3px;
}

.card-faction-container {
    position: absolute;
    top: 167px;
    left: -9px;
    border-radius: 100px;
    padding: 2px;
    width: 35px;
    height: 35px;
    vertical-align: middle;
    background-color: black;
}

.card-corner-other {
    position: absolute;
    border-radius: 100px;
    border: 1px solid #aaa;
    margin-top: 1px;
    margin-left: 1px;
    padding: 2px;
    width: 26px;
    height: 24px;
    vertical-align: middle;
    font-size: 13pt;
    padding-top: 5px;
    padding-left: 3px;
    text-overflow: clip;
    color: white;
    text-shadow: 1px 0 black, 0 2px black, 2px 0 black, 0 -1px black;
}

.card-corner-other-container {
    position: absolute;
    top: 167px;
    right: -8px;
    border-radius: 100px;
    padding: 2px;
    width: 35px;
    height: 35px;
    vertical-align: middle;
    background-color: black;
}

.background-red .card-pp, .background-red .card-suit, .background-red .card-faction, .background-red .card-corner-other {
    background-color: red;
}

.background-yellow .card-pp, .background-yellow .card-suit, .background-yellow .card-faction, .background-yellow .card-corner-other {
    background-color: yellow;
}

.background-green .card-pp, .background-green .card-suit, .background-green .card-faction, .background-green .card-corner-other {
    background-color: green;
}

.background-blue .card-pp, .background-blue .card-suit, .background-blue .card-faction, .background-blue .card-corner-other {
    background-color: blue;
}

.background-gray .card-pp, .background-gray .card-suit, .background-gray .card-faction, .background-gray .card-corner-other {
    background-color: gray;
}

.opponent-ship {
    z-index: 10;
    transform: skew(-9.5rad);
}

.opponent-ship .card {
    margin-right: -140px;
}

.card-suit img {
    width: 21px;
}

/* Player's hand — a warm amber lacquered tray, gold-rimmed.
   Sits flush below the battlefield, cradling the dealt cards. */
.player-ship {
    text-align: center;
    border: 1px solid rgba(212, 175, 55, 0.55);
    width: 1000px;
    padding: 20px;
    border-radius: 32px;
    background:
        linear-gradient(135deg, rgba(82, 50, 30, 0.94) 0%, rgba(50, 28, 20, 0.94) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        inset 0 0 60px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(212, 175, 55, 0.18),
        0 6px 22px rgba(0, 0, 0, 0.5);
}

/* Ship is locked while the blue "move a battlefield card" effect is pending.
   Cards can't be hovered, selected, or previewed — the player must complete
   the move (or click pass) before touching their hand. */
.player-ship.ship-locked .card {
    opacity: 0.45;
    pointer-events: none;
    filter: grayscale(0.4);
}

/* Row layout: ship + vault side-by-side for each player.
   Device player's vault sits to the RIGHT of their ship (DOM order: ship, vault).
   Opponent's row is anchored to the LEFT so their knockout pile lives at the
   upper-left of the screen, with facedown HQ cards immediately to its left. */
.player-row,
.opponent-row {
    display: flex;
    align-items: center;
    gap: 30px;
    margin: 20px;
}

.player-row {
    justify-content: center;
    align-items: flex-start;
    margin-top: 0;
}

.opponent-row {
    justify-content: flex-start;
}

/* Each player's HQ (facedown cards) sits adjacent to their own ship — on
   each player's OWN right. Player's vault DOM is HQ, KO; with row direction
   HQ ends up on the left of the vault, which is the side touching the ship
   to its left → HQ on the device user's right of the ship. ✓ */
.player-vault {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 80px;
    flex-shrink: 0;
}

/* Opponent's vault DOM is KO, HQ. With row direction KO ends up on the left
   of the vault and HQ on the right — and the vault sits to the LEFT of the
   opponent-ship, so HQ ends up touching the opponent's ship. From the
   opponent's seat that's THEIR right of THEIR ship. ✓ */
.opponent-vault {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.headquarters {
    display: inline-block;
}

.headquarters .card {
    margin-right: -177px;
}

.knockout {
    display: inline-block;
    isolation: isolate;
    position: relative; /* anchor for absolutely-positioned dead cards */
}

.knockout .card {
    margin: 0;
    margin-right: -178px;
    position: relative;
    z-index: 120;
}

/* Dead cards (Taladro and friends) stack exactly on top of the knockout
   placeholder — same x/y, just higher z. Padding matches the placeholder
   so the image perfectly overlays the marker. Only the most recent dead
   card shows, like a real discard pile. */
.knockout .card:not(.background-knockout) {
    position: absolute;
    top: 0;
    left: 0;
    padding: 10px;
    z-index: 300;
}

/* Inside the vaults the original .knockout magic-number margins (sized for
   the old "below the ship" layout) are no longer needed. */
.player-vault .knockout,
.opponent-vault .knockout {
    margin: 0;
}

.background-knockout {
    opacity: 0.2;
    background-color: #200010;
}

.background-knockout.card {
    z-index: 1;
}

.background-knockout.card img {
    margin-top: -5px;
}

.background-position {
    opacity: 0.2;
    background-color: #200010;
    -webkit-touch-callout: none; /* iOS Safari */
    -webkit-user-select: none; /* Safari */
     -khtml-user-select: none; /* Konqueror HTML */
       -moz-user-select: none; /* Old versions of Firefox */
        -ms-user-select: none; /* Internet Explorer/Edge */
            user-select: none; /* Non-prefixed version, currently
                                  supported by Chrome, Opera and Firefox */
}

.table-position {
    display: inline;
    margin-left: 5px;
}

.card-position {
    font-size: 60pt;
    color: #eeeeee;
    padding: 20px;
    text-shadow: 1px 0 black, 0 2px black, 2px 0 black, 0 -1px black;
}

.opponent-table-position, .player-table-position {
    min-width:1000px;
    text-align: center;
}

/* Opponent's row of 5 table positions shrinks to its content so the surrounding
   .opponent-side can be a centered, content-sized panel rather than full width. */
.opponent-side .opponent-table-position {
    min-width: auto;
    white-space: nowrap;
}

.battle-log {
    position: fixed;
    top: 30px;
    right: 30px;
    border-radius: 30px;
    border: 1px solid #555;
    padding: 5px 30px 30px;
    max-height: 100px;
    z-index: 300;
    overflow-y: auto;
    background-color: #fff;
}

.card.selected {
    outline: 10px solid chartreuse;
    outline-offset: -10px;
    cursor: pointer;
}

.table-position .valid-target {
    outline: 10px dashed mediumspringgreen;
    outline-offset: -10px;
    cursor: pointer;
}

.player-table-position .valid-target {
    opacity: 0.7;
    cursor: pointer;
}

/* Anchor for .ghost-preview overlay — applies to every valid drop target,
   regardless of which flow (play / bonus / move / attack / kill-one). */
.player-table-position .card.valid-target,
.player-table-position .card.valid-move-target,
.opponent-table-position .card.valid-target {
    position: relative;
}

/* Translucent preview of the selected source card, shown over a valid target
   on hover OR during a drag-over. pointer-events: none keeps the underlying
   click/drop handler reachable through the overlay. */
.ghost-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.92);
    z-index: 200;
    border-radius: 5px;
    transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}

/* Ghost element starts at opacity 0 / scale 0.92 (above) and is bumped to its
   visible state by adding the .visible class. Using a class transition rather
   than tearing the element down on every leave keeps the fade smooth. */
.ghost-preview.visible {
    opacity: 0.6;
    transform: scale(1);
}

.player-table-position {
    margin-top: 85px;
}

.player-table-position .table-position.active .card, .player-table-position .table-position.tired .card {
    margin-top: -70px;
}

.card.must-attack {
    outline: 10px groove darkred;
    outline-offset: -10px;
    cursor: pointer;
}

/* can be removed, or leave just for begginers */
.card.can-attack {
    outline: 10px groove darkcyan;
    outline-offset: -10px;
    cursor: pointer;
}

.card.did-attack {
    outline: 10px groove slategray;
    outline-offset: -10px;
}

.card.selected-to-attack {
    outline: 10px groove #FF552B;
    outline-offset: -10px;
    cursor: pointer;
}

.card.can-fly {
    outline: 10px groove lightskyblue;
    outline-offset: -10px;
    cursor: pointer;
}

.card.selected-to-fly {
    outline: 10px groove cyan;
    outline-offset: -10px;
    cursor: pointer;
}

.table-position .valid-fly-target {
    outline: 10px dashed mediumspringgreen;
    outline-offset: -10px;
    opacity: 0.7;
    cursor: pointer;
}

/* Blue-card "move a battlefield card" effect — visually distinct (royal blue
   accents) from fly's lightskyblue so both states stay readable if they ever
   end up coexisting on the same card. */
.card.can-move {
    outline: 10px groove royalblue;
    outline-offset: -10px;
    cursor: pointer;
}

.card.selected-to-move {
    outline: 10px groove deepskyblue;
    outline-offset: -10px;
    cursor: pointer;
}

.player-table-position .table-position .card.valid-move-target {
    outline: 10px dashed mediumspringgreen;
    outline-offset: -10px;
    opacity: 0.7;
    cursor: pointer;
}

.pass-button img {
    position: fixed;
    z-index: 130;
    width: 46px;
    right: 29px;
    top: 175px;
    cursor: pointer;
}

.skip-bonus-play-button {
    position: fixed;
    z-index: 130;
    right: 20px;
    top: 235px;
    padding: 8px 12px;
    border-radius: 6px;
    background-color: #fff;
    border: 2px solid blueviolet;
    color: blueviolet;
    font-family: sans-serif;
    font-size: 11pt;
    cursor: pointer;
    user-select: none;
}

.skip-bonus-play-button:hover {
    background-color: blueviolet;
    color: #fff;
}

.skip-move-card-button {
    position: fixed;
    z-index: 130;
    right: 20px;
    top: 285px;
    padding: 8px 12px;
    border-radius: 6px;
    background-color: #fff;
    border: 2px solid royalblue;
    color: royalblue;
    font-family: sans-serif;
    font-size: 11pt;
    cursor: pointer;
    user-select: none;
}

.skip-move-card-button:hover {
    background-color: royalblue;
    color: #fff;
}

.skip-add-shield-button {
    position: fixed;
    z-index: 130;
    right: 20px;
    top: 335px;
    padding: 8px 12px;
    border-radius: 6px;
    background-color: #fff;
    border: 2px solid #d4af37;
    color: #8b6914;
    font-family: sans-serif;
    font-size: 11pt;
    cursor: pointer;
    user-select: none;
}

.skip-add-shield-button:hover {
    background-color: #d4af37;
    color: #fff;
}

.skip-debilitate-button {
    position: fixed;
    z-index: 130;
    right: 20px;
    top: 385px;
    padding: 8px 12px;
    border-radius: 6px;
    background-color: #fff;
    border: 2px solid darkred;
    color: darkred;
    font-family: sans-serif;
    font-size: 11pt;
    cursor: pointer;
    user-select: none;
}

.skip-debilitate-button:hover {
    background-color: darkred;
    color: #fff;
}

.shield {
    position: relative;
}

/* shield version 1 */
.shield {
    top: -158px;
    opacity: 0.9;
    width: 80px;
    text-align: center;
    left: 37px;
}

/* */


/* shield version 2
.shield img.corner1, .shield img.corner2, .shield img.corner3, .shield img.corner4 {
    z-index: 140;
    position: relative;
    width: 31px;
}

.shield img.corner1 {
    top: -184px;
    left: 12px;
}

.shield img.corner2 {
    top: -184px;
    left: 61px;
}

.shield img.corner3 {
    top: 172px;
    left: 12px;
}

.shield img.corner4 {
    top: 172px;
    left: 61px;
}
*/


.card-full {
    padding: 1px;
}

.card-full img {
    width: 100%;
}