*,
body {
    letter-spacing: 0.06vw;
    font-family: "Sarabun", sans-serif;
    box-sizing: border-box;
    color: var(--board-color);
    margin: 0;
    padding: 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

:root {
    --blue: rgb(0, 0, 255);
    --blue-t: rgba(0, 0, 255, 0);
    --yellow: rgb(255, 255, 0);
    --fred: rgb(255, 0, 0);
    --fred-t: rgba(255, 0, 0, 0);
    --greenlee: rgb(0, 255, 0);
    --greenlee-t: rgba(0, 255, 0, 0);
    --pinkney: rgb(255, 0, 255);
    --bluebell: rgb(0, 255, 255);
    --willem: rgb(255, 127, 0);
    --greydon: rgb(200, 200, 200);
}

#game_container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    background-color: #111111;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
}

#game {
    position: relative;
    display: grid;
    width: 100%;
    max-width: calc(100vh * 4 / 3);
    aspect-ratio: 4 / 3;
    object-fit: contain;
    background-color: #000;
}

#mobile_title {
    display: none;
    color: var(--yellow);
    font-size: 3em;
    text-align: center;
}

@media screen and (max-width: 1000px) {
    #game {
        display: none;
    }
    #mobile_title {
        display: block;
    }
}

#start_page {
    background-color: #000;
    grid-column: 1;
    grid-row: 1;
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    z-index: 6;
}

canvas {
    position: relative;
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    aspect-ratio: 4 / 3;
    cursor: none;
}

#trails {
    position: relative;
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    aspect-ratio: 4 / 3;
    z-index: 3;
    cursor: none;
}

#trails canvas {
    position: absolute;
    aspect-ratio: auto;
}

#dots_canvas {
    z-index: 4;
}

#ui_canvas,
#overlay_canvas {
    z-index: 5;
    height: 100%;
    aspect-ratio: auto;
}

#ui_canvas {
    justify-self: end;
}

#overlay_canvas {
    justify-self: start;
    display: none;
}

#game_title {
    text-align: center;
    color: var(--yellow);
    margin: 40px 0;
}

#player_grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 100px;
}

.player_wrapper,
.player_wrapper_start {
    width: 100%;
    display: grid;
    grid-template-columns: 10% 30% 30% 30%;
    margin: 0;
    background-color: #000;
    border: none;
    text-align: left;
    opacity: 0.5;
}

.player_wrapper {
    position: relative;
}

.player_wrapper p {
    font-size: 35px;
    line-height: 1.7;
    cursor: pointer;
}

.player_wrapper.focus,
.player_wrapper.focus:hover {
    opacity: 1;
}

.player_wrapper:hover {
    opacity: 0.85;
}

.player_wrapper_start p {
    color: #fff;
    opacity: 1;
    font-size: 35px;
    line-height: 1.7;
}

.key_wrapper {
    display: grid;
}

.key_wrapper p {
    grid-column: 1;
    grid-row: 1;
}

.key_wrapper p:first-child {
    color: #fff;
    font-size: 20px;
    padding: 10px 0 12px 0;
    margin: 0 30px;
    border: 2px solid #fff;
    border-radius: 6px;
}

#start_game_button_wrapper {
    display: flex;
    justify-content: center;
}

#start_game_button {
    background-color: #6d6d6d;
    border: 2px solid #ffffff;
    text-align: center;
    font-size: 100%;
    color: #ffffff;
    padding: 10px 18px 13px;
    cursor: pointer;
    border-radius: 6px;
    margin: 20px;
}

#start_game_button:hover {
    background-color: #999999;
}

.underline {
    text-decoration: underline;
}

.text_center {
    text-align: center;
}

.hidden {
    visibility: hidden;
}

.fred {
    color: var(--fred);
}

.greenlee {
    color: var(--greenlee);
}

.pinkney {
    color: var(--pinkney);
}

.bluebell {
    color: var(--bluebell);
}

.willem {
    color: var(--willem);
}

.greydon {
    color: var(--greydon);
}

