/* Standalone crossing: progress map, memory cards, prompts, the Roll, settings. */
#map-panel {
  position: absolute;
  right: 4.5vw;
  top: calc(9vh + 92px);
  width: 280px;
  padding: 0;
  background: #071015a8;
  border: 1px solid #e6dfd024;
  backdrop-filter: blur(6px);
}
#map-panel canvas {
  display: block;
}
#behind-count {
  margin: 0;
  padding: 6px 10px 7px;
  border-top: 1px solid #e6dfd01c;
  font: 500 13px/1 var(--ui);
  letter-spacing: 0.04em;
  color: var(--rain);
}
#behind-count b {
  color: #e98a7e;
  font-weight: 600;
}
.crossing-condition {
  top: calc(9vh + 232px) !important;
}
.wind-widget.warn {
  animation: windwarn 0.25s steps(2) infinite;
}
.wind-widget.warn #wind-text {
  color: #f0b75f;
}
@keyframes windwarn {
  50% {
    opacity: 0.45;
  }
}
#panic {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at 50% 46%, transparent 22%, #020507 70%);
  transition: opacity 0.4s;
}
#memory-card {
  position: absolute;
  left: 4.5vw;
  bottom: calc(4% + 44px);
  width: min(380px, 40vw);
  padding: 16px 20px 18px;
  color: #2a2117;
  background: linear-gradient(170deg, #e9dcbf, #d9c7a0);
  box-shadow:
    0 10px 30px #0008,
    inset 0 0 40px #8a6a3a40;
  transform: rotate(-0.6deg);
  animation: card-in 0.35s ease-out;
}
#memory-card .eyebrow {
  color: #7b5d35;
}
#memory-card p {
  margin: 6px 0 0;
  font: italic 400 19px/1.35 var(--ink);
}
@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(12px) rotate(-0.6deg);
  }
}
#subtitle {
  position: fixed;
  left: 50%;
  bottom: 17%;
  transform: translateX(-50%);
  max-width: min(760px, 86vw);
  text-align: center;
  font: 500 20px/1.35 var(--ui);
  color: #f1ece0;
  text-shadow:
    0 2px 10px #000,
    0 0 2px #000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
  z-index: 6;
}
#subtitle.on {
  opacity: 1;
}
#subtitle b {
  color: #e3b45c;
  font-weight: 600;
  margin-right: 6px;
}
#subtitle i {
  color: #cfd7d3;
}
#tags {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
#tags span {
  position: absolute;
  transform: translate(-50%, -100%);
  font: 600 12px/1 var(--ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 7px;
  background: #071015cc;
  border: 1px solid #e6dfd033;
  color: #e6dfd0;
  white-space: nowrap;
}
#mash,
#draw-prompt {
  position: fixed;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 7;
  text-shadow: 0 2px 12px #000;
}
#mash b {
  display: block;
  font: 400 54px/1.1 var(--ink);
  margin: 6px 0;
}
#mash p {
  margin: 0 0 10px;
  color: var(--rain);
}
.mash-track {
  width: 240px;
  height: 6px;
  margin: 0 auto;
  background: #ffffff22;
}
#mash-fill {
  display: block;
  height: 100%;
  width: 0;
  background: #e3b45c;
}
#draw-prompt b {
  display: block;
  font: 400 92px/1 var(--ink);
  letter-spacing: 0.04em;
}
#draw-prompt span {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 18px;
  border: 2px solid #e6dfd0;
  font: 600 30px/1 var(--ui);
  animation: pulse 0.3s ease-in-out infinite alternate;
}
@keyframes pulse {
  to {
    transform: scale(1.12);
    background: #e6dfd022;
  }
}
@keyframes strike {
  to {
    background-size: 100% 2px;
  }
}
#intro-card {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}
#intro-card .flash-card {
  position: absolute;
  left: 50%;
  bottom: 14%;
  transform: translateX(-50%);
  width: min(620px, 86vw);
  padding: 20px 26px;
  background: #1a140ccc;
  border: 1px solid #e3b45c55;
  box-shadow: 0 0 0 100vmax #2a1d0c38;
  text-align: center;
  filter: sepia(0.3);
}
#intro-card .flash-card:empty {
  display: none;
}
#intro-card p {
  margin: 8px 0 0;
  font: 400 22px/1.4 var(--ink);
  color: #f1e6cc;
}
#intro-card.plain .flash-card {
  background: transparent;
  border: 0;
  box-shadow: none;
  filter: none;
}
#skip-intro {
  position: absolute;
  right: 4.5vw;
  bottom: 5%;
  pointer-events: auto;
}
#roll {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 6vh 16px;
}
.roll-inner {
  width: min(640px, 100%);
  text-align: center;
}
#roll h2 {
  font: 400 64px/1 var(--ink);
  margin: 10px 0 28px;
}
#roll-names {
  list-style: none;
  margin: 0 0 34px;
  padding: 0;
  font: 400 26px/1.7 var(--ink);
}
#roll-names li {
  opacity: 0;
  animation: rollin 0.8s ease-out forwards;
}
#roll-names li.survived {
  color: #e3b45c;
}
#roll-names li em {
  font: 500 14px var(--ui);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rain);
  font-style: normal;
  margin-left: 10px;
}
@keyframes rollin {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
  }
}
#roll-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 0 0 28px;
  opacity: 0;
  animation: rollin 0.8s ease-out forwards;
}
#roll-stats span {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font: 500 12px var(--ui);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rain);
}
#roll-stats b {
  font: 400 30px/1 var(--ink);
  color: var(--bone);
  letter-spacing: 0;
  text-transform: none;
}
#roll-notes {
  text-align: left;
  margin: 0 0 30px;
  opacity: 0;
  animation: rollin 0.8s ease-out forwards;
}
#roll-memories {
  margin: 10px 0 0;
  padding-left: 20px;
  font: italic 400 17px/1.5 var(--ink);
  color: #d9cfb8;
}
.roll-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.setting {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.setting input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: #e3b45c;
}
.setting b {
  display: block;
  font-weight: 600;
}
.setting span {
  color: var(--rain);
  font-size: 15px;
}
.setting span b {
  color: var(--bone);
}
#overlay .dialog button {
  display: block;
}
@media (max-width: 900px) {
  #map-panel {
    transform: scale(0.82);
    transform-origin: top right;
  }
  .crossing-condition {
    top: calc(9vh + 210px) !important;
  }
  #roll-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (prefers-reduced-motion: reduce) {
  #draw-prompt span,
  .wind-widget.warn {
    animation: none;
  }
}
#feet-marker {
  position: absolute;
  width: 8px;
  height: 8px;
  top: 5px;
  left: calc(50% - 4px);
  background: #e3b45c;
  transform: rotate(45deg);
  opacity: 0.85;
}
#balance-needle {
  transition: background 0.15s;
}
#balance-needle.hot {
  background: #e98a7e;
  box-shadow: 0 0 10px #e98a7e;
}
.setting input[type='range'] {
  width: 110px;
  margin-top: 6px;
  accent-color: #e3b45c;
  flex: none;
}
.controls-strip span {
  display: flex !important;
}
.controls-strip span:nth-child(4),
.controls-strip span:nth-child(5) {
  display: none !important;
}
@media (max-width: 750px) {
  .controls-strip span:nth-child(7) {
    display: none !important;
  }
}
#cue-left,
#cue-right {
  opacity: 0.35;
  transition:
    opacity 0.12s,
    color 0.12s;
}
#cue-left.on,
#cue-right.on {
  opacity: 1;
  color: #e3b45c;
  animation: cue 0.35s ease-in-out infinite alternate;
}
.cue-mid {
  font-size: 11px;
  color: var(--rain);
  letter-spacing: 0.06em;
}
@keyframes cue {
  to {
    transform: scale(1.12);
  }
}
.balance-wrap {
  width: 380px !important;
}

