/*
 * The game's stylesheet, also used by the wiki. Hand-written, no build step.
 *
 * Layers, lowest first. A later layer wins over an earlier one whatever the selectors are:
 *   reset       box sizing and margins
 *   tokens      colours, sizes and spacing as custom properties
 *   legacy      the rules the table pages were written with (th, td.c, td.l, td.k ...). Pages not
 *               yet rewritten need them, and so do the messages and combat reports stored as HTML
 *               in the database, which can never be rewritten: these rules stay.
 *   layout      the page shell: menu, top bar, content column
 *   components  pieces shared by pages
 *   pages       what a single page needs
 */
@layer reset, tokens, legacy, layout, components, pages;

@layer reset {
    *,
    *::before,
    *::after {
        box-sizing: border-box;
    }

    html {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    body {
        margin: 0;
    }

    /* an element marked hidden stays hidden whatever display its class gives it */
    [hidden] {
        display: none !important;
    }
}

@layer tokens {
    :root {
        /* the palette of the default skin */
        --c-bg: #040e1e;
        --c-panel: #344566;
        --c-panel-dark: #2a3a59;
        --c-border: #415680;
        --c-text: #e6ebfb;
        --c-text-muted: #b9c3dc;
        --c-link-hover: #cdd7f8;
        --c-accent: #ff8900;

        /* signal colours, light enough to read on the panel colour (4.5:1 or better) */
        --c-good: #00ff00;
        --c-bad: #ff9494;
        --c-warn: #ffa500;
        --c-info: #ffff00;

        /* text: 13 px on a phone, 15 px on a desktop screen, never smaller than 13 px */
        --fs-base: clamp(0.8125rem, 0.72rem + 0.3vw, 0.9375rem);
        --fs-small: 0.8125rem;
        --fs-large: 1.0625rem;
        --font: Tahoma, Verdana, sans-serif;

        --space-1: 0.25rem;
        --space-2: 0.5rem;
        --space-3: 0.75rem;
        --space-4: 1rem;
        --space-5: 1.5rem;
        --radius: 4px;

        /* the shell: its two breakpoints are 700 px and 1100 px. The content fills a 1920 px screen
           beside the menu and stops growing there */
        --menu-width: 180px;
        --content-width: 1600px;
        --touch: 44px;
    }

    @media (max-width: 1099.98px) {
        :root {
            --menu-width: 150px;
        }
    }
}

@layer legacy {
    /* ---- fleet, status and report colours (was default.css) ---- */

    .allymember {
      color: lime;
    }

    .noob {
      color: #a0ffa0;
    }

    .strong {
      color: #ffa0a0;
    }

    .vacation {
      color: skyblue;
    }

    .inactive {
      color: CCCCCC;
    }

    .longinactive {
      color: 999999;
    }

    .banned {
      text-decoration: line-through;
    }

    .flight {
    }

    .return {
    }

    .holding {
    }

    *.ownattack {
      color: lime;
    }

    .flight .ownattack a:hover {
      color: #E6EBFB;
    }

    .flight .ownattack a {
      color: lime;
    }


    *.owncolony {
      color: lime;
    }

    .flight .owncolony a {
      color: #E6EBFB;
    }

    *.owndeploy {
      color: lime;
    }


    .flight .owndeploy a {
      color: lime;
    }

    .flight .owndeploy a:hover {
      color: #E6EBFB;
    }


    *.owndestroy {
      color: gold;
    }

    .flight .owndestroy a {
      color: gold;
    }

    .flight .owndestroy a:hover {
      color: #E6EBFB;
    }

    *.ownespionage {
      color: orange;
    }


    .flight .ownespionage a {
      color: orange;
    }

    .flight .ownespionage a:hover {
      color: #E6EBFB;
    }


    *.ownfederation {
      color: #33CC00;
    }


    .flight .ownfederation a {
      color: #33CC00;
    }

    .flight .ownfederation a:hover {
      color: #E6EBFB;
    }


    *.ownharvest {
      color: lime;
    }


    .flight .ownharvest a {
      color: lime;
    }

    .flight .ownharvest a:hover {
      color: #E6EBFB;
    }


    *.ownhold {
      color: #80a0C0;
    }


    .flight .ownhold a {
      color: #80a0C0;
    }

    .flight .ownhold a:hover {
      color: #E6EBFB;
    }


    *.ownmissile {
      color: orange;
    }


    .flight .ownmissile a {
      color: orange;
    }

    .flight .ownmissile a:hover {
      color: #E6EBFB;
    }


    *.owntransport {
      color: lime;
    }

    *.owndeploy {
      color: lime;
    }

    .flight .owndeplay a {
      color: lime;
    }

    .flight .owndeplay a:hover {
      color: #E6EBFB;
    }

    .flight .owntransport a {
      color: lime;
    }

    .flight .owntransport a:hover {
      color: #E6EBFB;
    }

    .return .owntransport a {
      color: lime;
    }

    .return .owntransport a:hover {
      color: #E6EBFB;
    }



    *.attack {
      color: red;
    }

    .flight .attack a:hover {
      color: #E6EBFB;
    }

    .flight .attack a {
      color: red;
    }


    *.colony {
      color: lime;
    }


    .flight .colony a {
      color: lime;
    }

    .flight .colony a:hover {
      color: #E6EBFB;
    }


    *.deploy {
      color: lime;
    }


    .flight .deploy a {
      color: lime;
    }

    .flight .deploy a:hover {
      color: #E6EBFB;
    }


    *.destroy {
      color: gold;
    }

    .flight .destroy a {
      color: gold;
    }

    .flight .destroy a:hover {
      color: #E6EBFB;
    }

    *.espionage {
      color: red;
    }

    .flight .espionage a {
      color: red;
    }

    .flight .espionage a:hover {
      color: #E6EBFB;
    }

    *.federation {
      color: #CC0000;
    }

    .flight .federation a {
      color: #CC0000;
    }

    .flight .federation a:hover {
      color: #E6EBFB;
    }

    *.harvest {
      color: lime;
    }

    .flight .harvest a {
      color: lime;
    }

    .flight .harvest a:hover {
      color: #E6EBFB;
    }

    *.hold {
      color: #80a0C0;
    }

    .flight .hold a {
      color: #80a0C0;
    }

    .flight .hold a:hover {
      color: #E6EBFB;
    }

    *.missile {
      color: red;
    }


    *.transport {
      color: lime;
    }

    .flight .transport a {
      color: lime;
    }

    .flight .transport a:hover {
      color: #E6EBFB;
    }

    .flight .phalanx_fleet, .phalanx_fleet {
        color: lime;
    }

    .return .phalanx_fleet {
        color: #3BB9FF;
    }

    .success {
      color: lime;
    }

    .errormessage a {
        text-decoration: underline;
    }

    .error {
      color: red;
    }

    .warning {
      color: orange;
    }

    .notice {
      color: yellow;
    }

    .combatreport {
      color: red;
    }

    .combatreport_ididattack_iwon {
      color: #00B000;
    }

    .combatreport_ididattack_ilost {
      color: #C00000;
    }

    .combatreport_ididattack_draw {
      color: #C0C000;
    }

    .combatreport_igotattacked_iwon {
      color: lime;
    }

    .combatreport_igotattacked_ilost {
      color: red;
    }

    .combatreport_igotattacked_draw {
      color: yellow;
    }

    .espionagereport {
      color: orange;
    }

    .timeremaining {
    }

    .noresources {
      color: red;
    }

    /* ---- player status colours of the galaxy (was redesign.css) ---- */

    .status_abbr_admin {
        color: #f48406;
    }

    .status_abbr_strong {
        color: #f00;
    }

    .status_abbr_noob {
        color: lime;
    }

    .status_abbr_outlaw {
        color: #f3f;
    }

    .status_abbr_vacation {
        color: aqua;
    }

    .status_abbr_banned {
        color: #fff;
        text-decoration: line-through;
    }

    .status_abbr_inactive {
        color: #6e6e6e;
    }

    .status_abbr_longinactive {
        color: #4f4f4f;
    }

    .status_abbr_honorableTarget {
        color: #ff6;
    }

    /* ---- tables, cells and form fields (was formate.css) ---- */

    body,
    td,
    th,
    textarea,
    body,
    table,
    p td,
    table table td,
    th,
    td.a,
    td.b,
    td.c,
    td.f,
    input,
    select,
    td.g,
    td.h,
    td.i,
    td.j,
    td.k,
    td.l,
    td.m,
    td.n,
    td.o,
    td.q,
    td.r,
    td.v,
    .style td,
    textarea,
    p td,
    table.s th img,
    td.q,
    .style td,
    .style div a:hover,
    h1,
    .style div a:link,
    .style div a:visited {
        font-size: 14px;
    }

    body,
    td,
    th,
    textarea,
    body,
    table,
    p td,
    table table td,
    th,
    td.a,
    td.b,
    td.c,
    td.f,
    input,
    select,
    td.g,
    td.h,
    td.i,
    td.j,
    td.k,
    td.l,
    td.m,
    td.n,
    td.o,
    td.q,
    td.r,
    td.v,
    .style td,
    textarea,
    p td,
    table.s th img,
    td.q,
    .style td,
    .style div a:hover,
    h1,
    .style div a,
    .style div a:link,
    .style div a:visited,
    td {
        font-family: Tahoma, sans-serif;
    }

    img,
    p table,
    table table,
    table.s th,
    td.header,
    th.header,
    tr.header,
    table.header {
        border: 0px;
    }

    p td,
    th,
    td.a,
    td.h,
    td.i,
    td.j,
    td.k,
    td.k input,
    td.n,
    td.o,
    td.q,
    h1 {
        text-align: center;
    }

    td.g,
    td.m,
    td.n,
    td.q,
    td.r,
    td.v {
        text-align: right;
    }

    body,
    td.c,
    td.f,
    input,
    select,
    textarea,
    option,
    td.g,
    td.h
    td.i,
    td.j,
    td.k,
    td.k input,
    td.l,
    td.m,
    td.n,
    td.o,
    td.q,
    td.r,
    td.s,
    div.z,
    a,
    a.s,
    a.t,
    .style td,
    .style div a:hover {
        color: #E6EBFB;
    }

    body {
        margin: 1px 0 0 1px;
        background: #040e1e url(../upload/skins/xgproyect/img/background.jpg) top right no-repeat fixed;
    }

    body.style {
        background-image: none;
    }

    body.style table {
        margin: 0px;
    }

    body form table th table input {
        width: 60px;
    }

    th,
    td.a,
    td.b,
    td.c,
    td.f,
    input,
    select,
    td.g,
    td.h,
    td.i,
    td.j,
    td.k,
    td.l,
    td.m,
    td.n,
    td.o,
    td.q,
    td.r,
    td.v,
    .style td,
    textarea,
    p td,
    table.s th img {
        border: 1px #415680 solid;
    }

    th,
    td.a,
    td.b,
    td.c,
    td.f,
    input,
    select,
    td.g,
    td.h,
    td.i,
    td.j,
    td.k,
    td.m,
    td.o,
    td.q,
    td.r,
    td.v,
    td.s,
    .style td,
    p td,
    td.f,
    input,
    select,
    textarea,
    option,
    td.l,
    td {
        background-color: #344566;
    }

    th,
    td.c {
        padding-left: 3px;
    }

    th {
        padding-right: 3px;
    }

    td.a {
        height: 39px;
    }

    td.b,
    td.l {
        padding: 3px;
    }

    td.c,
    td.g,
    td.m,
    td.n,
    td.q,
    td.v,
    div.z,
    a {
        font-weight: bold;
    }

    td.c {
        background-image: url(../upload/skins/xgproyect/img/bg1.gif);
    }

    textarea,
    .style div a,
    .style div a:link,
    .style div a:visited,
    .style div a:hover {
        width: 100%;
    }

    td.k input {
        text-align: left;
    }

    td.l {
        vertical-align: top;
        background-image: url(../upload/skins/xgproyect/img/bg2.gif);
    }

    td.m {
        width: 86px;
    }

    td.n,
    table.s th img {
        width: 89px;
    }

    td.q,
    td {
        vertical-align: middle;
    }

    td.v {
        color: #f7f7f7;
    }

    table.s th img {
        height: 89px;
    }

    a,
    .style div a:hover {
        text-decoration: none;
    }

    a:hover {
        color: #CDD7F8;
        text-decoration: underline;
    }

    .style td {
        border-top: 0px;
    }

    .style div a,
    .style div a:link,
    .style div a:visited,
    .style div a:hover {
        height: 100%;
    }

    .style div a,
    .style div a:link,
    .style div a:visited {
        color: #f2f2f2;
    }

    .style div a,
    td {
        font-size: 11px;
    }

    .style div a:hover {
        background-color: #415680;
    }

    .style {
        margin-top: 15px;
    }

    h1 {
        border-bottom: 0px #344566 solid;
        width: 98%;
    }

    #darkmatter,
    #darkmatter2 {
        font-family: verdana;
        color: #FF8900;
        filter: glow(color=#000000, strength=6);
    }

    td.header,
    th.header,
    tr.header,
    table.header {
        background-color: transparent;
    }

    td {
        border-top: 0px solid #415680;
        padding: 1px;
    }

    /* ---- the same rules as the skin wrote them, they win where both set a value (was skins/xgproyect/formate.css) ---- */

    ., #, td, th, textarea, body, table {
        font-family: Tahoma, sans-serif;
        font-size: 11px;
    }

    img {
        border: 0px;
    }

    p table {
        border: 0px;
    }

    p td {
        text-align: center;
        font-size: 11px;
        font-family: Tahoma, sans-serif;
    }

    table table {
        border: 0px;
    }

    table table td {
        font-size: 11px;
        font-family: Tahoma, sans-serif;
    }

    body {
        color: #E6EBFB;
        margin-top: 1px;
        margin-left: 1px;
        background-color: #040e1e;
        background-image: url(../upload/skins/xgproyect/img/background.jpg);
        background-attachment: fixed;
        background-repeat: no-repeat;
        background-position: top right;
        scrollbar-arrow-color: #E6EBFB;
        scrollbar-base-color: #344566;
        scrollbar-track-color: #344566;
        scrollbar-face-color: #344566;
        scrollbar-highlight-color: #344566;
        scrollbar-3dlight-color: #465673;
        scrollbar-darkshadow-color: #344566;
        scrollbar-shadow-color: #465673;
        font-size: 11px;
        font-family: Tahoma, sans-serif;
    }

    body.style {
        background-image: none;
    }

    body.style table {
        margin: 0px;
    }

    body form table th table input {
        width: 60px;
    }

    th, td.a, td.b, td.c, td.f, input, select,
    td.g, td.h, td.i, td.j, td.k, td.l, td.m,
    td.n, td.o, td.q, td.r, td.v, .style td,
    textarea, p td, table.s th img {
        border: 1px #415680 solid;
        font-size: 11px;
        font-family: Tahoma, sans-serif;
    }

    th, td.a, td.b, td.c, td.f, input, select, td.g,
    td.h, td.i, td.j, td.k, td.m, td.o, td.q, td.r,
    td.v, td.s, .style td, p td {
        background-color: #344566;
    }

    th {
        text-align: center;
        padding-left: 3px;
        padding-right: 3px;
    }

    td.a {
        height: 39px;
        text-align: center;
    }

    td.b {
        padding: 3px;
    }

    td.c {
        font-weight: bold;
        color: #E6EBFB;
        padding-left: 3px;
        background-image: url(../upload/skins/xgproyect/img/bg1.gif);
    }

    td.f, input, select, textarea {
        color: #E6EBFB;
        background-color: #344566;
    }

    textarea {
        width: 100%;
    }

    td.k input {
        text-align: left;
    }

    td.g {
        font-weight: bold;
        text-align: right;
        color: #E6EBFB;
    }

    td.h {
        text-align: center;
        color: #E6EBFB;
    }

    td.i {
        text-align: center;
        color: #E6EBFB;
    }

    td.j {
        text-align: center;
        color: #E6EBFB;
    }

    td.k, td.k input {
        text-align: center;
        color: #E6EBFB;
    }

    td.l {
        background-color: #344566;
        color: #E6EBFB;
        vertical-align: top;
        padding: 3px;
        background-image: url(../upload/skins/xgproyect/img/bg2.gif);
    }

    td.m {
        font-weight: bold;
        text-align: right;
        width: 86px;
        color: #E6EBFB;
    }

    td.n {
        font-weight: bold;
        text-align: right;
        width: 89px;
        text-align: center;
        color: #E6EBFB;
    }

    td.o {
        text-align: center;
        color: #E6EBFB;
    }

    td.q {
        font-weight: bold;
        font-size: 11px;
        font-family: Tahoma, sans-serif;
        text-align: center;
        vertical-align: middle;
        color: #E6EBFB;
    }

    td.r {
        text-align: right;
        color: #E6EBFB;
    }

    td.v {
        font-weight: bold;
        text-align: right;
        color: #f7f7f7;
    }

    td.s {
        color: #E6EBFB;
    }

    table.s th {
        border: 0px;
    }

    table.s th img {
        width: 89px;
        height: 89px;
    }

    div.z {
        font-weight: bold;
        color: #E6EBFB;
    }

    a {
        color: #E6EBFB;
        text-decoration: none;
        font-weight: bold;
    }

    a.s {
        color: #E6EBFB;
    }

    a.t {
        color: #E6EBFB;
    }

    a:hover {
        color: #CDD7F8;
        text-decoration: underline;
    }

    .style td {
        color: #E6EBFB;
        border-top: 0px;
        font-size: 11px;
        font-family: Tahoma, sans-serif;
    }

    .style div a {
        height: 100%;
        width: 100%;
        color: #f2f2f2;
        font-size: 11px;
        font-family: Tahoma, sans-serif;
    }

    .style div a:link {
        height: 100%;
        width: 100%;
        color: #f2f2f2;
        font-size: 11px;
        font-family: Tahoma, sans-serif;
    }

    .style div a:visited {
        height: 100%;
        width: 100%;
        color: #f2f2f2;
        font-size: 11px;
        font-family: Tahoma, sans-serif;
    }

    .style div a:hover {
        background-color: #415680;
        height: 100%;
        width: 100%;
        text-decoration: none;
        font-size: 11px;
        font-family: Tahoma, sans-serif;
        color: #E6EBFB;
    }

    .style {
        margin-top: 15px;
    }

    h1 {
        font-size: 11px;
        font-family: Tahoma, sans-serif;
        border-bottom: 0px #344566 solid;
        width: 98%;
        text-align: center;
    }
}

