/* Waveline skins — the shared layer: tokens, reset, and the components every
   page uses. The system is documented in DESIGN.md at the site root; the short
   version is one cyan carrier for what is true right now, steel grey for
   everything else, and hairlines instead of shadows.

   Fonts are the site's own self-hosted latin subsets, two folders up, so this
   app makes no third-party request for type either. */

@font-face{
  font-family:'Chakra Petch'; font-style:normal; font-weight:600; font-display:swap;
  src:url("../../cdn/fonts/chakra-petch-600.woff2") format("woff2");
}
@font-face{
  font-family:'Chakra Petch'; font-style:normal; font-weight:700; font-display:swap;
  src:url("../../cdn/fonts/chakra-petch-700.woff2") format("woff2");
}
@font-face{
  font-family:'JetBrains Mono'; font-style:normal; font-weight:400 500; font-display:swap;
  src:url("../../cdn/fonts/jetbrains-mono.woff2") format("woff2");
}

:root{
  /* ground */
  --void:#04060B;
  --panel:#0A0F18;
  --rule:rgba(125,155,190,.12);
  --rule-soft:rgba(125,155,190,.07);
  --rule-strong:rgba(125,155,190,.38);
  --rail:rgba(255,255,255,.08);

  /* signal */
  --signal:#24E0FF;
  --signal-bright:#5AE9FF;
  --signal-deep:#0C7FA6;
  --signal-ink:#02161D;
  --standby:#FFB545;
  --lost:#FF5C5C;

  /* team keys — a separate axis from the cyan carrier, so a card can be both
     "equipped" and "worn by T" without the two meanings sharing a hue. Held as
     their own values rather than aliases: --standby is a status and the T key
     is not, and the day one moves the other must be free to stay. Both pills
     are filled, because a deep blue as text on the near-black card ground
     lands around 2:1 and no amount of care makes that readable. */
  --team-t:#FFB545;
  --team-t-ink:#1A1002;    /* 10.7:1 on --team-t */
  --team-ct:#1D3BB0;
  --team-ct-ink:#E8EDF4;   /* 7.8:1 on --team-ct */
  --team-ct-edge:#3A63E0;  /* the deep blue is 2.1:1 on the card ground, so the
                              pill needs an edge of its own to have a shape;
                              3.7:1, and the amber does not need one at 10.9:1 */

  /* steel */
  --steel-100:#E8EDF4;
  --steel-300:#B4BECC;
  --steel-400:#8B96A8;
  --steel-600:#737F92;

  /* quiet interactive fills */
  --fill-ghost:rgba(255,255,255,.02);
  --fill-live:rgba(36,224,255,.07);
  --fill-live-soft:rgba(36,224,255,.05);

  /* type */
  --display:'Chakra Petch','Arial Narrow',sans-serif;
  --body:-apple-system,BlinkMacSystemFont,'Segoe UI',system-ui,sans-serif;
  --mono:'JetBrains Mono','SFMono-Regular',Consolas,monospace;

  /* motion — durations are tokens so reduced motion can retune the whole
     system from one place instead of overriding rules with !important */
  --ease-smooth:cubic-bezier(.22,.68,.19,1);
  --t:.25s;
  --t-slow:.35s;
  --t-press:.12s;
  --t-bar:2.4s;
  --shift:7px;

  /* stacking scale — no ad-hoc z-index anywhere else */
  --z-content:20;
  --z-toolbar:30;
  --z-footer:35;
  --z-overlay:40;
  --z-toast:45;   /* a report about what just happened outranks the picker */
  --z-loader:50;
}

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

html{background:var(--void); color-scheme:dark;}

body{
  min-height:100vh;
  min-height:100lvh;   /* largest viewport: the footer lands below the fold, never floating */
  background:var(--void);
  color:var(--steel-300);
  font-family:var(--body);
  font-size:15px;
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
}

img{-webkit-user-select:none; user-select:none;}

::selection{background:var(--signal); color:var(--signal-ink);}

:focus-visible{outline:2px solid var(--signal); outline-offset:2px;}

*{scrollbar-width:thin; scrollbar-color:var(--rule-strong) transparent;}
::-webkit-scrollbar{width:9px; height:9px;}
::-webkit-scrollbar-track{background:transparent;}
::-webkit-scrollbar-thumb{background:var(--rule-strong); border-radius:999px;}
::-webkit-scrollbar-thumb:hover{background:var(--steel-600);}