.player_wrapper .bot_label {
    display: none;
    grid-column: 3 / 5;
    grid-row: 1;
    align-self: center;
    justify-self: center;
    font-size: 20px;
    line-height: normal;
    padding: 10px 60px 12px;
    border: 2px solid currentColor;
    border-radius: 6px;
}

.player_wrapper.is_bot .bot_label {
    display: block;
}

.is_bot .key_wrapper {
    display: none;
}

.bot_toggle {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 14px;
    background: none;
    border: 1px solid #555;
    border-radius: 4px;
    color: #888;
    font-size: 13px;
    padding: 2px 8px 4px;
    cursor: pointer;
}

.bot_toggle:hover,
.bot_toggle.on {
    border-color: currentColor;
}

.bot_toggle:hover {
    color: #fff;
}

#hud {
    position: absolute;
    left: 76%;
    bottom: 0.8%;
    z-index: 7;
    color: #777;
    pointer-events: none;
}

.online_line {
    text-align: center;
    margin-top: 12px;
    font-size: 15px;
    color: #777;
}

.online_line a {
    color: #777;
}

.online_line a:hover {
    color: #fff;
}

.player_wrapper.other,
.player_wrapper.other p {
    cursor: default;
}

.bot_toggle:disabled {
    cursor: default;
    opacity: 0.4;
}

#conn {
    position: absolute;
    left: 1%;
    top: 1%;
    z-index: 8;
    color: #c44;
    font-size: 15px;
    pointer-events: none;
}

#heads {
    position: relative;
    grid-column: 1;
    grid-row: 1;
    z-index: 4;
    pointer-events: none;
    overflow: hidden;
}

#heads i {
    position: absolute;
    left: 0;
    top: 0;
    border-radius: 50%;
    background: var(--yellow);
    will-change: transform;
}

#vfx_canvas {
    z-index: 3;
    height: 100%;
    aspect-ratio: auto;
    justify-self: start;
    pointer-events: none;
}

#marks_canvas {
    z-index: 3;
    height: 100%;
    aspect-ratio: auto;
    justify-self: start;
    pointer-events: none;
}

#tron_canvas {
    z-index: 3;
    box-shadow: 0 0 1.4vw rgba(60, 110, 255, 0.55); /* wall glow only outside the play area */
    height: 100%;
    aspect-ratio: auto;
    justify-self: start;
    pointer-events: none;
    display: none;
}

/* ---- TRON theme ---- */
body.tron {
    --fred: rgb(255, 36, 13);
    --greenlee: rgb(71, 255, 41);
    --pinkney: rgb(255, 36, 219);
    --bluebell: rgb(10, 204, 255);
    --willem: rgb(255, 148, 8);
    --greydon: rgb(204, 230, 255);
    --neon: rgb(60, 200, 255);
    --neon-dim: rgba(60, 200, 255, 0.35);
}

body.tron * {
    font-family: "Rajdhani", sans-serif;
    font-weight: 600;
}

body.tron #game_container {
    background: radial-gradient(ellipse at 50% 45%, #061326 0%, #01040b 70%);
}

body.tron #start_page {
    background-color: #01050c;
    background-image:
        radial-gradient(ellipse at 50% 30%, rgba(0, 130, 255, 0.16), transparent 65%),
        radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.75) 100%),
        linear-gradient(rgba(40, 170, 255, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(40, 170, 255, 0.07) 1px, transparent 1px);
    background-size:
        100% 100%,
        100% 100%,
        3.125% 4.1667%,
        3.125% 4.1667%;
    box-shadow: inset 0 0 0 1px var(--neon-dim);
}

body.tron #game_title {
    font-family: "Orbitron", sans-serif;
    font-weight: 900;
    font-size: 3.2em;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #e8fbff;
    margin: 36px 0 28px;
    text-shadow:
        0 0 6px var(--neon),
        0 0 22px rgba(0, 150, 255, 0.8),
        0 0 60px rgba(0, 110, 255, 0.6);
}

