:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #071011;
  color: #f2f7f2;
  font-synthesis: none;
  --acid: #b9f754;
  --acid-dark: #20320d;
  --ink: #071011;
  --muted: #8fa09b;
  --panel: #101b1b;
  --panel-raised: #142221;
  --line: rgba(205, 232, 220, 0.13);
  --danger: #ff4f4f;
  --danger-dark: #6d1016;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #071011;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 20% -10%, rgba(185, 247, 84, 0.13), transparent 34rem),
    linear-gradient(180deg, #091313 0%, #050a0b 100%);
  overscroll-behavior-y: none;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(185, 247, 84, 0.78);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
}

.topbar,
.section-heading,
.button-pair,
.connection-actions,
footer {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 3px;
  font-size: clamp(1.7rem, 7vw, 2.2rem);
  font-weight: 710;
  letter-spacing: -0.045em;
}

h2 {
  font-size: 1.12rem;
  font-weight: 680;
  letter-spacing: -0.025em;
}

.eyebrow {
  color: var(--acid);
  font-size: 0.66rem;
  font-weight: 780;
  letter-spacing: 0.18em;
}

.connection-badge,
.lock-badge,
footer {
  font-size: 0.61rem;
  font-weight: 780;
  letter-spacing: 0.1em;
}

.connection-badge {
  max-width: 145px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  text-align: center;
}

.connection-badge[data-state="connected"] {
  border-color: rgba(185, 247, 84, 0.35);
  background: rgba(185, 247, 84, 0.1);
  color: var(--acid);
}

.connection-badge[data-state="demo"] {
  border-color: rgba(104, 197, 255, 0.34);
  background: rgba(104, 197, 255, 0.1);
  color: #8bd4ff;
}

.support-notice {
  margin-bottom: 14px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 186, 88, 0.3);
  border-radius: 14px;
  background: rgba(99, 59, 5, 0.28);
  color: #ffdba7;
  font-size: 0.78rem;
  line-height: 1.45;
}

.panel {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(21, 35, 34, 0.98), rgba(12, 23, 23, 0.98));
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.16);
}

.hero-card {
  position: relative;
  min-height: 230px;
  overflow: hidden;
  padding: 24px;
}

.hero-card::after {
  position: absolute;
  right: -70px;
  bottom: -85px;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(185, 247, 84, 0.11);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(185, 247, 84, 0.025), 0 0 0 58px rgba(185, 247, 84, 0.015);
  content: "";
}

.pulse-mark {
  position: absolute;
  top: 24px;
  right: 24px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 28px rgba(185, 247, 84, 0.25);
  color: var(--ink);
  font-size: 1rem;
}

.bpm-readout {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.bpm-readout strong {
  min-height: 104px;
  color: var(--acid);
  font-size: clamp(5.1rem, 25vw, 7.3rem);
  font-weight: 680;
  line-height: 0.94;
  letter-spacing: -0.085em;
}

.bpm-readout span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 760;
  letter-spacing: 0.14em;
}

.hero-status {
  position: absolute;
  right: 24px;
  bottom: 24px;
  left: 24px;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.hero-status div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.hero-status span {
  color: var(--muted);
  font-size: 0.66rem;
}

.hero-status strong {
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-panel,
.control-panel {
  padding: 20px;
}

.section-heading {
  justify-content: space-between;
  gap: 16px;
}

.section-heading .eyebrow {
  margin-bottom: 5px;
}

.target-number {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--acid);
}

.target-number strong {
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.06em;
}

.target-number span {
  font-size: 0.65rem;
  font-weight: 760;
}

.target-controls {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 12px;
  align-items: center;
  margin: 24px 0 8px;
}

.step-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #1a2928;
  color: #f4f8f4;
  font-size: 1.45rem;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 99px;
  appearance: none;
  background: linear-gradient(90deg, var(--acid-dark), var(--acid));
}

input[type="range"]::-webkit-slider-thumb {
  width: 26px;
  height: 26px;
  border: 4px solid var(--panel);
  border-radius: 50%;
  appearance: none;
  background: var(--acid);
  box-shadow: 0 0 0 1px rgba(185, 247, 84, 0.45);
}

