:root {
  --bg: #061421;
  --panel: rgba(9, 32, 48, 0.68);
  --panel-strong: rgba(8, 26, 43, 0.86);
  --line: rgba(142, 241, 226, 0.24);
  --text: #eefcff;
  --muted: #a5c8cc;
  --turquoise: #20f0d0;
  --green: #7df4ad;
  --blue: #3aa7ff;
  --dark-blue: #071827;
  --danger: #ff6f91;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

html,
body { min-height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 12%, rgba(32, 240, 208, 0.22), transparent 34%),
    radial-gradient(circle at 85% 18%, rgba(58, 167, 255, 0.20), transparent 33%),
    linear-gradient(135deg, #061421 0%, #071827 48%, #052e35 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button,
.thermometer { touch-action: manipulation; }

.app-shell {
  position: relative;
  min-height: 100svh;
  padding: clamp(18px, 3vw, 34px);
  display: grid;
  place-items: center;
  isolation: isolate;
}

.ambient {
  position: fixed;
  z-index: -2;
  filter: blur(2px);
  opacity: 0.82;
  pointer-events: none;
}

.ambient-one {
  width: 38vw;
  height: 31vw;
  left: -9vw;
  bottom: -8vw;
  border-radius: 42% 58% 63% 37% / 44% 42% 58% 56%;
  background: linear-gradient(135deg, rgba(33, 240, 208, 0.28), rgba(125, 244, 173, 0.06));
}

.ambient-two {
  width: 34vw;
  height: 26vw;
  right: -7vw;
  top: 6vh;
  border-radius: 66% 34% 44% 56% / 45% 61% 39% 55%;
  background: linear-gradient(135deg, rgba(58, 167, 255, 0.24), rgba(32, 240, 208, 0.08));
}

.ambient-three {
  width: 42vw;
  height: 14vw;
  right: 12vw;
  bottom: 7vh;
  transform: rotate(-12deg);
  border-radius: 999px;
  background: rgba(125, 244, 173, 0.08);
}

.pulse-screen,
.thanks-screen {
  width: min(1180px, 100%);
  min-height: min(760px, calc(100svh - 40px));
  border: 1px solid var(--line);
  border-radius: 36px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.025)),
    var(--panel);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(22px);
}

.pulse-screen {
  padding: clamp(22px, 3vw, 38px);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: clamp(12px, 2vw, 22px);
}

.hero,
.dialog-header,
.stats-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: clamp(12px, 1.4vw, 15px);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: clamp(34px, 5.6vw, 74px);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

.microcopy {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(15px, 1.8vw, 20px);
}

.ghost-action,
.icon-button,
.secondary-button,
.danger-button,
.pulse-button {
  border: 0;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.ghost-action,
.secondary-button,
.danger-button,
.icon-button {
  border: 1px solid rgba(142, 241, 226, 0.24);
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(10px);
}

.ghost-action {
  padding: 12px 18px;
  border-radius: 999px;
  color: #d9feff;
}

.thermometer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(14px, 2vw, 22px);
  align-items: stretch;
}

.thermometer-card {
  position: relative;
  min-height: 390px;
  padding: 20px 16px 18px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  gap: 14px;
  overflow: hidden;
  border: 1px solid rgba(142, 241, 226, 0.18);
  border-radius: 30px;
  background: rgba(4, 20, 34, 0.52);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.card-glow {
  position: absolute;
  inset: auto -35% -18% -35%;
  height: 38%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(32, 240, 208, 0.18), transparent 68%);
  pointer-events: none;
}