/* Difficulty picker */
.difficulty {
  margin: 0 0 22px;
}
.difficulty > div {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.difficulty button {
  flex: 1;
  min-width: 120px;
  padding: 10px 12px;
  text-align: left;
  background: #071015a8;
  border: 1px solid #e6dfd033;
  color: var(--bone);
  font: 600 16px/1.2 var(--ui);
  cursor: pointer;
}
.difficulty button small {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: var(--rain);
  margin-top: 3px;
}
.difficulty button[aria-pressed='true'] {
  border-color: #e3b45c;
  background: #e3b45c22;
  box-shadow: inset 0 0 0 1px #e3b45c;
}
.difficulty button:hover {
  border-color: #e6dfd088;
}
.difficulty.in-settings {
  display: block;
}
.difficulty.in-settings button {
  min-width: 0;
  text-align: center;
}
/* Gust alert: the whole screen lights up from the side the wind comes from. */
#gust-alert {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}
#gust-alert .gust-glow {
  position: absolute;
  inset: 0;
  transition: opacity 0.2s;
}
#gust-alert[data-from='right'] .gust-glow {
  background: linear-gradient(
    270deg,
    #cfe6ffcc,
    #9fc7ee55 32%,
    transparent 70%
  );
}
#gust-alert[data-from='left'] .gust-glow {
  background: linear-gradient(90deg, #cfe6ffcc, #9fc7ee55 32%, transparent 70%);
}
#gust-alert[data-phase='warn'] .gust-glow {
  opacity: 0.55;
  animation: gustpulse 0.5s ease-in-out infinite alternate;
}
#gust-alert[data-phase='push'] .gust-glow,
#gust-alert[data-phase='steady'] .gust-glow,
#gust-alert[data-phase='braced'] .gust-glow {
  opacity: 0.85;
}
#gust-alert[data-level='light'] .gust-glow {
  opacity: 0.35 !important;
}
#gust-alert .gust-streaks {
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background: repeating-linear-gradient(
    0deg,
    transparent 0 34px,
    #ffffff59 34px 36px,
    transparent 36px 61px,
    #ffffff33 61px 62px
  );
  -webkit-mask: linear-gradient(
    90deg,
    transparent,
    #000 20%,
    #000 80%,
    transparent
  );
  mask: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
  background-size: 240px 100%;
}
#gust-alert .gust-streaks {
  background: repeating-linear-gradient(
    90deg,
    transparent 0 60px,
    #ffffff66 60px 140px,
    transparent 140px 260px
  );
  background-size: 260px 9px;
  -webkit-mask: repeating-linear-gradient(
    0deg,
    #000 0 2px,
    transparent 2px 23px
  );
  mask: repeating-linear-gradient(0deg, #000 0 2px, transparent 2px 23px);
}
#gust-alert[data-from='right'] .gust-streaks {
  animation: streak-left 0.35s linear infinite;
}
#gust-alert[data-from='left'] .gust-streaks {
  animation: streak-right 0.35s linear infinite;
}
@keyframes streak-left {
  to {
    background-position: -260px 0;
  }
}
@keyframes streak-right {
  to {
    background-position: 260px 0;
  }
}
@keyframes gustpulse {
  to {
    opacity: 0.25;
  }
}
#gust-alert .gust-card {
  position: absolute;
  left: 50%;
  top: 28%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #0b1418;
  text-shadow: none;
}
#gust-from {
  display: inline-block;
  padding: 5px 12px;
  background: #0b1418d9;
  color: #e6f2ff;
  font: 600 15px/1 var(--ui);
  letter-spacing: 0.14em;
}
#gust-key {
  display: block;
  margin: 12px auto 8px;
  width: 120px;
  height: 120px;
  border-radius: 18px;
  background: #f4f8fb;
  border: 3px solid #0b1418;
  box-shadow:
    0 8px 0 #0b1418,
    0 0 50px #cfe6ff;
  font: 700 86px/112px var(--ui);
  color: #0b1418;
}
#gust-alert[data-phase='push'] #gust-key {
  animation: keypress 0.22s ease-in-out infinite alternate;
  background: #ffe2a8;
}
#gust-alert[data-phase='steady'] #gust-key,
#gust-alert[data-phase='braced'] #gust-key {
  opacity: 0.45;
}
@keyframes keypress {
  to {
    transform: translateY(6px);
    box-shadow:
      0 2px 0 #0b1418,
      0 0 70px #ffe2a8;
  }
}
#gust-action {
  display: block;
  font: 400 46px/1.1 var(--ink);
  color: #fff;
  text-shadow:
    0 2px 14px #000,
    0 0 3px #000;
}
#gust-alert[data-phase='steady'] #gust-action {
  color: #bfe8c4;
}
#gust-alert small {
  display: block;
  margin-top: 6px;
  font: 500 15px var(--ui);
  color: #fff;
  text-shadow: 0 1px 8px #000;
}
.gust-timer {
  width: 240px;
  height: 5px;
  margin: 12px auto 0;
  background: #0b141888;
}
#gust-timer-fill {
  display: block;
  height: 100%;
  background: #fff;
  transform-origin: left;
}
#gust-alert.dim .gust-glow {
  opacity: 0.3 !important;
  animation: none;
}
#gust-alert.dim .gust-streaks {
  opacity: 0.25;
}
@media (prefers-reduced-motion: reduce) {
  #gust-alert .gust-streaks,
  #gust-alert .gust-glow,
  #gust-key {
    animation: none !important;
  }
}
@media (max-width: 750px) {
  #gust-key {
    width: 84px;
    height: 84px;
    font-size: 60px;
    line-height: 78px;
  }
  #gust-action {
    font-size: 32px;
  }
}

