/* MECHADUEL - the site's design system. ONE file, linked by every page.
 *
 * WHY THIS EXISTS. Every page used to carry its own <style> block with its own
 * copy of the palette, and they had already drifted: reset.html had lost
 * --plate, index.html had never had --bad, and the four account pages sat on a
 * flat black background while the front page had a layered one. Same product,
 * two different looks, and five places to fix any of it - the same argument
 * account-card.js makes for the header, which is why that is one file too.
 *
 * PALETTE. Black and dark blue ground, gunmetal plating, cyan as the primary
 * accent, terminal green kept for LIVE machine readouts only - if it is green
 * it is a real signal, not decoration. The five energy hues are the GAME'S OWN
 * (energy_color in game_core.gml), so the site teaches the same colour language
 * the board does. Change them there and change them here.
 */

:root {
  --void:     #04060b;
  --deep:     #080f1e;
  --panel:    #0d131f;
  --plate:    #121a28;
  --gunmetal: #2b3444;
  --edge:     #3b475b;
  --silver:   #98a4b8;
  --pale:     #dce0ee;
  --cyan:     #4fe3ff;
  --cyan-dim: #1c6f84;
  --term:     #7dff9b;
  --amber:    #f0a840;
  --bad:      #ff6b6b;
  /* Light purple-grey. The secondary text colour: cooler and less clinical
     than plain grey, and it keeps the page from being only cyan-on-black. */
  --lilac:    #b3aecb;
  --lilac-dim:#6d6885;
  /* The grid's own hues. Blue, cyan, green and white, faint by construction -
     these are line colours on black, not fills. */
  --grid-blue:  rgba(90, 150, 255, 0.16);
  --grid-cyan:  rgba(79, 227, 255, 0.16);
  --grid-term:  rgba(125, 255, 155, 0.12);
  --grid-white: rgba(220, 224, 238, 0.10);

  --e-magnetic: #00ffff;
  --e-plasma:   #ff00ff;
  --e-nuclear:  #ffff00;
  --e-chemical: #00ff00;
  --e-steam:    #ff2d2d;

  --notch: 10px;
  --pad: clamp(20px, 5vw, 32px);
  /* Lucida Console throughout - the terminal look is the point, so it is the
     page's voice rather than a font reserved for code. The fallbacks are the
     nearest equivalents on machines that do not ship it (macOS, Linux); a
     generic monospace is the floor, never a proportional face. */
  --mono: "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono",
          Menlo, Consolas, monospace;
}

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

/* --- the ground ----------------------------------------------------------
 * Every page, not just the front one. A sign-in form on flat black next to a
 * front page with depth reads as two different sites, and the moment that
 * matters most is the one where somebody is typing a password.
 */
body {
  background:
    radial-gradient(1300px 760px at 50% -12%, #12264a 0%, transparent 62%),
    linear-gradient(180deg, var(--deep) 0%, var(--void) 55%);
  background-attachment: fixed;
  color: var(--pale);
  font-family: var(--mono);
  min-height: 100vh;
  overflow-x: hidden;
}

/* THE STATIC GRID THAT USED TO BE HERE IS GONE. .cybergrid does this job on
 * every page now, and carrying both meant two masked full-viewport layers
 * drawing the same thing - one of the reasons the front page dropped frames.
 * With JavaScript off there is no grid, only the ground and the vignette
 * below; that is a plainer page, not a broken one. */

/* Vignette: pulls the eye to the middle and stops the grid ending abruptly. */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse at 50% 40%, transparent 45%, rgba(0, 0, 0, 0.55) 100%);
}

.wrap { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 0 var(--pad); }
.mono { font-family: var(--mono); }
a { color: var(--cyan); }

/* --- the reactive grid ----------------------------------------------------
 * Injected on every page by site-fx.js, so the background is one mechanism
 * rather than a thing the front page happens to have.
 *
 * BUILT FOR THE COMPOSITOR, because the first version was not and the page
 * was visibly laggy. What cost the frames:
 *   - four full-viewport layers, each carrying its OWN mask-image
 *   - a filter: drop-shadow() over a masked full-screen element on hover
 * A mask forces a separate composited surface, and a filter over one forces it
 * to be re-rasterised - every frame, for the whole viewport.
 *
 * Now: TWO animated layers, ONE mask (on the container, which never animates
 * so it rasterises once), and NO filters anywhere. Each layer still carries
 * two hues, as background-images on a single element - several backgrounds on
 * one layer are effectively free, several elements are not. Only transform and
 * opacity animate; both are compositor properties and neither repaints.
 */