a{color:var(--steel-100); text-decoration:none;}
a:hover{color:var(--signal);}

h1,h2,h3{
  font-family:var(--display);
  font-weight:600;
  line-height:1.04;
  letter-spacing:.02em;
  text-transform:uppercase;
  color:var(--steel-100);
}

/* ---------- buttons ---------------------------------------------------- */

/* Ghost is the default: a control drawn with a border, not a fill. The cyan
   fill is spent once per screen, on the one action that screen exists for. */
.main-btn{
  display:inline-flex;
  justify-content:center;
  align-items:center;
  gap:9px;
  min-height:46px;
  padding:14px 20px;
  background:var(--fill-ghost);
  border:1px solid var(--rule-strong);
  border-radius:3px;
  color:var(--steel-100);
  fill:var(--steel-100);
  font-family:var(--body);
  font-size:14px;
  font-weight:600;
  letter-spacing:.02em;
  white-space:nowrap;
  cursor:pointer;
  transition:background var(--t) var(--ease-smooth),
             border-color var(--t) var(--ease-smooth),
             color var(--t) var(--ease-smooth);
}
.main-btn:hover,
.main-btn:focus-visible{
  background:var(--fill-live);
  border-color:var(--signal);
}
.main-btn:active{transition-duration:var(--t-press);}
.main-btn svg{width:15px; height:15px; flex:none;}
.main-btn:disabled,
.main-btn.is-disabled{opacity:.38; pointer-events:none;}

/* ---------- loading ----------------------------------------------------- */

/* Every click here is a full document load, so the wait is real. It is reported
   the way this system reports progress: one 2px hairline on the rail. Never a
   spinner, never a full-screen intro over a page the visitor already read. */
#loading{
  position:fixed;
  inset:0 0 auto 0;
  height:2px;
  background:var(--rail);
  z-index:var(--z-loader);
  opacity:0;
  pointer-events:none;
  transition:opacity var(--t) var(--ease-smooth);
}
#loading span{
  display:block;
  height:100%;
  background:linear-gradient(90deg,var(--signal-deep),var(--signal));
  transform:scaleX(0);
  transform-origin:left;
}
#loading[data-loading]{opacity:1;}
#loading[data-loading] span{animation:loadbar var(--t-bar) var(--ease-smooth) forwards;}

@keyframes loadbar{
  from{transform:scaleX(0);}
  to{transform:scaleX(.92);}
}

/* ---------- toast messages --------------------------------------------- */

#messages{
  position:fixed;
  left:0;
  bottom:0;
  display:flex;
  flex-direction:column;
  gap:9px;
  padding:16px;
  z-index:var(--z-toast);
  pointer-events:none;
}
#messages .msg{
  display:flex;
  align-items:center;
  gap:14px;
  max-width:min(420px,88vw);
  padding:14px 16px;
  background:linear-gradient(180deg,rgba(10,15,24,.55),var(--panel));
  border:1px solid var(--rule);
  border-radius:3px;
  color:var(--steel-300);
  fill:var(--steel-600);
  font-family:var(--mono);
  font-size:12.5px;
  animation:msgfade var(--timeout,3000ms) var(--ease-smooth) forwards;
}
#messages .msg svg{width:15px; height:15px; flex:none;}
/* The three states, keyed off the icon the script picked: success is cyan,
   warning amber, failure red. Anything else stays steel. */
#messages .msg:has(svg[viewBox="0 0 32 32"]){fill:var(--signal); color:var(--steel-100);}
#messages .msg:has(svg[viewBox="0 0 24 24"]){fill:var(--standby);}
#messages .msg:has(svg[viewBox="0 0 512 512"]){fill:var(--lost);}

@keyframes msgfade{
  0%{opacity:0; transform:translateY(var(--shift));}
  12%{opacity:1; transform:translateY(0);}
  85%{opacity:1;}
  100%{opacity:0;}
}

/* ---------- inputs ------------------------------------------------------ */

/* The system has no filled grey input. Every field is a ghost button that
   accepts text: quiet fill, rule-strong border, cyan only once it has focus. */
