:is(.reaction-section, .settings-panel) {
  --reaction-brand: #6b65dc;
}

html[data-page="reaction"] body.fullscreen-open {
  overflow: hidden;
}

.reaction-section {
  --reaction-core: #287ab3;
  --reaction-core-soft: #cfe8fb;
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: var(--page-card-gap) 0 calc(var(--page-card-gap) + var(--records-card-overlap));
}

.reaction-section:has(~ .records-section[hidden]) {
  padding-bottom: var(--page-card-gap);
}

.reaction-panel {
  position: relative;
  display: grid;
  gap: clamp(16px, 2.5vw, 24px);
  padding: clamp(18px, 3.2vw, 36px);
  background: #ffffff;
  border-radius: 24px;
}

.result-strip {
  order: 0;
}

.reaction-stage {
  position: relative;
  order: 1;
  min-width: 0;
}

.action-row {
  order: 2;
}

.reaction-panel:fullscreen,
.reaction-panel.is-app-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100vw;
  height: 100dvh;
  min-height: 100dvh;
  margin: 0;
  padding: clamp(18px, 3.2vw, 42px);
  border-radius: 0;
  overflow: auto;
  background: #ffffff;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.reaction-panel:fullscreen .reaction-stage,
.reaction-panel.is-app-fullscreen .reaction-stage,
.reaction-panel:fullscreen .reaction-surface,
.reaction-panel.is-app-fullscreen .reaction-surface {
  height: 100%;
  min-height: 0;
}

.reaction-surface {
  --state-bg: var(--reaction-core);
  --state-color: #ffffff;
  --state-soft: var(--reaction-core-soft);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  place-items: center;
  gap: 18px;
  align-content: center;
  min-height: clamp(360px, 48vw, 560px);
  width: 100%;
  padding: clamp(28px, 5vw, 58px);
  color: var(--state-color);
  background: var(--state-bg);
  border: 0;
  border-radius: 22px;
  cursor: pointer;
  text-align: center;
  user-select: none;
  transition: background-color 160ms ease, color 160ms ease, filter 160ms ease, transform 120ms ease, box-shadow 180ms ease;
}

.reaction-surface::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.72), transparent 30%),
    linear-gradient(115deg, transparent 22%, rgba(255, 255, 255, 0.24) 45%, transparent 68%);
  opacity: 0;
  transform: scale(0.88);
  transition: opacity 420ms ease, transform 520ms ease;
}

.reaction-surface > * {
  position: relative;
  z-index: 1;
}

.reaction-surface::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: clamp(24px, 4vw, 38px);
  width: min(260px, 44%);
  height: 3px;
  background: currentColor;
  border-radius: 999px;
  opacity: 0.18;
  transform: translateX(-50%);
}

.reaction-surface[data-state="waiting"] {
  --state-bg: #e84f52;
  --state-color: #ffffff;
  --state-soft: #ba292f;
}

.reaction-surface[data-state="ready"] {
  --state-bg: #1fad74;
  --state-color: #ffffff;
  --state-soft: #087a50;
}

.reaction-surface[data-state="roundResult"] {
  --state-bg: #eef6ff;
  --state-color: #172a3b;
  --state-soft: #dcecff;
}

.reaction-surface[data-state="finalResult"] {
  --state-bg: #f7f3ff;
  --state-color: #172a3b;
  --state-soft: #ece4ff;
}

.reaction-surface[data-state="early"],
.reaction-surface[data-state="earlyContinue"] {
  --state-bg: #fff6e2;
  --state-color: #2a2417;
  --state-soft: #f5c85d;
}

.reaction-surface:hover {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 14px 28px rgba(42, 90, 145, 0.07);
}

.reaction-surface:active {
  transform: scale(0.992);
}

.reaction-surface:focus {
  outline: none;
}

.reaction-surface:focus-visible,
.secondary-action:focus-visible,
.tool-btn:focus-visible,
.settings-close:focus-visible,
.segmented-control button:focus-visible,
.toggle-row input:focus-visible,
.range-setting input:focus-visible {
  outline: 3px solid rgba(107, 101, 220, 0.25);
  outline-offset: 3px;
}