body.tron .player_wrapper,
body.tron .player_wrapper_start {
    background: transparent;
    border-bottom: 1px solid rgba(60, 200, 255, 0.12);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

body.tron .player_wrapper_start p {
    font-family: "Orbitron", sans-serif;
    font-weight: 500;
    font-size: 18px;
    color: #6cc4e8;
    letter-spacing: 0.3em;
    padding: 10px 0;
}

body.tron .player_wrapper p {
    font-weight: 700;
}

body.tron .player_wrapper.focus {
    background: linear-gradient(90deg, rgba(60, 200, 255, 0.07), transparent 80%);
}

body.tron .player_wrapper.focus p:not(.key_button) {
    text-shadow: 0 0 12px currentColor;
}

body.tron .key_wrapper p:first-child {
    color: #dff8ff;
    border: 1px solid var(--neon);
    border-radius: 2px;
    box-shadow:
        0 0 8px var(--neon-dim),
        inset 0 0 8px var(--neon-dim);
}

body.tron .player_wrapper .bot_label {
    border: 1px solid currentColor;
    border-radius: 2px;
    letter-spacing: 0.25em;
    box-shadow:
        0 0 10px currentColor,
        inset 0 0 8px rgba(255, 255, 255, 0.08);
    text-shadow: 0 0 8px currentColor;
}

body.tron .bot_toggle {
    border-radius: 2px;
    border-color: var(--neon-dim);
    color: #5a9ec0;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

body.tron .bot_toggle:hover,
body.tron .bot_toggle.on {
    border-color: currentColor;
    box-shadow: 0 0 8px currentColor;
}

body.tron #start_game_button {
    font-family: "Orbitron", sans-serif;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    background: rgba(0, 120, 200, 0.08);
    border: 1px solid var(--neon);
    border-radius: 2px;
    color: #e8fbff;
    padding: 14px 30px;
    box-shadow:
        0 0 14px var(--neon-dim),
        inset 0 0 14px var(--neon-dim);
    text-shadow: 0 0 8px var(--neon);
}

body.tron #start_game_button:hover {
    background: rgba(60, 200, 255, 0.2);
}

body.tron .online_line,
body.tron .online_line a {
    color: #4f8fb0;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

body.tron .online_line a:hover {
    color: #e8fbff;
    text-shadow: 0 0 8px var(--neon);
}

body.tron #hud {
    color: #4f8fb0;
    letter-spacing: 0.1em;
}

#ff_badge {
    position: absolute;
    left: 1.2%;
    top: 1.2%;
    z-index: 30;
    padding: 0.2em 0.6em;
    font: 600 clamp(11px, 1.1vw, 18px) / 1.3 "Rajdhani", "Sarabun", sans-serif;
    letter-spacing: 0.15em;
    color: #9ff3ff;
    background: rgba(2, 10, 20, 0.6);
    border: 1px solid rgba(80, 220, 255, 0.5);
    border-radius: 3px;
    pointer-events: none;
}
#ff_badge[hidden] {
    display: none;
}

#mute {
    position: absolute;
    right: 1%;
    top: 1%;
    z-index: 9;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    background: none;
    color: #777;
    opacity: 0.55;
    cursor: pointer;
}

#mute:hover {
    color: #fff;
    opacity: 1;
}

#mute .slash {
    display: none;
}

#mute.off .wave {
    display: none;
}

#mute.off .slash {
    display: inline;
}

body.tron #mute {
    color: var(--neon);
}

/* ---- online: name, clients, chat ---- */
#name_box {
    display: flex;
    align-items: center;
    gap: 0.6em;
    margin-bottom: 0.7em;
}

#name_box label {
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

#name_input,
.chat_input {
    font: inherit;
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid #555;
    border-radius: 3px;
    padding: 0.3em 0.6em;
    outline: none;
    -webkit-user-select: text;
    user-select: text;
}

#name_input {
    flex: 1;
    min-width: 0;
}

#name_input:focus,
.chat_input:focus {
    border-color: #fff;
}

