/* The 1v1 page (versus.html): the drill player's canvas, HUD and sheets (train.css), with its own lobby,
   matchup sheet, round end and results. Your side in the units' blue, theirs in their orange. */

.versus {
    --you: #38bdf8;
    --them: #fb923c;
}

/* A sheet over the battlefield between rounds lets the field show through more than a menu does. */
.vs-veil {
    background: rgba(4, 6, 12, 0.5);
    backdrop-filter: blur(2px);
}

/* ===== Lobby ===== */
#lobby {
    place-items: start center;
    padding-top: clamp(24px, 14vh, 150px);
}

.vs-lobby {
    width: min(880px, 100%);
    transition: opacity 0.15s ease-out;
}

.vs-lobby.is-pending {
    visibility: hidden;
    opacity: 0;
}

.vs-lobby h1 {
    font-size: 3rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.vs-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
}

/* Which game, beside the eyebrow: the title and the line under it change with it */
.vs-game-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 4px;
}

.vs-games button {
    letter-spacing: 0.04em;
}

/* Two lines, whichever game: nothing under it moves from one to the other */
.vs-tagline {
    min-height: calc(2 * 1.5em);
}

.vs-record .brief-best-value small {
    font-size: 1rem;
    color: var(--ink-3);
}

/* Who to play: two tabs, as wide as the sheet */
.vs-modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 22px 0 16px;
}