.surface-icon {
  display: none;
  width: clamp(62px, 7vw, 78px);
  height: clamp(62px, 7vw, 78px);
  color: #6b65dc;
}

.surface-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.reaction-surface[data-state="idle"] .surface-icon {
  display: block;
  color: #cfe8fb;
  transform-origin: center;
  animation: idle-bolt-pulse 2.6s ease-in-out infinite;
}

.reaction-surface[data-state="idle"] .surface-detail {
  opacity: 1;
}

@keyframes idle-bolt-pulse {
  0%,
  100% {
    opacity: 0.72;
    transform: scale(0.99);
  }

  50% {
    opacity: 1;
    transform: scale(1.01);
  }
}

.surface-title {
  display: block;
  max-width: 100%;
  color: currentColor;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 4.2rem);
  font-weight: 850;
  line-height: 1;
  overflow-wrap: anywhere;
}

.surface-message {
  display: block;
  max-width: min(760px, 100%);
  color: currentColor;
  font-size: clamp(1rem, 1.7vw, 1.22rem);
  font-weight: 800;
  line-height: 1.55;
  opacity: 0.94;
}

.reaction-surface[data-state="idle"] .surface-message {
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  line-height: 1.4;
}

.surface-title[hidden],
.surface-message[hidden],
.surface-detail[hidden] {
  display: none;
}

.surface-detail {
  display: block;
  max-width: min(720px, 100%);
  color: currentColor;
  font-size: 0.98rem;
  font-weight: 750;
  line-height: 1.5;
  opacity: 0.74;
}

.result-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  text-align: center;
}

.metric {
  --metric-accent: #2f88c9;
  --metric-accent-bright: #58c8e8;
  --metric-surface: #f7fbfe;
  --metric-border: #deedf7;
  --metric-shadow: rgb(47 136 201 / 0.04);
  --metric-flow-start: rgb(47 136 201 / 0.13);
  --metric-flow-end: rgb(88 200 232 / 0.055);
  --metric-flow-top: 54%;
  --metric-flow-left: -6%;
  --metric-flow-rotate: -4deg;
  --metric-flow-radius: 44% 56% 48% 52% / 68% 48% 52% 32%;
  --metric-ripple-origin: 20% 118%;
  --metric-signal-left: 12%;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-width: 0;
  height: 80px;
  padding: 13px 18px;
  background: linear-gradient(145deg, #ffffff 4%, var(--metric-surface) 100%);
  border: 1px solid var(--metric-border);
  border-radius: 18px;
  box-shadow: 0 4px 12px var(--metric-shadow), inset 0 1px 0 rgb(255 255 255 / 0.9);
}

.metric::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: -1px;
  left: var(--metric-signal-left);
  width: 36%;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--metric-accent) 24%, var(--metric-accent-bright) 74%, transparent 100%);
  border-radius: 0 0 2px 2px;
  opacity: 0.58;
  transform: skewX(-28deg);
}

.metric::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: var(--metric-flow-top);
  left: var(--metric-flow-left);
  width: 112%;
  height: 62%;
  pointer-events: none;
  background:
    repeating-radial-gradient(ellipse at var(--metric-ripple-origin), transparent 0 9px, rgb(255 255 255 / 0.28) 10px 11px, transparent 12px 23px),
    radial-gradient(circle, rgb(255 255 255 / 0.25) 0 0.8px, transparent 1.4px) 0 0 / 17px 17px,
    linear-gradient(105deg, var(--metric-flow-start), var(--metric-flow-end));
  border-radius: var(--metric-flow-radius);
  transform: rotate(var(--metric-flow-rotate));
  transform-origin: center;
}

