/* The canvas renders at a fixed internal resolution and is scaled up by CSS to fit
   the window. The upscale is deliberately non-integer — image-rendering: pixelated
   is what keeps it crisp, so the view always fills the screen rather than letterboxing
   to the nearest whole multiple. */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 100%;
    height: 100%;
    background: #0b0c0a;
    overflow: hidden;
    font-family: monospace;
    /* A shooter reads the mouse as an aim device, not a pointer — text selection
       and the context menu both interrupt that. */
    user-select: none;
    -webkit-user-select: none;
}

/* Title screen. Sits over everything until the player deploys.

   The game is already connected and simulating behind this — joining is seating into a
   body, not starting a match — so the screen is opaque rather than a menu floating over a
   live view of a fight the player is not in yet. */
#title {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0b0c0a;
    color: #dfe0d8;
    font-family: monospace;
}

#title.gone { display: none; }

#title .panel {
    width: 340px;
    text-align: center;
}

#title h1 {
    font-size: 46px;
    letter-spacing: 0.34em;
    /* The letter-spacing pushes the whole word right by one gap; pull it back so it sits
       centred on the panel rather than looking a character off. */
    text-indent: 0.34em;
    font-weight: 700;
    color: #7fb2e5;
}

#title .blurb { margin-top: 6px; font-size: 11px; opacity: 0.45; letter-spacing: 0.08em; }

#title label {
    display: block;
    margin-top: 26px;
    font-size: 10px;
    letter-spacing: 0.22em;
    opacity: 0.5;
}

#title input {
    width: 100%;
    margin-top: 6px;
    padding: 9px 10px;
    font-family: monospace;
    font-size: 15px;
    text-align: center;
    letter-spacing: 0.1em;
    color: #dfe0d8;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.2);
    outline: none;
}

#title input:focus { border-color: #7fb2e5; }

/* Class picker. Three rows rather than a segmented control, because each one needs a
   line of explanation more than it needs to be compact — this is where a new player finds
   out the rifleman is not simply the default. */
#title #classPick {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

#title #classPick button {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 7px 10px;
    font-family: monospace;
    text-align: left;
    color: #dfe0d8;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    cursor: pointer;
}

#title #classPick button:hover { background: rgba(255, 255, 255, 0.12); }

#title #classPick button.picked {
    border-color: #7fb2e5;
    background: rgba(127, 178, 229, 0.16);
}

#title #classPick .name { font-size: 12px; letter-spacing: 0.14em; font-weight: 700; }
#title #classPick .note { font-size: 9px; opacity: 0.45; letter-spacing: 0.04em; }

#title button {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    font-family: monospace;
    font-size: 13px;
    letter-spacing: 0.18em;
    font-weight: 700;
    color: #0b0c0a;
    background: #7fb2e5;
    border: 0;
    cursor: pointer;
}

#title button:hover { background: #9cc6f0; }
#title button[disabled] { opacity: 0.35; cursor: default; }

#title .hint { margin-top: 18px; font-size: 10px; opacity: 0.35; line-height: 1.7; }
#title .status { margin-top: 10px; font-size: 11px; min-height: 15px; color: #e0885f; }

/* Held upright, on a phone. The game runs — it just cannot show you enough of the field
   to be worth playing, because a 16:9 battlefield in a portrait window is a corridor and
   the men shooting at you are off to the sides of it.

   Gated on orientation AND a coarse pointer together: a tall, narrow desktop window is
   somebody deliberately resizing a window they can still see, and telling them to rotate
   their monitor would be absurd. */
#rotate {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #0b0c0a;
    color: #dfe0d8;
    font-family: monospace;
    text-align: center;
}

#rotate h1 {
    font-size: 40px;
    letter-spacing: 0.34em;
    text-indent: 0.34em;
    color: #7fb2e5;
}

#rotate p { margin-top: 14px; font-size: 13px; line-height: 1.7; }
#rotate .small { margin-top: 8px; font-size: 11px; opacity: 0.5; }

@media (orientation: portrait) and (pointer: coarse) {
    #rotate { display: flex; }
}

#stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#gameCanvas {
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    /* Hidden because the game draws its own crosshair in world space, at the aim
       point rather than the cursor position — they diverge once the cursor is
       clamped to the window edge. */
    cursor: none;
}

/* The HUD is DOM rather than canvas-drawn: it never needs to survive the camera
   transform, and text at this scale is far more legible as real text than as
   pixel-font blits. It sits over the canvas and ignores the mouse entirely so it
   can never eat an aim click. */
