/* The black System theme. Every colour comes from these variables, so changing
   --accent restyles the whole app at once. */
:root {
  --bg: #000000;
  --accent: #2f7bff;
  --danger: #ff3344;
  --text: #eaf2ff;
  --text-dim: #8493ad;
  --gold: #ffc94d;
  --ember: #ff8a2a;

  --line: color-mix(in srgb, var(--accent) 65%, transparent);
  --line-soft: color-mix(in srgb, var(--accent) 30%, transparent);
  --glow: color-mix(in srgb, var(--accent) 45%, transparent);
  --fill: color-mix(in srgb, var(--accent) 9%, #000);
  --fill-strong: color-mix(in srgb, var(--accent) 24%, #000);

  --font: 'Rajdhani', 'Segoe UI', Roboto, system-ui, sans-serif;
  --tap: 48px;

  color-scheme: dark;
}

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

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  background: var(--bg);
  /* No rubber-band bounce or pull-to-refresh at the edges of the page. */
  overscroll-behavior: none;
}

/* Like an app, not a web page: text in the interface cannot be selected or
   long-pressed, taps respond at once, and pictures cannot be dragged. */
body {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

input {
  user-select: text;
  -webkit-user-select: text;
}

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

body {
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

h1,
h2,
p,
ul,
fieldset,
legend {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

fieldset {
  border: 0;
  min-width: 0;
}

button,
input {
  font: inherit;
  color: inherit;
}

/* A faint wash of the accent colour at the top of the screen. The rest stays true black. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(80% 34% at 50% -6%, color-mix(in srgb, var(--accent) 17%, transparent), transparent 72%);
  pointer-events: none;
}

/* A phone-sized column, even on a wide desktop window. */
#app {
  max-width: 460px;
  margin: 0 auto;
  overflow-x: clip; /* a screen sliding in must not make the page scroll sideways */
}

/* ---------- Text ---------- */

.eyebrow {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.system-line {
  color: color-mix(in srgb, var(--text) 92%, var(--accent));
  text-shadow: 0 0 14px color-mix(in srgb, var(--accent) 30%, transparent);
}

.system-line--center {
  text-align: center;
}

/* ---------- System window ----------
   A pane of dark glass with its corners cut off, inside a thin glowing frame.
   The frame is two shapes: ::before is the whole cut-corner shape in the line
   colour, and ::after is the same shape a hair smaller in dark glass, laid on
   top. What is left showing round the edge is the frame. */

.panel {
  --cut: 14px;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 16px 18px;
  box-shadow: 0 0 36px -12px var(--glow);
  animation: panel-open 0.26s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.panel::before,
.panel::after {
  content: '';
  position: absolute;
  pointer-events: none;
}

.panel::before {
  inset: 0;
  z-index: -2;
  background: linear-gradient(180deg, var(--accent), var(--line-soft) 18%, var(--line-soft) 82%, var(--accent));
  clip-path: polygon(
    var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)),
    calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut)
  );
}

.panel::after {
  --in: calc(var(--cut) - 0.6px);
  inset: 1.5px;
  z-index: -1;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.014) 0 1px, transparent 1px 3px),
    radial-gradient(120% 55% at 50% 0%, color-mix(in srgb, var(--accent) 17%, #000), transparent 72%),
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 6%, #000), #010204);
  clip-path: polygon(
    var(--in) 0, calc(100% - var(--in)) 0, 100% var(--in), 100% calc(100% - var(--in)),
    calc(100% - var(--in)) 100%, var(--in) 100%, 0 calc(100% - var(--in)), 0 var(--in)
  );
}

/* The window's name, in a small plate with a line trailing off either side. */
.panel__title {
  position: relative;
  align-self: center;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 18%, transparent), transparent);
  border: 1px solid var(--line);
  color: color-mix(in srgb, var(--accent) 30%, #fff);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 0 12px var(--glow);
}

.panel__title::before,
.panel__title::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 26px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line));
}

.panel__title::before {
  right: calc(100% + 6px);
}

.panel__title::after {
  left: calc(100% + 6px);
  transform: scaleX(-1);
}