.metric:nth-child(1) {
  --metric-accent: #2f88c9;
  --metric-accent-bright: #58c8e8;
  --metric-surface: #f7fbfe;
  --metric-border: #deedf7;
  --metric-shadow: rgb(47 136 201 / 0.04);
  --metric-flow-start: rgb(47 136 201 / 0.14);
  --metric-flow-end: rgb(88 200 232 / 0.06);
  --metric-flow-top: 55%;
  --metric-flow-left: -7%;
  --metric-flow-rotate: -4deg;
  --metric-flow-radius: 42% 58% 46% 54% / 72% 44% 56% 28%;
  --metric-ripple-origin: 18% 118%;
  --metric-signal-left: 12%;
}

.metric:nth-child(2) {
  --metric-accent: #7c6ee6;
  --metric-accent-bright: #d27fc4;
  --metric-surface: #faf8ff;
  --metric-border: #ece7fa;
  --metric-shadow: rgb(124 110 230 / 0.04);
  --metric-flow-start: rgb(124 110 230 / 0.13);
  --metric-flow-end: rgb(210 127 196 / 0.055);
  --metric-flow-top: 52%;
  --metric-flow-left: -5%;
  --metric-flow-rotate: 3deg;
  --metric-flow-radius: 58% 42% 54% 46% / 46% 70% 30% 54%;
  --metric-ripple-origin: 52% 122%;
  --metric-signal-left: 28%;
}

.metric:nth-child(3) {
  --metric-accent: #2fa37b;
  --metric-accent-bright: #9acb63;
  --metric-surface: #f7fcf9;
  --metric-border: #dfefe7;
  --metric-shadow: rgb(47 163 123 / 0.04);
  --metric-flow-start: rgb(47 163 123 / 0.14);
  --metric-flow-end: rgb(154 203 99 / 0.06);
  --metric-flow-top: 55%;
  --metric-flow-left: -8%;
  --metric-flow-rotate: -2deg;
  --metric-flow-radius: 48% 52% 40% 60% / 62% 42% 58% 38%;
  --metric-ripple-origin: 82% 118%;
  --metric-signal-left: 44%;
}

.metric-label {
  position: relative;
  z-index: 1;
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.metric strong {
  position: relative;
  z-index: 1;
  display: block;
  color: #172a3b;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  white-space: nowrap;
}

.metric.is-updated strong {
  animation: metric-value-kick 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.metric.is-updated::after {
  animation: metric-flow-pulse 300ms ease-out;
}

@keyframes metric-value-kick {
  0% {
    color: var(--metric-accent);
    transform: translateY(1px) scale(0.985);
  }

  55% {
    color: var(--metric-accent);
    transform: translateY(-1px) scale(1.025);
  }

  100% {
    color: #172a3b;
    transform: translateY(0) scale(1);
  }
}

@keyframes metric-flow-pulse {
  0% {
    filter: saturate(0.9);
    opacity: 0.48;
    transform: rotate(var(--metric-flow-rotate)) translateY(4px) scaleX(0.985);
  }

  50% {
    filter: saturate(1.08);
    opacity: 0.88;
    transform: rotate(var(--metric-flow-rotate)) translateY(-1px) scaleX(1.005);
  }

  100% {
    filter: saturate(1);
    opacity: 1;
    transform: rotate(var(--metric-flow-rotate)) translateY(0) scaleX(1);
  }
}

.action-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

.action-row[hidden] {
  display: none;
}

.secondary-action {
  min-width: 148px;
  min-height: 46px;
  height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 900;
  flex: 0 0 auto;
  transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.secondary-action {
  color: #172a3b;
  background: #eef3ff;
}

.secondary-action:hover {
  background: #e5edff;
  transform: translateY(-1px);
}

.tool-controls {
  position: absolute;
  right: clamp(12px, 2vw, 18px);
  bottom: clamp(12px, 2vw, 18px);
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  min-height: 34px;
  opacity: 0.66;
  transition: opacity 180ms ease;
}

.tool-controls:hover,
.tool-controls:focus-within {
  opacity: 1;
}

.tool-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: rgba(255, 255, 255, 0.82);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: none;
  transition: color 180ms ease, opacity 180ms ease;
}

.tool-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.35;
}

.tool-btn:hover {
  color: #ffffff;
  background: transparent;
}

.tool-btn.is-on {
  color: rgba(255, 255, 255, 0.96);
  background: transparent;
}

.tool-btn.is-off {
  color: rgba(255, 255, 255, 0.58);
  background: transparent;
}

#settingsButton {
  color: rgba(255, 255, 255, 0.58);
}