/* The HUD is a fixed 1440x810 box scaled by exactly the factor the canvas is scaled by,
   rather than a set of pixel sizes that ignore the window.
   
   That means every size in here is a CANVAS pixel, not a screen pixel: a 32px weapon icon
   is 32 game pixels at any window size, and the interface keeps the same proportion of the
   battlefield whether the game is filling a monitor or squeezed into a small window.

   It used to be absolute px over a canvas that scaled without it, so shrinking the window
   shrank the game and left the interface at full size — on a short window the kill feed
   alone covered a third of the screen. One transform fixes every element at once, which is
   why this is a transform and not thirty-one converted font sizes. */
#hud {
    position: absolute;
    /* Above the touch layer, which covers the whole stage to collect thumbs. The HUD
       ignores pointers as a whole, so touches fall straight through it to the sticks —
       but the class row opts back in on a phone, and it can only do that from on top. */
    z-index: 6;
    left: 50%;
    top: 50%;
    width: 1440px;
    height: 810px;
    transform: translate(-50%, -50%) scale(var(--hud-scale, 1));
    transform-origin: center;
    pointer-events: none;
    color: #dfe0d8;
    text-shadow: 0 1px 0 #000;
    font-size: 14px;
    letter-spacing: 0.05em;
}

#tickets {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 24px;
}

.ticket-bar {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 5px 10px;
    min-width: 190px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.ticket-bar .label { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; }
.ticket-bar[data-team="0"] .label { color: #7fb2e5; }
.ticket-bar[data-team="1"] .label { color: #e0885f; }

/* Reinforcements, emptying left to right. The only clock in the match. */
.ticket-bar .progress {
    position: relative;
    height: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.12);
}

/* Territory eating the bar, shown rather than stated.

   This replaced a "-1.3/s" printed beside the count. The number was accurate and useless:
   nobody converts a rate into a fate mid-firefight, and reading it took more attention
   than the thing it described was worth. What a player actually needs is "we are losing
   ground, badly" — which is a speed, and speed is something the eye reads without being
   asked.

   A line at the leading edge of what is left, sweeping back into the bar and fading, over
   and over. The interval comes from the drain rate, so two points down pulses twice as
   often as one. */
.ticket-bar .edge {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    margin-left: -2px;
    background: #fff;
    opacity: 0;
}

.ticket-bar.bleeding .edge {
    animation-name: bar-drain;
    animation-timing-function: ease-out;
    animation-iteration-count: infinite;
}

@keyframes bar-drain {
    0%   { opacity: 0.9; transform: translateX(0); }
    100% { opacity: 0;   transform: translateX(-22px); }
}

.ticket-bar .fill {
    height: 100%;
    width: 100%;
    transform: scaleX(0);
    transform-origin: left center;
}

.ticket-bar[data-team="0"] .fill { background: #7fb2e5; }
.ticket-bar[data-team="1"] .fill { background: #e0885f; }

/* Reinforcements: the other way to lose. Quiet until it is nearly gone, because for most
   of a match it is not the clock that matters — and then suddenly it is. */
.ticket-bar .reinf { font-size: 10px; opacity: 0.45; }

.ticket-bar.bleeding .reinf { opacity: 0.9; }

.ticket-bar.last-men .reinf { opacity: 1; color: #e8483a; font-weight: 700; }

/* Nothing left to send. Louder than merely low, because it is a different fact. */
.ticket-bar.spent .reinf { opacity: 1; color: #e8483a; font-weight: 700; letter-spacing: 0.08em; }

/* Close to taking it. The bar is about to decide the match, so it stops being furniture. */
.ticket-bar.winning .progress { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5); }

/* Kill feed, top right and out of the way of everything you aim at. */
#feed {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

#feed .kill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 7px;
    font-size: 11px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: opacity 0.4s;
}

/* The tail of a busy feed reads as on its way out rather than as equally current. Only
   once there are enough rows for that to mean something — on a quiet feed of two, fading
   both would just look broken. */
#feed .kill.old-1 { opacity: 0.66; }
#feed .kill.old-2 { opacity: 0.33; }

/* Last, so the time-based fade still wins over the staged one at equal specificity. */
#feed .kill.fading { opacity: 0; }

/* Your own kills and deaths are the ones you actually care about. */
#feed .kill.mine { border-color: rgba(242, 217, 139, 0.5); }

/* The weapon, straight off the same sheet the soldiers carry, at 2x. Using the real art
   rather than a word means the feed says "rifle" in the same language the game does.

   background-size is the WHOLE sheet at 2x — 2 columns by 3 rows of 16px cells is 64x96 —
   and the JS sets both background-position axes to pick a cell. It used to set only the Y,
   which worked exactly as long as the sheet was one column wide. */
#feed .weapon {
    width: 32px;
    height: 32px;
    background-image: url('./assets/Weapons.png');
    background-size: 64px 96px;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    flex: none;
}

#feed .who { font-weight: 700; }
#feed .note { opacity: 0.55; font-size: 10px; letter-spacing: 0.06em; }

#points {
    position: absolute;
    top: 82px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.point-pip {
    width: 46px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.25);
    position: relative;
    overflow: hidden;
}

/* Capture progress fills the pip from the left, so a point being taken reads at a
   glance without needing a separate progress bar. */
.point-pip .fill {
    position: absolute;
    inset: 0;
    transform-origin: left center;
    opacity: 0.55;
}

.point-pip .glyph { position: relative; }

/* Last stand banner. Louder than a notice because it changes the rules of the match, and
   it stays up rather than flashing past — the state it describes lasts until somebody
   finishes it. */
#lastStand {
    position: absolute;
    top: 116px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    padding: 5px 16px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.14em;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid currentColor;
}

#lastStand.show { display: block; }
#lastStand.hunting { color: #9fd08a; }
#lastStand.hunted { color: #e8483a; animation: vitals-pulse 1.1s ease-in-out infinite; }

/* Points stop counting once a side is out of men, so they stop looking live. */
#points.spent { opacity: 0.3; filter: saturate(0.3); }

/* Sits directly under the last stand banner rather than on top of it — the two were at
   the same coordinate, so a death during a last stand put the respawn clock over the count
   of who was left. `top` is moved by a class rather than by stacking them in the document,
   because the banner comes and goes and the notice must not jump when it does. */
#notice {
    position: absolute;
    top: 116px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.25s;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 12px;
}