.cybergrid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .55;
  transition: opacity .5s ease;
  mask-image: radial-gradient(circle at 50% 38%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 50% 38%, #000 0%, transparent 72%);
}
/* The two CSS span layers that used to breathe here are GONE: the grid is
 * now the GAME's own system, ported into site-fx.js and drawn on one
 * canvas wearing this same .cybergrid class (Sam, 2026-09-01: the site
 * should look like the game). Four slots, eight vibrant inks, per-slot
 * cell/drift/period/peak - the container rules above and the switch below
 * apply to the canvas unchanged. */

/* Hover brings it up. Opacity only - the glow that used to do this was a
   drop-shadow, which is what made hovering a button stutter. */
body:has(.btn:hover) .cybergrid,
body:has(.btn:focus-visible) .cybergrid,
body:has(a:hover) .cybergrid,
body:has(button:hover) .cybergrid { opacity: 1; }

/* --- the off switch -------------------------------------------------------
 * Kills the animation outright rather than hiding it: no compositing, no
 * timers, nothing left running behind a display:none. The grid itself stays as
 * a still image, because it is the page's depth and removing it would be a
 * different design - the toggle is about MOTION.
 */
html.no-fx .cybergrid { transition: none; opacity: .5; }
html.no-fx .scan { display: none; }

/* The animation toggle rides the shared button grammar (it IS a button);
 * only its size and pinned position are its own. */
.fxtoggle {
  position: fixed; left: 12px; bottom: 12px; z-index: 60;
  width: auto; margin: 0; padding: 7px 12px;
  font-size: 10px; letter-spacing: .14em;
}

/* --- form pages ----------------------------------------------------------
 * account / forgot / reset / profile are a centred column: brand, then one or
 * more cards. Given its own layout class rather than styling <body> directly,
 * because index.html is not this shape and shares everything else.
 */
.sheet {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  min-height: 100vh; padding: 40px 16px 64px;
  font-family: var(--mono);
}
/* EVERY CHILD IS LIFTED ABOVE THE GROUND, and it has to be spelled out.
 * body::after is the vignette: fixed, and POSITIONED, so it paints above any
 * non-positioned in-flow content in the same stacking context - which is
 * exactly what these cards are. Without this the vignette washes over the
 * sign-in form. index.html never hit it only because its content sits inside
 * .wrap, which is already relative/z-index 1 for this same reason. */
/* :not() spares the two FIXED overlays this rule was never for: the grid
 * canvas (site-fx.js inserts it as body's first child, and relative would
 * drop it back INTO FLOW - a full-viewport canvas shoving the sign-in card
 * a whole screen down, Sam's 2026-09-06 report) and the animation toggle,
 * pinned by its own rule. */
.sheet > :not(.cybergrid, .fxtoggle) { position: relative; z-index: 1; }

.brand {
  font-size: 26px; letter-spacing: 0.34em; color: var(--cyan);
  text-decoration: none; margin-bottom: 30px;
  text-shadow: 0 0 26px rgba(79, 227, 255, 0.35);
}
.brand:hover { text-shadow: 0 0 34px rgba(79, 227, 255, 0.75); }

/* The notched panel. The corner cut is the mecha tell that ties these pages to
 * the front page's panels and to the game's own HUD. */
.card {
  width: 100%; max-width: 460px;
  background: linear-gradient(160deg, var(--plate), var(--panel));
  border: 1px solid var(--gunmetal);
  border-top: 2px solid var(--cyan);
  padding: 26px 26px 30px;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px,
                     100% 100%, 14px 100%, 0 calc(100% - 14px));
}
.card + .card { margin-top: 18px; }

.card h1 { font-size: 15px; letter-spacing: 0.22em; margin: 0 0 6px; color: var(--cyan); }
.sub { font-size: 12px; color: var(--lilac); margin: 0 0 22px; line-height: 1.6; }
.note { margin-top: 22px; font-size: 11px; color: var(--lilac-dim); line-height: 1.7; }
.row { display: flex; justify-content: space-between; margin-top: 18px; font-size: 12px; }