.tool-btn:is(.is-on, .is-off):hover {
  color: #ffffff;
}

#settingsButton:is(:hover, :focus-visible, [aria-expanded="true"]) {
  color: #ffffff;
}

.tool-btn:focus-visible {
  outline-color: rgba(255, 255, 255, 0.92);
}

html[data-page="reaction"] body.settings-open {
  overflow: hidden;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 1090;
  background: rgba(7, 23, 47, 0.28);
  backdrop-filter: blur(4px);
}

.settings-overlay[hidden] {
  display: none;
}

.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1100;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(460px, calc(100vw - 28px));
  height: 100dvh;
  color: #172a3b;
  background: #ffffff;
  box-shadow: -24px 0 60px rgba(23, 42, 59, 0.16);
  transform: translateX(102%);
  transition: transform 220ms ease;
}

.settings-panel.is-open {
  transform: translateX(0);
}

.settings-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 16px;
}

.settings-kicker {
  margin: 0 0 4px;
  color: var(--reaction-brand);
  font-family: "Segoe Print", "Bradley Hand ITC", "Comic Sans MS", "SF Pro Rounded", cursive;
  font-size: 0.84rem;
  font-weight: 800;
}

.settings-panel h2,
.settings-panel h3 {
  margin: 0;
  font-family: var(--font-display);
  line-height: 1.1;
}

.settings-panel h2 {
  font-size: 1.55rem;
}

.settings-panel h3 {
  font-size: 1.02rem;
}

.settings-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #66746f;
  background: #f1f6fb;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.settings-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.settings-scroll {
  display: grid;
  gap: 14px;
  min-height: 0;
  padding: 16px 18px 24px;
  overflow: auto;
}

.settings-group {
  display: grid;
  gap: 13px;
  padding: 16px;
  background: #fbfdff;
  border-radius: 16px;
}

.setting-row,
.toggle-row,
.range-setting label {
  display: grid;
  gap: 8px;
}

.setting-row > span,
.toggle-row > span,
.range-setting label > span {
  color: #59685f;
  font-size: 0.82rem;
  font-weight: 900;
}

.setting-row-inline {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.setting-row-inline strong {
  color: #172a3b;
  font-size: 0.9rem;
}

.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

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

.segmented-control[data-setting="penaltyMode"] button:last-child {
  grid-column: 1 / -1;
}

.segmented-control button {
  min-height: 36px;
  padding: 8px 10px;
  color: #59685f;
  background: #eef4f9;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.15;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.segmented-control button:hover {
  color: #172a3b;
  transform: translateY(-1px);
}

.segmented-control button.is-active {
  color: #ffffff;
  background: #172a3b;
}

.range-setting {
  display: grid;
  gap: 10px;
}

.range-setting input[type="range"] {
  width: 100%;
  accent-color: #172a3b;
}

.range-setting p,
.settings-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.55;
}

.toggle-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 38px;
}

.toggle-row input {
  width: 44px;
  height: 24px;
  accent-color: #172a3b;
  cursor: pointer;
}

.reaction-surface[data-transition="hardCut"] {
  transition: transform 120ms ease, box-shadow 180ms ease;
}

.reaction-surface[data-transition="gradient"] {
  transition: background-color 820ms cubic-bezier(0.22, 1, 0.36, 1), color 420ms ease, filter 420ms ease, transform 120ms ease, box-shadow 420ms ease;
}

.reaction-surface[data-transition="gradient"][data-state="waiting"]::before {
  opacity: 0.16;
  transform: scale(0.92);
}

.reaction-surface[data-transition="gradient"][data-state="ready"]::before {
  animation: ready-gradient-wash 940ms cubic-bezier(0.2, 0.8, 0.2, 1) 1;
  opacity: 0.34;
  transform: scale(1.08);
}