#lobby_social {
    position: absolute;
    left: 8%;
    right: 8%;
    top: 78%;
    bottom: 3%;
    display: flex;
    gap: 2%;
    font-size: clamp(11px, 1.15vw, 19px);
}

#lobby_side {
    flex: 0 0 32%;
    overflow: hidden;
}

.clients_head {
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.85em;
    margin-bottom: 0.3em;
}

.client {
    display: flex;
    gap: 0.6em;
    align-items: baseline;
    color: #ddd;
    line-height: 1.5;
}

.client.me .cname {
    color: #fff;
    font-weight: bold;
}

.client .cname {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client .host {
    font-size: 0.7em;
    color: var(--yellow);
    border: 1px solid currentColor;
    border-radius: 2px;
    padding: 0 0.35em;
}

.client .ms {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

#chat {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4em;
}

#chat[hidden] {
    display: none;
}

.chat_log {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #333;
    border-radius: 3px;
    padding: 0.3em 0.6em;
}

.chat_log .line {
    color: #ddd;
    line-height: 1.4;
    overflow-wrap: anywhere;
    -webkit-user-select: text;
    user-select: text;
}

.chat_log .who {
    font-weight: bold;
    margin-right: 0.5em;
    color: #aaa;
}

.chat_log .sys .txt {
    color: #888;
    font-style: italic;
}

/* between rounds the chat floats in the scoreboard column; lines fade unless the player is typing */
#chat.ingame {
    position: absolute;
    right: 0;
    bottom: 15%;
    width: 24%;
    height: 10%;
    z-index: 8;
    font-size: clamp(10px, 0.95vw, 16px);
}

#chat.ingame .chat_log {
    background: rgba(0, 0, 0, 0.45);
    border-color: transparent;
    overflow: hidden;
}

#chat.ingame:not(.show) {
    display: none;
}

#chat_badge {
    position: absolute;
    right: 2.5%;
    bottom: 15.5%;
    z-index: 8;
    font-size: clamp(10px, 0.95vw, 16px);
    letter-spacing: 0.1em;
    color: #8fdfff;
    opacity: 0.7;
    pointer-events: none;
}

#chat_badge[hidden] {
    display: none;
}

#chat.ingame:not(.typing) .chat_input {
    display: none;
}


.player_wrapper .owner {
    font-size: 0.55em;
    letter-spacing: 0.05em;
    opacity: 0.75;
    text-transform: none;
}

/* ---- pointing, countdown ---- */
#points {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    aspect-ratio: 1;
    z-index: 7;
    pointer-events: none;
}

#points.active {
    pointer-events: auto;
    cursor: crosshair;
    touch-action: none;
}

#points svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

#point_hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 1%;
    text-align: center;
    font-size: clamp(10px, 0.9vw, 15px);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #fff;
    opacity: 0.35;
}

.mark {
    color: #fff;
}

.mark .ring {
    fill: none;
    stroke: currentColor;
    stroke-width: 4;
    transform-box: fill-box;
    transform-origin: center;
    animation: point_pulse 1.1s ease-out infinite;
}

.mark .dot,
.mark .head {
    fill: currentColor;
}

.mark .shaft {
    stroke: currentColor;
    stroke-width: 6;
    stroke-linecap: round;
}

.mark .who {
    fill: currentColor;
    font: 700 28px "Sarabun", sans-serif;
    paint-order: stroke;
    stroke: #000;
    stroke-width: 5px;
}

.mark.fade {
    animation: point_fade 6s linear forwards;
}

.mark.preview {
    opacity: 0.6;
}

body.tron .mark {
    filter: drop-shadow(0 0 4px currentColor) drop-shadow(0 0 12px currentColor);
}

body.tron .mark .who {
    font-family: "Rajdhani", sans-serif;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    stroke: none;
}

@keyframes point_pulse {
    from {
        transform: scale(0.5);
        opacity: 1;
    }
    to {
        transform: scale(1.7);
        opacity: 0;
    }
}

@keyframes point_fade {
    0%,
    70% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

#countdown {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    aspect-ratio: 1;
    z-index: 7;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(min(100vh, 75vw) * 0.3);
    line-height: 1;
    color: #fff;
}