/* --- HUD brackets and plates ---------------------------------------------
 * The corner bracket is the mecha tell, and it lives here so every page frames
 * things the same way instead of each inventing its own.
 */
.bracket {
  position: absolute; width: 26px; height: 26px; pointer-events: none;
  border-color: var(--cyan); opacity: 0.75;
}
.bracket.tl { top: 0; left: 0;  border-top: 2px solid; border-left: 2px solid; }
.bracket.tr { top: 0; right: 0; border-top: 2px solid; border-right: 2px solid; }
.bracket.bl { bottom: 0; left: 0;  border-bottom: 2px solid; border-left: 2px solid; }
.bracket.br { bottom: 0; right: 0; border-bottom: 2px solid; border-right: 2px solid; }

/* A notched plate. The wider sibling of .card, for content that is not a form. */
.panel {
  position: relative; padding: 30px 28px;
  background: linear-gradient(160deg, var(--plate), var(--panel));
  border: 1px solid var(--gunmetal);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px,
                     100% 100%, 16px 100%, 0 calc(100% - 16px));
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.panel:hover {
  border-color: var(--cyan-dim); transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.panel .bracket { width: 16px; height: 16px; opacity: 0.55; }
.panel h2 {
  font-size: 0.78rem; color: var(--cyan); letter-spacing: 0.24em;
  text-transform: uppercase; margin: 0 0 14px;
}
.panel p { color: var(--lilac); line-height: 1.75; font-size: 0.92rem; }

/* --- controls -------------------------------------------------------------
 * THE GAME'S OWN BUTTON, in CSS. The anatomy is ui_draw_button_ex's
 * (scripts/ui_draw/ui_draw.gml), piece for piece: a notched plate with a
 * lighter band across the top half (the shaderless bevel), a gunmetal edge
 * that turns the accent colour under the pointer, a 3px accent strip down
 * the left edge (the identity that survives a small label), one bracket at
 * the top-right corner (the mecha mark, live controls only), and a lilac
 * label that turns pale when hot. The ACCENT SEMANTICS are the game's too:
 * cyan = interactive default, amber = commit (submits, the big CTA),
 * red = danger, term green = a toggle that is ON. Change the look there and
 * change it here - the two are one product.
 */
label {
  display: block; font-size: 11px; letter-spacing: 0.16em;
  color: var(--silver); margin: 16px 0 6px;
}
input, textarea, select {
  width: 100%; padding: 11px 12px;
  background: var(--deep); color: var(--pale);
  border: 1px solid var(--gunmetal); font: inherit; font-size: 14px;
  caret-color: var(--cyan);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan-dim);
}
/* The same selection band the game's text widget paints (UI_CYAN at .35). */
::selection { background: rgba(79, 227, 255, 0.35); color: var(--pale); }
/* Small helper line under a field (name availability, hints). One class, not
 * per-page inline styles that drift. */
.form-hint { font-size: 11px; color: var(--silver); margin-top: 6px; min-height: 15px; }

button, .btn {
  --acc: var(--cyan);
  position: relative; z-index: 0;
  font: inherit; letter-spacing: 0.16em; text-transform: uppercase;
  cursor: pointer; text-decoration: none;
  color: var(--lilac);
  background: none; border: none;
  border-left: 3px solid var(--acc);
  transition: color .15s ease;
}
button { width: 100%; margin-top: 22px; padding: 13px; font-size: 13px; }
.btn { display: inline-block; padding: 15px 32px; font-size: 0.8rem; font-weight: 600; }

/* The plate: panel body, plate band over the top half, gunmetal edge, the
 * top-right/bottom-left corner cut. A pseudo-element rather than the element
 * itself so the accent strip and the bracket escape the clip. */