.input{display:grid; gap:7px; width:100%;}
.input label{
  font-family:var(--mono);
  font-size:10.5px;
  font-weight:500;
  letter-spacing:.24em;
  text-transform:uppercase;
  color:var(--steel-600);
}
.input select,
.input input[type="text"],
.input input[type="number"]{
  width:100%;
  min-height:46px;
  padding:9px 14px;
  background:var(--fill-ghost);
  border:1px solid var(--rule-strong);
  border-radius:3px;
  color:var(--steel-100);
  font-family:var(--mono);
  font-size:12.5px;
  font-variant-numeric:tabular-nums;
  transition:background var(--t) var(--ease-smooth), border-color var(--t) var(--ease-smooth);
}
.input select{cursor:pointer;}
.input select:hover,
.input input[type="text"]:hover,
.input input[type="number"]:hover{border-color:var(--steel-600);}
.input select:focus-visible,
.input input[type="text"]:focus-visible,
.input input[type="number"]:focus-visible{
  background:var(--fill-live);
  border-color:var(--signal);
  outline:none;
}
.input input:disabled{opacity:.38; cursor:not-allowed;}
.input option{background:var(--panel); color:var(--steel-100);}
.input input::placeholder{color:var(--steel-600); opacity:.6;}
.input input[type="number"]{-moz-appearance:textfield;}
.input input[type="number"]::-webkit-outer-spin-button,
.input input[type="number"]::-webkit-inner-spin-button{appearance:none; margin:0;}

/* A row that holds a control keeps the 46px touch height on its own. */
.input .box{
  display:flex;
  align-items:center;
  gap:14px;
  min-height:46px;
}

/* Checkbox: a 20px square in that row, cyan only when it is actually on. */
.input input[type="checkbox"]{
  appearance:none;
  position:relative;
  flex:none;
  width:20px;
  height:20px;
  background:var(--fill-ghost);
  border:1px solid var(--rule-strong);
  border-radius:3px;
  cursor:pointer;
  transition:background var(--t) var(--ease-smooth), border-color var(--t) var(--ease-smooth);
}
.input input[type="checkbox"]:hover{border-color:var(--steel-600);}
.input input[type="checkbox"]::before{
  content:'';
  position:absolute;
  top:3px;
  left:6px;
  width:5px;
  height:9px;
  border:solid transparent;
  border-width:0 2px 2px 0;
  transform:rotate(45deg);
  transition:border-color var(--t) var(--ease-smooth);
}
.input input[type="checkbox"]:checked{background:var(--fill-live); border-color:var(--signal);}
.input input[type="checkbox"]:checked::before{border-color:var(--signal);}

/* ---------- team marks -------------------------------------------------- */

/* Two jobs wear the same pill, and they are not the same thing.

   In #preset on the view page the pair is a switch - which team's saved setup
   the form is showing - so it stays mono and steel with the live one cyan, the
   way every other control in the system reports what is true right now.

   On a card the pill is not a switch, it is a label: it is rendered at all only
   when that team is actually wearing the item, so presence is the whole claim
   and nothing below reads :checked. It used to, which meant a card worn by both
   teams could light only one of them - the two inputs share a radio name (that
   shared name is what drives the preview image toggle in the weapon grid) and a
   radio group lights one member. Team is its own axis, so it gets its own hues
   and leaves cyan to mean selected. The letters stay: colour is never the only
   carrier. */
.marks{display:flex; align-items:center; gap:7px;}
.marks input[type="radio"]{
  appearance:none;
  position:relative;
  min-width:32px;
  height:20px;
  padding:0 7px;
  background:var(--fill-ghost);
  border:1px solid var(--rule);
  border-radius:999px;
  color:var(--steel-600);
  font-family:var(--mono);
  font-size:10.5px;
  font-weight:500;
  letter-spacing:.18em;
  cursor:pointer;
  transition:background var(--t) var(--ease-smooth),
             border-color var(--t) var(--ease-smooth),
             color var(--t) var(--ease-smooth),
             filter var(--t) var(--ease-smooth);
}
.marks input[type="radio"]::after{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  padding-left:.18em;   /* pays back the trailing letter-space */
}
.marks input[type="radio"]:hover{color:var(--steel-300); border-color:var(--rule-strong);}
.marks input[type="radio"]:checked{
  background:var(--fill-live-soft);
  border-color:rgba(36,224,255,.28);
  color:var(--signal);
}
.terrormark::after{content:'T';}
.counterterrormark::after{content:'CT';}

/* The label form. Filled, because a deep blue as text on the near-black card
   ground lands near 2:1 and no amount of care makes that readable. Written
   against input[type="radio"] rather than the class alone so it outweighs the
   control's own :hover and :checked rules above - a card mark must not restyle
   itself on hover, it is reporting, not offering. */
