:root {
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Courier New", monospace;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --ink: #112a41;
  --ink-soft: #46677f;
  --cyan: #9beeff;
  --gold: #ffd36c;
  --green: #9df08f;
  --red: #ff7c73;
  --page-navy: #0a1421;
  --window-line: #5d7f9a;
}

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

[hidden] {
  display: none !important;
}

html {
  color-scheme: dark;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: #eaf6ff;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(ellipse 900px 620px at 50% -12%, rgba(50, 104, 148, .48), transparent 60%),
    radial-gradient(ellipse 700px 520px at 6% 108%, rgba(48, 91, 56, .45), transparent 55%),
    radial-gradient(ellipse 780px 500px at 98% 104%, rgba(40, 76, 92, .38), transparent 60%),
    linear-gradient(180deg, #101f32 0%, #0a1421 48%, #070e17 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

body::before {
  opacity: .38;
  background-image:
    radial-gradient(rgba(179, 224, 255, .35) 0.8px, transparent 1px),
    radial-gradient(rgba(179, 224, 255, .18) 0.8px, transparent 1px);
  background-position: 0 0, 21px 17px;
  background-size: 47px 47px, 61px 61px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, .35) 48%, transparent 82%);
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, .35) 48%, transparent 82%);
}

body::after {
  z-index: 50;
  opacity: .5;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, .018) 0,
    rgba(255, 255, 255, .018) 1px,
    transparent 1px,
    transparent 4px
  );
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.page {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100% - 40px));
  margin: auto;
  padding: 18px 0 12px;
}

/* ---------------------------------- header --------------------------------- */

.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  color: #ffd36c;
  background:
    radial-gradient(circle at 35% 22%, rgba(255, 255, 255, .18), transparent 45%),
    linear-gradient(180deg, #27445e, #132536);
  border: 1px solid rgba(157, 218, 255, .37);
  border-radius: 13px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .17),
    0 8px 20px rgba(0, 0, 0, .32);
  font-size: 21px;
  transform: rotate(-4deg);
}

.brand-mark svg {
  display: block;
  width: 26px;
  height: 26px;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .24));
}

.brand-text {
  min-width: 0;
}

.brand h1 {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  color: #f1fbff;
  font-size: clamp(19px, 2.1vw, 24px);
  font-weight: 900;
  letter-spacing: .5px;
  line-height: 1.15;
  text-shadow: 0 1px 8px rgba(92, 183, 235, .2);
}

.brand h1 span {
  color: var(--gold);
  font-size: .68em;
  letter-spacing: 1.5px;
}

.brand p {
  margin: 4px 0 0;
  color: #8fb0c6;
  font-family: var(--mono);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 2px;
}

.sound-btn {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #bcecff;
  background: rgba(16, 35, 54, .68);
  border: 1px solid rgba(153, 214, 247, .32);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 4px 16px rgba(0, 0, 0, .2);
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 800;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}

.sound-btn:hover {
  color: #ffffff;
  background: rgba(28, 57, 82, .8);
  border-color: rgba(153, 214, 247, .6);
  transform: translateY(-1px);
}

.sound-btn.is-off {
  color: #758b9d;
  background: rgba(10, 22, 35, .65);
}

.sound-btn.is-off::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
  transform: rotate(-34deg);
}

.sound-btn:focus-visible,
.start-btn:focus-visible,
.ghost-btn:focus-visible {
  outline: 2px solid #a6f3ff;
  outline-offset: 3px;
}

/* -------------------------------- game window ------------------------------ */

.game-window {
  width: 100%;
  overflow: hidden;
  background: #a4c1d7;
  border: 1px solid rgba(207, 239, 255, .38);
  border-radius: 13px;
  box-shadow:
    0 32px 80px rgba(0, 0, 0, .58),
    0 0 0 1px rgba(8, 20, 32, .7),
    0 0 46px rgba(67, 152, 210, .12);
  animation: windowIn .45s cubic-bezier(.2, .8, .3, 1) both;
}