@layer layout {
    html {
        scrollbar-color: var(--c-border) var(--c-bg);
    }

    body {
        /* the old rules give the page a margin of one pixel: with it every page is a pixel taller than the window and scrolls */
        margin: 0;
        font-family: var(--font);
        font-size: var(--fs-base);
        /* tight: most pages are tables of short lines */
        line-height: 1.3;
    }

    /* the old rules set 11 px on every cell and field: all text follows the page instead */
    table,
    td,
    th,
    input,
    select,
    textarea,
    button,
    h1 {
        font-size: inherit;
    }

    button {
        font-family: inherit;
    }

    small,
    sub,
    sup,
    font[size="1"] {
        font-size: var(--fs-small);
    }

    :focus-visible {
        outline: 2px solid var(--c-accent);
        outline-offset: 1px;
    }

    /* ---- shell: the menu beside the page, the page no wider than the content width ---- */

    .shell {
        display: grid;
        grid-template-columns: var(--menu-width) minmax(0, 1fr);
        align-items: start;
        min-height: 100vh;
    }

    .shell-no-menu {
        grid-template-columns: minmax(0, 1fr);
    }

    .shell-page {
        min-width: 0;
        max-width: calc(var(--content-width) + 2 * var(--space-3));
        padding: 0 var(--space-3) var(--space-5);
    }

    .topbar {
        position: sticky;
        top: 0;
        z-index: 20;
        border-bottom: 1px solid var(--c-border);
        background: rgb(4 14 30 / 0.92);
        backdrop-filter: blur(4px);
    }

    .topbar-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--space-1) var(--space-4);
        padding: var(--space-1) 0;
    }

    #content {
        padding-top: var(--space-3);
        /* a table too wide for the screen scrolls here, the page itself never scrolls sideways */
        overflow-x: auto;
    }

    /* ---- content written for a 519 px column: tables take the width they are given ---- */

    #content > table,
    #content > form > table,
    #content > center > table,
    #content > center > form > table,
    #content > div > table,
    #content > div > form > table,
    #content table:is([width^="44"], [width^="5"], [width^="6"], [width^="7"]):not([width$="%"]) {
        width: 100%;
    }

    #content :is(input, select, textarea) {
        max-width: 100%;
    }

    /* fields a shade darker than the panel they sit on, buttons a shade lighter */
    :is(input:not([type="submit"], [type="button"], [type="reset"], [type="image"], [type="checkbox"], [type="radio"]), select, textarea) {
        border-color: #5b739f;
        background-color: var(--c-panel-dark);
    }

    input:is([type="submit"], [type="button"], [type="reset"]) {
        border-color: #5b739f;
        background-color: var(--c-border);
        cursor: pointer;
    }

    input:is([type="submit"], [type="button"], [type="reset"]):hover {
        background-color: #4f689a;
    }

    /* fields and form buttons get the height and the corners of .button, so a row of them lines up */
    input:is([type="submit"], [type="button"], [type="reset"]) {
        min-height: 1.875rem;
        padding: 0 var(--space-3);
        border-style: solid;
        border-width: 1px;
        border-radius: var(--radius);
        color: var(--c-text);
    }

    :is(input:not([type="submit"], [type="button"], [type="reset"], [type="image"], [type="checkbox"], [type="radio"], [type="hidden"]), select) {
        min-height: 1.875rem;
        padding: 2px var(--space-2);
        border-style: solid;
        border-width: 1px;
        border-radius: var(--radius);
    }

    textarea {
        padding: var(--space-1) var(--space-2);
        border-style: solid;
        border-width: 1px;
        border-radius: var(--radius);
        line-height: 1.4;
    }

    /* ---- menu ---- */

    .menu {
        color: var(--c-text);
        font-size: var(--fs-base);
    }

    .menu-player {
        margin: var(--space-3) 0;
        text-align: center;
    }

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

    .menu-group ul {
        padding: var(--space-1) 0;
        background: var(--c-panel);
    }

    .menu-heading {
        display: block;
        width: 100%;
        object-fit: cover;
        object-position: bottom;
    }

    .menu-group a {
        display: block;
        padding: 2px var(--space-2);
        color: #fff;
        text-align: center;
    }

    .menu-group a:hover {
        background: var(--c-border);
        color: #fff;
        text-decoration: none;
    }

    .menu-group a.menu-highlight {
        color: var(--c-accent);
    }

    .menu-group a.menu-special {
        color: var(--c-good);
    }

    .menu-group a.menu-current {
        color: var(--c-accent);
    }

    .menu-officers {
        display: none;
    }

    .menu-footer {
        background: var(--c-panel);
        text-align: center;
    }

    .menu-footer p {
        margin: 0;
        padding: 2px var(--space-2);
    }

    @media (min-width: 700px) {
        /* a popover only on a phone: from here on the menu is part of the page */
        .menu {
            display: block;
            position: sticky;
            inset: 0 auto auto;
            width: auto;
            height: auto;
            max-height: 100vh;
            margin: 0;
            padding: 0 var(--space-3) var(--space-3);
            border: 0;
            overflow-y: auto;
            background: none;
            scrollbar-width: thin;
        }
    }

    /* ---- top bar: planet, resources, officers ---- */

    .menu-toggle,
    .topbar-messages {
        display: none;
        flex: none;
        place-items: center;
        width: var(--touch);
        height: var(--touch);
        padding: 0;
        border: 1px solid var(--c-border);
        border-radius: var(--radius);
        background: var(--c-panel);
        color: var(--c-text);
        cursor: pointer;
    }

    .planet-picker {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        min-width: 0;
    }

    .planet-picker img {
        flex: none;
        width: 40px;
        height: 40px;
    }

    .planet-picker select {
        min-width: 0;
        max-width: 13rem;
        padding: 2px var(--space-1);
    }

    .resources {
        display: flex;
        flex: 1 1 auto;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: var(--space-1) var(--space-3);
        margin: 0;
        padding: 0;
        border: 0;
        background: none;
        color: inherit;
        text-align: left;
        /* nothing to open where the full amounts are already shown */
        pointer-events: none;
    }

    /* picture and name on one line, the amount under them */
    .resource {
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: center;
        gap: 0 var(--space-1);
    }

    .resource img {
        width: 32px;
        height: 17px;
    }

    .resource-name {
        font-size: var(--fs-small);
        font-style: italic;
        font-weight: bold;
    }

    .resource-amount {
        grid-column: 1 / -1;
        white-space: nowrap;
    }

    .resource-short {
        display: none;
    }

    .resource-alert :is(.resource-amount, .resource-short, dd) {
        color: var(--c-bad);
    }

    .resources-full {
        inset: 6.5rem 0 auto;
        width: min(22rem, 100vw - 1rem);
        margin: 0 auto;
        padding: var(--space-2) var(--space-4);
        border: 1px solid var(--c-border);
        border-radius: var(--radius);
        background: var(--c-panel);
        color: var(--c-text);
        font-size: var(--fs-large);
    }

    .resources-full::backdrop {
        background: rgb(0 0 0 / 0.5);
    }

    .resources-full div {
        display: flex;
        justify-content: space-between;
        gap: var(--space-4);
        padding: var(--space-1) 0;
    }

    .resources-full dt {
        font-style: italic;
        font-weight: bold;
    }

    .resources-full dd {
        margin: 0;
    }

    .officers {
        display: flex;
        gap: var(--space-1);
        margin: 0 0 0 auto;
        padding: 0;
        list-style: none;
    }

    .officers img,
    .menu-officers img {
        display: block;
    }

    /* a wide screen has the room for the pictures at their own size and for larger amounts */
    @media (min-width: 1400px) {
        .topbar-row {
            gap: var(--space-2) var(--space-5);
            padding: var(--space-2) 0;
        }

        .planet-picker img {
            width: 50px;
            height: 50px;
        }

        .planet-picker select {
            max-width: 16rem;
            padding: var(--space-1) var(--space-2);
            font-size: var(--fs-large);
        }

        .resource {
            gap: 2px var(--space-2);
        }

        .resource img {
            width: 42px;
            height: 22px;
        }

        .resource-name {
            font-size: var(--fs-base);
        }

        .resource-amount {
            font-size: var(--fs-large);
        }

        .officers {
            gap: var(--space-2);
        }

        .officers img {
            width: 40px;
            height: 40px;
        }
    }

    /* ---- phone: the menu is a drawer, the bar shows short amounts in one row ---- */

    @media (max-width: 699.98px) {
        body {
            background-attachment: scroll;
        }

        .shell {
            display: block;
        }

        .shell-page {
            padding: 0 var(--space-2) var(--space-4);
        }

        .menu {
            inset: 0 auto 0 0;
            width: min(18rem, 85vw);
            height: 100dvh;
            max-height: none;
            margin: 0;
            padding: 0 var(--space-3) var(--space-4);
            border: 0;
            border-right: 1px solid var(--c-border);
            background: var(--c-bg);
            font-size: var(--fs-large);
        }

        .menu::backdrop {
            background: rgb(0 0 0 / 0.6);
        }

        .menu-heading {
            height: var(--space-2);
        }

        .menu-group a {
            padding: var(--space-2);
        }

        .menu-officers {
            display: flex;
            justify-content: center;
            gap: var(--space-2);
            padding: var(--space-3) 0;
        }

        .menu-toggle,
        .topbar-messages {
            display: grid;
        }

        .topbar-row {
            gap: var(--space-1) var(--space-2);
        }

        .planet-picker {
            flex: 1 1 0;
        }

        .planet-picker img {
            width: 32px;
            height: 32px;
        }

        .planet-picker select {
            flex: 1 1 0;
            max-width: none;
            min-height: var(--touch);
        }

        .officers {
            display: none;
        }

        .resources {
            flex: 1 0 100%;
            flex-wrap: nowrap;
            justify-content: flex-start;
            gap: var(--space-2);
            min-height: 2rem;
            overflow-x: auto;
            cursor: pointer;
            pointer-events: auto;
            scrollbar-width: none;
        }

        .resource {
            grid-template-columns: auto auto;
            gap: 0 3px;
        }

        .resource img {
            width: 24px;
            height: 13px;
        }

        .resource-name,
        .resource-amount {
            display: none;
        }

        .resource-short {
            display: inline;
            white-space: nowrap;
        }
    }

    @media (max-width: 1099.98px) {
        /* no room for one row: planet and officers share the first, the resources take the second */
        .resources {
            order: 1;
            flex-basis: 100%;
        }

        /* a long field or a text box takes the width of its cell instead of widening the table */
        #content :is(td, th) > :is(textarea, input:is([size^="2"], [size^="3"], [size^="4"], [size^="5"], [size^="6"], [size^="7"]):not([size="2"], [size="3"], [size="4"], [size="5"], [size="6"], [size="7"])) {
            contain: inline-size;
            width: 100%;
            min-width: 7rem;
        }
    }

    /* ---- fingers need bigger targets than a mouse ---- */

    @media (pointer: coarse) {
        input:is([type="submit"], [type="button"], [type="reset"]),
        button,
        select {
            min-height: var(--touch);
        }

        input:is([type="text"], [type="password"], [type="number"], [type="email"], :not([type])) {
            min-height: 2.25rem;
        }

        input:is([type="checkbox"], [type="radio"]) {
            width: 1.375rem;
            height: 1.375rem;
        }

        .menu-group a {
            display: grid;
            place-items: center;
            min-height: var(--touch);
        }

        #content :is(th, td) {
            padding-block: 0.375rem;
        }
    }

    @media (prefers-reduced-motion: reduce) {
        *,
        *::before,
        *::after {
            scroll-behavior: auto !important;
            transition-duration: 0.01ms !important;
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
        }
    }
}

