/* GRIT - the skin.
 *
 * Dark, cold and slightly clinical, because the lab is a room for finding out what the damage
 * model does, not an arena. One warm accent (the blood red) and nothing else competes with it -
 * the only red on the screen should be a thing that is bleeding.
 */

:root {
  --bg: #14161a;
  --panel: rgba(18, 20, 24, 0.82);
  --line: rgba(190, 200, 214, 0.14);
  --ink: #dfe4ec;
  --dim: #8a93a1;
  --blood: #b4423c;
  --wind: #d9b45a;
  --wits: #6fa8c8;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font: 13px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#gl { position: fixed; inset: 0; display: block; width: 100vw; height: 100dvh; }

#status {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  margin: 0; color: var(--dim); font-family: var(--mono); letter-spacing: .08em;
}
#status.bad { color: var(--blood); max-width: 80vw; text-align: center; }

/* ---------------------------------------------------------------- the readout */

#hud {
  position: fixed; inset: 0; pointer-events: none;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
}

.fighter {
  width: min(290px, 40vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 10px 8px;
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  transition: border-color .3s, opacity .3s;
}
.fighter.down { border-color: rgba(180, 66, 60, .5); }
.fighter.dead { opacity: .6; border-color: rgba(180, 66, 60, .8); }

.who { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.who b { font-family: var(--mono); font-size: 12px; letter-spacing: .13em; text-transform: uppercase; }
.who em {
  font-style: normal; font-family: var(--mono); font-size: 10px;
  letter-spacing: .08em; color: var(--blood); text-transform: uppercase; text-align: right;
}

.meter { display: grid; grid-template-columns: 38px 1fr 26px; align-items: center; gap: 7px; margin-bottom: 4px; }
.meter .key { font-family: var(--mono); font-size: 9px; letter-spacing: .1em; color: var(--dim); }
.meter .num { font-family: var(--mono); font-size: 10px; color: var(--dim); text-align: right; }
.meter .track {
  position: relative; height: 7px; border-radius: 4px;
  background: rgba(255, 255, 255, .07); overflow: hidden;
}
.meter .fill {
  position: absolute; inset: 0 auto 0 0; width: 100%;
  border-radius: 4px; transition: width .12s linear;
}
.meter .cap {
  position: absolute; top: -1px; bottom: -1px; width: 2px; margin-left: -1px;
  background: var(--ink); opacity: 0; transition: left .3s, opacity .3s;
}
.meter.wind .fill { background: linear-gradient(90deg, #8a6d2c, var(--wind)); }
.meter.wits .fill { background: linear-gradient(90deg, #3e6b84, var(--wits)); }
.meter.blood .fill { background: linear-gradient(90deg, #6d1f1c, var(--blood)); }
.meter.wind.empty .fill { background: #6b4f18; animation: gasp .7s ease-in-out infinite; }
.meter.blood.bleeding .fill { animation: pump 1.1s ease-in-out infinite; }
@keyframes pump { 50% { filter: brightness(1.55); } }
@keyframes gasp { 50% { opacity: .45; } }

.lower { display: flex; gap: 9px; margin-top: 6px; }
.figure { width: 46px; flex: none; }
.figure .part { stroke: rgba(0, 0, 0, .35); stroke-width: .5; transition: fill .3s; }
.figure .cut { fill: var(--blood); opacity: 0; transition: opacity .4s; mix-blend-mode: screen; }

.notes { list-style: none; margin: 0; padding: 0; font-size: 10.5px; color: var(--dim); flex: 1; min-width: 0; }
.notes li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notes li b { color: #b9c1cc; font-weight: 600; }
.notes li.bad b, .notes li.bad { color: var(--blood); }
.notes li.none { opacity: .45; font-style: italic; }

.banner {
  position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%) scale(.96);
  text-align: center; opacity: 0; pointer-events: none; transition: opacity .5s, transform .5s;
}
.banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.banner b {
  display: block; font-family: var(--mono); font-size: clamp(22px, 5vw, 40px);
  letter-spacing: .2em; color: var(--blood);
  text-shadow: 0 2px 26px rgba(0, 0, 0, .9);
}
.banner.won b { color: var(--ink); }
.banner span { display: block; margin-top: 5px; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--dim); }
.banner em { display: block; margin-top: 12px; font-style: normal; font-family: var(--mono); font-size: 10px; letter-spacing: .22em; color: var(--dim); opacity: .7; }

/* ---------------------------------------------------------------- the lab panel
 *
 * NOTE the panel is `.lab` and a meter's label is `.key`. They were both `.lab` once, which
 * made every WIND/WITS/BLOOD caption a fixed-position 370px panel in the middle of the screen
 * and tore the readout apart. Keep these names apart.
 */

.lab {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(370px, 92vw); max-height: 92dvh; overflow: auto;
  background: rgba(16, 18, 22, .95);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 20px 22px 18px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .7);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: opacity .35s, transform .35s;
}
.lab.gone { opacity: 0; transform: translate(-50%, -46%); pointer-events: none; }
.lab h1 { margin: 0; font-family: var(--mono); font-size: 27px; letter-spacing: .22em; }
.lab h1 small { font-size: 11px; letter-spacing: .18em; color: var(--dim); margin-left: 7px; }
.lab .sub { margin: 4px 0 16px; color: var(--dim); font-size: 12px; }

.field { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 10px; margin-bottom: 9px; }
.field > span { font-family: var(--mono); font-size: 10px; letter-spacing: .09em; color: var(--dim); text-transform: uppercase; }
.field b { font-family: var(--mono); font-size: 11px; color: var(--dim); min-width: 32px; text-align: right; }
.field select, .field input[type="range"] { width: 100%; }
select {
  background: #1d2026; color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 8px; font: inherit; font-size: 12px;
}
input[type="range"] { accent-color: var(--blood); }
.blurb { margin: 2px 0 14px 106px; font-size: 11.5px; color: var(--dim); min-height: 2.4em; }
.check { display: flex; align-items: center; gap: 8px; margin: 12px 0 8px; font-size: 12px; color: var(--dim); }
.check input { accent-color: var(--blood); }
.watch-only { display: none; }
.lab.watching .watch-only { display: grid; }

#go {
  width: 100%; margin-top: 12px; padding: 11px;
  background: var(--blood); color: #fff; border: 0; border-radius: 7px;
  font-family: var(--mono); font-size: 13px; letter-spacing: .2em; cursor: pointer;
  transition: filter .15s;
}
#go:hover { filter: brightness(1.13); }
#go:active { filter: brightness(.9); }

.lab .keys { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11px; color: var(--dim); line-height: 1.8; }
.lab .keys b { font-family: var(--mono); color: #b9c1cc; font-weight: 600; }
.lab .note { margin: 10px 0 0; font-size: 11px; color: var(--dim); opacity: .75; }

/* ---------------------------------------------------------------- thumbs */

.pad, .buttons { position: fixed; bottom: max(16px, env(safe-area-inset-bottom)); display: none; }
.pad {
  left: max(16px, env(safe-area-inset-left)); width: 124px; height: 124px;
  border-radius: 50%; border: 1px solid var(--line); background: rgba(20, 23, 28, .5);
}
.pad .knob {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%; background: rgba(200, 210, 224, .22); border: 1px solid var(--line);
}
.buttons {
  right: max(14px, env(safe-area-inset-right));
  display: none; grid-template-columns: repeat(2, 78px); gap: 8px;
}
.buttons button {
  height: 50px; border-radius: 9px; border: 1px solid var(--line);
  background: rgba(24, 27, 33, .72); color: var(--ink);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
}
.buttons button.hit.cross { background: rgba(80, 32, 30, .72); }
.buttons button.hit.kick { background: rgba(64, 44, 24, .72); }
.buttons button.slip { height: 40px; font-size: 15px; }
.buttons button.on { filter: brightness(1.5); }
.buttons button.latched { background: var(--blood); color: #fff; }

@media (pointer: coarse) {
  .pad { display: block; }
  .buttons { display: grid; }
  .fighter { width: min(210px, 44vw); padding: 7px 8px 6px; }
  .notes { display: none; }
  .lower { margin-top: 4px; }
  .figure { width: 38px; }
}
@media (max-width: 560px) {
  .fighter { width: 46vw; }
  .meter { grid-template-columns: 30px 1fr 22px; gap: 5px; }
}