@keyframes panel-open {
  from {
    opacity: 0;
    transform: scaleY(0.7);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Buttons ----------
   Dark glass with a hairline border and two bright corner brackets. */

.btn {
  position: relative;
  flex: 1;
  min-height: var(--tap);
  padding: 10px 16px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 8%, #000), #000);
  border: 1px solid var(--line-soft);
  border-radius: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.15s, background 0.15s;
}

.btn::before,
.btn::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1px solid var(--accent);
  pointer-events: none;
}

.btn::before {
  top: -1px;
  left: -1px;
  border-right: 0;
  border-bottom: 0;
}

.btn::after {
  right: -1px;
  bottom: -1px;
  border-top: 0;
  border-left: 0;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 34%, #000), color-mix(in srgb, var(--accent) 12%, #000));
  border-color: var(--accent);
  box-shadow: 0 0 18px -2px var(--glow), inset 0 1px 0 color-mix(in srgb, var(--accent) 60%, transparent);
  text-shadow: 0 0 10px var(--glow);
}

.btn--dashed {
  flex: none;
  width: 100%;
  background: none;
  border-style: dashed;
  border-color: var(--line);
  color: var(--text-dim);
}

.btn--dashed::before,
.btn--dashed::after {
  display: none;
}

.btn:disabled {
  opacity: 0.4;
  box-shadow: none;
  cursor: default;
}

.btn:focus-visible,
.input:focus-visible,
.gate:focus-visible,
.icon-btn:focus-visible,
.quest__tick:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

/* The main action gets the room; Back, Cancel and No stay compact. */
.actions .btn:not(.btn--primary) {
  flex: 0 1 34%;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--text-dim);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- Form fields ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.input {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--line-soft);
  border-radius: 0;
  font-size: 19px;
  font-weight: 500;
}

.input::placeholder {
  color: color-mix(in srgb, var(--text-dim) 60%, transparent);
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--glow);
  outline: none;
}

.field-error {
  color: var(--danger);
  font-weight: 600;
}

/* Three-way choice (priority). */
.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 56px;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

.segmented input:checked + label {
  background: var(--fill-strong);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--glow);
  color: var(--text);
}

.segmented input:focus-visible + label {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

/* Small suggestion buttons. */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: -6px;
}

.chip {
  padding: 6px 10px;
  background: none;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
}

/* Priority shown as one to three small diamonds. */
.pips {
  display: inline-flex;
  gap: 5px;
}

.pip {
  width: 8px;
  height: 8px;
  border: 1px solid var(--accent);
  transform: rotate(45deg);
}

.pip.is-on {
  background: var(--accent);
  box-shadow: 0 0 6px var(--glow);
}

/* ---------- Pop-up windows ---------- */

.modal {
  width: min(100vw - 24px, 436px);
  max-width: none;
  max-height: calc(100dvh - 24px);
  padding: 0;
  overflow: visible auto;
  background: none;
  border: 0;
  color: inherit;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.86);
  animation: backdrop-in 0.22s ease-out;
}

/* A centred window (a message, a photo) pops open. */
.modal:not(.sheet) {
  animation: modal-pop 0.24s cubic-bezier(0.2, 1.3, 0.4, 1);
}

/* A sheet rises from the bottom edge of the screen and stays attached to it. */
.sheet {
  width: 100%;
  max-width: 460px;
  max-height: 94dvh;
  margin: auto auto 0;
  animation: sheet-up 0.34s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.sheet .panel {
  padding-top: 30px;
  padding-bottom: calc(22px + env(safe-area-inset-bottom));
  animation: none;
}

/* The little grab bar at the top of a sheet. */
.sheet__handle {
  position: absolute;
  top: 11px;
  left: 50%;
  width: 44px;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  transform: translateX(-50%);
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
}

@keyframes modal-pop {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
}

@keyframes backdrop-in {
  from {
    opacity: 0;
  }
}

.notice__icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  font-size: 15px;
  letter-spacing: 0;
}

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

/* ---------- Danger zone ----------
   Anything inside .zone-danger is drawn in red instead of the accent colour.
   The colours built from --accent are listed again so they follow the change. */