@layer components {
    /* ---- the old signal colours, lightened where they could not be read on the panel colour ---- */

    .attack,
    .flight .attack a,
    .espionage,
    .flight .espionage a,
    .missile,
    .federation,
    .flight .federation a,
    .error,
    .noresources,
    .combatreport,
    .combatreport_ididattack_ilost,
    .combatreport_igotattacked_ilost,
    .status_abbr_strong,
    font:is([color="red" i], [color="#ff0000" i]) {
        color: var(--c-bad);
    }

    .combatreport_ididattack_iwon,
    font[color="green" i] {
        color: #4cd964;
    }

    .ownhold,
    .flight .ownhold a,
    .hold,
    .flight .hold a {
        color: #9fbbd8;
    }

    .return .phalanx_fleet {
        color: #5cc4ff;
    }

    .status_abbr_admin {
        color: #ffa033;
    }

    .status_abbr_outlaw {
        color: #ff80ff;
    }

    .status_abbr_inactive,
    font[color="#7f7f7f" i] {
        color: #b4b4b4;
    }

    .status_abbr_longinactive {
        color: #a0a0a0;
    }

    /* the subject of a stored battle report carries its colour in a style attribute, which only !important reaches */
    #content a[style*="color:green"] {
        color: #4cd964 !important;
    }

    #content a[style*="color:red"] {
        color: var(--c-bad) !important;
    }

    /* a message or report stored as HTML: it keeps the old table markup and scrolls in its own box */
    .stored-html {
        max-width: 100%;
        overflow-x: auto;
    }

    /* ---- button: the look of the form buttons, for <button> and for a link that acts ---- */

    .button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 1.875rem;
        padding: 0 var(--space-3);
        border: 1px solid #5b739f;
        border-radius: var(--radius);
        background: var(--c-border);
        color: var(--c-text);
        font: inherit;
        text-decoration: none;
        white-space: nowrap;
        cursor: pointer;
    }

    .button:hover {
        background: #4f689a;
        color: var(--c-text);
        text-decoration: none;
    }

    /* a button that undoes something that cannot be brought back */
    .button-danger,
    .button-danger:hover {
        border-color: var(--c-bad);
        color: var(--c-bad);
    }

    /* a button that is only its picture */
    .icon-button {
        display: inline-grid;
        place-items: center;
        min-width: 1.5rem;
        min-height: 1.5rem;
        padding: 0;
        border: 0;
        background: none;
        cursor: pointer;
    }

    /* a button and, joined to it, the arrow that opens the rest of its actions */
    .split-button {
        display: inline-flex;
    }

    .split-button > .button:first-child {
        border-radius: var(--radius) 0 0 var(--radius);
    }

    .split-button > .button:nth-child(2) {
        padding: 0 var(--space-2);
        border-left: 0;
        border-radius: 0 var(--radius) var(--radius) 0;
    }

    /* ---- drop-down: a short menu in a popover. It opens under its button; a browser that cannot place it there shows it in the middle of the screen ---- */

    .dropdown {
        padding: var(--space-1);
        border: 1px solid #5b739f;
        border-radius: var(--radius);
        background: var(--c-panel-dark);
        box-shadow: 0 4px 16px rgb(0 0 0 / 0.6);
    }

    .dropdown:popover-open {
        display: grid;
        gap: 2px;
    }

    .dropdown .button {
        justify-content: flex-start;
        border-color: transparent;
        background: none;
    }

    .dropdown .button:hover {
        background: var(--c-border);
    }

    @supports (position-area: bottom) {
        .dropdown {
            inset: auto;
            margin: var(--space-1) 0;
            position-area: bottom span-left;
            position-try-fallbacks: flip-block;
        }
    }

    /* ---- box that opens from a button (x-game.popover): ships of a fleet, an officer, what can be done with a planet ---- */

    /* the button reads as part of the text or shows a picture; the dots under it say there is more */
    .popover-trigger {
        min-height: 0;
        padding: 0;
        border: 0;
        background: none;
        color: inherit;
        font: inherit;
        text-decoration: underline dotted;
        text-underline-offset: 0.2em;
        cursor: pointer;
    }

    .popover-trigger:hover {
        text-decoration-style: solid;
    }

    .popover-trigger:has(> img) {
        display: inline-grid;
        place-items: center;
        vertical-align: middle;
    }

    .popover-trigger > img {
        display: block;
    }

    /* a solid box above the page. Not given a display: closed, it must stay hidden */
    .popover {
        max-width: min(22rem, 100vw - 1rem);
        padding: var(--space-2);
        border: 1px solid #5b739f;
        border-radius: var(--radius);
        background: var(--c-panel-dark);
        box-shadow: 0 4px 16px rgb(0 0 0 / 0.6);
        color: var(--c-text);
        font-size: var(--fs-base);
        font-weight: normal;
        line-height: 1.35;
        text-align: left;
        white-space: normal;
    }

    /* the script puts it at its button; without the script it opens in the middle of the screen */
    .popover-placed {
        inset: auto;
        margin: 0;
    }

    /* :where() keeps this as weak as a class, so the rules after it can set their own margins */
    .popover :where(p, dl, ul) {
        margin: 0;
        padding: 0;
    }

    .popover > * + *,
    .popover-media > div > * + * {
        margin-top: var(--space-2);
    }

    .popover-title {
        margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-2)) 0;
        padding: var(--space-1) var(--space-2);
        border-bottom: 1px solid var(--c-border);
        background: var(--c-panel) url(../upload/skins/xgproyect/img/bg1.gif);
        font-weight: bold;
    }

    /* a name and its amount on each line */
    .popover-list > div {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: var(--space-4);
        padding: 1px 0;
    }

    .popover-list dd {
        margin: 0;
        font-variant-numeric: tabular-nums;
        text-align: right;
        white-space: nowrap;
    }

    .popover-actions {
        list-style: none;
    }

    .popover-actions a {
        display: block;
        padding: 2px var(--space-2);
        border-radius: var(--radius);
    }

    .popover-actions a:hover {
        background: var(--c-border);
        color: var(--c-text);
        text-decoration: none;
    }

    /* a picture with what belongs to it beside it */
    .popover-media {
        display: grid;
        grid-template-columns: auto minmax(8rem, 1fr);
        align-items: start;
        gap: var(--space-3);
    }

    .popover-media > img {
        display: block;
        border: 1px solid var(--c-border);
    }

    @media (pointer: coarse) {
        .popover-trigger:has(> img) {
            min-width: 2.25rem;
            min-height: 2.25rem;
        }

        .popover {
            font-size: var(--fs-large);
        }

        .popover-actions a {
            display: flex;
            align-items: center;
            min-height: var(--touch);
        }
    }

    /* ---- dialog: a small form over the page it belongs to (planet name, phalanx, attack group). The browser centres it; a phone gives it the whole width ---- */

    .dialog {
        width: min(42rem, 100vw - 2rem);
        max-height: calc(100dvh - 2rem);
        padding: 0;
        border: 1px solid #5b739f;
        border-radius: var(--radius);
        background: var(--c-bg);
        box-shadow: 0 8px 32px rgb(0 0 0 / 0.7);
        color: var(--c-text);
    }

    .dialog::backdrop {
        background: rgb(0 0 0 / 0.6);
    }

    /* the bar with the button that closes stays in sight while the content scrolls */
    .dialog-bar {
        position: sticky;
        top: 0;
        z-index: 1;
        display: flex;
        justify-content: flex-end;
        padding: var(--space-1);
        border-bottom: 1px solid var(--c-border);
        background: var(--c-panel-dark);
    }

    .dialog-bar .button {
        min-width: 1.75rem;
        padding: 0;
        font-size: var(--fs-large);
    }

    .dialog-body {
        padding: var(--space-3);
    }

    /* the page's content was written for the content column */
    .dialog-body table {
        width: 100%;
    }

    .dialog-body :is(input, select, textarea) {
        max-width: 100%;
    }

    @media (max-width: 699.98px) {
        .dialog {
            width: 100%;
            max-width: 100%;
            border-inline: 0;
            border-radius: 0;
        }

        .dialog-body {
            padding: var(--space-2);
        }
    }

    @media (pointer: coarse) {
        .dialog-bar .button {
            min-width: var(--touch);
        }
    }

    /* ---- a small form opened as a page of its own: a box of the dialog's width. In the dialog the dialog is the box ---- */

    .form-panel {
        max-width: 42rem;
        padding: var(--space-3);
        border: 1px solid var(--c-border);
        background: var(--c-bg);
    }

    .dialog-body .form-panel {
        max-width: none;
        padding: 0;
        border: 0;
        background: none;
    }

    /* ---- a label, its field and its button on a line; the field takes the room that is left ---- */

    .form-line {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--space-2);
        padding: var(--space-2) 0;
    }

    .form-line > input:is([type="text"], [type="password"]) {
        flex: 1 1 10rem;
        min-width: 0;
    }

    /* ---- tabs: links to the parts of a page, each with its amount ---- */

    .tabs {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-1);
        padding: var(--space-2);
    }

    .tab {
        display: inline-flex;
        flex: 0 1 auto;
        align-items: center;
        justify-content: center;
        gap: var(--space-2);
        min-height: 1.75rem;
        padding: 0 var(--space-3);
        border: 1px solid var(--c-border);
        border-radius: var(--radius);
        background: var(--c-panel-dark);
        white-space: nowrap;
    }

    .tab:hover {
        border-color: #5b739f;
        background: var(--c-border);
        color: var(--c-text);
        text-decoration: none;
    }

    .tab-current {
        border-color: var(--c-accent);
        background: var(--c-border);
        font-weight: bold;
    }

    .tab-count {
        color: var(--c-text-muted);
        font-weight: normal;
    }

    .badge {
        min-width: 1.25rem;
        padding: 0 0.375rem;
        border-radius: 1rem;
        background: var(--c-accent);
        color: #000;
        font-size: var(--fs-small);
        font-weight: bold;
        text-align: center;
    }

    /* ---- page links under a list ---- */

    .pagination {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-2);
        padding: var(--space-2);
    }

    .pagination ul {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-1);
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .pagination p {
        margin: 0;
        color: var(--c-text-muted);
    }

    .pagination :is(a, span) {
        display: grid;
        place-items: center;
        min-width: 1.75rem;
        height: 1.75rem;
        padding: 0 var(--space-2);
        border: 1px solid var(--c-border);
        border-radius: var(--radius);
        background: var(--c-panel-dark);
    }

    .pagination a:hover {
        border-color: #5b739f;
        background: var(--c-border);
        color: var(--c-text);
        text-decoration: none;
    }

    .pagination [aria-current] {
        border-color: var(--c-accent);
        background: var(--c-border);
        font-weight: bold;
    }

    .pagination [aria-disabled] {
        border-color: transparent;
        background: none;
        color: var(--c-text-muted);
    }

    @media (pointer: coarse) {
        .button,
        .tab {
            min-height: var(--touch);
        }

        .split-button > .button:nth-child(2) {
            min-width: var(--touch);
        }

        .pagination :is(a, span) {
            min-width: var(--touch);
            height: var(--touch);
        }
    }

    /* ---- espionage report. It is saved in the message as HTML: reports sent with this markup need these rules for good ---- */

    .spy-report {
        white-space: normal;
    }

    .spy-section {
        margin-bottom: var(--space-2);
    }

    .spy-title {
        padding: 2px var(--space-2);
        border: 1px solid var(--c-border);
        background: var(--c-panel) url(../upload/skins/xgproyect/img/bg1.gif);
        font-weight: bold;
    }

    summary.spy-title {
        cursor: pointer;
    }

    .spy-count {
        color: var(--c-text-muted);
        font-weight: normal;
    }

    /* label and amount in pairs: two beside each other, four where the report is wide enough */
    .spy-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 var(--space-5);
        margin: 0;
        padding: var(--space-1) var(--space-2) 0;
    }

    .spy-grid > div {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: var(--space-2);
        padding: 2px 0;
        border-bottom: 1px solid rgb(255 255 255 / 0.08);
    }

    .spy-grid dd {
        margin: 0;
        font-variant-numeric: tabular-nums;
        text-align: right;
        white-space: nowrap;
    }

    .spy-foot {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-2);
        margin: var(--space-3) 0 0;
    }

    @container (min-width: 46rem) {
        .spy-grid {
            grid-template-columns: repeat(4, minmax(0, 1fr));
        }
    }

    /* ---- small pieces pages share ---- */

    /* text for screen readers only */
    .visually-hidden {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    /* the title bar of a block of the page: the look of the title row of the table pages (td.c) */
    .panel-title {
        width: auto;
        margin: 0;
        padding: 2px var(--space-2);
        border: 1px solid var(--c-border);
        background: var(--c-panel) url(../upload/skins/xgproyect/img/bg1.gif);
        font-size: inherit;
        font-weight: bold;
        text-align: left;
    }

    /* a line above the page's content that says why something cannot be done now */
    .page-warning {
        margin: 0 0 var(--space-2);
        padding: var(--space-1) var(--space-2);
        border: 1px solid var(--c-bad);
        border-radius: var(--radius);
        background: var(--c-panel-dark);
        color: var(--c-bad);
    }

    /* a line that answers what the player just did (x-notice): done, failed, or something to know */
    .page-notice {
        margin: 0 0 var(--space-2);
        padding: var(--space-1) var(--space-2);
        border: 2px solid var(--c-bad);
        border-radius: var(--radius);
        background: var(--c-panel-dark);
        text-align: center;
    }

    .page-notice-good {
        border-color: var(--c-good);
    }

    .page-notice-info {
        border-color: #1df0f0;
    }

    /* the old shell centred the notice under the bar; the bar's own one keeps a little air */
    .topbar > .page-notice {
        margin: 0 0 var(--space-1);
    }

    /* the number of unread messages, on the menu entry and on the phone bar's envelope */
    .menu-group a .badge {
        display: inline-block;
        margin-left: var(--space-1);
    }

    .topbar-messages {
        position: relative;
    }

    .topbar-messages .badge {
        position: absolute;
        top: -0.25rem;
        right: -0.25rem;
    }

    /* ---- build lists (buildings, research, ships, defences): one card per row, its picture at full size ---- */

    .build-grid {
        container: build / inline-size;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-1);
        margin: 0;
        padding: 0;
        list-style: none;
    }

    /* picture, text, and what can be done with it */
    .build-card {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
        gap: var(--space-2) var(--space-4);
        padding: var(--space-2);
        border: 1px solid var(--c-border);
        background: var(--c-panel) url(../upload/skins/xgproyect/img/bg2.gif);
    }

    .build-card-picture {
        align-self: start;
    }

    /* 120 px is the size the pictures were drawn at */
    .build-card-picture img {
        display: block;
        width: 120px;
        height: 120px;
        border: 1px solid var(--c-border);
        border-radius: var(--radius);
    }

    .build-card-picture:hover img {
        border-color: var(--c-link-hover);
    }

    .build-card-body {
        display: grid;
        gap: var(--space-2);
        min-width: 0;
    }

    .build-card-name {
        margin: 0;
        font-size: var(--fs-large);
        font-weight: normal;
    }

    .build-card-name a {
        font-weight: bold;
    }

    .build-card-bonus {
        color: var(--c-good);
    }

    /* the description, three lines of it at most; the page behind the name has all of it */
    .build-card-text {
        display: -webkit-box;
        max-width: 95ch;
        margin: 0;
        overflow: hidden;
        color: var(--c-text-muted);
        line-height: 1.4;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }

    .build-card-costs {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-1) var(--space-4);
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .cost {
        display: inline-flex;
        align-items: center;
        gap: var(--space-1);
        white-space: nowrap;
    }

    .cost img {
        width: 32px;
        height: 17px;
    }

    .cost b {
        color: var(--c-good);
    }

    .cost-missing b,
    .cost-short {
        color: var(--c-bad);
    }

    .build-card-action {
        display: grid;
        justify-items: center;
        gap: var(--space-1);
        min-width: 11rem;
        text-align: center;
    }

    .build-card-time,
    .build-level,
    .build-origin {
        white-space: nowrap;
    }

    .build-card-time,
    .build-idle {
        color: var(--c-text-muted);
    }

    /* green orders, red cannot: the colours the lists always had */
    .build-order,
    .build-blocked {
        min-width: 9rem;
        padding-block: var(--space-2);
        font-size: var(--fs-large);
        text-align: center;
    }

    .build-order,
    .build-order:hover {
        color: var(--c-good);
        font-weight: bold;
    }

    .build-blocked,
    .build-blocked:hover {
        border-style: dashed;
        background: none;
        color: var(--c-bad);
        cursor: default;
    }

    .build-note {
        max-width: 11rem;
        color: var(--c-bad);
    }

    /* the countdown of the work under way, as its script writes it: "time <br> link" */
    .build-card-action #brp {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--space-1);
        font-size: var(--fs-large);
        font-variant-numeric: tabular-nums;
        font-weight: bold;
    }

    .build-card-action #brp br {
        display: none;
    }

    .build-card-action #brp a {
        padding: var(--space-1) var(--space-3);
        border: 1px solid #5b739f;
        border-radius: var(--radius);
        background: var(--c-border);
        font-size: var(--fs-base);
        font-weight: normal;
    }

    .build-card-action #brp a:hover {
        background: #4f689a;
        text-decoration: none;
    }

    .build-amount {
        display: inline-flex;
        gap: var(--space-1);
    }

    .build-amount input {
        width: 6rem;
        min-height: 2rem;
        font-size: var(--fs-large);
        text-align: right;
    }

    /* a narrow screen: a smaller picture, and what can be done moves under the text, the button at the thumb's side */
    @container build (max-width: 640px) {
        .build-card {
            grid-template-columns: auto minmax(0, 1fr);
            gap: var(--space-2);
        }

        .build-card-picture img {
            width: 88px;
            height: 88px;
        }

        .build-card-body {
            gap: var(--space-1);
        }

        .build-card-text {
            -webkit-line-clamp: 2;
            line-clamp: 2;
        }

        .build-card-action {
            grid-column: 1 / -1;
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            justify-content: flex-end;
            gap: var(--space-1) var(--space-2);
            min-width: 0;
        }

        .build-level {
            order: -2;
        }

        .build-card-time {
            order: -1;
            margin-right: auto;
        }

        .build-note {
            max-width: none;
        }

        .build-card-action #brp {
            flex-direction: row;
            gap: var(--space-2);
        }
    }

    /* the button that sends a form (the amounts of a list, the ships of a fleet) stays at the bottom of the screen */
    .build-bar,
    .action-bar {
        position: sticky;
        bottom: 0;
        z-index: 10;
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: var(--space-1) var(--space-2);
        margin-top: var(--space-1);
        padding: var(--space-1) var(--space-1) max(var(--space-1), env(safe-area-inset-bottom));
        border: 1px solid var(--c-border);
        background: var(--c-panel) url(../upload/skins/xgproyect/img/bg1.gif);
    }

    :is(.build-bar, .action-bar) input[type="submit"] {
        min-width: 10rem;
        min-height: 2rem;
        font-weight: bold;
    }

    .action-bar .button {
        min-height: 2rem;
    }

    /* sticky needs the window as its scroller; these pages have nothing wide to scroll inside the content */
    #content:has(.build-bar, .action-bar) {
        overflow: visible;
    }

    /* ---- queue: what is being built, under the top bar and sticky with it ---- */

    .queue {
        padding: var(--space-1) 0;
        border-top: 1px solid var(--c-border);
    }

    .queue-now {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--space-1) var(--space-3);
        font-variant-numeric: tabular-nums;
    }

    .queue-name,
    .queue-label {
        font-weight: bold;
    }

    .queue-name i,
    .queue-chip i {
        color: var(--c-bad);
        font-weight: normal;
    }

    /* the part that is done; it fills up in the time that is left, without a script */
    .queue-bar {
        flex: 1 1 4rem;
        height: 0.5rem;
        overflow: hidden;
        border: 1px solid var(--c-border);
        border-radius: 1rem;
        background: var(--c-panel-dark);
    }

    .queue-bar::before {
        content: "";
        display: block;
        width: var(--done);
        height: 100%;
        background: var(--c-accent);
        animation: queue-fill var(--left) linear forwards;
    }

    @keyframes queue-fill {
        to {
            width: 100%;
        }
    }

    @media (prefers-reduced-motion: reduce) {
        /* the bar shows where the work stood when the page was loaded */
        .queue-bar::before {
            animation: none;
        }
    }

    /* the countdown scripts write "time <br> link" into their box: here both stand on the line, the link last */
    .queue-now #blc {
        display: contents;
    }

    :is(.queue-now, .planet-work) #blc br {
        display: none;
    }

    :is(.queue-now, .planet-work) #blc a {
        order: 1;
        padding: 0 var(--space-2);
        border: 1px solid #5b739f;
        border-radius: var(--radius);
        background: var(--c-border);
        font-weight: normal;
    }

    :is(.queue-now, .planet-work) #blc a:hover {
        background: #4f689a;
        text-decoration: none;
    }

    .queue-now #bx {
        flex: 1 1 auto;
    }

    .queue-end {
        color: var(--c-good);
        white-space: nowrap;
    }

    .queue-waiting {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-1);
        margin: var(--space-1) 0 0;
        padding: 0;
        list-style: none;
    }

    .queue-chip {
        display: inline-flex;
        flex: none;
        align-items: stretch;
        border: 1px solid var(--c-border);
        border-radius: var(--radius);
        background: var(--c-panel);
        white-space: nowrap;
    }

    .queue-chip span {
        align-self: center;
        padding: 0 var(--space-2);
    }

    .queue-remove {
        display: grid;
        place-items: center;
        min-width: 1.5rem;
        min-height: 1.5rem;
        border-left: 1px solid var(--c-border);
        color: var(--c-bad);
        font-size: var(--fs-large);
        line-height: 1;
    }

    .queue-remove:hover {
        background: var(--c-border);
        color: var(--c-bad);
        text-decoration: none;
    }

    /* the orders of the shipyard, opened from the strip */
    #shipyard-orders select {
        min-width: min(18rem, 80vw);
    }

    @media (max-width: 699.98px) {
        /* the bar must not grow with the list: the order under way on a line, under it its cancel link and the waiting orders on one row that scrolls sideways */
        .queue:has(.queue-waiting) {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: var(--space-1) var(--space-2);
            font-variant-numeric: tabular-nums;
        }

        .queue:has(.queue-waiting) .queue-now {
            display: contents;
        }

        .queue:has(.queue-waiting) .queue-now::after {
            content: "";
            flex-basis: 100%;
            order: 1;
        }

        .queue:has(.queue-waiting) #blc a {
            order: 2;
        }

        .queue-waiting {
            flex: 1 1 0;
            flex-wrap: nowrap;
            order: 2;
            min-width: 0;
            margin: 0;
            overflow-x: auto;
            scrollbar-width: none;
        }
    }

    @media (pointer: coarse) {
        .queue-remove {
            min-width: var(--touch);
            min-height: 2.25rem;
        }

        :is(.queue-now, .planet-work) #blc a,
        .build-card-action :is(#brp a, .button) {
            display: inline-flex;
            align-items: center;
            min-height: var(--touch);
        }

        .build-card-action #brp a {
            padding: 0 var(--space-3);
        }

        :is(.build-bar, .action-bar) input[type="submit"] {
            flex: 1 1 auto;
        }

        .events-more summary {
            padding-block: 0.75rem;
        }

        .menu-group a:has(.badge) {
            grid-auto-flow: column;
            justify-content: center;
            gap: var(--space-2);
        }
    }

    /* a phone held sideways has no room for a bar that carries a queue: it scrolls away with the page */
    @media (max-height: 480px) {
        .topbar:has(.queue) {
            position: static;
        }
    }

    /* ---- fleet events (overview, phalanx): countdown and arrival on one line, then what happens ---- */

    .event-when {
        font-variant-numeric: tabular-nums;
        text-align: left;
        white-space: nowrap;
    }

    .event-when > div {
        display: inline-block;
        min-width: 4.5em;
        margin-right: var(--space-2);
        text-align: right;
    }

    .event-when time {
        color: var(--c-good);
    }

    .event-text {
        text-align: left;
    }

    .events {
        container: events / inline-size;
    }

    .events table {
        width: 100%;
    }

    .events .event-when {
        width: 11rem;
    }

    @container events (max-width: 520px) {
        /* a fleet per block: when it arrives, then what it does */
        .events :is(table, tbody, tr, th) {
            display: block;
        }

        .events tr {
            margin-top: 2px;
            border: 1px solid var(--c-border);
            background: var(--c-panel);
        }

        .events th {
            width: auto;
            border: 0;
            background: none;
        }

        .events .event-text {
            padding-top: 0;
        }
    }

    /* ---- panel: a titled block of a page ---- */

    /* one colour: the picture the cards use (bg2.gif) starts again every 301 px, which shows as stripes in a tall block */
    .panel {
        margin: 0 0 var(--space-2);
        border: 1px solid var(--c-border);
        background: var(--c-panel);
    }

    /* a title that stands on the list it names */
    .panel-title:has(+ .table, + .table-scroll, + .table-wrap, + form > .table:first-child) {
        border-bottom: 0;
    }

    .panel > .panel-title {
        border-width: 0 0 1px;
    }

    .panel-body {
        padding: var(--space-2);
    }

    .panel-body > :first-child {
        margin-top: 0;
    }

    .panel-body > :last-child {
        margin-bottom: 0;
    }

    /* a title with something to do at its other end */
    .panel-title:has(> a, > span, > button) {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-1) var(--space-3);
    }

    .muted {
        color: var(--c-text-muted);
    }

    .good {
        color: var(--c-good);
    }

    .bad {
        color: var(--c-bad);
    }

    .warn {
        color: var(--c-warn);
    }

    /* ---- bar: a row of fields and buttons above or under a list ---- */

    .toolbar {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--space-1) var(--space-3);
        margin: 0 0 var(--space-2);
        padding: var(--space-1) var(--space-2);
        border: 1px solid var(--c-border);
        background: var(--c-panel) url(../upload/skins/xgproyect/img/bg1.gif);
    }

    .toolbar > form,
    .toolbar-group {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--space-1) var(--space-2);
    }

    .toolbar-end {
        margin-left: auto;
    }

    .toolbar :is(input, select, .button) {
        min-height: 1.75rem;
    }

    /* ---- table: rows of data. Headings left, numbers right; a table too wide for the screen scrolls in its own box ---- */

    .table-scroll {
        max-width: 100%;
        margin: 0 0 var(--space-2);
        overflow-x: auto;
    }

    .table {
        width: 100%;
        margin: 0 0 var(--space-2);
        border-collapse: collapse;
    }

    .table-scroll > .table {
        margin: 0;
    }

    .table caption {
        padding: 2px var(--space-2);
        border: 1px solid var(--c-border);
        border-bottom: 0;
        background: var(--c-panel) url(../upload/skins/xgproyect/img/bg1.gif);
        font-weight: bold;
        text-align: left;
    }

    .table :is(th, td) {
        height: 2rem;
        padding: 3px var(--space-2);
        border: 1px solid var(--c-border);
        background: var(--c-panel);
        font-weight: normal;
        text-align: left;
        vertical-align: middle;
    }

    /* the title of a group of rows (table-group) looks like the head of the columns */
    .table thead th,
    .table tr.table-group > * {
        background-image: url(../upload/skins/xgproyect/img/bg1.gif);
        font-weight: bold;
        white-space: nowrap;
    }

    .table tbody th {
        font-weight: bold;
    }

    .table tbody tr:hover > * {
        background-color: #3b4e73;
    }

    .table :is(th, td).num {
        font-variant-numeric: tabular-nums;
        text-align: right;
        white-space: nowrap;
    }

    .table :is(th, td).center {
        text-align: center;
    }

    .table :is(th, td).nowrap {
        white-space: nowrap;
    }

    .table :is(th, td).shrink {
        width: 1%;
        white-space: nowrap;
    }

    .table-empty {
        color: var(--c-text-muted);
        text-align: center !important;
    }

    .table td > form {
        display: inline;
    }

    /* a narrow list: each row becomes a block, each cell a line that names itself (data-label) */
    .table-wrap {
        container: table / inline-size;
        margin: 0 0 var(--space-2);
    }

    .table-wrap > .table {
        margin: 0;
    }

    @container table (max-width: 560px) {
        .table-stack thead {
            display: none;
        }

        .table-stack,
        .table-stack :is(caption, tbody) {
            display: block;
        }

        /* the name of the row on a line of its own, then what belongs to it in two columns */
        .table-stack tr {
            display: grid;
            grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
            gap: 0 var(--space-2);
            margin-top: var(--space-1);
            border: 1px solid var(--c-border);
            background: var(--c-panel);
        }

        .table-stack :is(th, td),
        .table-stack :is(th, td).num,
        .table-stack :is(th, td).shrink,
        .table-stack :is(th, td).center {
            width: auto;
            height: auto;
            min-height: 1.75rem;
            padding-block: var(--space-1);
            border: 0;
            background: none;
            text-align: left;
            white-space: normal;
            overflow-wrap: anywhere;
        }

        .table-stack :is(th, td:not([data-label])) {
            grid-column: 1 / -1;
        }

        .table-stack td[data-label]::before {
            content: attr(data-label) " ";
            color: var(--c-text-muted);
            font-weight: normal;
        }

        .table-stack td:empty {
            display: none;
        }

        .table-stack tbody tr:hover > * {
            background: none;
        }

        .table-stack tr.table-group {
            margin-top: var(--space-2);
            background-image: url(../upload/skins/xgproyect/img/bg1.gif);
        }
    }

    /* ---- form: a label and its field on a line, the field under the label where the line is short ---- */

    .form {
        container: form / inline-size;
    }

    /* the label's column stops growing at 22 rem: on a wide page the field stays near its label */
    .form-row {
        display: grid;
        grid-template-columns: minmax(8rem, min(38%, 22rem)) minmax(0, 1fr);
        align-items: center;
        gap: var(--space-1) var(--space-3);
        min-height: 2.25rem;
        padding: var(--space-1) var(--space-2);
        border-top: 1px solid rgb(255 255 255 / 0.08);
    }

    .form-row:first-child,
    .panel-title + .form-row {
        border-top: 0;
    }

    .form-row > :is(label, .form-label) {
        font-weight: bold;
    }

    .form-row small,
    .form-hint {
        display: block;
        color: var(--c-text-muted);
        font-weight: normal;
    }

    .form-field {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--space-1) var(--space-2);
        min-width: 0;
    }

    .form-field > :is(input:is([type="text"], [type="password"], [type="email"], [type="url"]), select) {
        flex: 1 1 12rem;
        min-width: 0;
        max-width: 28rem;
    }

    /* a text is written in a box as wide as a line can be read */
    .form-field > textarea {
        flex: 1 1 12rem;
        min-width: 0;
        max-width: 56rem;
    }

    /* a row that is one thing: a text, a tick box with its label */
    .form-row-wide {
        grid-template-columns: minmax(0, 1fr);
    }

    /* a heading inside a form, and a text between its rows */
    .form-heading {
        margin: 0;
        padding: var(--space-1) var(--space-2);
        border-block: 1px solid var(--c-border);
        background: var(--c-panel-dark);
        font-size: inherit;
        text-align: left;
    }

    .panel-title + .form-heading {
        border-top: 0;
    }

    .form-text {
        max-width: 75ch;
        margin: 0;
        padding: var(--space-2);
        color: var(--c-text-muted);
        line-height: 1.45;
    }

    .form-text p {
        margin: 0 0 var(--space-2);
    }

    .form-text > :last-child {
        margin-bottom: 0;
    }

    .form-actions {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: var(--space-2);
        padding: var(--space-2);
        border-top: 1px solid var(--c-border);
    }

    .form-actions :is(input, button, .button) {
        min-width: 8rem;
        min-height: 2.125rem;
    }

    /* options: its three blocks beside each other where the screen has the room */
    .preferences {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(min(30rem, 100%), 1fr));
        align-items: start;
        gap: 0 var(--space-2);
    }

    .preferences .form-row {
        grid-template-columns: minmax(8rem, 42%) minmax(0, 1fr);
    }

    @container form (max-width: 480px) {
        /* a row that only shows a value, or has a short field, keeps its line (form-row-inline) */
        .form-row:not(.form-row-inline) {
            grid-template-columns: minmax(0, 1fr);
        }

        .form-row-inline {
            grid-template-columns: minmax(0, auto) minmax(0, 1fr);
        }

        .form-row-inline > :last-child {
            justify-self: end;
            text-align: right;
        }

        .form-row-inline > .form-field {
            flex-wrap: nowrap;
        }

        .form-row-inline > .form-field > select {
            flex: 0 1 auto;
        }
    }

    @media (pointer: coarse) {
        .table :is(th, td) {
            height: 2.25rem;
        }

        .form-row {
            min-height: var(--touch);
        }
    }
}