#countdown[hidden] {
    display: none;
}

body.tron #countdown {
    font-family: "Orbitron", sans-serif;
    font-weight: 900;
    color: #eafcff;
    text-shadow:
        0 0 12px var(--neon),
        0 0 40px rgba(0, 150, 255, 0.9),
        0 0 100px rgba(0, 110, 255, 0.7);
}

body.tron #countdown.go {
    color: #f4fff2;
    text-shadow:
        0 0 12px var(--greenlee),
        0 0 40px rgba(71, 255, 41, 0.9),
        0 0 100px rgba(71, 255, 41, 0.6);
}

body.tron #countdown.pop {
    animation: count_pop 0.9s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

@keyframes count_pop {
    0% {
        transform: scale(1.9);
        opacity: 0;
    }
    25% {
        transform: scale(1);
        opacity: 1;
    }
    75% {
        opacity: 1;
    }
    100% {
        transform: scale(0.85);
        opacity: 0.25;
    }
}

body:not(.tron) #countdown {
    font-family: "Sarabun", sans-serif;
    color: #fff;
}

/* ---- online parts, TRON skin ---- */
body.tron #name_box label,
body.tron .clients_head {
    color: #4f8fb0;
    font-family: "Orbitron", sans-serif;
    font-size: 0.75em;
}

body.tron #name_input,
body.tron .chat_input {
    color: #e8fbff;
    background: rgba(40, 170, 255, 0.07);
    border-color: var(--neon-dim);
}

body.tron #name_input:focus,
body.tron .chat_input:focus {
    border-color: var(--neon);
    box-shadow: 0 0 10px rgba(60, 200, 255, 0.35);
}

body.tron .chat_log {
    background: rgba(2, 14, 28, 0.55);
    border-color: var(--neon-dim);
}

body.tron #chat.ingame .chat_log {
    background: rgba(1, 8, 18, 0.7);
}

body.tron .client {
    color: #a9d8ee;
}

body.tron .client.me .cname {
    color: #eafcff;
    text-shadow: 0 0 8px var(--neon);
}

body.tron .chat_log .line {
    color: #cfeefa;
}

body.tron .chat_log .sys .txt {
    color: #4f8fb0;
}

/* ---- all-time stats ---- */
#stats_panel {
    position: absolute;
    right: 1.5%;
    top: 130px;
    width: 27%;
    z-index: 3;
    font-size: clamp(11px, 1.1vw, 18px);
}

#stats_panel[hidden] {
    display: none;
}

body:not(.tron) #start_page:not(.online) #stats_panel {
    display: none; /* the classic local lobby stays exactly as the original */
}

body.tron #start_page.with_stats #player_grid,
#start_page.online.with_stats #player_grid {
    margin: 20px 36% 20px 70px;
}

body.tron #start_page.with_stats .player_wrapper > p,
#start_page.online.with_stats .player_wrapper > p {
    font-size: 26px;
}

body.tron #start_page.with_stats .bot_label,
#start_page.online.with_stats .bot_label {
    padding: 6px 20px 8px;
}

.stats_head h2 {
    font-size: 1.3em;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--yellow);
    margin-bottom: 0.5em;
}

.stats_tabs {
    display: flex;
    gap: 0.4em;
    margin-bottom: 0.6em;
}

.stats_tabs button,
.stats_profile,
#profile button {
    font: inherit;
    font-size: 0.85em;
    color: #aaa;
    background: none;
    border: 1px solid #555;
    border-radius: 3px;
    padding: 0.2em 0.7em;
    cursor: pointer;
}

.stats_tabs button.on,
.stats_tabs button:hover,
.stats_profile:hover,
#profile button:hover {
    color: #fff;
    border-color: #fff;
}

.stats_row {
    display: grid;
    grid-template-columns: 1.6em 1fr auto 3.2em;
    gap: 0.5em;
    align-items: baseline;
    padding: 0.18em 0.4em;
    color: #ddd;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.stats_row .rk {
    color: #777;
}