.zone-danger {
  --accent: var(--danger);
  --text-dim: #b89da2;
  --line: color-mix(in srgb, var(--accent) 65%, transparent);
  --line-soft: color-mix(in srgb, var(--accent) 30%, transparent);
  --glow: color-mix(in srgb, var(--accent) 45%, transparent);
  --fill: color-mix(in srgb, var(--accent) 9%, #000);
  --fill-strong: color-mix(in srgb, var(--accent) 24%, #000);
}

/* ---------- Small extras ---------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.btn--small {
  flex: none;
  min-height: 40px;
  padding: 4px 14px;
  font-size: 13px;
}

/* Buttons with a long label may wrap onto two lines. */
.btn--wrap {
  flex: none;
  letter-spacing: 0.12em;
  white-space: normal;
}

/* A label styled as a button, wrapping a hidden file input (the camera). */
.btn--file {
  display: grid;
  place-items: center;
  flex: none;
}

.btn--file:focus-within {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.link-btn {
  min-height: 40px;
  padding: 4px 8px;
  background: none;
  border: 0;
  color: var(--text-dim);
  font-size: 16px;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

/* Press-and-hold button: the fill sweeps across while it is held. */
.btn--hold {
  position: relative;
  flex: none;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.btn--hold__fill {
  position: absolute;
  inset: 0;
  background: var(--fill-strong);
  transform: scaleX(0);
  transform-origin: left;
}

.btn--hold.is-holding .btn--hold__fill {
  transform: scaleX(1);
  transition: transform var(--hold-ms) linear;
}

.btn--hold__label {
  position: relative;
}

/* ---------- Coins and the reward pop-up ---------- */

.coin {
  display: inline-block;
  flex: none;
  width: 0.62em;
  height: 0.62em;
  margin: 0 0.14em;
  background: linear-gradient(135deg, #fff6d0, var(--gold) 42%, #9a5f0e);
  box-shadow: 0 0 9px color-mix(in srgb, var(--gold) 70%, transparent);
  transform: rotate(45deg);
}

/* ---------- The reward sequence ----------
   A layer over the whole screen: a flash of light, a shockwave ring, sparks, and
   a card saying what was earned. Taps pass straight through it. */

.reward {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.reward__flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 42% at 50% 36%, color-mix(in srgb, var(--accent) 70%, #fff), transparent 72%);
  animation: reward-flash 0.7s ease-out both;
}

.reward__ring {
  position: absolute;
  top: 36%;
  left: 50%;
  width: 60px;
  height: 60px;
  border: 2px solid color-mix(in srgb, var(--accent) 60%, #fff);
  border-radius: 50%;
  box-shadow: 0 0 30px var(--accent), inset 0 0 20px var(--accent);
  animation: reward-ring 0.8s cubic-bezier(0.1, 0.7, 0.3, 1) both;
}

.reward__sparks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.reward__card {
  position: absolute;
  top: 36%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 16px 28px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 16%, #000), rgba(0, 0, 0, 0.94));
  border-top: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  box-shadow: 0 0 44px var(--glow);
  text-align: center;
  transform: translate(-50%, -50%);
  animation: reward-pop 0.36s cubic-bezier(0.2, 1.6, 0.4, 1) both, reward-out 0.4s 1.6s ease-in both;
}

.reward__title {
  margin-right: -0.3em;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-shadow: 0 0 14px var(--accent);
  animation: reward-title 0.5s 0.05s ease-out both;
}

.reward__gains {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
}

.reward__xp {
  text-shadow: 0 0 18px var(--accent);
}

.reward__coins {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gold);
  text-shadow: 0 0 18px color-mix(in srgb, var(--gold) 70%, transparent);
}

.reward__level {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  color: var(--gold);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  animation: reward-level 0.5s 0.55s ease-out both;
}

/* A level-up, or the last quest of the day: gold, larger, and it stays longer. */
.reward.is-big .reward__flash {
  background: radial-gradient(90% 60% at 50% 36%, #fff3c4, color-mix(in srgb, var(--gold) 70%, transparent) 30%, transparent 75%);
  animation-duration: 1.1s;
}

.reward.is-big .reward__ring {
  border-color: var(--gold);
  box-shadow: 0 0 40px var(--gold), inset 0 0 26px var(--gold);
  animation-duration: 1.1s;
}

.reward.is-big .reward__card {
  padding: 22px 30px;
  border-color: var(--gold);
  box-shadow: 0 0 60px color-mix(in srgb, var(--gold) 55%, transparent);
  animation: reward-pop 0.42s cubic-bezier(0.2, 1.7, 0.4, 1) both, reward-out 0.5s 3.3s ease-in both;
}

.reward.is-big .reward__title {
  color: var(--gold);
  font-size: 19px;
  text-shadow: 0 0 18px var(--gold);
}

.reward.is-big .reward__gains {
  font-size: 38px;
}

@keyframes reward-flash {
  from {
    opacity: 0.6;
  }
  to {
    opacity: 0;
  }
}

@keyframes reward-ring {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.4);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(11);
  }
}

@keyframes reward-pop {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes reward-out {
  to {
    opacity: 0;
    transform: translate(-50%, -62%) scale(0.96);
  }
}

@keyframes reward-title {
  from {
    letter-spacing: 1em;
    opacity: 0;
  }
}

@keyframes reward-level {
  from {
    opacity: 0;
    transform: scale(1.4);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Jolts ---------- */

#app.is-shaking {
  animation: shake 0.32s linear;
}

#app.is-quaking {
  animation: quake 0.6s linear;
}

@keyframes shake {
  20% { transform: translate(-3px, 2px); }
  40% { transform: translate(3px, -2px); }
  60% { transform: translate(-2px, -1px); }
  80% { transform: translate(2px, 1px); }
}

@keyframes quake {
  10% { transform: translate(-7px, 4px) rotate(-0.4deg); }
  25% { transform: translate(7px, -5px) rotate(0.4deg); }
  40% { transform: translate(-6px, -3px) rotate(-0.3deg); }
  55% { transform: translate(5px, 4px) rotate(0.3deg); }
  70% { transform: translate(-3px, 2px); }
  85% { transform: translate(2px, -1px); }
}

/* ---------- Tension ----------
   The last ten minutes before a deadline: the edges of the screen glow red, on
   every screen. In the last minute the glow beats fast. */

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 15;
  box-shadow: inset 0 0 70px 4px color-mix(in srgb, var(--danger) 70%, transparent);
  opacity: 0;
  pointer-events: none;
}

body[data-tension='near']::after {
  animation: tension 2.6s ease-in-out infinite;
}

body[data-tension='critical']::after {
  animation: tension-fast 1s ease-in-out infinite;
}

@keyframes tension {
  50% { opacity: 0.45; }
}

@keyframes tension-fast {
  0% { opacity: 0.25; }
  12% { opacity: 1; }
  40% { opacity: 0.25; }
  100% { opacity: 0.25; }
}

/* ---------- A soldier rises ---------- */

.arise {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.92);
  overflow: hidden;
  animation: arise-veil 2.6s ease-in-out both;
}

/* The pool of shadow the soldier climbs out of. */
.arise__pool {
  position: absolute;
  top: calc(50% + 96px);
  left: 50%;
  width: 280px;
  height: 46px;
  background: radial-gradient(closest-side, #7c4dff, #3b4fe0 45%, transparent);
  border-radius: 50%;
  filter: blur(6px);
  transform: translate(-50%, -50%);
  animation: arise-pool 2.6s ease-out both;
}

.arise__art {
  position: relative;
  height: 250px;
  animation: arise-rise 1.25s 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.arise__word {
  position: relative;
  margin-right: -0.6em;
  color: #cfe2ff;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 0.6em;
  text-transform: uppercase;
  text-shadow: 0 0 26px #5b8cff, 0 0 60px #7c4dff;
  animation: arise-word 0.9s 0.75s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.arise__name {
  position: relative;
  color: var(--text-dim);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  animation: arise-word 0.6s 1.15s ease-out both;
}

@keyframes arise-veil {
  0% { opacity: 0; }
  10% { opacity: 1; }
  86% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes arise-pool {
  0% { transform: translate(-50%, -50%) scale(0.1); opacity: 0; }
  25% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.25); opacity: 0.7; }
}

@keyframes arise-rise {
  from {
    clip-path: inset(100% 0 0 0);
    filter: brightness(4) blur(4px);
    transform: translateY(70px);
  }
  to {
    clip-path: inset(0);
    filter: none;
    transform: none;
  }
}

@keyframes arise-word {
  from {
    opacity: 0;
    transform: scale(1.7);
    filter: blur(8px);
  }
}

/* ---------- Every touch is answered ----------
   Anything you can press sinks and brightens for an instant under your finger. */

.btn,
.tile,
.tab,
.chip,
.icon-btn,
.swatch,
.quest__tick,
.quest__focus,
.segmented label {
  transition: transform 0.09s ease-out, filter 0.09s ease-out;
}

.btn:active,
.tile:active,
.tab:active,
.chip:active,
.icon-btn:active,
.swatch:active,
.quest__tick:active,
.quest__focus:active,
.segmented label:active {
  transform: scale(0.95);
  filter: brightness(1.4);
}

/* ---------- The tab bar ---------- */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  max-width: 460px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(3, 6, 14, 0.9), #000 70%);
  border-top: 1px solid var(--line-soft);
  transform: translateX(-50%);
}

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 52px;
  padding: 7px 0 4px;
  background: none;
  border: 0;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

.tab svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab[aria-current='page'] {
  color: var(--text);
}

.tab[aria-current='page'] svg {
  stroke: var(--accent);
  filter: drop-shadow(0 0 6px var(--accent));
}

/* A lit bar above the tab you are on. */
.tab[aria-current='page']::before {
  content: '';
  position: absolute;
  top: -7px;
  left: 50%;
  width: 30px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  transform: translateX(-50%);
  animation: tab-lit 0.25s ease-out;
}

.tab:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: -3px;
}

/* How many soldiers you have, on the Army tab. */
.tab__badge {
  position: absolute;
  top: 3px;
  left: calc(50% + 7px);
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  background: var(--accent);
  border-radius: 9px;
  color: #000;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 17px;
}

@keyframes tab-lit {
  from {
    width: 0;
    opacity: 0;
  }
}

/* The reward card names what the quest was for. */
.reward__note {
  max-width: 290px;
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.25;
  animation: reward-level 0.5s 0.3s ease-out both;
}