@layer pages {
    /* ---- messages: tabs, then one line per message with its body folded under it ---- */

    .messages {
        /* width of the column of tick boxes */
        --message-check: 2.25rem;

        container-type: inline-size;
        border: 1px solid var(--c-border);
        background: var(--c-panel);
    }

    /* the look of the title row of the table pages (td.c) */
    .messages-title {
        width: auto;
        height: auto;
        margin: 0;
        padding: 2px var(--space-2);
        border: 0;
        border-bottom: 1px solid var(--c-border);
        background: var(--c-panel) url(../upload/skins/xgproyect/img/bg1.gif);
        font-weight: bold;
        text-align: left;
    }

    .messages-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-2);
        padding: var(--space-1) var(--space-2) var(--space-1) 0;
        border-block: 1px solid var(--c-border);
        background: var(--c-panel-dark);
    }

    /* its box stands in the column of the boxes it ticks */
    .messages-all {
        display: inline-grid;
        grid-template-columns: var(--message-check) auto;
        align-items: center;
        justify-items: center;
        min-height: 1.75rem;
        cursor: pointer;
    }

    .messages-empty {
        margin: 0;
        padding: var(--space-4) var(--space-2);
        border-top: 1px solid var(--c-border);
        color: var(--c-text-muted);
        text-align: center;
    }

    .messages-operators {
        margin: var(--space-3) 0 0;
        color: var(--c-text-muted);
    }

    .messages .pagination {
        border-top: 1px solid var(--c-border);
    }

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

    /* the tick box lies on the left end of the line, so the body under the line can take the whole width */
    .message {
        display: grid;
        grid-template-columns: var(--message-check) minmax(0, 1fr);
        align-items: start;
    }

    .message > details {
        grid-area: 1 / 1 / 2 / 3;
    }

    .message + .message {
        border-top: 1px solid var(--c-border);
    }

    .message:has(> details[open]) {
        background: var(--c-panel-dark);
    }

    /* the label is the target: wider than the box in it */
    .message-check {
        display: grid;
        z-index: 1;
        grid-area: 1 / 1;
        place-items: center;
        min-height: 1.75rem;
        cursor: pointer;
    }

    .message-head {
        display: grid;
        grid-template-columns: 0.5rem 8.5rem minmax(7rem, 13rem) minmax(0, 1fr) auto 1.25rem;
        grid-template-areas: "dot time from subject reply arrow";
        align-items: center;
        gap: 0 var(--space-2);
        min-height: 1.75rem;
        padding: 0 var(--space-2) 0 var(--message-check);
        list-style: none;
        cursor: pointer;
    }

    .message-head::-webkit-details-marker {
        display: none;
    }

    .message-head:hover {
        background: rgb(255 255 255 / 0.05);
    }

    /* the arrow that tells an open message from a closed one */
    .message-head::after {
        content: "";
        grid-area: arrow;
        justify-self: center;
        width: 0.5rem;
        height: 0.5rem;
        border: solid var(--c-text-muted);
        border-width: 0 2px 2px 0;
        rotate: -45deg;
        transition: rotate 0.15s;
    }

    details[open] > .message-head::after {
        rotate: 45deg;
    }

    .message-bodiless .message-head {
        cursor: default;
    }

    .message-bodiless .message-head::after {
        visibility: hidden;
    }

    .message-dot {
        grid-area: dot;
        width: 0.5rem;
        height: 0.5rem;
        border-radius: 50%;
    }

    .message-unread .message-dot {
        background: var(--c-accent);
    }

    .message-time {
        grid-area: time;
        color: var(--c-text-muted);
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
    }

    .message-from {
        grid-area: from;
    }

    .message-subject {
        grid-area: subject;
    }

    .message-from,
    .message-subject {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .message-unread :is(.message-from, .message-subject) {
        font-weight: bold;
    }

    details[open] .message-subject {
        white-space: normal;
    }

    .message-reply {
        display: grid;
        grid-area: reply;
        place-items: center;
        min-width: 1.75rem;
        min-height: 1.75rem;
    }

    /* text as it was written: its line breaks kept, in a column narrow enough to read */
    .message-text {
        max-width: calc(75ch + var(--message-check) + var(--space-4));
        padding: var(--space-2) var(--space-2) var(--space-3) calc(var(--message-check) + var(--space-4));
        line-height: 1.45;
        white-space: pre-line;
        overflow-wrap: break-word;
    }

    /* a report fills the width */
    .message-text:has(table, .spy-report) {
        max-width: none;
    }

    .message-text table {
        white-space: normal;
    }

    @container (max-width: 44rem) {
        /* one row of tabs that scrolls sideways */
        .tabs {
            flex-wrap: nowrap;
            overflow-x: auto;
            scrollbar-width: none;
        }

        .tab {
            flex: none;
        }

        .message-head {
            grid-template-columns: 0.5rem auto minmax(0, 1fr) auto 1.25rem;
            grid-template-areas:
                "dot time from reply arrow"
                ". subject subject reply arrow";
            padding-block: var(--space-1);
        }

        .message-subject {
            white-space: normal;
        }

        .message-text {
            padding-left: var(--space-2);
        }

        .spy-grid {
            column-gap: var(--space-4);
        }
    }

    @media (pointer: coarse) {
        .messages {
            --message-check: 3rem;
        }

        .message-check,
        .message-head,
        .messages-all {
            min-height: var(--touch);
        }

        .message-reply {
            min-width: var(--touch);
            min-height: var(--touch);
        }
    }

    /* ---- galaxy: the bar that moves through the systems, the fifteen positions, the answers to the quick actions ---- */

    .galaxy {
        display: flex;
        flex-direction: column;
    }

    .galaxy-nav input[type="number"] {
        width: 4.5rem;
        text-align: center;
    }

    .galaxy-stock,
    .galaxy-foot {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0 var(--space-4);
        margin: 0 0 var(--space-2);
        padding: 2px var(--space-2);
        border: 1px solid var(--c-border);
        background: var(--c-panel);
    }

    .galaxy-foot {
        justify-content: space-between;
        background-image: url(../upload/skins/xgproyect/img/bg1.gif);
        font-weight: bold;
    }

    .galaxy-table {
        margin: 0;
    }

    .galaxy-table :is(th, td) {
        height: 34px;
        padding-block: 2px;
        text-align: center;
    }

    /* the planet at 48 px, moon and debris a size smaller */
    .galaxy-table .popover-trigger > img {
        border: 1px solid var(--c-border);
        border-radius: var(--radius);
    }

    .galaxy-table .popover-trigger:hover > img {
        border-color: var(--c-link-hover);
    }

    .galaxy-planet img {
        width: 48px;
        height: 48px;
    }

    :is(.galaxy-moon, .galaxy-debris) img {
        width: 36px;
        height: 36px;
    }

    .galaxy-name {
        font-weight: bold;
    }

    .galaxy-position {
        width: 4%;
    }

    .galaxy-planet {
        width: 5%;
        min-width: 60px;
    }

    .galaxy-name {
        width: 23%;
    }

    .galaxy-moon,
    .galaxy-debris {
        width: 6%;
    }

    .galaxy-player {
        width: 25%;
    }

    .galaxy-alliance {
        width: 14%;
    }

    .galaxy-actions {
        white-space: nowrap;
    }

    .galaxy-actions a {
        display: inline-grid;
        place-items: center;
        min-width: 2rem;
        min-height: 2rem;
        border-radius: var(--radius);
        vertical-align: middle;
    }

    .galaxy-actions a:hover {
        background: var(--c-border);
    }

    .galaxy-status {
        padding: var(--space-1) var(--space-2);
        border: 1px solid var(--c-border);
        border-top: 0;
        background: var(--c-panel-dark);
        font-weight: bold;
    }

    .galaxy-status table {
        width: 100%;
    }

    .galaxy-status td {
        padding: 0 var(--space-2) 0 0;
        border: 0;
        background: none;
    }

    .galaxy-foot {
        border-top: 0;
    }

    .galaxy-missiles .panel-body {
        gap: var(--space-2) var(--space-4);
    }

    @media (max-width: 699.98px) {
        /* the bar sticks to the window, not to a box that scrolls sideways; nothing here is wider than the screen */
        #content:has(.galaxy) {
            overflow: visible;
        }

        /* under the thumb: the bar stands under the system and stays at the bottom of the screen; the way to an expedition follows it */
        .galaxy-nav {
            display: contents;
        }

        .galaxy-nav form {
            position: sticky;
            bottom: 0;
            z-index: 10;
            order: 1;
            flex-wrap: nowrap;
            align-items: end;
            justify-content: space-between;
            gap: var(--space-1);
            margin: var(--space-2) 0 0;
            padding: var(--space-1) var(--space-2) max(var(--space-1), env(safe-area-inset-bottom));
            border: 1px solid var(--c-border);
            background: var(--c-panel) url(../upload/skins/xgproyect/img/bg1.gif);
        }

        .galaxy-nav .toolbar-group {
            display: grid;
            grid-template-columns: auto auto auto;
            gap: 0 2px;
        }

        .galaxy-nav label {
            grid-column: 1 / -1;
            font-size: var(--fs-small);
            text-align: center;
        }

        .galaxy-nav :is(.button, input) {
            min-width: 2.5rem;
            min-height: var(--touch);
        }

        .galaxy-nav input[type="number"] {
            width: 3.25rem;
            padding: 0 2px;
        }

        .galaxy-nav .toolbar-end {
            order: 2;
            margin: var(--space-2) 0 0;
        }

        /* a position per block: name and player beside each other, what can be done and the alliance under them */
        .galaxy-table thead {
            display: none;
        }

        .galaxy-table,
        .galaxy-table tbody {
            display: block;
        }

        .galaxy-planet img {
            width: 40px;
            height: 40px;
        }

        :is(.galaxy-moon, .galaxy-debris) img {
            width: 28px;
            height: 28px;
        }

        .galaxy-table .galaxy-planet {
            min-width: 0;
        }

        .galaxy-table tr {
            display: grid;
            grid-template-columns: 1.75rem 3rem minmax(0, 1fr) 4.75rem minmax(0, 1fr);
            grid-template-areas:
                "position planet name bodies player"
                "position planet actions actions alliance";
            align-items: center;
            min-height: 2.25rem;
            border: 1px solid var(--c-border);
            border-top: 0;
            background: var(--c-panel);
        }

        .galaxy-table tr:first-child {
            border-top: 1px solid var(--c-border);
        }

        .galaxy-table tr.galaxy-free {
            min-height: 1.5rem;
            color: var(--c-text-muted);
        }

        .galaxy-table :is(th, td) {
            width: auto;
            height: auto;
            padding: 2px var(--space-1);
            border: 0;
            background: none;
            overflow-wrap: anywhere;
        }

        .galaxy-table tbody tr:hover > * {
            background: none;
        }

        .galaxy-table td:empty {
            padding: 0;
        }

        .galaxy-table .galaxy-position {
            grid-area: position;
        }

        .galaxy-table .galaxy-planet {
            grid-area: planet;
        }

        .galaxy-table .galaxy-name {
            grid-area: name;
            text-align: left;
        }

        /* moon and debris share a column: the moon on its left, the debris on its right */
        .galaxy-table .galaxy-moon,
        .galaxy-table .galaxy-debris {
            grid-area: bodies;
        }

        .galaxy-table .galaxy-moon {
            justify-self: start;
        }

        .galaxy-table .galaxy-debris {
            justify-self: end;
        }

        .galaxy-table .galaxy-player {
            grid-area: player;
            text-align: right;
        }

        .galaxy-table .galaxy-alliance {
            grid-area: alliance;
            text-align: right;
        }

        .galaxy-table .galaxy-actions {
            grid-area: actions;
            justify-self: start;
        }

        .galaxy-actions a {
            min-width: 2.5rem;
            min-height: 2.25rem;
        }

        .galaxy-stock {
            justify-content: space-between;
            gap: 0 var(--space-2);
        }
    }

    /* ---- galaxy: the legend of the status letters ---- */

    .galaxy-legend > div {
        justify-content: flex-start;
        gap: var(--space-3);
    }

    .galaxy-legend dt {
        flex: none;
        min-width: 1.5rem;
        font-weight: bold;
    }

    .galaxy-legend dd {
        text-align: left;
        white-space: normal;
    }

    /* ---- fleet: ships, then target and speed, then mission and cargo ---- */

    .fleet-ships {
        container: fleet / inline-size;
    }

    .fleet-ships .table {
        margin: 0;
    }

    /* the ship's picture and its name; the picture is the one of the shipyard, at half its size */
    .fleet-ship {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        font-size: var(--fs-large);
    }

    .fleet-ship img {
        display: block;
        flex: none;
        width: 60px;
        height: 60px;
        border: 1px solid var(--c-border);
        border-radius: var(--radius);
    }

    .fleet-ship small {
        display: block;
        color: var(--c-text-muted);
        font-weight: normal;
    }

    .fleet-ships .num {
        font-size: var(--fs-large);
        font-weight: bold;
    }

    .fleet-ship-amount {
        width: 1%;
        white-space: nowrap;
    }

    .fleet-ship-amount input,
    .fleet-cargo input {
        width: 9rem;
        text-align: right;
    }

    .fleet-ship-amount :is(input, .button) {
        min-height: 2.25rem;
        font-size: var(--fs-large);
    }

    .fleet-ship-amount .button {
        min-width: 4rem;
    }

    @container fleet (max-width: 480px) {
        /* name and what there is on a line, the amount to send under them */
        .fleet-ships thead {
            display: none;
        }

        .fleet-ships :is(.table, caption, tbody) {
            display: block;
        }

        .fleet-ships tbody tr {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto;
            border: 1px solid var(--c-border);
            border-top: 0;
            background: var(--c-panel);
        }

        .fleet-ships tbody :is(th, td) {
            height: auto;
            border: 0;
            background: none;
        }

        .fleet-ships tbody tr:hover > * {
            background: none;
        }

        .fleet-ship img {
            width: 44px;
            height: 44px;
        }

        .fleet-ships .fleet-ship-amount {
            display: flex;
            grid-column: 1 / -1;
            gap: var(--space-2);
            width: auto;
            padding-bottom: var(--space-2);
        }

        .fleet-ships .fleet-ship-amount input {
            flex: 1 1 auto;
            width: auto;
            min-width: 0;
        }
    }

    /* two blocks beside each other where there is room for both */
    .fleet-columns {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
        align-items: start;
        gap: 0 var(--space-2);
    }

    .fleet-columns .panel-title:not(:first-child) {
        border-top-width: 1px;
    }

    .fleet-coords input {
        flex: none;
        width: 4rem;
        text-align: center;
    }

    .fleet-coords select {
        flex: 0 1 auto;
    }

    .fleet-cargo {
        flex-wrap: nowrap;
    }

    .fleet-cargo input {
        flex: 1 1 auto;
        min-width: 0;
    }

    .fleet-target select {
        max-width: 100%;
    }

    .fleet-target .form-row-wide select {
        width: 100%;
    }

    .fleet-groups {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-1);
        margin: 0;
        padding: var(--space-2);
        list-style: none;
    }

    .fleet-none {
        margin: 0;
        padding: var(--space-1) var(--space-2);
    }

    .fleet-heading {
        margin-bottom: var(--space-2);
    }

    .fleet-missions {
        min-width: 0;
        padding: 0;
    }

    /* a fieldset draws its legend into its border: as a block it is a title like the others */
    .fleet-missions legend {
        float: left;
        width: 100%;
    }

    .fleet-missions label {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 0 var(--space-2);
        clear: both;
        min-height: 2rem;
        padding: var(--space-1) var(--space-2);
        border-top: 1px solid rgb(255 255 255 / 0.08);
        cursor: pointer;
    }

    .fleet-missions label:hover,
    .fleet-missions label:has(:checked) {
        background: rgb(255 255 255 / 0.06);
    }

    .fleet-missions label:has(:checked) span {
        font-weight: bold;
    }

    .fleet-missions small {
        grid-column: 2;
    }

    /* the scripts of the fleet pages write their numbers in <font color>: the colours of the page instead */
    #content font[color="lime" i] {
        color: var(--c-good);
    }

    @media (pointer: coarse) {
        .fleet-missions label {
            min-height: var(--touch);
        }

        .fleet-ship-amount .button,
        .fleet-cargo .button {
            min-width: 4rem;
        }
    }

    /* ---- fleet movement: a fleet per row; on a narrow screen a fleet per block ---- */

    .movement-table :is(.movement-arrival, .movement-return) > div {
        display: inline-block;
        margin-right: var(--space-2);
        font-variant-numeric: tabular-nums;
        font-weight: bold;
    }

    .movement-table time {
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
    }

    .movement-order {
        white-space: nowrap;
    }

    .movement-recall,
    .movement-recall:hover {
        border-color: var(--c-bad);
        color: var(--c-bad);
        font-weight: bold;
    }

    .movement-table abbr {
        color: var(--c-text-muted);
        text-decoration: none;
    }

    @container table (max-width: 640px) {
        .movement-table thead,
        .movement-table :is(.movement-number, .movement-departure) {
            display: none;
        }

        .movement-table,
        .movement-table tbody {
            display: block;
        }

        /* mission and way, when it arrives and is back, the ships and the way back */
        .movement-table tr {
            display: grid;
            grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
            grid-template-areas:
                "mission route"
                "arrival return"
                "ships order";
            align-items: center;
            margin-bottom: var(--space-1);
            border: 1px solid var(--c-border);
            background: var(--c-panel);
        }

        .movement-table td {
            height: auto;
            min-height: 1.75rem;
            border: 0;
            background: none;
        }

        .movement-table tbody tr:hover > * {
            background: none;
        }

        .movement-table td[data-label]::before {
            content: attr(data-label) " ";
            color: var(--c-text-muted);
        }

        .movement-table .movement-mission {
            grid-area: mission;
            font-weight: bold;
        }

        .movement-table .movement-route {
            grid-area: route;
            text-align: right;
        }

        .movement-table .movement-arrival {
            grid-area: arrival;
        }

        .movement-table .movement-return {
            grid-area: return;
            text-align: right;
        }

        .movement-table .movement-ships {
            grid-area: ships;
            text-align: left;
        }

        .movement-table .movement-order {
            grid-area: order;
            padding-bottom: var(--space-1);
            text-align: right;
        }

        .movement-table .table-empty {
            grid-column: 1 / -1;
        }
    }

    /* ---- empire: a column per planet. The columns share the page's width; on a screen too narrow for them they scroll and the names of the rows stay in sight ---- */

    .resource-settings th:first-child {
        position: sticky;
        left: 0;
        z-index: 1;
        max-width: 11rem;
    }

    /* the box is what scrolls, never taller than the screen below the top bar and the title */
    .empire {
        --empire-names: 12.5rem;
        --empire-above: 9rem;
        container: empire / inline-size;
        max-height: calc(100dvh - var(--empire-above));
        min-height: 12rem;
        border: 1px solid var(--c-border);
        border-width: 1px 0 0 1px;
        overflow: auto;
        scrollbar-width: thin;
    }

    .panel-title:has(+ .empire) {
        border-bottom: 0;
    }

    /* fixed: every planet gets the same width whatever its numbers are. --planets comes from the page.
       Cells keep their own lines (separate): the lines of a cell that sticks would stay behind */
    .empire .table {
        min-width: calc(var(--empire-names) + var(--planets) * 4.5rem);
        margin: 0;
        border-collapse: separate;
        border-spacing: 0;
        table-layout: fixed;
    }

    .empire-names {
        width: var(--empire-names);
    }

    .empire :is(th, td) {
        height: 1.625rem;
        padding: 1px var(--space-2);
        border-width: 0 1px 1px 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .empire th:first-child {
        position: sticky;
        left: 0;
        z-index: 1;
    }

    .empire thead th {
        position: sticky;
        top: 0;
        z-index: 2;
    }

    .empire thead th:first-child {
        z-index: 3;
    }

    .empire tbody th {
        white-space: nowrap;
    }

    .empire-planet {
        padding: var(--space-1) 2px !important;
        text-align: center !important;
        vertical-align: top !important;
        white-space: normal !important;
    }

    .empire-planet a {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .empire-planet a + a {
        color: var(--c-text-muted);
        font-size: var(--fs-small);
        font-weight: normal;
    }

    .empire-planet img {
        display: block;
        width: min(64px, 100%);
        height: auto;
        aspect-ratio: 1;
        margin: 0 auto 2px;
        border: 1px solid var(--c-border);
        border-radius: var(--radius);
    }

    .empire-planet a:hover img {
        border-color: var(--c-link-hover);
    }

    /* what there is, and under it what an hour adds */
    .empire-amounts td {
        height: 2.5rem;
        line-height: 1.15;
    }

    .empire-amounts td > :first-child {
        font-weight: bold;
    }

    .empire-amounts small {
        display: block;
    }

    /* a zero says "none here": it steps back so the planets that have the thing stand out */
    .empire-none,
    .empire-none a {
        color: #aab5cd;
    }

    /* the title of a group of rows stays at the left edge too; its cell must not clip it */
    .empire .table-group th {
        overflow: visible;
    }

    .empire .table-group span {
        position: sticky;
        left: var(--space-2);
    }

    .empire small,
    .resource-settings small {
        color: var(--c-text-muted);
        font-weight: normal;
    }

    /* research: one cell over all columns. Its list keeps the width of the box and stays in place when the columns scroll */
    .empire td.empire-research {
        height: auto;
        padding: 0;
        overflow: visible;
    }

    .empire-research ul {
        position: sticky;
        left: 0;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr));
        gap: 0 var(--space-5);
        width: calc(100cqw - 2px);
        margin: 0;
        padding: var(--space-1) var(--space-2);
        list-style: none;
    }

    .empire-research li {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: var(--space-3);
        padding: 3px 0;
        border-bottom: 1px solid rgb(255 255 255 / 0.08);
    }

    .empire-research b {
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
    }

    .empire tbody tr:hover > .empire-research {
        background-color: var(--c-panel);
    }

    @media (max-width: 1099.98px) {
        .empire {
            --empire-above: 11rem;
        }
    }

    @media (max-width: 699.98px) {
        .empire {
            --empire-names: 8.5rem;
        }

        .empire tbody th {
            white-space: normal;
        }
    }

    /* a phone held sideways: too low for a box of its own, the page scrolls */
    @media (max-height: 480px) {
        .empire {
            max-height: none;
        }
    }

    /* ---- resource settings ---- */

    .resource-settings-total :is(th, td) {
        background-color: var(--c-panel-dark);
        font-weight: bold;
    }

    @media (max-width: 699.98px) {
        .empire tbody th:first-child,
        .resource-settings th:first-child {
            max-width: 7rem;
            white-space: normal;
        }

        .resource-settings :is(th, td) {
            padding-inline: var(--space-1);
        }

        .empire small {
            display: block;
        }
    }

    /* ---- a list of links, as many beside each other as fit (fleet shortcuts) ---- */

    .link-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr));
        gap: var(--space-1);
        margin: 0;
        padding: var(--space-2);
        list-style: none;
    }

    .link-grid a {
        display: block;
        padding: var(--space-1) var(--space-2);
        border: 1px solid var(--c-border);
        border-radius: var(--radius);
        background: var(--c-panel-dark);
    }

    .link-grid a:hover {
        background: var(--c-border);
        color: var(--c-text);
        text-decoration: none;
    }

    /* ---- highscore ---- */

    .highscore-filter label {
        display: flex;
        align-items: center;
        gap: var(--space-2);
    }

    .highscore-table :is(.highscore-position, .highscore-change, .highscore-actions) {
        width: 1%;
    }

    .highscore-table .highscore-position {
        border-right: 0;
        font-weight: bold;
    }

    .highscore-table .highscore-change {
        border-left: 0;
        font-size: var(--fs-small);
    }

    .highscore-table small {
        color: var(--c-text-muted);
    }

    .rank-same {
        color: #87ceeb;
    }

    .highscore-own-alliance,
    .highscore-own-alliance:hover {
        color: #5cc4ff;
    }

    /* ---- search and buddies ---- */

    .search-actions a,
    .highscore-actions a {
        display: inline-grid;
        place-items: center;
        min-width: 1.5rem;
        min-height: 1.5rem;
        vertical-align: middle;
    }

    .buddies-actions {
        width: 1%;
        white-space: nowrap;
    }

    .buddies-text {
        overflow-wrap: anywhere;
    }

    @container table (max-width: 560px) {
        .table-stack :is(.buddies-actions, .search-actions) {
            padding-bottom: var(--space-1);
            text-align: right;
        }
    }

    @media (pointer: coarse) {
        .search-actions a,
        .highscore-actions a {
            min-width: 2.5rem;
            min-height: 2.25rem;
        }
    }

    @media (max-width: 699.98px) {
        .highscore-table :is(th, td) {
            padding-inline: var(--space-1);
        }

        .highscore-table small {
            display: block;
        }
    }

    /* ---- alliance ---- */

    .alliance-image {
        margin: 0;
        padding: var(--space-2);
        text-align: center;
    }

    .alliance-image img {
        max-width: 100%;
        height: auto;
    }

    /* the texts the alliance wrote for itself */
    .alliance-text {
        min-height: 4rem;
        padding: var(--space-2);
        border-top: 1px solid rgb(255 255 255 / 0.08);
        line-height: 1.45;
        text-align: center;
        overflow-wrap: anywhere;
    }

    .alliance-text img {
        max-width: 100%;
        height: auto;
    }

    .alliance-application {
        margin: 0;
        line-height: 1.45;
        white-space: pre-line;
        overflow-wrap: anywhere;
    }

    .alliance-message {
        text-align: center;
    }

    .panel-body > textarea {
        display: block;
        margin-top: var(--space-1);
    }

    .alliance-member-number {
        width: 1%;
    }

    .alliance-member-rank form {
        display: flex;
        gap: var(--space-1);
    }

    .alliance-member-actions {
        white-space: nowrap;
    }

    .alliance-rights .table {
        margin: 0;
    }

    .alliance-rights th[scope="row"] {
        position: sticky;
        left: 0;
        z-index: 1;
    }

    .alliance-rights-groups th {
        color: #9fc1e3;
        text-align: center !important;
    }

    .alliance-legend {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(min(18rem, 100%), 1fr));
        gap: var(--space-1) var(--space-4);
        margin: 0;
        padding: var(--space-2);
    }

    .alliance-legend div {
        display: flex;
        align-items: center;
        gap: var(--space-2);
    }

    .alliance-legend dd {
        margin: 0;
    }

    @container table (max-width: 560px) {
        .table-stack .alliance-member-number {
            display: none;
        }

        .table-stack .alliance-member-actions {
            text-align: right;
        }
    }

    /* ---- technology: what there is and what each needs ---- */

    .tech-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr));
        gap: 1px;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    /* the picture, and beside it the name with what it needs */
    .tech-card {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
        gap: var(--space-3);
        padding: var(--space-2);
        outline: 1px solid rgb(255 255 255 / 0.08);
    }

    .tech-card img {
        display: block;
        width: 64px;
        height: 64px;
        border: 1px solid var(--c-border);
        border-radius: var(--radius);
    }

    .tech-card-picture:hover img {
        border-color: var(--c-link-hover);
    }

    .tech-card-name {
        font-weight: bold;
    }

    .tech-card :is(.tech-needs, p) {
        margin: var(--space-1) 0 0;
        padding: 0;
        font-size: var(--fs-small);
        line-height: 1.35;
        list-style: none;
    }

    .tech-wiki {
        margin: 0 0 var(--space-2);
    }

    /* the picture with the text beside it; under 700 px a smaller picture */
    .tech-summary {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        gap: var(--space-3);
        padding: var(--space-2);
        line-height: 1.45;
    }

    .tech-summary > img {
        display: block;
        border: 1px solid var(--c-border);
    }

    .tech-summary > div {
        max-width: 80ch;
    }

    .tech-rapidfire {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
        gap: 2px var(--space-4);
        margin: var(--space-2) 0 0;
        padding: 0 0 0 1.1em;
    }

    .tech-stats {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
        gap: 0 var(--space-4);
        margin: 0;
        padding: var(--space-1) var(--space-2) var(--space-2);
        border-top: 1px solid var(--c-border);
    }

    .tech-stats div {
        display: flex;
        justify-content: space-between;
        gap: var(--space-3);
        padding: 2px 0;
        border-bottom: 1px solid rgb(255 255 255 / 0.08);
    }

    .tech-stats dt {
        color: var(--c-text-muted);
    }

    .tech-stats dd {
        margin: 0;
        font-variant-numeric: tabular-nums;
        font-weight: bold;
    }

    .tech-levels {
        margin: 0;
        border-top: 1px solid var(--c-border);
    }

    .tech-levels :is(th, td) {
        height: 1.5rem;
    }

    .tech-teardown p {
        margin: 0 0 var(--space-1);
    }

    .jump-gate input[type="text"] {
        width: 9rem;
        text-align: right;
    }

    .jump-gate-wait > div {
        font-variant-numeric: tabular-nums;
        font-weight: bold;
    }

    @media (max-width: 699.98px) {
        .tech-summary > img {
            width: 72px;
            height: 72px;
        }

        /* two beside each other, so the list is half as long */
        .tech-grid {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .tech-card {
            gap: var(--space-2);
            padding: var(--space-1);
        }

        .tech-card img {
            width: 44px;
            height: 44px;
        }

        .tech-card-name {
            overflow-wrap: anywhere;
        }
    }

    /* ---- planet name and abandon ---- */

    .planet-edit-intro {
        display: flex;
        align-items: center;
        gap: var(--space-3);
        margin-bottom: var(--space-2);
    }

    .planet-edit-intro img {
        flex: none;
        border: 1px solid var(--c-border);
    }

    .planet-edit p {
        margin: var(--space-2) 0;
    }

    /* the line with the planet and the button opens the question for the password */
    .planet-abandon summary {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-2);
        padding: var(--space-1) 0;
        list-style: none;
        cursor: pointer;
    }

    .planet-abandon summary::-webkit-details-marker {
        display: none;
    }

    .planet-abandon summary .button {
        color: var(--c-bad);
    }

    /* ---- attack group (ACS): who can be invited, the buttons, who is in ---- */

    .acs-notice {
        margin: var(--space-2) 0 0;
        font-weight: bold;
    }

    .acs-lists {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        align-items: center;
        gap: var(--space-2) var(--space-3);
        padding: var(--space-2) 0;
        border-block: 1px solid var(--c-border);
    }

    .acs-lists label {
        display: grid;
        gap: var(--space-1);
    }

    .acs-lists select {
        width: 100%;
    }

    .acs-buttons {
        display: grid;
        gap: var(--space-2);
    }

    @media (max-width: 699.98px) {
        .acs-lists {
            grid-template-columns: minmax(0, 1fr);
        }

        .acs-buttons {
            grid-template-columns: 1fr 1fr;
        }
    }

    /* ---- notes: the subject in the colour of its priority ---- */

    .notes .notes-check {
        width: 2.5rem;
    }

    .notes .notes-date {
        width: 12rem;
        white-space: nowrap;
    }

    .note-important,
    .note-important:hover {
        color: var(--c-bad);
    }

    .note-normal,
    .note-normal:hover {
        color: var(--c-info);
    }

    .note-unimportant,
    .note-unimportant:hover {
        color: var(--c-good);
    }

    /* ---- a line the game answers with, on a page of its own or in the dialog ---- */

    .game-message {
        max-width: 42rem;
        margin: var(--space-3) 0;
        padding: var(--space-3);
        border: 1px solid var(--c-border);
        background: var(--c-panel);
        font-weight: bold;
        text-align: center;
    }

    .content-center .game-message {
        margin-inline: auto;
    }

    .dialog-body .game-message {
        max-width: none;
        margin: 0;
    }

    /* ---- changelog ---- */

    .changelog th[scope="row"] {
        width: 1%;
        vertical-align: top;
        white-space: nowrap;
    }

    .changelog td {
        line-height: 1.45;
    }

    /* ---- battle report: stored as HTML. No wider than a text can be read; a fleet with many kinds of ships scrolls in its own box ---- */

    .combat-report {
        max-width: 60rem;
        padding: var(--space-2);
        border: 1px solid var(--c-border);
        /* the lines between the fleets stand on this, not on the picture behind the page */
        background: var(--c-bg);
        text-align: center;
        line-height: 1.45;
    }

    .combat-report > table,
    .combat-report > table > tbody,
    .combat-report > table > tbody > tr,
    .combat-report > table > tbody > tr > td {
        display: block;
    }

    .combat-report > table > tbody > tr > td {
        overflow-x: auto;
    }

    .combat-report table table {
        width: auto;
    }

    /* ---- merchant: refill a storage, or sell one resource for the two others ---- */

    .trader-refill {
        display: grid;
        grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr);
        align-items: center;
        gap: var(--space-2) var(--space-3);
        padding: var(--space-2);
        border-top: 1px solid var(--c-border);
    }

    .trader-resource {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 2px var(--space-2);
    }

    .trader-resource span {
        grid-column: 1 / -1;
        font-size: var(--fs-small);
    }

    .trader-options {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--space-1);
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .trader-options li {
        display: grid;
        justify-items: center;
        gap: 2px;
        padding: var(--space-1);
        border: 1px solid var(--c-border);
        border-radius: var(--radius);
        background: var(--c-panel-dark);
        text-align: center;
    }

    .trader-percent {
        font-size: var(--fs-large);
    }

    .trader-price {
        color: #5cc4ff;
    }

    .trader-call {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
        gap: var(--space-2) var(--space-4);
        padding: var(--space-2);
        border-top: 1px solid var(--c-border);
    }

    .trader-call fieldset {
        display: grid;
        gap: var(--space-1);
        min-width: 0;
        margin: 0;
        padding: 0;
        border: 0;
    }

    .trader-call legend {
        padding: 0 0 var(--space-1);
        color: var(--c-text-muted);
    }

    .trader-call label {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        min-height: 1.75rem;
        cursor: pointer;
    }

    .trader-call p {
        margin: 0 0 var(--space-2);
        color: var(--c-text-muted);
    }

    #merchant .table {
        margin: 0;
    }

    #merchanttable .resIcon img {
        vertical-align: middle;
    }

    #merchanttable input[type="text"] {
        width: 8rem;
        text-align: right;
    }

    #merchanttable .toSell > * {
        background-color: var(--c-panel-dark);
    }

    @media (max-width: 699.98px) {
        .trader-refill {
            grid-template-columns: minmax(0, 1fr);
        }

        #merchanttable :is(th, td) {
            padding-inline: 3px;
            white-space: normal;
        }

        #merchanttable input[type="text"] {
            width: 4.75rem;
        }

        #merchanttable .button {
            padding-inline: var(--space-2);
        }

        #merchanttable .resIcon img {
            display: block;
        }
    }

    @media (pointer: coarse) {
        .trader-call label {
            min-height: var(--touch);
        }
    }

    /* ---- officers: a picture, what the officer gives, and the two ways to hire ---- */

    .officer-grid {
        container: officers / inline-size;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(min(30rem, 100%), 1fr));
        gap: 1px;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .officer-card {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: start;
        gap: var(--space-2) var(--space-3);
        padding: var(--space-2);
        outline: 1px solid rgb(255 255 255 / 0.08);
    }

    .officer-picture {
        display: block;
        width: 88px;
        height: 88px;
        border: 1px solid var(--c-border);
    }

    .officer-body h3 {
        margin: 0 0 var(--space-1);
        font-size: inherit;
        text-align: left;
    }

    .officer-body h3 span {
        font-weight: normal;
    }

    .officer-body p {
        margin: 0 0 var(--space-1);
        color: var(--c-text-muted);
        line-height: 1.4;
    }

    .officer-body .officer-benefit {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        margin: 0;
        color: #9fd3f5;
        font-weight: bold;
    }

    .officer-benefit img {
        flex: none;
    }

    .officer-actions {
        display: grid;
        align-self: center;
        gap: var(--space-1);
    }

    .officer-actions .button {
        display: grid;
        justify-items: center;
        min-width: 6.5rem;
        padding: var(--space-1) var(--space-2);
        white-space: normal;
    }

    .officer-actions b {
        color: var(--c-good);
    }

    .officer-actions small {
        color: var(--c-text-muted);
    }

    @media (max-width: 699.98px) {
        .officer-card {
            grid-template-columns: auto minmax(0, 1fr);
        }

        .officer-picture {
            width: 56px;
            height: 56px;
        }

        .officer-actions {
            grid-column: 1 / -1;
            grid-auto-flow: column;
            grid-auto-columns: 1fr;
        }
    }

    /* ---- overview: the planet with its facts, the fleet events, the other planets ---- */

    .overview-messages {
        margin: 0 0 var(--space-2);
        padding: var(--space-1) var(--space-2);
        border: 1px solid var(--c-accent);
        border-radius: var(--radius);
        background: var(--c-panel);
        text-align: center;
    }

    .planet-card {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: var(--space-2) var(--space-4);
        padding: var(--space-2);
        border: 1px solid var(--c-border);
        background: var(--c-panel) url(../upload/skins/xgproyect/img/bg2.gif);
    }

    /* 200 px is the size the planets were drawn at */
    .planet-card-picture {
        display: block;
        width: 200px;
        height: 200px;
        border: 1px solid var(--c-border);
        border-radius: var(--radius);
    }

    .planet-card-body {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }

    .planet-card-name {
        width: auto;
        margin: 0 0 var(--space-3);
        font-size: 1.375rem;
        text-align: left;
    }

    .planet-facts {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 30rem));
        gap: var(--space-2) var(--space-5);
        margin: 0 0 var(--space-3);
        font-size: var(--fs-large);
    }

    .planet-facts div {
        display: flex;
        gap: var(--space-2);
    }

    .planet-facts dt {
        flex: none;
        min-width: 7.5rem;
        color: var(--c-text-muted);
    }

    .planet-facts dd {
        margin: 0;
        font-weight: bold;
    }

    /* what the planet builds, with the countdown the script keeps */
    .planet-work {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: var(--space-1) var(--space-3);
        margin-top: auto;
        padding-top: var(--space-2);
        border-top: 1px solid var(--c-border);
        font-size: var(--fs-large);
        font-variant-numeric: tabular-nums;
        font-weight: bold;
    }

    .planet-work #blc {
        display: flex;
        align-items: center;
        gap: var(--space-3);
    }

    .planet-card-side {
        display: grid;
        align-content: space-between;
        justify-items: end;
        gap: var(--space-2);
    }

    .planet-card-clock {
        color: var(--c-text-muted);
        font-size: var(--fs-small);
        white-space: nowrap;
    }

    .planet-card-moon {
        display: grid;
        justify-items: center;
        gap: 2px;
    }

    .planet-card-moon img {
        width: 88px;
        height: 88px;
        border: 1px solid var(--c-border);
        border-radius: var(--radius);
    }

    .planet-card + .events {
        margin-top: var(--space-2);
    }

    .events-more summary {
        padding: var(--space-1) var(--space-2);
        border: 1px solid var(--c-border);
        background: var(--c-panel-dark);
        text-align: center;
        cursor: pointer;
    }

    .events-more[open] .events-more-open,
    .events-more:not([open]) .events-more-close {
        display: none;
    }

    /* picture, name and what it builds; as many beside each other as fit */
    .planet-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
        gap: var(--space-1);
        margin: var(--space-2) 0 0;
        padding: 0;
        list-style: none;
    }

    .planet-grid li {
        display: grid;
        align-content: start;
        justify-items: center;
        min-width: 0;
        padding: var(--space-2) var(--space-1);
        border: 1px solid var(--c-border);
        background: var(--c-panel);
        text-align: center;
    }

    .planet-grid a {
        display: grid;
        justify-items: center;
        gap: 2px;
        max-width: 100%;
    }

    /* 88 px is the size the small planets were drawn at */
    .planet-grid img {
        display: block;
        width: 88px;
        height: 88px;
        border: 1px solid var(--c-border);
        border-radius: var(--radius);
    }

    .planet-grid a:hover img {
        border-color: var(--c-link-hover);
    }

    .planet-grid-name {
        font-weight: bold;
    }

    .planet-grid span {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .planet-grid-left,
    .planet-grid-free {
        color: var(--c-text-muted);
    }

    /* the page lays out by the room its content has, which is the window less the menu */
    #content:has(.planet-card) {
        container: overview / inline-size;
    }

    @container overview (max-width: 760px) {
        .planet-card {
            grid-template-columns: auto minmax(0, 1fr);
        }

        /* clock and moon on a row of their own under the planet */
        .planet-card-side {
            grid-column: 1 / -1;
            grid-auto-flow: column;
            align-items: center;
            justify-content: space-between;
        }

        .planet-card-moon {
            grid-auto-flow: column;
            align-items: center;
            gap: var(--space-2);
        }

        .planet-card-moon img {
            width: 50px;
            height: 50px;
        }

        .planet-card-picture {
            width: 140px;
            height: 140px;
        }

        .planet-card-name {
            margin-bottom: var(--space-2);
            font-size: var(--fs-large);
        }

        .planet-facts,
        .planet-work {
            font-size: inherit;
        }

        .planet-facts {
            grid-template-columns: minmax(0, 1fr);
            gap: var(--space-1);
        }
    }

    @container overview (max-width: 520px) {
        .planet-card-picture {
            width: 104px;
            height: 104px;
        }

        .planet-grid img {
            width: 64px;
            height: 64px;
        }

        /* one row to swipe through instead of a page of pictures */
        .planet-grid {
            display: flex;
            overflow-x: auto;
            scroll-snap-type: x proximity;
        }

        .planet-grid li {
            flex: 0 0 7rem;
            scroll-snap-align: start;
        }
    }

}