.stats_row .nm {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats_row .mt {
    color: #777;
    font-size: 0.8em;
}

.stats_row .v {
    text-align: right;
    font-weight: bold;
    color: #fff;
}

.stats_row.me {
    background: rgba(255, 255, 0, 0.12);
    color: var(--yellow);
}

.stats_empty {
    color: #777;
    padding: 0.4em;
    font-size: 0.85em;
}

.stats_foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5em;
    margin-top: 0.8em;
    color: #aaa;
}

#stats_line {
    position: absolute;
    left: 0;
    top: 67%;
    height: auto;
    width: calc(min(100vh, 75vw));
    text-align: center;
    z-index: 8;
    font-size: clamp(14px, 1.7vw, 28px);
    letter-spacing: 0.1em;
    color: #fff;
    pointer-events: none;
}

#stats_line[hidden] {
    display: none;
}

#profile {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile_box {
    width: 62%;
    max-width: 720px;
    padding: 1.6em;
    background: #0a0a0a;
    border: 1px solid #666;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    font-size: clamp(12px, 1.2vw, 20px);
}

.profile_box h2 {
    color: var(--yellow);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.profile_box label {
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.8em;
    margin-top: 0.6em;
}

.profile_box .code {
    font: inherit;
    letter-spacing: 0.1em;
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid #555;
    border-radius: 3px;
    padding: 0.4em 0.6em;
    -webkit-user-select: text;
    user-select: text;
}

.profile_box .warn {
    color: #ffb020;
    font-size: 0.9em;
}

.profile_box button {
    align-self: flex-start;
}

.profile_msg {
    color: #ff6a6a;
    min-height: 1.2em;
}

body.tron #stats_panel .stats_head h2,
body.tron .profile_box h2 {
    font-family: "Orbitron", sans-serif;
    color: #e8fbff;
    text-shadow: 0 0 10px var(--neon);
}

body.tron .stats_row.me {
    background: rgba(60, 200, 255, 0.14);
    color: #eafcff;
    text-shadow: 0 0 8px var(--neon);
}

body.tron .stats_row {
    border-bottom-color: rgba(60, 200, 255, 0.12);
    color: #a9d8ee;
}

body.tron .stats_tabs button.on {
    border-color: var(--neon);
    box-shadow: 0 0 8px var(--neon-dim);
}

body.tron .profile_box {
    background: rgba(2, 10, 22, 0.96);
    border-color: var(--neon-dim);
}

body.tron #stats_line {
    font-family: "Orbitron", sans-serif;
    color: #eafcff;
    text-shadow: 0 0 10px var(--neon);
}

body.tron #start_page.with_stats .key_wrapper p,
#start_page.online.with_stats .key_wrapper p {
    font-size: 26px;
}

body.tron #start_page.with_stats .key_wrapper p:first-child,
#start_page.online.with_stats .key_wrapper p:first-child {
    font-size: 15px;
    margin: 0 8px;
    padding: 8px 0;
    line-height: 1.2;
}

/* ---- admin extras in the room ---- */
#motd_line {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    z-index: 3;
    padding: 0.35em 1em;
    text-align: center;
    font-size: clamp(11px, 1.15vw, 19px);
    letter-spacing: 0.08em;
    color: #ffe9a8;
    background: rgba(255, 176, 32, 0.12);
    border-bottom: 1px solid rgba(255, 176, 32, 0.4);
}

#motd_line[hidden] {
    display: none;
}

.client .admin_tag {
    font-size: 0.7em;
    color: #ffb020;
    border: 1px solid currentColor;
    border-radius: 2px;
    padding: 0 0.35em;
}

.adm {
    font: inherit;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #aaa;
    background: none;
    border: 1px solid #555;
    border-radius: 2px;
    padding: 0 0.5em;
    cursor: pointer;
}

.adm:hover {
    color: #fff;
    border-color: #fff;
}

.adm.kick,
.adm.close_room {
    color: #ff6a6a;
    border-color: rgba(255, 74, 74, 0.5);
}