.card .marks input[type="radio"].terrormark{
  background:var(--team-t);
  border-color:var(--team-t);
  color:var(--team-t-ink);
}
.card .marks input[type="radio"].counterterrormark{
  background:var(--team-ct);
  border-color:var(--team-ct-edge);
  color:var(--team-ct-ink);
}
.card .marks input[type="radio"]:hover{filter:brightness(1.12);}

/* ---------- footer ------------------------------------------------------ */

footer{
  flex:0 0 auto;
  background:linear-gradient(180deg,rgba(4,6,11,0),var(--panel));
  border-top:1px solid var(--rule);
  z-index:var(--z-footer);
}
footer .wrapper{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  width:min(1300px,100%);
  margin:0 auto;
  padding:16px clamp(20px,4vw,32px);
}
footer .info{
  display:flex;
  align-items:center;
  gap:14px;
  min-height:44px;
  min-width:0;
  color:var(--steel-400);
  font-family:var(--mono);
  font-size:12.5px;
}
footer .info img{
  width:32px;
  height:32px;
  flex:none;
  border:1px solid var(--rule);
  border-radius:3px;
}
footer .info p{overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
footer .info strong{color:var(--steel-100); font-weight:500;}
footer .info:hover strong{color:var(--signal);}
footer .actions{display:flex; align-items:center; gap:9px;}

/* settings menu */
footer .settings{
  position:relative;
  display:none;
  place-items:center;
  width:44px;
  height:44px;
  fill:var(--steel-400);
}
footer .settings:has(button){display:grid;}
footer .settings > svg{
  width:20px;
  height:20px;
  cursor:pointer;
  transition:fill var(--t) var(--ease-smooth), transform var(--t) var(--ease-smooth);
}
footer .settings > svg:hover{fill:var(--signal); transform:rotate(25deg);}
footer .settings svg path{pointer-events:none;}
footer .settings .items{
  position:absolute;
  right:0;
  bottom:calc(100% + 9px);
  background:var(--panel);
  border:1px solid var(--rule);
  border-radius:3px;
  opacity:0;
  transform:translateY(var(--shift));
  pointer-events:none;
  transition:opacity var(--t) var(--ease-smooth), transform var(--t) var(--ease-smooth);
}
footer .settings[data-open] .items{opacity:1; transform:translateY(0); pointer-events:auto;}
footer .settings ul{
  display:flex;
  flex-direction:column;
  width:240px;
  max-height:300px;
  overflow-y:auto;
  list-style:none;
  direction:ltr;
}
footer .settings button{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  min-height:44px;
  padding:9px 14px;
  background:none;
  border:none;
  border-top:1px solid var(--rule-soft);
  color:var(--steel-400);
  fill:var(--steel-600);
  font-family:var(--mono);
  font-size:11.5px;
  font-weight:500;
  letter-spacing:.2em;
  text-transform:uppercase;
  text-align:left;
  cursor:pointer;
  transition:background var(--t) var(--ease-smooth), color var(--t) var(--ease-smooth), fill var(--t) var(--ease-smooth);
}
footer .settings button:first-child{border-top:none;}
footer .settings button:hover,
footer .settings button:focus-visible{background:var(--fill-ghost); color:var(--steel-100); fill:var(--signal);}
footer .settings button *{pointer-events:none;}
footer .settings button div{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:9px;
  flex:1;
  min-width:0;
}
footer .settings button span{overflow:hidden; text-overflow:ellipsis;}
footer .settings button svg{width:14px; height:14px; flex:none;}
footer .settings input[type="radio"]{
  appearance:none;
  width:9px;
  height:9px;
  border:1px solid var(--rule-strong);
  border-radius:50%;
}
footer .settings input[type="radio"]:checked{background:var(--signal); border-color:var(--signal);}
footer .settings input[type="color"]{
  appearance:none;
  width:20px;
  height:20px;
  padding:0;
  background:none;
  border:1px solid var(--rule-strong);
  border-radius:3px;
}

@media (width <= 700px){
  footer .wrapper{gap:14px; padding:14px 20px;}
  }

@media (prefers-reduced-motion:reduce){
  /* Same information, no travel: transitions collapse, the progress bar shows
     one static frame, and nothing slides in from an offset. */
  :root{
    --t:.001ms;
    --t-slow:.001ms;
    --t-press:.001ms;
    --t-bar:.001ms;
    --shift:0px;
  }
}