/* ── Fatality screen: big word, the cause in detail, and how not to die that way again. */
#fatality {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  pointer-events: auto;
  background: radial-gradient(
    ellipse at 50% 46%,
    #0000 0,
    #0000 22%,
    #1a0204b8 62%,
    #000e 100%
  );
}
#fatality .fx-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: min(300px, 44vh);
  transform: translateY(-58%);
  background: linear-gradient(#0000, #000c 18%, #000d 82%, #0000);
}
#fatality .fx-inner {
  position: relative;
  width: min(880px, calc(100vw - 32px));
  text-align: center;
}
#fatality .fx-word {
  font: 400 clamp(72px, 15vw, 184px)/0.9 var(--ink);
  letter-spacing: 0.06em;
  color: #b3121a;
  text-shadow:
    0 0 38px #ff1a2a55,
    0 6px 0 #3a0003,
    0 0 2px #000;
}
#fatality .fx-headline {
  margin-top: 10px;
  font: 700 clamp(18px, 2.6vw, 28px)/1.1 var(--ui);
  letter-spacing: 0.24em;
  color: #f3ead6;
}
#fatality .fx-rule {
  width: min(520px, 70%);
  height: 1px;
  margin: 18px auto 16px;
  background: linear-gradient(90deg, #0000, #e6dfd088, #0000);
}
#fatality .fx-line {
  margin: 0 auto 8px;
  max-width: 680px;
  font: 400 clamp(15px, 1.7vw, 19px)/1.45 var(--ui);
  color: #e6dfd0;
}
#fatality .fx-line:empty {
  display: none;
}
#fatality .fx-tip {
  display: inline-flex;
  gap: 12px;
  align-items: baseline;
  margin: 14px auto 0;
  padding: 10px 16px;
  border: 1px solid #d9a64a66;
  border-radius: 6px;
  background: #1b130a99;
  font: 500 15px/1.4 var(--ui);
  color: #f1d9a6;
  text-align: left;
  max-width: 680px;
}
#fatality .fx-tip b {
  font: 700 11px/1 var(--ui);
  letter-spacing: 0.2em;
  color: #d9a64a;
  white-space: nowrap;
}
#fatality .fx-roll {
  margin-top: 22px;
}
#fatality .fx-roll p {
  margin: 6px 0 0;
  font: 400 26px/1.2 var(--ink);
  color: #e6dfd0;
}
#fatality .fx-roll s {
  text-decoration: none;
  background: linear-gradient(#b3121a, #b3121a) no-repeat 0 58%/0 3px;
}
#fatality .fx-continue {
  margin-top: 22px;
  font: 500 14px/1 var(--ui);
  letter-spacing: 0.06em;
  color: #e6dfd0b0;
}
#fatality .fx-continue kbd {
  display: inline-block;
  min-width: 54px;
  padding: 5px 8px;
  margin: 0 4px;
  border: 1px solid #e6dfd077;
  border-bottom-width: 3px;
  border-radius: 5px;
  font: 600 13px/1 var(--ui);
  color: #fff;
}
#fatality .fx-sep {
  margin: 0 12px;
  opacity: 0.5;
}
#fatality.in {
  animation: fxBg 0.5s ease-out both;
}
#fatality.in .fx-word {
  animation: fxSlam 0.9s cubic-bezier(0.2, 0.9, 0.2, 1) 0.15s both;
}
#fatality.in .fx-headline {
  animation: fxUp 0.6s ease-out 0.75s both;
}
#fatality.in .fx-rule {
  animation: fxRule 0.7s ease-out 0.95s both;
}
#fatality.in .fx-line {
  animation: fxUp 0.6s ease-out 1.15s both;
}
#fatality.in .fx-line + .fx-line {
  animation-delay: 1.45s;
}
#fatality.in .fx-tip {
  animation: fxUp 0.6s ease-out 1.9s both;
}
#fatality.in .fx-roll {
  animation: fxUp 0.5s ease-out 2.3s both;
}
#fatality.in .fx-roll s {
  animation: fxStrike 0.7s 2.8s ease-out forwards;
}
#fatality.in .fx-continue {
  animation: fxUp 0.5s ease-out 1.3s both;
}
@keyframes fxBg {
  from {
    opacity: 0;
  }
}
@keyframes fxSlam {
  0% {
    opacity: 0;
    transform: scale(2.4);
    letter-spacing: 0.5em;
    filter: blur(10px);
  }
  55% {
    opacity: 1;
    filter: blur(0);
  }
  72% {
    transform: scale(0.96);
  }
  100% {
    transform: scale(1);
    letter-spacing: 0.06em;
  }
}
@keyframes fxUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}
@keyframes fxRule {
  from {
    transform: scaleX(0);
  }
}
@keyframes fxStrike {
  to {
    background-size: 100% 3px;
  }
}
@media (max-width: 600px) {
  #fatality .fx-tip {
    flex-direction: column;
    gap: 6px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #fatality.in * {
    animation-duration: 0.01s !important;
    animation-delay: 0s !important;
  }
}