input[type="range"]::-moz-range-thumb {
  width: 19px;
  height: 19px;
  border: 4px solid var(--panel);
  border-radius: 50%;
  background: var(--acid);
}

.range-labels {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.64rem;
}

.range-labels span:last-child {
  text-align: right;
}

.primary-button,
.quiet-button,
.connect-button,
.text-button {
  min-height: 48px;
  border-radius: 14px;
  font-weight: 720;
}

.primary-button {
  width: 100%;
  border: 0;
  background: var(--acid);
  color: #0b1409;
}

.compact {
  align-items: flex-start;
}

.lock-badge {
  flex: 0 0 auto;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(185, 247, 84, 0.1);
  color: var(--acid);
}

.lock-badge[data-enabled="true"] {
  background: rgba(255, 79, 79, 0.15);
  color: #ff8b8b;
}

.panel-copy {
  margin: 15px 0 18px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.button-pair {
  gap: 10px;
}

.button-pair .primary-button {
  flex: 1 1 auto;
}

.quiet-button {
  flex: 0 0 92px;
  border: 1px solid var(--line);
  background: transparent;
  color: #d9e2dd;
}

.stop-zone {
  margin: 18px 0 16px;
}

.stop-button {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 132px;
  grid-template-columns: 48px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  padding: 24px 25px;
  overflow: hidden;
  border: 1px solid rgba(255, 142, 142, 0.3);
  border-radius: 24px;
  background: linear-gradient(135deg, #d31f2b, #7c1119);
  box-shadow: 0 20px 50px rgba(125, 5, 15, 0.28);
  color: white;
  text-align: left;
}

.stop-button::after {
  position: absolute;
  top: -50%;
  right: -35px;
  width: 180px;
  height: 180px;
  border: 24px solid rgba(255, 255, 255, 0.045);
  border-radius: 50%;
  content: "";
}

.stop-button > span:nth-child(2) {
  position: relative;
  z-index: 1;
  align-self: end;
  font-size: 2.35rem;
  font-weight: 820;
  letter-spacing: 0.09em;
}

.stop-button small {
  position: relative;
  z-index: 1;
  align-self: start;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.7rem;
  font-weight: 620;
}

.stop-icon {
  position: relative;
  z-index: 1;
  width: 32px;
  height: 32px;
  grid-row: 1 / span 2;
  border: 6px solid white;
  border-radius: 9px;
}

.stop-button.is-disconnected {
  filter: saturate(0.6);
}

.stop-zone > p {
  padding: 10px 8px 0;
  color: #aeb9b5;
  font-size: 0.67rem;
  line-height: 1.45;
  text-align: center;
}

.message {
  min-height: 42px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

.message[data-tone="success"] {
  border-color: rgba(185, 247, 84, 0.25);
  color: #d7ff98;
}

.message[data-tone="warning"] {
  border-color: rgba(255, 186, 88, 0.25);
  color: #ffd49a;
}

.message[data-tone="danger"] {
  border-color: rgba(255, 79, 79, 0.32);
  color: #ffaaaa;
}

.connection-actions {
  justify-content: center;
  gap: 8px;
  margin: 14px 0 22px;
}

.connect-button {
  min-width: 145px;
  border: 1px solid rgba(185, 247, 84, 0.3);
  background: rgba(185, 247, 84, 0.08);
  color: var(--acid);
}

.text-button {
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
}

footer {
  justify-content: space-between;
  padding: 0 4px;
  color: #64726e;
}

.no-start {
  color: #be7478;
}

@media (min-width: 700px) {
  .app-shell {
    padding-top: 34px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .pulse-mark {
    animation: heartbeat 2.2s ease-in-out infinite;
  }

  @keyframes heartbeat {
    0%, 52%, 100% { transform: scale(1); }
    8% { transform: scale(1.12); }
    16% { transform: scale(1); }
    23% { transform: scale(1.08); }
  }
}