button::before, .btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(18, 26, 40, 0.55) 0%, rgba(18, 26, 40, 0.55) 50%, transparent 50%),
    linear-gradient(180deg, var(--plate), var(--panel));
  border: 1px solid var(--gunmetal);
  clip-path: polygon(0 0, calc(100% - var(--notch)) 0, 100% var(--notch),
                     100% 100%, var(--notch) 100%, 0 calc(100% - var(--notch)));
  transition: border-color .15s ease, background-color .15s ease;
}
/* The bracket, top-right - live controls only (see :disabled below). */
button::after, .btn::after {
  content: ""; position: absolute; top: 0; right: 0;
  width: 9px; height: 9px;
  border-top: 2px solid var(--acc); border-right: 2px solid var(--acc);
  opacity: 0.5; transition: opacity .15s ease;
}
button:hover:not(:disabled), .btn:hover, .btn:focus-visible {
  color: var(--pale);
}
button:hover:not(:disabled)::before, .btn:hover::before, .btn:focus-visible::before {
  border-color: var(--acc);
  background-color: color-mix(in srgb, var(--acc) 16%, transparent);
}
button:hover:not(:disabled)::after, .btn:hover::after, .btn:focus-visible::after {
  opacity: 0.95;
}
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: default; color: #686e7c; }
button:disabled::after { display: none; }
button:disabled { border-left-color: #3a3e48; }

/* Commit actions are WARM, exactly as the game's CONFIRM is. */
button[type="submit"], .btn-play { --acc: var(--amber); }
/* Destructive actions. */
.btn-danger, button.danger { --acc: var(--bad); }

/* A checkbox with its explanation beside it. The whole thing is the <label>, so
   the text is part of the hit target - a tick box you have to hit exactly is a
   tick box people mis-click, and consent is the last thing to collect by
   accident in either direction. */
.check {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 20px 0 0; padding: 12px 13px;
  background: var(--deep); border: 1px solid var(--gunmetal);
  font-size: 11px; line-height: 1.65; color: var(--lilac);
  letter-spacing: 0; text-transform: none; cursor: pointer;
}
.check:hover { border-color: var(--cyan-dim); }
.check input { width: auto; margin: 2px 0 0; flex: none; accent-color: var(--cyan); cursor: pointer; }

/* Tabs are TOGGLES: the selected one wears the game's ON state - body
 * tinted with the accent, accent edge, lit label - instead of a different
 * design of its own. */
.tabs { display: flex; gap: 8px; margin-bottom: 4px; }
.tabs button { margin: 0; flex: 1; padding: 9px; font-size: 11px; letter-spacing: 0.14em; }
.tabs button[aria-selected="true"] { color: var(--cyan); }
.tabs button[aria-selected="true"]::before {
  border-color: color-mix(in srgb, var(--acc) 55%, var(--gunmetal));
  background-color: color-mix(in srgb, var(--acc) 22%, transparent);
}
.tabs button[aria-selected="true"]::after { opacity: 0.95; }

/* Result banners. Hidden until a state class is added, so an empty one never
 * leaves a gap on the page. */
.msg { margin-top: 18px; padding: 11px 13px; font-size: 12px; line-height: 1.6; display: none; }
.msg.ok  { display: block; border: 1px solid var(--term); color: var(--term); }
.msg.err { display: block; border: 1px solid var(--bad);  color: var(--bad); }

/* --- link buttons ---------------------------------------------------------
 * .btn shares the one button grammar defined in the controls section above.
 * The lift and glow on hover are the front page's own flourish, kept on top
 * of the shared anatomy rather than replacing it. */
.btn:hover, .btn:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 0 22px rgba(79, 227, 255, 0.22); outline: none;
}
.btn-play { font-weight: 700; }
.btn-play:hover, .btn-play:focus-visible {
  box-shadow: 0 0 34px rgba(240, 168, 64, 0.4);
}

/* --- footer --------------------------------------------------------------- */
footer {
  border-top: 1px solid rgba(43, 52, 68, 0.6); padding: 24px var(--pad);
  color: var(--silver); font-size: 0.72rem; letter-spacing: 0.1em; text-align: center;
  position: relative; z-index: 1;
}
footer a { color: var(--cyan); text-decoration: none; }
/* On the card pages the footer is a flex child of .sheet: pinned to the bottom
 * by the auto margin, full-bleed across the column. */
.sheet .sheetfoot { margin-top: auto; width: 100%; }
footer a:hover { text-shadow: 0 0 12px rgba(79, 227, 255, 0.6); }

/* Somebody who has asked their system not to animate things means it. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .btn:hover, .feature:hover { transform: none; }
}
