:root {
  --bg: #05070a;
  --panel: rgba(17, 21, 28, 0.72);
  --panel2: rgba(24, 29, 38, 0.82);
  --line: rgba(226, 31, 42, 0.2);
  --line2: #2a3240;
  --silver: #e2e7eb;
  --silver2: #9aa2ac;
  --red: #e21f2a;
  --red2: #ff2e3a;
  --red-soft: rgba(226, 31, 42, 0.14);
  --ok: #2ee06b;
  --warn: #f5a524;
  --text: #eaeef1;
  --muted: #7f8791;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --display: "Arial Narrow", "Segoe UI Semibold", var(--font);
  --mono: "SFMono-Regular", Consolas, "Roboto Mono", monospace;
  --radius: 16px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

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

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body.fixed {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.fixed .topbar {
  position: static;
  flex: 0 0 auto;
  padding: 12px 24px;
}

body.fixed .page-head {
  flex: 0 0 auto;
  margin: 2px auto 4px;
}

body.fixed .page-head h2 {
  font-size: clamp(20px, 3vw, 28px);
}

body.fixed .page-head p {
  font-size: 13px;
  margin-top: 3px;
}

body.page-in {
  animation: pageIn 0.28s ease;
}

body.page-out {
  animation: pageOut 0.14s ease forwards;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pageOut {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 42% at 0% 0%, rgba(226, 31, 42, 0.3), transparent 60%),
    radial-gradient(ellipse 55% 42% at 100% 0%, rgba(226, 31, 42, 0.24), transparent 60%),
    radial-gradient(ellipse at 50% 130%, rgba(226, 31, 42, 0.12), transparent 55%);
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(226, 31, 42, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(226, 31, 42, 0.07) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse at 50% 38%, #000 50%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 38%, #000 50%, transparent 100%);
}

.bg-ecg {
  position: fixed;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: 240px;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-style: italic;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1.05;
}

.brand-red {
  color: var(--red2);
  text-shadow: 0 0 22px rgba(255, 46, 58, 0.45);
}

.brand-silver {
  background: linear-gradient(180deg, #ffffff, #97a0aa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: var(--mono);
  letter-spacing: 1px;
}

img {
  max-width: 100%;
  display: block;
}

.twin-mark {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.16em;
  color: var(--silver);
}

.brand-logo {
  height: 30px;
  width: auto;
  vertical-align: middle;
  filter: drop-shadow(0 2px 7px rgba(0, 0, 0, 0.55));
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-style: italic;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-size: 18px;
  padding: 15px 34px;
  border-radius: 12px;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(135deg, var(--red), #9c111a);
  box-shadow: 0 0 0 rgba(226, 31, 42, 0.6), 0 14px 30px rgba(226, 31, 42, 0.3);
  animation: btnPulse 2.4s ease-in-out infinite;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

@keyframes btnPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(226, 31, 42, 0.45), 0 14px 30px rgba(226, 31, 42, 0.3);
  }
  50% {
    box-shadow: 0 0 26px 4px rgba(226, 31, 42, 0.5), 0 14px 30px rgba(226, 31, 42, 0.4);
  }
}

.btn:hover {
  transform: translateY(-3px);
}

.btn.ghost {
  background: rgba(10, 12, 16, 0.55);
  border: 1px solid var(--line2);
  color: var(--silver);
  box-shadow: none;
  animation: none;
  font-size: 13px;
  padding: 10px 20px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.btn.ghost:hover {
  border-color: var(--red);
  transform: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--silver2);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: rgba(10, 12, 16, 0.4);
}

.pill .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red2);
  box-shadow: 0 0 10px var(--red2);
  animation: blink 1.3s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 24px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: linear-gradient(180deg, rgba(5, 7, 10, 0.85), rgba(5, 7, 10, 0));
}

.brandline {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--silver);
  font-family: var(--display);
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 17px;
}

.brandline b {
  color: var(--red2);
  font-weight: 700;
}

.hud {
  position: fixed;
  z-index: 5;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(255, 46, 58, 0.6);
  pointer-events: none;
}

.hud.tl {
  top: 84px;
  left: 24px;
}

.hud.br {
  bottom: 22px;
  right: 24px;
}

.hud .live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.hud .live::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red2);
  box-shadow: 0 0 9px var(--red2);
  animation: blink 1.1s infinite;
}

@media (max-width: 640px) {
  .hud {
    display: none;
  }
}

#tp-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 45%, #0b0e13, #05070a 72%);
  transition: opacity 0.45s ease;
}

#tp-loader.tpl-done {
  opacity: 0;
  pointer-events: none;
}

.tpl-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.tpl-logo {
  width: 104px;
  height: auto;
  filter: drop-shadow(0 6px 22px rgba(226, 31, 42, 0.45));
  animation: tplBreathe 2s ease-in-out infinite;
}

@keyframes tplBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.tpl-ecg {
  width: 260px;
  height: 52px;
}

.tpl-ecg polyline {
  fill: none;
  stroke: var(--red2);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(255, 46, 58, 0.85));
  stroke-dasharray: 64 300;
  animation: tplEcg 1.1s linear infinite;
}

@keyframes tplEcg {
  from { stroke-dashoffset: 364; }
  to { stroke-dashoffset: 0; }
}

.tpl-pct {
  font-family: var(--display);
  font-style: italic;
  font-size: 46px;
  line-height: 1;
  color: #fff;
}

.tpl-pct .tpl-u {
  font-size: 22px;
  color: var(--red2);
  margin-left: 2px;
}

.tpl-cap {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--silver2);
}

@media (max-width: 820px) {
  body.fixed {
    height: auto;
    min-height: 100vh;
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.fixed .topbar {
    position: sticky;
  }

  .tpl-logo {
    width: 84px;
  }

  .tpl-ecg {
    width: 200px;
  }
}