/* ── Key dock: ← W → Shift, lit while held, pulsing when that key is what you need. */
.controls-strip span:nth-child(1),
.controls-strip span:nth-child(2),
.controls-strip span:nth-child(3) {
  display: none !important;
}
#keydock {
  position: absolute;
  left: 50%;
  bottom: 2.2%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  transition:
    bottom 0.6s,
    transform 0.6s;
}
#keydock .kd-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
#keydock .kd-key {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font: 600 10px/1 var(--ui);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #e6dfd0aa;
}
#keydock kbd {
  display: grid;
  place-items: center;
  width: 44px;
  height: 40px;
  border: 1px solid #e6dfd055;
  border-bottom: 4px solid #e6dfd033;
  border-radius: 7px;
  background: #0b1118c8;
  font: 600 19px/1 var(--ui);
  color: #f3ead6;
  box-shadow: 0 4px 14px #0008;
  transition:
    transform 0.06s,
    background 0.1s,
    border-color 0.1s;
}
#keydock .kd-wide kbd {
  width: 78px;
  font-size: 13px;
  letter-spacing: 0.08em;
}
#keydock .kd-key.down kbd {
  transform: translateY(3px);
  border-bottom-width: 1px;
  background: #e6dfd0;
  color: #0b1118;
}
#keydock .kd-key.need kbd {
  border-color: #f0b54e;
  background: #3a2408e0;
  color: #ffd58a;
  animation: kdNeed 0.42s ease-in-out infinite alternate;
}
#keydock .kd-key.need span {
  color: #ffd58a;
}
@keyframes kdNeed {
  from {
    box-shadow:
      0 0 0 0 #f0b54e00,
      0 4px 14px #0008;
  }
  to {
    box-shadow:
      0 0 0 6px #f0b54e55,
      0 0 24px #f0b54e88;
  }
}
#keydock .kd-caption {
  display: none;
  max-width: min(560px, 92vw);
  padding: 8px 14px;
  border-radius: 6px;
  background: #050b12cc;
  font: 500 15px/1.35 var(--ui);
  color: #f3ead6;
  text-align: center;
}
#keydock .kd-caption b {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  padding: 2px 6px;
  border: 1px solid #f0b54e;
  border-radius: 4px;
  color: #ffd58a;
  font-weight: 700;
}
#keydock .kd-caption em {
  font-style: normal;
  color: #ffd58a;
  font-weight: 700;
}
/* First crossing: big, centred low, with the caption. */
#keydock {
  transform-origin: 50% 100%;
}
#keydock.teach {
  transform: translateX(-50%) scale(1.3);
}
.playing .balance-wrap {
  bottom: calc(2.2% + 86px) !important;
  transition: bottom 0.6s;
}
#keydock.teach .kd-caption {
  display: block;
}
body:has(#keydock.teach) .balance-wrap {
  bottom: calc(2.2% + 168px) !important;
}
@media (max-width: 750px) {
  #keydock.teach {
    transform: translateX(-50%) scale(1.05);
  }
  #keydock kbd {
    width: 38px;
    height: 34px;
  }
}
#keydock[hidden] {
  display: none !important;
}