.vs-mode {
    padding: 0.65rem 1rem;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: transparent;
    color: var(--ink-2);
    font: 700 1rem var(--font);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.vs-mode:hover {
    border-color: var(--accent);
    color: var(--ink);
}

.vs-mode.is-on {
    border-color: var(--accent);
    background: var(--surface-2);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.vs-mode:focus-visible,
.vs-level:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* The computer's levels: one row, the one picked lit, each with how hard it is and your record against it */
.vs-levels {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.vs-level {
    display: grid;
    gap: 6px;
    justify-items: start;
    min-height: 82px;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--line-2);
    border-radius: 12px;
    background: rgba(6, 9, 18, 0.5);
    color: var(--ink-2);
    font-family: var(--font);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.vs-level:hover {
    border-color: var(--accent);
    color: var(--ink);
}

.vs-level.is-on {
    border-color: var(--accent);
    background: var(--surface-2);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.vs-level-name {
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.vs-pips {
    display: flex;
    gap: 3px;
}

.vs-pips i {
    width: 14px;
    height: 5px;
    border-radius: 2px;
    background: var(--line-2);
}

.vs-pips i.is-on {
    background: var(--hot);
}

.vs-level-record {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}

.vs-level-record.is-beaten {
    color: var(--good);
}

/* What the level picked does, and what beating it takes: two lines, always two, so nothing under them moves */
.vs-level-blurb {
    min-height: 3em;
    margin-top: 12px;
    font-size: 1.05rem;
    color: var(--ink-2);
}

.vs-level-blurb b {
    color: var(--ink);
}

.vs-level-blurb span {
    display: block;
    color: var(--ink-3);
}

/* The match's settings, behind the arrow: a round of armies' or a full game's */
.vs-settings {
    padding: 4px 0 18px;
}

.vs-settings-part {
    display: grid;
    gap: 12px;
}

.vs-settings-part[hidden] {
    display: none;
}

.vs-setting {
    display: flex;
    align-items: center;
    gap: 16px;
}

.vs-setting-label {
    width: 80px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.vs-rules {
    margin: 4px 0 0;
    padding-left: 1.1rem;
    color: var(--ink-2);
    font-size: 1rem;
}

.vs-rules li + li {
    margin-top: 0.25rem;
}

/* ===== Against a player ===== */
/* As tall as the computer's pane (its cards, 82 px, and the blurb's three lines under them), so that the
   sheet keeps its size from one tab to the other */
.vs-online {
    display: grid;
    align-content: start;
    gap: 12px;
    min-height: calc(82px + 12px + 3 * 1.05rem);
}

.vs-online-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.vs-online-me {
    justify-content: space-between;
}

/* What can be started, and what is under way, in one place: the one not in use keeps its room */
.vs-online-actions {
    display: grid;
}

.vs-online-actions > .vs-online-row {
    grid-area: 1 / 1;
}

.vs-online-row.is-off {
    visibility: hidden;
}

.vs-or {
    margin-left: 10px;
    color: var(--ink-3);
    font-weight: 600;
}

.vs-online-name {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink-3);
    font-weight: 600;
}

.vs-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-3);
    font-weight: 600;
    cursor: pointer;
}

.vs-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.vs-check:hover {
    color: var(--ink-2);
}

.vs-input {
    width: 180px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--line-2);
    border-radius: 9px;
    background: #0b1220;
    color: var(--ink);
    font: 700 1rem var(--font);
    letter-spacing: 0.04em;
}

.vs-input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.vs-input.is-code {
    width: 130px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    text-align: center;
}

.vs-status {
    min-height: 1.5em;
    color: var(--ink-2);
    font-size: 1.02rem;
    font-variant-numeric: tabular-nums;
}

.vs-status b {
    color: var(--ink);
}

.vs-status.is-bad {
    color: var(--bad);
}

.vs-status.is-good {
    color: var(--good);
}

.vs-link {
    display: flex;
    flex: 1;
    min-width: 0;
    align-items: center;
    gap: 8px;
    padding: 0.1rem 0.2rem 0.1rem 0.9rem;
    border: 1px dashed var(--line-2);
    border-radius: 10px;
    background: rgba(6, 9, 18, 0.5);
    font-variant-numeric: tabular-nums;
}

.vs-link code {
    flex: 1;
    overflow: hidden;
    color: var(--accent);
    font: 700 1rem var(--font);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vs-fine {
    font-size: 0.86rem;
    color: var(--ink-3);
}

.vs-fine a {
    color: var(--ink-2);
}

/* ===== Before a round: the matchup ===== */
.vs-intro {
    width: min(880px, 100%);
}

.vs-intro-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.vs-matchup {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: stretch;
    gap: 18px;
    margin: 16px 0 6px;
}

.vs-matchup[hidden] {
    display: none;
}

.vs-army {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(6, 9, 18, 0.55);
}

.vs-army.is-you {
    border-top: 3px solid var(--you);
}

.vs-army.is-them {
    border-top: 3px solid var(--them);
}

.vs-army h3 {
    margin-bottom: 10px;
    font-size: 0.82rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.vs-army.is-you h3 b {
    color: var(--you);
}

.vs-army.is-them h3 b {
    color: var(--them);
}

.vs-vs {
    align-self: center;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.vs-units {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.vs-unit {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.vs-unit-pic {
    position: relative;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: #0c1424;
}

.vs-unit-glyph {
    width: 34px;
    height: 34px;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
}

.vs-unit-count {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.vs-unit-name {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--ink-3);
}

.vs-army-value {
    margin-top: 10px;
    font-size: 0.86rem;
    color: var(--ink-3);
}

/* A full game in place of the armies: the map with both starts beside how the game goes */
.vs-full {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    align-items: start;
    gap: 22px;
    margin: 16px 0 6px;
}

.vs-full[hidden] {
    display: none;
}

.vs-map {
    width: 300px;
    height: 185px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #0a101d;
}

.vs-full-who {
    margin-bottom: 10px;
    font-size: 0.82rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.vs-full-who .is-you {
    color: var(--you);
}

.vs-full-who .is-them {
    color: var(--them);
}

/* What the game is, a line each: the label in a column of its own */
.vs-facts {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 6px 14px;
    margin: 0;
    font-size: 1.02rem;
}

.vs-facts dt {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1.9;
    text-transform: uppercase;
    color: var(--ink-3);
}

.vs-facts dd {
    margin: 0;
    color: var(--ink-2);
}

/* What the matchup asks: a mark for each line, green for an edge, red for a threat */
.vs-notes {
    display: grid;
    gap: 6px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.vs-notes li {
    position: relative;
    padding-left: 1.4rem;
    font-size: 1.04rem;
    color: var(--ink-2);
}

.vs-notes li::before {
    content: "";
    position: absolute;
    left: 0.2rem;
    top: 0.42em;
    width: 0.62rem;
    height: 0.62rem;
    border-radius: 2px;
    transform: rotate(45deg);
    background: var(--accent);
}

.vs-notes li.is-good::before {
    background: var(--good);
}

.vs-notes li.is-bad::before {
    background: var(--bad);
}

.vs-intro-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.vs-intro-hint {
    color: var(--ink-3);
    font-size: 0.95rem;
}

.vs-intro-hints {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.vs-intro-ready {
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
}

/* Fight and Ready, and Ready greyed once pressed, all one width */
#fightBtn {
    min-width: 11rem;
}

#fightBtn:disabled {
    opacity: 0.6;
    cursor: default;
    box-shadow: none;
}

/* The other player is ready: beside their name, over their army */
.vs-ready-tag {
    margin-left: 10px;
    padding: 0.05rem 0.45rem;
    border: 1px solid var(--good);
    border-radius: 6px;
    color: var(--good);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
}

.vs-ready-tag[hidden] {
    display: none;
}

/* Under the results against a player: who wants a rematch, or that the other has left */
.vs-rematch {
    flex-basis: 100%;
    min-height: 1.5em;
    margin: 0;
    color: var(--ink-2);
    font-size: 1rem;
}

/* The match's points: yours in your colour, theirs in theirs */
.vs-score {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ink-3);
    white-space: nowrap;
}

.vs-score b {
    font-size: 1.35rem;
}

.vs-score .is-you {
    color: var(--you);
}

.vs-score .is-them {
    color: var(--them);
}

/* ===== After a round ===== */
.vs-round-end {
    display: grid;
    gap: 10px;
    justify-items: start;
}

.vs-outcome {
    font-size: 2.4rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.vs-outcome.is-win {
    color: var(--good);
}

.vs-outcome.is-loss {
    color: var(--bad);
}

.vs-end-line {
    font-size: 1.1rem;
    color: var(--ink-2);
}

.vs-round-end .btn {
    margin-top: 8px;
}

/* ===== In a round ===== */
/* What each army has left, under the stats: yours from the middle leftward, theirs rightward. */
.vs-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    width: 236px;
}

.vs-bar-side {
    display: flex;
    height: 6px;
    border-radius: 3px;
    background: rgba(148, 163, 184, 0.18);
    overflow: hidden;
}

.vs-bar-side.is-you {
    justify-content: flex-end;
}

.vs-bar-side i {
    display: block;
    height: 100%;
    transition: width 0.25s ease-out;
}

.vs-bar-side.is-you i {
    width: var(--mine, 100%);
    background: var(--you);
}

.vs-bar-side.is-them i {
    width: var(--theirs, 100%);
    background: var(--them);
}

/* The other page has not answered for a moment */
.vs-wait {
    position: absolute;
    top: 104px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1.1rem;
    border: 1px solid rgba(251, 191, 36, 0.6);
    border-radius: 10px;
    background: var(--panel);
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
}

/* ===== The match's end ===== */
.vs-result-title.is-win {
    color: var(--good);
}

.vs-result-title.is-loss {
    color: var(--bad);
}

.vs-final {
    display: flex;
    align-items: baseline;
    gap: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.vs-final b {
    font-size: 4.2rem;
    line-height: 0.95;
}

.vs-final .is-you {
    color: var(--you);
}

.vs-final .is-them {
    color: var(--them);
}

.vs-final span {
    font-size: 2rem;
    color: var(--ink-3);
}

.vs-rounds .rt-table td.is-win {
    color: var(--good);
}

.vs-rounds .rt-table td.is-loss {
    color: var(--bad);
}

.vs-mini-army {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px 8px;
    white-space: normal;
}

.vs-mini-army span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--ink-2);
    font-size: 0.92rem;
}

.vs-mini-army .vs-unit-glyph {
    width: 18px;
    height: 18px;
}

/* A full game's results: three charts of the game, both sides, side by side */
.vs-charts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 980px) {
    .vs-levels {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .vs-matchup,
    .vs-full,
    .vs-charts {
        grid-template-columns: 1fr;
    }

    .vs-vs {
        justify-self: center;
    }
}

@media (max-height: 760px) {
    #lobby {
        padding-top: 24px;
    }

    .vs-lobby h1 {
        font-size: 2.4rem;
    }
}