.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 37px;
  padding: 0 11px;
  color: #17344f;
  background: linear-gradient(180deg, #f8fdff 0%, #ddedf9 42%, #b2d0e6 100%);
  border-bottom: 1px solid #6b8da8;
  box-shadow: inset 0 1px 0 #ffffff;
}

.titlebar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.title-orb {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  background: radial-gradient(circle at 32% 28%, #f2feff 0 12%, #7fdef2 28%, #2b9cc1 66%, #17627f 100%);
  border: 1px solid #effcff;
  border-radius: 50%;
  box-shadow: 0 0 9px rgba(106, 220, 245, .9), inset 0 0 2px rgba(0, 26, 38, .6);
}

.titlebar h2 {
  overflow: hidden;
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .6px;
  text-overflow: ellipsis;
  text-shadow: 0 1px 0 #ffffff;
  white-space: nowrap;
}

.window-controls {
  display: flex;
  align-items: center;
  gap: 3px;
}

.window-controls span {
  display: grid;
  place-items: center;
  width: 21px;
  height: 19px;
  color: #46647c;
  background: linear-gradient(180deg, #fbfeff, #dbe8f2);
  border: 1px solid rgba(87, 123, 152, .5);
  border-radius: 3px;
  box-shadow: inset 0 1px 0 #ffffff;
  font-family: var(--mono);
  font-size: 9px;
}

.window-controls .close {
  color: #8c3b36;
  background: linear-gradient(180deg, #fff6f4, #ebd2d0);
}

.window-body {
  padding: 7px 7px 0;
  background: linear-gradient(180deg, #b4cfe3 0%, #9ebbd2 100%);
}

.stage {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 320px;
  max-height: calc(100vh - 250px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #bd9251;
  border: 1px solid #506f87;
  border-radius: 3px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .26),
    0 0 0 1px rgba(17, 36, 52, .35);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: crosshair;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

#waterCanvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.warning-veil {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(ellipse at center, transparent 34%, rgba(178, 26, 25, .3) 72%, rgba(126, 9, 12, .66) 100%),
    linear-gradient(180deg, rgba(255, 69, 64, .16), transparent 22%, transparent 78%, rgba(255, 69, 64, .12));
  box-shadow: inset 0 0 48px rgba(255, 48, 44, .55);
  transition: opacity .08s linear;
}

/* ----------------------------------- hud ---------------------------------- */

.hud {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 12px;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.hud-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.hud-chip {
  padding: 6px 9px;
  color: #e9f9ff;
  background: rgba(7, 19, 31, .57);
  border: 1px solid rgba(172, 227, 255, .22);
  border-radius: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
  font-size: 10.5px;
  letter-spacing: .4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

.hud-chip b {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 12px;
}

.score-chip b {
  color: #aff5ff;
}

.status-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 6px 9px;
  color: #c8dce8;
  background: rgba(7, 19, 31, .57);
  border: 1px solid rgba(172, 227, 255, .22);
  border-radius: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  white-space: nowrap;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.status-chip i {
  width: 6px;
  height: 6px;
  background: #93a9b7;
  border-radius: 50%;
  box-shadow: 0 0 7px rgba(147, 169, 183, .5);
  transition: background .16s ease, box-shadow .16s ease;
}

.status-chip.is-good {
  color: #dcffd5;
  border-color: rgba(143, 235, 127, .35);
  background: rgba(10, 35, 25, .6);
}

.status-chip.is-good i {
  background: var(--green);
  box-shadow: 0 0 9px rgba(157, 240, 143, .85);
}

.status-chip.is-bad {
  color: #ffddd9;
  border-color: rgba(255, 124, 115, .45);
  background: rgba(44, 14, 18, .66);
}

.status-chip.is-bad i {
  background: var(--red);
  box-shadow: 0 0 9px rgba(255, 124, 115, .85);
  animation: statusBlink .6s ease-in-out infinite;
}

.stage.is-menu .hud,
.stage.is-menu .time-track {
  opacity: 0;
  transition: opacity .2s ease;
}

.stage.is-failed .hud,
.stage.is-failed .time-track {
  opacity: 0;
  transition: opacity .2s ease;
}

/* --------------------------------- progress -------------------------------- */

.time-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  height: 4px;
  overflow: hidden;
  background: rgba(6, 16, 25, .4);
  pointer-events: none;
}

.time-track i {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #77e9ff 0%, #a9f5ff 45%, #ffd36c 100%);
  box-shadow: 0 0 10px rgba(123, 235, 255, .65);
  transform: scaleX(0);
  transform-origin: left center;
  transition: background .2s ease;
}

.time-track i.is-low {
  background: linear-gradient(90deg, #ffbd6e, #ff665d);
  box-shadow: 0 0 10px rgba(255, 108, 93, .6);
}

/* -------------------------------- countdown -------------------------------- */

.countdown {
  position: absolute;
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transform: translate(-50%, -100%);
  pointer-events: none;
  will-change: left, top;
}

.countdown-num {
  color: #e8fdff;
  font-family: "Arial Black", "Trebuchet MS", var(--sans);
  font-size: clamp(58px, 8vw, 104px);
  font-weight: 900;
  line-height: .85;
  letter-spacing: -2px;
  text-shadow:
    0 0 5px #ffffff,
    0 0 16px rgba(133, 233, 255, .95),
    0 0 38px rgba(64, 188, 255, .75),
    0 5px 0 rgba(16, 65, 91, .28);
  transform-origin: center;
}

.countdown-num.pop {
  animation: countPop .34s cubic-bezier(.2, 1.5, .4, 1) both;
}

.countdown-label {
  padding: 3px 7px;
  color: #eafcff;
  background: rgba(5, 18, 30, .56);
  border: 1px solid rgba(158, 234, 255, .3);
  border-radius: 3px;
  font-size: 9px;
  letter-spacing: 2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

/* -------------------------------- overlays --------------------------------- */

.screen-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  padding: clamp(18px, 4vw, 46px);
  overflow-y: auto;
  cursor: default;
}

.start-screen {
  justify-content: flex-start;
  background:
    linear-gradient(90deg, rgba(4, 13, 23, .95) 0%, rgba(4, 13, 23, .86) 32%, rgba(4, 13, 23, .45) 50%, rgba(4, 13, 23, .08) 70%, rgba(4, 13, 23, .01) 88%, rgba(4, 13, 23, 0) 100%);
}

.start-panel {
  width: min(470px, 100%);
  animation: panelIn .42s cubic-bezier(.2, .8, .3, 1) both;
}

.panel-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #9cecff;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 2.2px;
}

.panel-kicker::before {
  content: "";
  width: 19px;
  height: 1px;
  background: #77d6f5;
  box-shadow: 0 0 7px rgba(119, 214, 245, .8);
}

.start-panel h2 {
  margin: 8px 0 10px;
  color: #f2fbff;
  font-size: clamp(34px, 4.7vw, 50px);
  font-weight: 900;
  letter-spacing: 1px;
  line-height: 1.1;
  text-shadow: 0 3px 16px rgba(0, 0, 0, .55);
}

.start-panel h2 span {
  color: var(--gold);
}

.start-lead {
  max-width: 430px;
  margin: 0 0 16px;
  color: #c7d9e5;
  font-size: 12.5px;
  line-height: 1.85;
}

.how-to {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  max-width: 430px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.how-to li {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 8px 9px;
  background: rgba(9, 23, 38, .55);
  border: 1px solid rgba(168, 220, 244, .16);
  border-radius: 6px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.how-to b {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 8px;
}

.how-to span {
  overflow: hidden;
  color: #dceaf4;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.start-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(430px, 100%);
  padding: 11px 15px;
  color: #3b2809;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .32) 0%, transparent 42%),
    linear-gradient(180deg, #ffe9a8 0%, #ffd170 45%, #f0b642 100%);
  border: 2px solid #5e431b;
  border-radius: 7px;
  box-shadow:
    0 4px 0 #8e611e,
    inset 0 1px 0 #fff7d7,
    0 0 22px rgba(255, 201, 94, .12);
  font-weight: 900;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}

.start-btn::after {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  top: 3px;
  height: 1px;
  background: rgba(255, 255, 255, .68);
  pointer-events: none;
}

.start-btn span {
  font-size: 14px;
  letter-spacing: 2px;
}

.start-btn small {
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1.7px;
  opacity: .5;
}

.start-btn:hover {
  filter: brightness(1.055);
  transform: translateY(-1px);
  box-shadow:
    0 5px 0 #8e611e,
    inset 0 1px 0 #fff7d7,
    0 0 25px rgba(255, 201, 94, .2);
}

.start-btn:active {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 #8e611e,
    inset 0 1px 0 #fff7d7;
}

.best-line {
  margin: 10px 0 0;
  color: #8fa8ba;
  font-size: 9px;
  letter-spacing: .4px;
}

.best-line b {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 11px;
}

.best-line span {
  margin: 0 6px;
  opacity: .45;
}

/* -------------------------------- fail screen ------------------------------- */

.fail-screen {
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(91, 25, 27, .42), transparent 58%),
    rgba(4, 10, 18, .82);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.fail-panel {
  position: relative;
  width: min(520px, 100%);
  padding: 27px 28px 22px;
  color: #e9f4ff;
  background:
    radial-gradient(ellipse at 80% 0%, rgba(255, 118, 100, .1), transparent 45%),
    linear-gradient(180deg, rgba(23, 36, 54, .98), rgba(10, 18, 29, .99));
  border: 1px solid rgba(255, 151, 134, .32);
  border-radius: 11px;
  box-shadow:
    0 22px 60px rgba(0, 0, 0, .55),
    inset 0 1px 0 rgba(255, 255, 255, .07),
    0 0 40px rgba(255, 78, 67, .08);
  animation: failIn .32s cubic-bezier(.2, 1.2, .4, 1) both;
}

.fail-stamp {
  position: absolute;
  top: -17px;
  right: 22px;
  padding: 3px 13px 4px;
  color: #ff9188;
  background: rgba(41, 12, 15, .92);
  border: 2px solid #ff7a70;
  border-radius: 4px;
  box-shadow: 0 0 20px rgba(255, 91, 80, .22);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 3px;
  transform: rotate(4deg);
}

.fail-panel .panel-kicker {
  color: #ff9d93;
}

.fail-panel .panel-kicker::before {
  background: #ff8278;
  box-shadow: 0 0 7px rgba(255, 130, 120, .75);
}

.fail-panel h2 {
  margin: 7px 0 7px;
  color: #f4f9ff;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: .5px;
}

.fail-lead {
  margin: 0 0 15px;
  color: #acbdcc;
  font-size: 11.5px;
  line-height: 1.7;
}

.fail-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 13px;
}

.fail-stats div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 8px 9px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(169, 209, 239, .1);
  border-radius: 5px;
}

.fail-stats span {
  overflow: hidden;
  color: #7f93a6;
  font-size: 8px;
  letter-spacing: .7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fail-stats b {
  overflow: hidden;
  color: #eaf5ff;
  font-family: var(--mono);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fail-stats div:nth-child(3) b {
  color: var(--gold);
}

.fail-stats div:nth-child(4) b {
  color: #9fe9ff;
}

.record-badge {
  display: inline-block;
  margin: 0 0 12px;
  padding: 3px 9px;
  color: #ffd882;
  background: rgba(255, 205, 105, .08);
  border: 1px solid rgba(255, 205, 105, .37);
  border-radius: 99px;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1px;
  animation: badgeGlow 1.5s ease-in-out infinite;
}

.fail-actions {
  display: flex;
  gap: 8px;
}

.fail-actions .start-btn {
  flex: 1 1 auto;
  width: auto;
  margin: 0;
}

.ghost-btn {
  flex: 0 0 auto;
  padding: 0 17px;
  color: #aebfce;
  background: rgba(255, 255, 255, .025);
  border: 1px solid rgba(173, 209, 237, .24);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.ghost-btn:hover {
  color: #edf9ff;
  background: rgba(255, 255, 255, .055);
  border-color: rgba(173, 209, 237, .5);
}

/* ------------------------------- success toast ------------------------------ */

.success-banner {
  position: absolute;
  left: 50%;
  top: 16%;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 18px;
  color: #dcffd8;
  background: rgba(7, 31, 25, .84);
  border: 1px solid rgba(157, 240, 143, .55);
  border-radius: 99px;
  box-shadow:
    0 0 34px rgba(94, 231, 126, .28),
    inset 0 1px 0 rgba(255, 255, 255, .08);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
  transform: translateX(-50%);
  pointer-events: none;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  animation: bannerIn .34s cubic-bezier(.2, 1.3, .4, 1) both;
}

.success-banner b {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .5px;
}

/* -------------------------------- status bar -------------------------------- */

.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 31px;
  margin-top: 7px;
  padding: 6px 9px;
  color: #2b465c;
  background: linear-gradient(180deg, #eefaff 0%, #d3e6f3 100%);
  border-top: 1px solid #7291a8;
  border-radius: 0 0 4px 4px;
  box-shadow: inset 0 1px 0 #ffffff;
  font-size: 9.5px;
}

.status-led {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  background: #69c47d;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(105, 196, 125, .16);
  transition: background .2s ease, box-shadow .2s ease;
}

.status-led.is-idle {
  background: #8197a7;
  box-shadow: 0 0 0 2px rgba(129, 151, 167, .14);
}

.status-led.is-bad {
  background: #d9554c;
  box-shadow: 0 0 0 2px rgba(217, 85, 76, .16);
}

.status-copy {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-brand {
  flex: 0 0 auto;
  color: #71899d;
  font-family: var(--mono);
  font-size: 6.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
}

.site-foot {
  padding: 9px 0 0;
  color: rgba(153, 185, 207, .62);
  font-size: 8px;
  letter-spacing: .7px;
  text-align: center;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 30px;
  color: #eaf6ff;
  background: #0a1421;
  font-size: 15px;
  text-align: center;
}

/* -------------------------------- animations -------------------------------- */

@keyframes windowIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes failIn {
  from { opacity: 0; transform: scale(.97) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes countPop {
  0% { opacity: 0; transform: scale(.58); filter: blur(2px); }
  45% { opacity: 1; transform: scale(1.1); filter: blur(0); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes bannerIn {
  from { opacity: 0; transform: translate(-50%, 8px) scale(.94); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

@keyframes statusBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

@keyframes badgeGlow {
  0%, 100% { background: rgba(255, 205, 105, .08); }
  50% { background: rgba(255, 205, 105, .17); }
}

@media (pointer: coarse) {
  .stage {
    cursor: default;
  }
}

/* -------------------------------- responsive -------------------------------- */

@media (max-width: 900px) {
  .page {
    width: calc(100% - 24px);
    padding-top: 13px;
  }

  .stage {
    max-height: calc(100vh - 230px);
  }

  .start-lead {
    font-size: 12px;
  }
}

@media (max-width: 720px) {
  .page {
    width: calc(100% - 16px);
    padding-top: 9px;
  }

  .site-head {
    margin-bottom: 8px;
  }

  .brand-mark {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    font-size: 18px;
  }

  .brand {
    gap: 9px;
  }

  .brand h1 {
    gap: 4px;
    font-size: 17px;
  }

  .brand h1 span {
    font-size: .62em;
  }

  .brand p {
    margin-top: 2px;
    font-size: 6px;
    letter-spacing: 1.2px;
  }

  .sound-btn {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    font-size: 15px;
  }

  .titlebar {
    height: 33px;
    padding: 0 8px;
  }

  .titlebar h2 {
    font-size: 11px;
  }

  .title-orb {
    flex-basis: 12px;
    width: 12px;
    height: 12px;
  }

  .window-controls span {
    width: 19px;
    height: 18px;
    font-size: 8px;
  }

  .window-body {
    padding: 5px 5px 0;
  }

  .stage {
    max-height: none;
    min-height: 0;
    aspect-ratio: 4 / 5;
  }

  .screen-overlay {
    padding: 18px;
  }

  .start-screen {
    background:
      linear-gradient(180deg, rgba(4, 13, 23, .6) 0%, rgba(4, 13, 23, .82) 42%, rgba(4, 13, 23, .93) 100%);
    align-items: flex-end;
  }

  .start-panel {
    width: 100%;
    padding-bottom: 2px;
  }

  .start-panel h2 {
    font-size: 31px;
  }

  .start-lead {
    margin-bottom: 12px;
    font-size: 11.5px;
    line-height: 1.75;
  }

  .how-to {
    margin-bottom: 13px;
  }

  .how-to li {
    padding: 6px 7px;
  }

  .how-to b {
    font-size: 7px;
  }

  .how-to span {
    font-size: 9px;
  }

  .hud {
    left: 8px;
    right: 8px;
    top: 8px;
    gap: 5px;
  }

  .hud-chip {
    padding: 5px 7px;
    font-size: 9px;
  }

  .hud-chip b {
    font-size: 10px;
  }

  .status-chip {
    padding: 5px 7px;
    font-size: 8.5px;
    letter-spacing: .6px;
  }

  .status-chip i {
    width: 5px;
    height: 5px;
  }

  .countdown-num {
    font-size: clamp(54px, 15vw, 90px);
  }

  .countdown-label {
    font-size: 8px;
    letter-spacing: 1.5px;
  }

  .success-banner {
    top: 12%;
    padding: 8px 14px;
    font-size: 11px;
  }

  .fail-panel {
    padding: 23px 18px 18px;
  }

  .fail-stamp {
    top: -15px;
    right: 14px;
    font-size: 14px;
    letter-spacing: 2px;
  }

  .fail-panel h2 {
    font-size: 24px;
  }

  .fail-lead {
    font-size: 11px;
  }

  .fail-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fail-actions {
    flex-direction: column;
  }

  .ghost-btn {
    padding: 10px 12px;
  }

  .status-brand {
    display: none;
  }

  .status-bar {
    min-height: 29px;
    font-size: 9px;
  }

  .site-foot {
    padding-top: 7px;
    font-size: 7px;
  }
}

@media (max-width: 430px) {
  .brand h1 {
    font-size: 15.5px;
  }

  .brand h1 span {
    display: none;
  }

  .start-panel h2 {
    font-size: 28px;
  }

  .start-lead {
    font-size: 11px;
  }

  .how-to {
    gap: 5px;
  }

  .how-to span {
    font-size: 8.5px;
  }

  .start-btn {
    padding: 10px 12px;
  }

  .start-btn span {
    font-size: 13px;
  }

  .hud-group {
    gap: 4px;
  }

  .status-bar {
    gap: 6px;
    padding: 6px 7px;
  }

  .status-copy {
    font-size: 8.5px;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .stage {
    aspect-ratio: 16 / 9;
    max-height: calc(100vh - 155px);
  }

  .start-screen {
    align-items: center;
    background:
      linear-gradient(90deg, rgba(4, 13, 23, .94), rgba(4, 13, 23, .78) 52%, rgba(4, 13, 23, .25));
  }

  .start-panel {
    width: min(430px, 65%);
  }

  .start-panel h2 {
    margin: 5px 0 6px;
    font-size: 27px;
  }

  .start-lead {
    margin-bottom: 8px;
    font-size: 10.5px;
    line-height: 1.6;
  }

  .how-to {
    margin-bottom: 9px;
  }

  .best-line {
    margin-top: 7px;
  }
}

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

@media (max-height: 700px) {
  .countdown-num {
    font-size: clamp(46px, 6vw, 74px);
  }
}

@media (max-height: 620px) {
  .start-screen,
  .fail-screen {
    align-items: flex-start;
  }
}