/* ── A balance meter you can read at a glance: thick track, red edges, glowing needle. */
.playing .balance-wrap {
  width: min(460px, 80vw) !important;
  max-width: none !important;
}
.balance-track {
  height: 10px !important;
  border-radius: 5px;
  background: linear-gradient(
    90deg,
    #b3121acc 0,
    #b3121a55 12%,
    #e6dfd022 28%,
    #e6dfd033 50%,
    #e6dfd022 72%,
    #b3121a55 88%,
    #b3121acc 100%
  ) !important;
  box-shadow: inset 0 0 0 1px #e6dfd033;
}
.balance-track .safe-zone {
  top: 0;
  bottom: 0;
  height: auto !important;
  border-radius: 5px;
}
.balance-track .center-tick {
  height: 18px !important;
  top: -4px !important;
  width: 2px !important;
  background: #e6dfd0aa !important;
}
#balance-needle {
  width: 6px !important;
  height: 28px !important;
  top: -9px !important;
  margin-left: -1px;
  border-radius: 3px;
  background: #f3ead6 !important;
  box-shadow:
    0 0 10px #fff8,
    0 0 2px #000;
}
#balance-needle.hot {
  background: #ff4b4b !important;
  box-shadow: 0 0 16px #ff2a2acc;
}
#feet-marker {
  top: 12px !important;
}
.balance-hint {
  font-size: 13px !important;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.balance-hint .cue-mid {
  color: #f3ead6;
}
.balance-label {
  font-size: 13px !important;
  font-weight: 600;
  letter-spacing: 0.12em;
}
/* Subtitles sit above the meter and the key dock, never under them. */
.playing #subtitle {
  bottom: calc(2.2% + 196px);
}
body.playing:has(#keydock.teach:not([hidden])) #subtitle {
  bottom: calc(2.2% + 286px);
}
body.playing:has(#keydock.teach:not([hidden])) .balance-wrap {
  bottom: calc(2.2% + 176px) !important;
}
body:has(#fatality:not([hidden])) #subtitle {
  opacity: 0 !important;
}