.reaction-surface[data-transition="flash"][data-state="ready"] {
  animation: ready-flash 1100ms ease-out 1;
}

.reaction-surface[data-transition="flash"][data-state="ready"]::before {
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.14) 34%, transparent 68%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 58%);
  animation: ready-flash-overlay 1100ms ease-out 1;
}

.reaction-surface[data-scheme="blackWhite"][data-state="waiting"] {
  --state-bg: #111318;
  --state-color: #ffffff;
  --state-soft: #2b3038;
}

.reaction-surface[data-scheme="blackWhite"][data-state="ready"] {
  --state-bg: #ffffff;
  --state-color: #172a3b;
  --state-soft: #dbe3ea;
  box-shadow: inset 0 0 0 2px rgba(23, 42, 59, 0.1);
}

.reaction-surface[data-scheme="grayOrange"][data-state="waiting"] {
  --state-bg: #dfe5eb;
  --state-color: #172a3b;
  --state-soft: #c8d0d8;
}

.reaction-surface[data-scheme="grayOrange"][data-state="ready"] {
  --state-bg: #f0a23a;
  --state-color: #21170c;
  --state-soft: #d98416;
}

.reaction-surface[data-scheme="softBlueGreen"][data-state="waiting"] {
  --state-bg: #dbeaf2;
  --state-color: #172a3b;
  --state-soft: #c4d8e4;
}

.reaction-surface[data-scheme="softBlueGreen"][data-state="ready"] {
  --state-bg: #dff5df;
  --state-color: #173321;
  --state-soft: #b9ddb9;
}

.reaction-surface[data-colorblind="true"][data-state="ready"] {
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.28) 0 4px, transparent 5px);
  background-size: 34px 34px;
  background-position: center;
}

.reaction-surface[data-colorblind="true"][data-scheme="blackWhite"][data-state="ready"],
.reaction-surface[data-colorblind="true"][data-scheme="grayOrange"][data-state="ready"],
.reaction-surface[data-colorblind="true"][data-scheme="softBlueGreen"][data-state="ready"] {
  background-image: radial-gradient(circle, rgba(23, 42, 59, 0.18) 0 4px, transparent 5px);
}

@keyframes ready-gradient-wash {
  0% {
    opacity: 0.04;
    transform: scale(0.78);
  }
  48% {
    opacity: 0.48;
    transform: scale(1.18);
  }
  100% {
    opacity: 0.34;
    transform: scale(1.08);
  }
}

@keyframes ready-flash {
  0% {
    filter: brightness(1) saturate(1);
    box-shadow: inset 0 0 0 0 rgba(255, 255, 255, 0), 0 0 0 rgba(31, 173, 116, 0);
  }
  34% {
    filter: brightness(1.055) saturate(1.05);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.24), 0 0 0 8px rgba(31, 173, 116, 0.08);
  }
  68% {
    filter: brightness(1.025) saturate(1.025);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 0 0 18px rgba(31, 173, 116, 0);
  }
  100% {
    filter: brightness(1) saturate(1);
    box-shadow: inset 0 0 0 0 rgba(255, 255, 255, 0), 0 0 0 rgba(31, 173, 116, 0);
  }
}

@keyframes ready-flash-overlay {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }
  42% {
    opacity: 0.22;
    transform: scale(1.08);
  }
  72% {
    opacity: 0.1;
    transform: scale(1.16);
  }
  100% {
    opacity: 0;
    transform: scale(1.22);
  }
}

.secondary-action[hidden] {
  display: none;
}

@media (max-width: 760px) {
  .reaction-surface {
      min-height: 360px;
    }

  .reaction-panel:fullscreen,
  .reaction-panel.is-app-fullscreen {
      grid-template-rows: auto minmax(280px, 1fr) auto;
    }

  .reaction-panel:fullscreen .tool-controls,
  .reaction-panel.is-app-fullscreen .tool-controls {
      position: absolute;
      right: 18px;
      bottom: 18px;
      width: auto;
    }

  .result-strip {
      grid-template-columns: 1fr;
    }
}