.clients_head .adm {
    margin-left: 0.8em;
}

#admin_badge[hidden] {
    display: none;
}

#name_box .admin_tag {
    font-size: 0.7em;
    color: #ffb020;
    border: 1px solid currentColor;
    border-radius: 2px;
    padding: 0 0.35em;
}

/* ---- lobby scales with its own box (TRON and online): one layout from 960×720 up, never clipped ---- */
body.tron #start_page,
#start_page.online {
    container-type: size;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
}

body.tron #start_page #game_title,
#start_page.online #game_title {
    font-size: clamp(22px, 4.2cqw, 84px);
    margin: 3.4cqh 0 2.6cqh;
}

body.tron #start_page #player_grid,
#start_page.online #player_grid {
    margin: 1.6cqh 5cqw;
}

body.tron #start_page.with_stats #player_grid,
#start_page.online.with_stats #player_grid {
    margin: 1.6cqh 36% 1.6cqh 5cqw;
}

body.tron #start_page .player_wrapper > p,
#start_page.online .player_wrapper > p {
    font-size: clamp(15px, 2.15cqw, 64px);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.tron #start_page .player_wrapper_start p,
#start_page.online .player_wrapper_start p {
    font-size: clamp(11px, 1.5cqw, 30px);
    padding: 0.8cqh 0;
}

body.tron #start_page .key_wrapper p,
#start_page.online .key_wrapper p {
    font-size: clamp(15px, 2.15cqw, 64px);
}

body.tron #start_page .key_wrapper p:first-child,
#start_page.online .key_wrapper p:first-child {
    font-size: clamp(10px, 1.25cqw, 32px);
    margin: 0 0.8cqw;
    padding: 0.8cqh 0;
    line-height: 1.2;
}

#start_page .player_wrapper.named > p:nth-child(2) {
    letter-spacing: 0.08em;
}

#start_page .player_wrapper .owner {
    font-size: 0.5em;
    opacity: 0.6;
    margin-left: 0.2em;
}

body.tron #start_page #stats_panel,
#start_page.online #stats_panel {
    top: 15cqh;
    right: 1.5cqw;
    width: 27cqw;
    font-size: clamp(10px, 1.5cqw, 32px);
}

body.tron #start_page #lobby_social,
#start_page.online #lobby_social {
    font-size: clamp(10px, 1.45cqw, 30px);
}

body.tron #start_page #start_game_button,
#start_page.online #start_game_button {
    font-size: clamp(11px, 1.45cqw, 32px);
}

body.tron #start_page #motd_line,
#start_page.online #motd_line {
    font-size: clamp(10px, 1.5cqw, 30px);
}

/* ---- fixed row height: no row state (empty, binding, keys, BOT box, owner label) may change the layout below it ---- */
body.tron #start_page,
#start_page.online {
    --row-font: clamp(15px, 2.15cqw, 64px);
    --row-h: calc(var(--row-font) * 1.7);
}

body.tron #start_page .player_wrapper,
#start_page.online .player_wrapper {
    height: var(--row-h);
    overflow: visible;
}

body.tron #start_page .player_wrapper > p,
#start_page.online .player_wrapper > p {
    line-height: var(--row-h);
}

body.tron #start_page .player_wrapper .key_wrapper,
#start_page.online .player_wrapper .key_wrapper {
    height: var(--row-h);
    align-content: center;
}

body.tron #start_page .player_wrapper .key_wrapper p,
#start_page.online .player_wrapper .key_wrapper p {
    line-height: 1.2;
}

body.tron #start_page .player_wrapper .bot_label,
#start_page.online .player_wrapper .bot_label {
    box-sizing: border-box;
    height: 72%;
    padding: 0 3cqw;
    line-height: 1;
    font-size: clamp(10px, 1.45cqw, 24px);
}

body.tron #start_page .player_wrapper.is_bot .bot_label,
#start_page.online .player_wrapper.is_bot .bot_label {
    display: flex;
    align-items: center;
    justify-content: center;
}