/* ── Heart monitor: a bedside trace on the HUD. */
.crossing-condition .pulse-line {
  display: none !important;
}
#heart-monitor {
  position: absolute;
  left: 4.5vw;
  top: 118px;
  width: 320px;
  padding: 8px 10px 6px;
  border: 1px solid #5cf08a33;
  border-radius: 8px;
  background: #020607d9;
  box-shadow:
    0 6px 24px #000a,
    inset 0 0 18px #5cf08a14;
  pointer-events: none;
  transition:
    border-color 0.3s,
    box-shadow 0.3s;
}
#heart-monitor .hm-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font: 600 12px/1 var(--ui);
  letter-spacing: 0.14em;
  color: #9fb5a8;
}
#heart-monitor .hm-heart {
  font-size: 22px;
  color: #5cf08a;
  display: inline-block;
}
#heart-monitor .hm-heart.beat {
  animation: hmBeat 0.28s ease-out;
}
@keyframes hmBeat {
  0% {
    transform: scale(1.45);
  }
  100% {
    transform: scale(1);
  }
}
#heart-monitor .hm-bpm {
  font: 700 40px/1 var(--ui);
  letter-spacing: 0;
  color: #5cf08a;
  font-variant-numeric: tabular-nums;
  min-width: 74px;
  text-shadow: 0 0 12px currentColor;
}
#heart-monitor .hm-zone {
  margin-left: auto;
  padding: 3px 7px;
  border-radius: 3px;
  background: #5cf08a22;
  color: #5cf08a;
}
#heart-monitor canvas {
  display: block;
  width: 100%;
  height: 74px;
  margin-top: 6px;
  border-radius: 4px;
}
#heart-monitor .hm-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font: 600 11px/1 var(--ui);
  letter-spacing: 0.14em;
  color: #7d9186;
}
#heart-monitor .hm-foot b {
  color: #e6dfd0;
  font-variant-numeric: tabular-nums;
}
#heart-monitor[data-zone='strained'] {
  border-color: #f0c24e55;
}
#heart-monitor[data-zone='strained'] :is(.hm-bpm, .hm-heart) {
  color: #f0c24e;
}
#heart-monitor[data-zone='strained'] .hm-zone {
  background: #f0c24e22;
  color: #f0c24e;
}
#heart-monitor[data-zone='panic'] {
  border-color: #ff7a3b88;
  box-shadow:
    0 6px 24px #000a,
    0 0 22px #ff7a3b44;
}
#heart-monitor[data-zone='panic'] :is(.hm-bpm, .hm-heart) {
  color: #ff7a3b;
}
#heart-monitor[data-zone='panic'] .hm-zone {
  background: #ff7a3b33;
  color: #ff9a6b;
}
#heart-monitor[data-zone='critical'] {
  border-color: #ff3b3b;
  box-shadow:
    0 6px 24px #000a,
    0 0 30px #ff3b3b77;
  animation: hmCrit 0.5s ease-in-out infinite alternate;
}
#heart-monitor[data-zone='critical'] :is(.hm-bpm, .hm-heart) {
  color: #ff3b3b;
}
#heart-monitor[data-zone='critical'] .hm-zone {
  background: #ff3b3b;
  color: #fff;
}
@keyframes hmCrit {
  to {
    box-shadow:
      0 6px 24px #000a,
      0 0 44px #ff3b3baa;
  }
}
#heart-monitor.flat :is(.hm-bpm, .hm-heart) {
  color: #ff3b3b;
}
@media (max-width: 750px) {
  #heart-monitor {
    width: 200px;
    top: 96px;
  }
  #heart-monitor .hm-bpm {
    font-size: 28px;
  }
  #heart-monitor canvas {
    height: 48px;
  }
}
/* Fatality: a flatlining trace and the heart numbers. */
#fatality .fx-heart {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 22px;
  margin: 16px auto 0;
  max-width: 680px;
  font: 600 12px/1 var(--ui);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #e6dfd0aa;
}
#fatality .fx-heart svg {
  flex-basis: 100%;
  height: 34px;
  width: 100%;
}
#fatality .fx-heart b {
  color: #ff4b4b;
  font-size: 15px;
  letter-spacing: 0.04em;
  margin-left: 6px;
}
#fatality .fx-ecg {
  fill: none;
  stroke: #ff3b3b;
  stroke-width: 2;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  filter: drop-shadow(0 0 4px #ff3b3b);
}
#fatality.in .fx-ecg {
  animation: fxEcg 2.2s 0.4s linear forwards;
}
#fatality.in .fx-heart {
  animation: fxUp 0.5s ease-out 1.6s both;
}
@keyframes fxEcg {
  to {
    stroke-dashoffset: 0;
  }
}
#fatality .fx-word {
  letter-spacing: 0.02em !important;
  font-size: clamp(64px, 13vw, 170px) !important;
}

/* ── The big balance gauge (balance-gauge.js). Wide arc, pivoting needle, ghost of where you're heading,
   a safe window that narrows as your pulse climbs, and a figure that tips with you. */