#notice.show { opacity: 1; }

/* Pushed clear while the banner above it is up. */
#notice.below-banner { top: 152px; }

/* Your own health and weapon.

   This replaced a line of text reading "ALIVE hp 87 Rifleman 3/5". Everything in it was
   true and none of it was legible mid-fight, because reading a number is a thing you do
   with your attention and there isn't any spare. Bars and pips are read peripherally —
   you see a short bar, not the number 30.

   Blocks, hard edges and no transitions on anything that has to be truthful: a health bar
   that eases down is lying to you about how much you have RIGHT NOW, which is the only
   moment it is for. */
#vitals {
    position: absolute;
    bottom: 14px;
    left: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 210px;
}

#vitals .health {
    display: flex;
    align-items: center;
    gap: 8px;
}

#vitals .health .bar {
    position: relative;
    flex: 1;
    height: 14px;
    background: rgba(0, 0, 0, 0.55);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.16);
}

#vitals .health .fill {
    position: absolute;
    inset: 2px;
    transform-origin: left center;
    background: #6fbf73;
}

#vitals .health .hp {
    min-width: 34px;
    font-size: 15px;
    font-weight: 700;
    text-align: right;
    color: rgba(255, 255, 255, 0.9);
}

/* Under a third, the bar goes red and breathes. Motion in the corner of the eye is the
   only thing that reliably gets attention that is busy elsewhere. */
#vitals.hurt .health .fill { background: #c86a4a; animation: vitals-pulse 0.75s ease-in-out infinite; }
#vitals.hurt .health .hp { color: #e79a80; }

@keyframes vitals-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

#vitals.down { opacity: 0.35; }

#vitals .weapon {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* One block per round, while there are few enough to count at a glance. A rifleman's five
   and an officer's eight are countable without counting; the support's twenty are not, so
   that case falls back to a bar (see .pips.dense). */
#vitals .pips {
    display: flex;
    flex: 1;
    gap: 2px;
    height: 9px;
}

#vitals .pips i {
    flex: 1;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5);
}

#vitals .pips i.spent { background: rgba(255, 255, 255, 0.13); }

/* Too many rounds to read as objects, so they become a quantity instead. */
#vitals .pips.dense { gap: 1px; }
#vitals .pips.dense i { box-shadow: none; }

#vitals .ammo {
    min-width: 46px;
    font-size: 13px;
    text-align: right;
    color: rgba(255, 255, 255, 0.85);
}

#vitals .ammo .mag { opacity: 0.4; }
#vitals.empty .ammo .loaded { color: #e0885f; }

/* The same reload the crosshair ring shows, mirrored down here — the ring is for the
   fight, this is for the moment after it when you are behind a wall and looking at your
   own kit. Zero height when not reloading, so it takes no room in the layout. */
#vitals .reload {
    height: 0;
    background: rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