@media (max-width: 460px) {
  .reaction-section {
      width: min(100% - 22px, 1200px);
    }

  .reaction-panel {
      gap: 10px;
      padding: 14px;
    }

  .reaction-surface {
      min-height: 258px;
      padding: 24px 18px;
    }

  .surface-title {
      font-size: clamp(1.75rem, 9vw, 2.7rem);
    }

  .action-row {
      justify-content: center;
      padding-right: 0;
      padding-bottom: 0;
    }

  .secondary-action {
      width: min(100%, 180px);
    }

  .tool-controls {
      right: 10px;
      bottom: 10px;
      gap: 8px;
    }

  .tool-btn {
      width: 38px;
      height: 38px;
    }

  .settings-panel {
      top: auto;
      bottom: 0;
      width: 100vw;
      height: min(86dvh, 720px);
      border-radius: 22px 22px 0 0;
      box-shadow: 0 -24px 60px rgba(23, 42, 59, 0.18);
      transform: translateY(102%);
    }

  .settings-panel.is-open {
      transform: translateY(0);
    }

  .settings-panel-head {
      padding: 18px 18px 14px;
    }

  .settings-scroll {
      padding: 14px 14px 22px;
    }

  .segmented-grid {
      grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
  .reaction-panel:fullscreen,
  .reaction-panel.is-app-fullscreen {
      gap: clamp(8px, 1.5dvh, 14px);
      padding-top: max(14px, env(safe-area-inset-top));
      padding-bottom: max(14px, env(safe-area-inset-bottom));
    }

  .reaction-panel:fullscreen .tool-controls,
  .reaction-panel.is-app-fullscreen .tool-controls {
      right: 10px;
      bottom: 10px;
      width: auto;
      margin: 0;
    }

  .result-strip {
      grid-template-columns: 1fr;
      gap: 0;
      padding: 0 18px;
      overflow: hidden;
      background: #ffffff;
      border-radius: 18px;
    }

  .result-strip .metric {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: center;
      gap: 12px;
      min-height: 64px;
      padding: 12px 4px;
      background: transparent;
      border: 0;
      border-bottom: 1px solid #e3ebf3;
      border-radius: 0;
    }

  .result-strip .metric::after {
      top: 60%;
      width: 112%;
      height: 58%;
      opacity: 0.52;
    }

  .metric::before {
      display: none;
    }

  .metric:last-child {
      border-bottom: 0;
    }

  .metric-label {
      margin-bottom: 0;
      text-align: left;
    }

  .metric strong {
      justify-self: end;
      font-size: 1.5rem;
    }

  .metric:last-child strong {
      color: #172a3b;
    }
}

@media (prefers-reduced-motion: reduce) {
  .metric.is-updated strong,
  .metric.is-updated::after {
    animation: none;
  }
}

@media (hover: none), (pointer: coarse) {
  .tool-controls {
      opacity: 0.62;
      transform: none;
    }
}

@media (hover: hover) and (pointer: fine) {
  .tool-controls {
      visibility: hidden;
      opacity: 0;
      pointer-events: none;
      transition: opacity 180ms ease, visibility 0s linear 180ms;
    }

  .reaction-stage:hover .tool-controls,
  .reaction-stage:focus-within .tool-controls {
      visibility: visible;
      opacity: 1;
      pointer-events: auto;
      transition-delay: 0s;
    }
}

@media (max-width: 760px) {
  .reaction-panel:not(.has-started) .tool-controls {
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      transform: translateY(4px);
      transition: opacity 180ms ease, transform 180ms ease, visibility 0s linear 180ms;
    }

  .reaction-panel.has-started .tool-controls,
  .reaction-panel:fullscreen .tool-controls,
  .reaction-panel.is-app-fullscreen .tool-controls {
      opacity: 1;
      visibility: visible;
      pointer-events: auto;
      transform: translateY(0);
      transition-delay: 0s;
    }
}

@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .reaction-panel:not(.has-started) .tool-controls,
  .reaction-panel.has-started .tool-controls {
      transform: none;
      transition: none;
    }
}
