/*
 * The match HUD on a desktop window (the owner, 2026-12-03). One top bar:
 * who you are, your energy and shield, and the Terminal framed beside them,
 * then the menu. The units you order run down the left side in one column,
 * the height of the play area. The minimap panel holds the formations to its
 * right. Every piece keeps one size and place, so nothing moves in play.
 * A phone keeps its own layout (phone-match.css).
 */
@media (min-width: 48.0625rem) {
  :root:not([data-phone='true']) .hud {
    --left: 21rem;
    grid-template-columns: var(--left) minmax(0, 1fr) auto;
  }

  /* ---------- The top bar ---------- */
  :root:not([data-phone='true']) .hud__identity {
    grid-area: 1 / 1 / 2 / 3;
    align-self: stretch;
    /* Only as wide as what it holds: the Terminal stays beside your readouts. */
    justify-self: start;
    max-width: 100%;
    min-height: 3rem;
    gap: var(--space-2);
    padding: 0 var(--space-2) 0 var(--space-3);
  }

  :root:not([data-phone='true']) .hud__identity > * {
    flex: none;
  }

  /* A long name gives way first, down to a few letters, never the readouts. */
  :root:not([data-phone='true']) .hud__identity .hud__name {
    flex: 0 1 auto;
    min-width: 4.5rem;
  }

  :root:not([data-phone='true']) .hud__identity .hud__energy-label {
    margin-left: var(--space-2);
  }

  /* The shield's cost wraps to two short lines, so the bar fits a laptop screen. */
  :root:not([data-phone='true']) .hud__upkeep {
    min-width: 20ch;
    max-width: 20ch;
    line-height: 1.25;
  }

  /* One width for 400 or Down, so the Terminal after it never shifts. */
  :root:not([data-phone='true']) .hud__shield {
    min-width: 4.5ch;
  }

  /* No fees: no empty room after the Terminal. */
  :root:not([data-phone='true']) .hud__upkeep:empty {
    display: none;
  }

  :root:not([data-phone='true']) .hud__buttons {
    grid-area: 1 / 3;
    align-self: stretch;
    justify-content: space-between;
    padding: 0 var(--space-2);
  }

  /* The Terminal: framed in the accent, right after your readouts. */
  .hud__terminal {
    margin-left: var(--space-2);
    min-height: 2.25rem;
    padding: 0 var(--space-3);
    border: 1px solid var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    font: 600 var(--text-sm) / 1 var(--font-mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .hud__terminal:hover,
  .hud__terminal:focus-visible {
    background: color-mix(in srgb, var(--accent) 22%, transparent);
  }

  .hud__terminal .hud__key {
    border-color: var(--accent-line);
    color: var(--accent);
  }

  /* ---------- The left column: what you can order ---------- */
  :root:not([data-phone='true']) .deck {
    grid-area: 2 / 1 / 4 / 2;
    align-self: stretch;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: var(--left);
    min-height: 0;
    pointer-events: auto;
    background: var(--bg-veil);
    border: 1px solid var(--accent-line);
    border-radius: var(--radius);
  }

  :root:not([data-phone='true']) .deck__list,
  :root:not([data-phone='true']) .deck__panel {
    width: auto;
    border: 0;
    border-radius: 0;
    background: none;
  }

  :root:not([data-phone='true']) .deck__panel {
    margin: 0 var(--space-2);
    padding: var(--space-3) var(--space-1);
    border-top: 1px solid var(--line);
  }

  /* ---------- Bottom right: the minimap, its buttons, and formations ---------- */
  :root:not([data-phone='true']) .hud__overview {
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: var(--space-3);
  }

  :root:not([data-phone='true']) .hud__view-buttons {
    grid-column: 1;
  }

  :root:not([data-phone='true']) .hud__dock {
    grid-area: 1 / 2 / 3 / 3;
    display: grid;
    align-content: start;
    width: 25rem;
    padding-left: var(--space-3);
    border-left: 1px solid var(--line);
  }

  /* Its room is kept when no fighters are picked, with a word on what goes here. */
  :root:not([data-phone='true']) .hud__dock:not(:has(.formation-bar:not([hidden])))::before {
    content: 'Select fighters or your Twin Haul to give them orders here.';
    align-self: center;
    font-size: var(--text-xs);
    line-height: 1.5;
    color: var(--text-dim);
  }

  :root:not([data-phone='true']) .hud__dock .formation-bar {
    grid-area: auto;
    width: auto;
    padding: 0;
    border: 0;
    background: none;
    animation: none;
  }

  /* In the panel: who is picked and Clear on one line, the orders under them. */
  :root:not([data-phone='true']) .hud__dock .formation-bar__head {
    flex-wrap: wrap;
  }

  :root:not([data-phone='true']) .hud__dock .formation-bar__head .segments {
    order: 3;
    flex: 1 1 100%;
  }

  /* The first-seconds hint and the tips sit at the top right, under the menu
     (the owner, 2026-12-03): the hint first, a tip in its own place below it. */
  :root:not([data-phone='true']) .hud__hint {
    grid-area: 2 / 3;
    align-self: start;
    justify-self: end;
    max-width: 100%;
    border-left: 0;
    border-right: 2px solid var(--accent);
    text-align: right;
  }

  :root:not([data-phone='true']) .coach {
    grid-area: 2 / 3;
    align-self: start;
    justify-self: end;
    margin-top: 3rem;
    max-width: 100%;
  }

  :root:not([data-phone='true']) .hud__out {
    grid-area: 2 / 2;
    align-self: start;
  }

  /* ---------- Scores docked above the minimap panel (Tab, in Cycle mode) ---------- */
  :root:not([data-phone='true']) .scores[data-place='dock'] {
    position: static;
    grid-area: 2 / 3;
    align-self: end;
    justify-self: stretch;
    width: auto;
    transform: none;
    padding: var(--space-3);
    font-size: var(--text-xs);
  }

  :root:not([data-phone='true']) .scores[data-place='dock'] .scores__hint {
    display: none;
  }

  :root:not([data-phone='true']) .scores[data-place='dock'] .scores__table {
    font-size: var(--text-xs);
  }
}

/* A laptop screen: the formations panel a little narrower. */
@media (min-width: 48.0625rem) and (max-width: 100rem) {
  :root:not([data-phone='true']) .hud__dock {
    width: 19rem;
  }
}