#vitals.reloading .reload { height: 6px; }

/* Frags, under the weapon row. Same block language as the ammo pips so the eye reads the
   two the same way, but smaller and set apart — it is a thing you have once, not a
   resource you are spending down through a fight. */
#vitals .frags {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 9px;
}

#vitals .frags .blocks { display: flex; gap: 2px; }

#vitals .frags i {
    width: 12px;
    height: 9px;
    background: #8fae6b;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5);
}

#vitals .frags i.spent { background: rgba(255, 255, 255, 0.13); box-shadow: none; }

/* Seconds until the next frag, to the right of the label. Present only while waiting —
   a permanent "30s" would be a number that is usually zero and always in the way. */
#vitals .frags .wait {
    font-size: 10px;
    letter-spacing: 0.06em;
    color: #e2b25a;
    font-weight: 700;
}

#vitals .frags .label {
    font-size: 9px;
    letter-spacing: 0.14em;
    opacity: 0.45;
}

/* Nothing left to throw: the label goes with the block rather than sitting there naming
   something you do not have. */
#vitals.no-frags .frags .label { opacity: 0.2; }

#vitals .reload .fill {
    height: 100%;
    width: 100%;
    transform-origin: left center;
    background: #e2b25a;
}

/* Scoreboard. Hidden until Tab is held.

   pointer-events are re-enabled here and nowhere else in the HUD: the switch buttons are
   the only thing in the interface you click, and the rest of the overlay must stay
   transparent to the mouse so it can never eat an aim click. */
#scoreboard {
    position: absolute;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    gap: 18px;
    background: rgba(6, 8, 6, 0.82);
    pointer-events: auto;
}

#scoreboard.open { display: flex; }

#scoreboard .side {
    width: 330px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 10px 12px;
}

#scoreboard .head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

#scoreboard .head .name { font-size: 14px; font-weight: 700; letter-spacing: 0.12em; }
#scoreboard .side[data-team="0"] .head .name { color: #7fb2e5; }
#scoreboard .side[data-team="1"] .head .name { color: #e0885f; }

#scoreboard .row {
    display: grid;
    grid-template-columns: 1fr 30px 30px;
    gap: 6px;
    font-size: 11px;
    line-height: 17px;
    opacity: 0.75;
}

/* Column headers. Same grid as a row, so K and D sit over the numbers rather than near
   them, and quiet enough that they read as labels rather than as a player called K. */
#scoreboard .row.labels {
    opacity: 0.35;
    font-size: 9px;
    letter-spacing: 0.1em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 3px;
    padding-bottom: 2px;
}

/* Every row looks the same. Highlighting the humans would tell a solo player that the
   other nineteen names on their side are machines, which is what the roster exists to
   avoid. Only YOUR row stands out, and only to you. */
#scoreboard .row.you { color: #f2d98b; font-weight: 700; }
#scoreboard .row .kd { text-align: right; }
#scoreboard .row .deaths { opacity: 0.5; }
#scoreboard .row.dead .who { opacity: 0.45; }

#scoreboard .join {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 6px;
    font-family: monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    color: #dfe0d8;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

#scoreboard .join:hover { background: rgba(255, 255, 255, 0.16); }

/* Your own side, and a side with no room, are both un-joinable — but for different
   reasons, so they say different things rather than both just going grey. */
#scoreboard .join[disabled] { opacity: 0.3; cursor: default; }

/* Result screen. Covers the field without hiding it. */
#outcome {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(6, 8, 6, 0.6);
    text-align: center;
}

#outcome.show { display: flex; }

#outcome .verdict {
    font-size: 52px;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-indent: 0.3em;
}

#outcome.won .verdict { color: #9fd08a; }
#outcome.lost .verdict { color: #e0885f; }

#outcome .detail { font-size: 13px; letter-spacing: 0.12em; opacity: 0.75; }
#outcome .next { margin-top: 14px; font-size: 11px; letter-spacing: 0.16em; opacity: 0.45; }

#netstat {
    position: absolute;
    bottom: 8px;
    right: 10px;
    font-size: 11px;
    opacity: 0.35;
}

/* Class selector. Shows what you are carrying and what you have queued for the next
   spawn — the distinction matters, because a class change deliberately does not take
   effect until you respawn and the player needs to see that rather than be surprised. */
#classes {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.class-chip {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 5px 12px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.14);
    font-size: 12px;
    letter-spacing: 0.08em;
    opacity: 0.55;
}

.class-chip .key {
    font-size: 10px;
    opacity: 0.6;
}

/* Currently carried. */
.class-chip.active {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.65);
    background: rgba(255, 255, 255, 0.1);
}