.playing .balance-wrap,
.balance-wrap {
  width: min(780px, 78vw) !important;
  max-width: none !important;
  bottom: calc(2.2% + 74px) !important;
  display: block !important;
  pointer-events: none;
}
body:has(#keydock.teach:not([hidden])) .balance-wrap {
  bottom: calc(2.2% + 150px) !important;
}
.bg-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  will-change: transform;
}
.bg-track {
  fill: none;
  stroke: #e6dfd01c;
  stroke-width: 30;
  stroke-linecap: round;
}
.bg-red {
  fill: none;
  stroke: #d4151d;
  stroke-opacity: 0.72;
  stroke-width: 30;
}
.bg-amber {
  fill: none;
  stroke: #f0b54e;
  stroke-opacity: 0.34;
  stroke-width: 30;
}
.bg-safe {
  fill: none;
  stroke: #5cf08a;
  stroke-opacity: 0.45;
  stroke-width: 30;
  transition: stroke-opacity 0.2s;
}
.bg-tick {
  stroke: #f3ead655;
  stroke-width: 2;
}
.bg-tick.major {
  stroke: #f3ead6aa;
  stroke-width: 3;
}
.bg-fall {
  font: 800 22px/1 var(--ui);
  letter-spacing: 0.2em;
  fill: #ff3b3b;
  paint-order: stroke;
  stroke: #000a;
  stroke-width: 4px;
}
.bg-needle .bg-head {
  fill: #fff;
}
.bg-ghost {
  fill: none;
  stroke: #f3ead6;
  stroke-opacity: 0.55;
  stroke-width: 2.5;
  stroke-dasharray: 6 5;
}
.bg-ghost path {
  fill: #f3ead633;
  stroke-dasharray: none;
}
.bg-figure {
  fill: #f3ead6;
  stroke: #0008;
  stroke-width: 1.5;
  transition: fill 0.15s;
}
.bg-stone {
  fill: #6d6a62;
  stroke: #000a;
  stroke-width: 1.5;
}
.bg-stone-edge {
  stroke: #ff3b3b;
  stroke-width: 3;
}
.bg-feet {
  fill: #e3b45c;
  stroke: #000;
  stroke-width: 1.5;
}
.bg-label {
  font: 700 15px/1 var(--ui);
  letter-spacing: 0.16em;
  fill: #f3ead6;
  paint-order: stroke;
  stroke: #000b;
  stroke-width: 4px;
}
.bg-key rect {
  fill: #0b1118d0;
  stroke: #e6dfd055;
  stroke-width: 2;
}
.bg-key text {
  font: 700 34px/1 var(--ui);
  fill: #e6dfd0aa;
}
.bg-key .bg-key-cap {
  font-size: 12px;
  letter-spacing: 0.2em;
  opacity: 0;
}
.bg-key.need rect {
  fill: #3a2408f0;
  stroke: #ffb22e;
  stroke-width: 3;
  animation: bgNeed 0.3s ease-in-out infinite alternate;
}
.bg-key.need text {
  fill: #ffd58a;
}
.bg-key.need .bg-key-cap {
  opacity: 1;
}
.bg-key.down rect {
  fill: #f3ead6;
  stroke: #fff;
}
.bg-key.down text {
  fill: #0b1118;
}
@keyframes bgNeed {
  to {
    stroke: #fff;
    filter: drop-shadow(0 0 10px #ffb22e);
  }
}
#balance-gauge[data-state='off'] .bg-safe {
  stroke-opacity: 0.25;
}
#balance-gauge[data-state='danger'] .bg-amber {
  stroke-opacity: 0.75;
}
#balance-gauge[data-state='danger'] .bg-figure {
  fill: #ffcf7a;
}
#balance-gauge[data-state='critical'] .bg-red {
  stroke-opacity: 1;
  animation: bgCrit 0.18s steps(2) infinite;
}
#balance-gauge[data-state='critical'] .bg-figure {
  fill: #ff4b4b;
}
#balance-gauge[data-state='critical'] .bg-head {
  fill: #ff4b4b;
}
@keyframes bgCrit {
  50% {
    stroke: #ff8080;
  }
}
#balance-gauge.wrong .bg-needle .bg-head {
  fill: #ff4b4b;
}
#balance-gauge.wrong .bg-footing {
  fill: #ff6b6b;
}
.bg-warn {
  position: absolute;
  left: 50%;
  top: -44px;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  align-items: baseline;
  white-space: nowrap;
  padding: 8px 18px;
  border: 2px solid #f0b54e;
  border-radius: 6px;
  background: #2a1806e6;
  color: #ffd58a;
  font: 600 15px/1 var(--ui);
  letter-spacing: 0.06em;
  box-shadow: 0 0 24px #f0b54e55;
}
.bg-warn b {
  font-weight: 800;
  letter-spacing: 0.22em;
  color: #fff;
}
.bg-warn em {
  font-style: normal;
  color: #f3ead6;
}
.bg-warn.now {
  border-color: #ff3b3b;
  background: #3a0808ee;
  animation: bgNeed 0.22s infinite alternate;
}
.bg-warn[hidden] {
  display: none;
}
@media (max-width: 750px) {
  .playing .balance-wrap,
  .balance-wrap {
    width: 94vw !important;
  }
  .bg-warn {
    font-size: 12px;
  }
}