.thermometer-card h2 {
  max-width: 170px;
  margin: 0;
  text-align: center;
  font-size: clamp(17px, 2vw, 24px);
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.thermometer {
  position: relative;
  width: min(134px, 100%);
  height: 260px;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  cursor: ns-resize;
  user-select: none;
}

.thermometer:focus-visible {
  outline: 3px solid rgba(32, 240, 208, 0.7);
  outline-offset: 8px;
  border-radius: 24px;
}

.scale-markers {
  height: 228px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: rgba(238, 252, 255, 0.56);
  font-weight: 800;
}

.tube {
  position: relative;
  width: 54px;
  height: 238px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(238, 252, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 0 22px rgba(0, 0, 0, 0.28),
    0 0 38px rgba(32, 240, 208, 0.10);
}

.tube::before {
  content: "";
  position: absolute;
  inset: 10px 14px auto;
  height: 88%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0.34), transparent);
  opacity: 0.38;
  z-index: 2;
}

.fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 50%;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--blue), var(--turquoise) 45%, var(--green));
  box-shadow: 0 -10px 32px rgba(32, 240, 208, 0.36);
  transition: height 140ms ease;
}

.thumb {
  position: absolute;
  left: 50%;
  bottom: calc(50% - 16px);
  z-index: 3;
  width: 74px;
  height: 34px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: rgba(238, 252, 255, 0.22);
  box-shadow: 0 9px 24px rgba(0, 0, 0, 0.28);
  transition: bottom 140ms ease;
}

.value-pill {
  min-width: 78px;
  padding: 10px 14px;
  text-align: center;
  border: 1px solid rgba(142, 241, 226, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 20px;
}

.pulse-button {
  justify-self: center;
  min-width: min(360px, 100%);
  padding: 18px 34px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--turquoise), var(--green));
  color: #03222b;
  box-shadow: 0 18px 46px rgba(32, 240, 208, 0.32);
  text-transform: uppercase;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.pulse-button small {
  font-size: 11px;
  letter-spacing: 0.14em;
  opacity: 0.76;
}

.thanks-screen {
  place-items: center;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 14px;
}

.thanks-screen:not([hidden]) { display: grid; }

.thanks-orb {
  width: 118px;
  height: 118px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--turquoise), var(--green));
  color: #03222b;
  font-size: 62px;
  font-weight: 950;
  box-shadow: 0 0 70px rgba(32, 240, 208, 0.45);
}

.thanks-screen h2 {
  margin: 0;
  font-size: clamp(42px, 7vw, 86px);
  letter-spacing: -0.06em;
}

.thanks-screen p {
  color: var(--muted);
  font-size: 22px;
}

.stats-dialog {
  width: min(860px, calc(100% - 28px));
  border: 0;
  padding: 0;
  border-radius: 30px;
  color: var(--text);
  background: transparent;
}

.stats-dialog::backdrop {
  background: rgba(0, 8, 16, 0.68);
  backdrop-filter: blur(8px);
}

.dialog-panel {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.dialog-header h2 { margin: 0; font-size: 34px; }

.icon-button {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 30px;
  line-height: 1;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.stat-card {
  padding: 16px;
  border: 1px solid rgba(142, 241, 226, 0.18);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.secondary-button,
.danger-button {
  padding: 12px 16px;
  border-radius: 16px;
}

.danger-button { color: #ffdbe4; border-color: rgba(255, 111, 145, 0.38); }

.storage-note { margin-bottom: 0; color: var(--muted); }

@media (max-width: 900px) {
  body { overflow: auto; }
  .app-shell { place-items: start center; }
  .pulse-screen { min-height: auto; }
  .thermometer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .hero,
  .dialog-header,
  .stats-actions { align-items: stretch; flex-direction: column; }
  .thermometer-grid,
  .stats-summary { grid-template-columns: 1fr; }
  .thermometer-card { min-height: 330px; }
}

@media print {
  body { overflow: visible; background: #fff; color: #111; }
  body * { visibility: hidden; }
  .stats-dialog,
  .stats-dialog * { visibility: visible; color: #111; }
  .stats-dialog { position: absolute; inset: 0; width: 100%; }
  .stats-actions,
  .icon-button { display: none !important; }
  .dialog-panel { box-shadow: none; border: 0; background: #fff; }
}