/* Chosen, but not in your hands until you next spawn. */
.class-chip.queued {
    opacity: 0.95;
    border-style: dashed;
    border-color: #e8c15a;
    color: #e8c15a;
}

/* ── Touch controls ──────────────────────────────────────────────────────────

   Hidden outright unless touch.js found a touchscreen and added .touch to the body, and
   hidden again while the title screen is up — the sticks would otherwise sit over the
   callsign box, and a thumb reaching for the name field would steer a soldier the player
   has not been given yet.

   This layer is NOT inside #hud. The HUD is a fixed 1440x810 box scaled to match the
   canvas, which is exactly right for interface that should keep the same proportion of the
   battlefield at any size — and exactly wrong for controls, which have to keep the same
   proportion of a THUMB. A stick that shrinks with the window is a stick that stops fitting
   the hand, so every measurement below is a real screen pixel. */
#touch { display: none; }

body.touch #title.gone ~ #stage #touch {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 5;
    /* The element has to receive the touches, and none of them may reach the browser:
       a drag is steering, not a scroll or a back-swipe. */
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Parked off screen until a thumb lands and touch.js moves it here. Opacity rather than
   display so the ring can fade in under the thumb instead of appearing fully formed. */
.stick {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    transform: translate(var(--x, -400px), var(--y, -400px));
    opacity: 0;
    transition: opacity 120ms linear;
    pointer-events: none;
}

.stick.live { opacity: 1; }

.stick .ring,
.stick .rim,
.stick .knob {
    position: absolute;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* Travel, drawn at the 64px touch.js clamps the thumb to. */
.stick .ring {
    width: 128px;
    height: 128px;
    border: 2px solid rgba(223, 224, 216, 0.28);
    background: rgba(11, 12, 10, 0.32);
}

/* The outer edge, lit only while the stick is actually held there. This is the whole
   feedback for sprint and for fire: the rule is "push it to the rim", so the rim has to
   tell you when you have. */
.stick .rim {
    width: 128px;
    height: 128px;
    border: 2px solid transparent;
    transition: border-color 80ms linear, box-shadow 80ms linear;
}

.stick.edge .rim {
    border-color: rgba(255, 179, 71, 0.9);
    box-shadow: 0 0 14px rgba(255, 179, 71, 0.45);
}

.stick .knob {
    width: 58px;
    height: 58px;
    left: 0;
    top: 0;
    background: rgba(223, 224, 216, 0.5);
    border: 2px solid rgba(223, 224, 216, 0.75);
    transform: translate(calc(-50% + var(--kx, 0px)), calc(-50% + var(--ky, 0px)));
}

.stick.edge .knob {
    background: rgba(255, 179, 71, 0.6);
    border-color: rgba(255, 246, 208, 0.9);
}

/* A column up the right edge, NOT the bottom-right corner — because the corner is where
   the right thumb already lives, and that is the aim stick's ground. Pads sitting there
   would take the touch that was meant to start an aim, so every attempt to turn and shoot
   would reload instead.

   Ordered by how often a thumb wants them: FRAG lowest and largest, SCORES highest, since
   the bottom of the column is the shortest reach from where the thumb rests. Held clear of
   the rounded corners and the home indicator by the safe-area insets — in landscape the
   bottom inset is the bar people swipe to leave the app with. */
.pads {
    position: absolute;
    right: calc(14px + env(safe-area-inset-right, 0px));
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    top: 50%;
    transform: translateY(-50%);
    height: max-content;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
    pointer-events: auto;
}

.pad {
    min-width: 72px;
    height: 44px;
    padding: 0 12px;
    border: 2px solid rgba(223, 224, 216, 0.4);
    border-radius: 6px;
    background: rgba(11, 12, 10, 0.5);
    color: #dfe0d8;
    font-family: monospace;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-shadow: 0 1px 0 #000;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

/* The frag is the one with a cooldown and a count, so it is the one worth finding without
   looking. Bigger, and the only coloured pad. */
.pad.frag {
    min-width: 84px;
    height: 56px;
    font-size: 13px;
    border-color: rgba(255, 179, 71, 0.6);
    color: #ffb347;
}

.pad.on {
    background: rgba(255, 179, 71, 0.35);
    border-color: rgba(255, 246, 208, 0.95);
    color: #fff6d0;
}

/* The class row is keys 1-4 on a desktop and nothing at all on a phone, so on touch it
   becomes the buttons it already looks like. */
body.touch #classes { pointer-events: auto; }
body.touch #classes .class-chip { touch-action: manipulation; cursor: pointer; }