/* ── Fighting back: the dagger quiver during the chase, the grab ring, the courtyard duel. */
#quiver {
  position: absolute;
  right: 4.5vw;
  bottom: calc(2.2% + 96px);
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid #e6dfd033;
  border-radius: 8px;
  background: #050b12b8;
  color: #f3ead6;
  font: 600 13px/1.2 var(--ui);
  letter-spacing: 0.1em;
}
#quiver[hidden] {
  display: none;
}
#quiver kbd {
  display: grid;
  place-items: center;
  width: 42px;
  height: 40px;
  border: 1px solid #e6dfd066;
  border-bottom: 4px solid #e6dfd044;
  border-radius: 7px;
  font-size: 20px;
  color: #f3ead6;
}
#quiver.inrange kbd {
  border-color: #ffb22e;
  color: #ffd58a;
  animation: kdNeed 0.45s ease-in-out infinite alternate;
}
#quiver.cool kbd,
#quiver.empty kbd {
  opacity: 0.35;
  animation: none;
}
#quiver b {
  display: block;
  font-weight: 800;
  letter-spacing: 0.18em;
}
#quiver .qv-count {
  display: flex;
  gap: 5px;
  margin: 6px 0 4px;
}
#quiver .qv-count i {
  width: 6px;
  height: 20px;
  border-radius: 2px;
  background: linear-gradient(#e8eef2, #8a949c);
  transform: skewX(-12deg);
}
#quiver .qv-count i.spent {
  background: #e6dfd022;
}
#quiver small {
  display: block;
  color: #b9c3c8;
  letter-spacing: 0.06em;
  font-weight: 500;
}
#quiver.inrange small {
  color: #ffd58a;
}
#combat {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -46%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  z-index: 30;
  text-align: center;
  filter: drop-shadow(0 4px 18px #000c);
}
#combat[hidden] {
  display: none;
}
.cb-title {
  font: 800 clamp(34px, 5vw, 64px)/1 var(--ui);
  letter-spacing: 0.24em;
  color: #fff;
  text-shadow: 0 0 22px #ff2a2a99;
}
#combat[data-kind='duel'] .cb-title {
  font-size: clamp(20px, 2.2vw, 28px);
  letter-spacing: 0.5em;
  color: #f3ead6;
  text-shadow: none;
  opacity: 0.8;
}
.cb-move {
  font: 700 clamp(18px, 2.2vw, 28px)/1.2 var(--ui);
  letter-spacing: 0.14em;
  color: #ffd58a;
  min-height: 1.2em;
}
.cb-ring {
  position: relative;
  width: min(220px, 40vw);
  aspect-ratio: 1;
}
.cb-ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.cb-target {
  fill: none;
  stroke: #5cf08a;
  stroke-opacity: 0.55;
}
.cb-closing {
  fill: none;
  stroke: #fff;
  stroke-width: 4;
  filter: drop-shadow(0 0 6px #fff);
}
#combat[data-kind='duel'] .cb-ring svg {
  display: none;
}
#combat[data-kind='grab'][data-phase='draw'] .cb-target,
#combat[data-kind='grab'][data-phase='draw'] .cb-closing {
  opacity: 0.15;
}
.cb-ring kbd {
  position: absolute;
  inset: 0;
  margin: auto;
  display: grid;
  place-items: center;
  width: min(120px, 24vw);
  height: min(100px, 20vw);
  border: 2px solid #ffb22e;
  border-bottom-width: 8px;
  border-radius: 14px;
  background: #2a1806ee;
  color: #ffd58a;
  font: 800 clamp(30px, 4.4vw, 52px)/1 var(--ui);
  letter-spacing: 0.04em;
  animation: bgNeed 0.25s ease-in-out infinite alternate;
}
.cb-ring kbd:empty {
  display: none;
}
#combat[data-phase='strike'] .cb-ring kbd {
  width: min(150px, 30vw);
  font-size: clamp(22px, 3vw, 34px);
}
#combat[data-phase='counter'] .cb-ring kbd {
  border-color: #5cf08a;
  background: #082a12ee;
  color: #b6ffd0;
  animation-duration: 0.14s;
}
#combat[data-phase='hurt'] .cb-move {
  color: #ff6b6b;
}
.cb-act {
  font: 800 clamp(18px, 2vw, 26px)/1 var(--ui);
  letter-spacing: 0.26em;
  color: #fff;
  min-height: 1em;
}
#combat[data-phase='hurt'] .cb-act {
  color: #ff3b3b;
  animation: bgNeed 0.2s infinite alternate;
}
.cb-timer {
  width: min(360px, 70vw);
  height: 6px;
  border-radius: 3px;
  background: #e6dfd022;
  overflow: hidden;
}
.cb-timer i {
  display: block;
  height: 100%;
  background: #ffb22e;
  transform-origin: 0 50%;
}
#combat[data-phase='counter'] .cb-timer i {
  background: #5cf08a;
}
.cb-pips {
  display: flex;
  gap: 44px;
  margin-top: 6px;
}
.cb-pips span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.cb-pips span > i {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin: 0 3px;
}
.cb-pips .you i {
  border: 2px solid #ffd58a;
  transform: rotate(45deg);
  border-radius: 2px;
}
.cb-pips .you i.hit {
  background: #ffd58a;
  box-shadow: 0 0 10px #ffb22e;
}
.cb-pips .life i {
  border-radius: 50%;
  background: #e33;
  box-shadow: 0 0 8px #f33;
}
.cb-pips .life i.lost {
  background: none;
  border: 2px solid #e6dfd044;
  box-shadow: none;
}
.cb-pips b {
  font: 700 11px/1 var(--ui);
  letter-spacing: 0.2em;
  color: #b9c3c8;
}
#combat[data-kind='grab'] .cb-pips {
  display: none;
}
body.playing:has(#combat:not([hidden])) .balance-wrap,
body.playing:has(#combat:not([hidden])) #keydock {
  opacity: 0.15;
}
