:root {
  color-scheme: light;
  --ink: #102622;
  --ink-soft: #36544d;
  --field: #0b3b36;
  --field-deep: #062b27;
  --field-light: #15564d;
  --paper: #f4f7f6;
  --paper-warm: #ffffff;
  --line: #758e87;
  --mango: #f7c948;
  --mango-dark: #b8800b;
  --prey: #ff4d45;
  --mint: #79d6a5;
  --focus: #1264a3;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  overflow-x: hidden;
}

button,
select,
input {
  font: inherit;
}

button,
a,
select,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button,
a,
select,
input {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 60;
  top: 10px;
  left: 12px;
  padding: 10px 14px;
  color: white;
  background: var(--ink);
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(1480px, 100%);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(18px, env(safe-area-inset-top))
    max(clamp(18px, 3.2vw, 54px), env(safe-area-inset-right))
    max(34px, env(safe-area-inset-bottom))
    max(clamp(18px, 3.2vw, 54px), env(safe-area-inset-left));
}

.topbar {
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(170px, 1fr) auto minmax(170px, 1fr);
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.home-link,
.settings-button,
.session-state {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.home-link {
  width: max-content;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 750;
  text-decoration: none;
}

.home-link:hover {
  color: var(--field);
}

.home-arrow {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: white;
  transition: transform 160ms ease, border-color 160ms ease;
}

.home-link:hover .home-arrow {
  border-color: var(--field);
  transform: translateX(-3px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.brand-mark {
  position: relative;
  width: 36px;
  height: 32px;
  display: block;
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: 8px;
  bottom: 1px;
  width: 22px;
  height: 17px;
  border-radius: 55% 55% 45% 45%;
  background: var(--field);
  transform: rotate(-4deg);
}

.brand-mark span {
  position: absolute;
  width: 8px;
  height: 10px;
  border-radius: 50%;
  background: var(--field);
}

.brand-mark span:nth-child(1) {
  top: 1px;
  left: 2px;
}

.brand-mark span:nth-child(2) {
  top: -2px;
  left: 12px;
}

.brand-mark span:nth-child(3) {
  top: 0;
  left: 23px;
}

.brand-mark span:nth-child(4) {
  top: 8px;
  right: 0;
}

.brand-copy h1 {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 1.4rem;
  letter-spacing: -0.04em;
}

.top-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-state {
  gap: 8px;
  padding: 0 12px;
  color: var(--ink-soft);
  font-size: 0.83rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(121, 214, 165, 0.25);
}

.settings-button {
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: white;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 750;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.settings-button:hover {
  border-color: var(--field);
  background: var(--paper-warm);
  transform: translateY(-1px);
}

.action-icon {
  font-size: 1.05rem;
}

.setup-layout {
  min-height: calc(100vh - 120px);
  min-height: calc(100dvh - 120px);
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(350px, 0.75fr);
  align-items: center;
  gap: clamp(32px, 5vw, 86px);
  padding: clamp(34px, 5vh, 72px) 0;
}

.arena-column {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.36fr);
  gap: 22px 26px;
  align-items: end;
}

.arena-frame {
  grid-column: 1 / -1;
  position: relative;
  width: 100%;
  aspect-ratio: 1.9 / 1;
  min-height: 330px;
  padding: clamp(13px, 1.6vw, 22px);
  background: var(--ink);
  clip-path: ellipse(50% 50% at 50% 50%);
  filter: drop-shadow(0 24px 26px rgba(6, 43, 39, 0.2));
}

.arena-frame::before,
.arena-frame::after {
  content: "";
  position: absolute;
  z-index: 2;
  top: 50%;
  width: 11%;
  height: 3px;
  background: var(--mango);
}

.arena-frame::before {
  left: 0;
}

.arena-frame::after {
  right: 0;
}

.arena-surface {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--field);
  clip-path: ellipse(50% 50% at 50% 50%);
}

.arena-surface::before {
  content: "";
  position: absolute;
  inset: 8%;
  border: 1px solid rgba(244, 247, 246, 0.16);
  border-radius: 50%;
}

.arena-surface::after {
  content: "";
  position: absolute;
  inset: 42% 18%;
  border: 1px dashed rgba(244, 247, 246, 0.24);
  border-radius: 50%;
}

.track-line {
  position: absolute;
  display: block;
  border: 1px solid rgba(121, 214, 165, 0.17);
  border-radius: 50%;
  transform: rotate(-9deg);
}

.track-line-one {
  inset: 20% 12%;
}

.track-line-two {
  inset: 29% 23%;
  transform: rotate(11deg);
}

.track-line-three {
  inset: 12% 34%;
  transform: rotate(68deg);
}

.arena-track {
  position: absolute;
  inset: 15%;
}

.demo-prey {
  position: absolute;
  z-index: 4;
  top: 45%;
  left: 56%;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--prey);
  box-shadow:
    0 0 0 9px rgba(255, 77, 69, 0.17),
    0 0 32px rgba(255, 77, 69, 0.72);
  animation: demo-hunt 5.2s cubic-bezier(0.56, 0, 0.28, 1) infinite;
}

.demo-prey::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: inherit;
  background: white;
  opacity: 0.68;
}

.demo-prey[data-mode="bug"] {
  width: 30px;
  height: 20px;
  border-radius: 55% 45% 52% 48%;
  background: var(--mint);
  box-shadow:
    -10px 2px 0 -5px rgba(121, 214, 165, 0.68),
    10px 2px 0 -5px rgba(121, 214, 165, 0.68),
    0 0 22px rgba(121, 214, 165, 0.86);
}

.demo-prey[data-mode="crawl"] {
  width: 44px;
  height: 16px;
  border-radius: 45%;
  background: var(--mango);
  box-shadow:
    -13px 0 0 -3px var(--mango),
    13px 0 0 -3px var(--mango);
}

.demo-paw {
  position: absolute;
  z-index: 3;
  right: 9%;
  bottom: -12%;
  width: 25%;
  aspect-ratio: 1;
  border-radius: 50% 50% 46% 46%;
  background: rgba(244, 247, 246, 0.94);
  transform: rotate(-24deg);
  transform-origin: 70% 85%;
  box-shadow: 0 -10px 0 rgba(244, 247, 246, 0.94);
  animation: paw-pounce 5.2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.demo-paw::before,
.demo-paw::after {
  content: "";
  position: absolute;
  top: -27%;
  width: 29%;
  aspect-ratio: 0.8;
  border-radius: 50%;
  background: inherit;
}

.demo-paw::before {
  left: 12%;
  transform: rotate(-12deg);
}

.demo-paw::after {
  right: 12%;
  transform: rotate(12deg);
}

.arena-caption h2,
.console-intro h2 {
  margin: 4px 0 10px;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  letter-spacing: -0.04em;
}

.arena-caption h2 {
  max-width: 530px;
  font-size: 3.5rem;
  line-height: 0.98;
  text-wrap: balance;
}

.arena-caption p:last-child,
.console-intro p:last-child {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.6;
}

.caption-kicker,
.console-kicker {
  margin: 0;
  color: var(--field-light);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

.safety-strip {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid #d7b33e;
  background: #fff6d6;
}

.safety-icon {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--mango);
  font-weight: 900;
}

.safety-copy {
  display: grid;
  gap: 4px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.45;
}

.safety-copy strong {
  color: var(--ink);
}

.owner-console {
  position: relative;
  padding: clamp(24px, 3vw, 38px);
  border: 2px solid var(--field);
  border-top: 7px solid var(--field);
  background: white;
}

.owner-console::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 12%;
  width: 22%;
  height: 7px;
  background: var(--mango);
}

.console-controls {
  display: contents;
}

.console-intro h2 {
  font-size: 2.25rem;
  line-height: 1.03;
  text-wrap: balance;
}

.control-group {
  min-width: 0;
  margin: 27px 0 0;
  padding: 0;
  border: 0;
}

.control-group legend {
  width: 100%;
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.choice-button {
  min-height: 48px;
  border: 1px solid var(--line);
  background: var(--paper);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.choice-button:hover {
  border-color: var(--field-light);
  transform: translateY(-1px);
}

.choice-button:active,
.settings-button:active,
.home-link:active .home-arrow,
.hud-button:active {
  transform: translateY(1px);
}

.choice-button:disabled,
.primary-action:disabled,
.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.choice-button[aria-pressed="true"] {
  border: 2px solid var(--field);
  background: #e8f3ef;
}

.mode-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mode-group legend {
  grid-column: 1 / -1;
}

.mode-button {
  min-width: 0;
  min-height: 98px;
  display: grid;
  grid-template-rows: 30px auto;
  justify-items: start;
  gap: 9px;
  padding: 13px;
  text-align: left;
}

.choice-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.choice-copy strong {
  font-size: 0.88rem;
}

.choice-description {
  color: var(--ink-soft);
  font-size: 0.7rem;
  line-height: 1.3;
}

.choice-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--field);
  font-weight: 900;
}

.laser-icon {
  width: 18px;
  height: 18px;
  margin: 5px;
  border-radius: 50%;
  background: var(--prey);
  box-shadow: 0 0 0 6px rgba(255, 77, 69, 0.14);
}

.bug-icon {
  color: #17784d;
  font-size: 1.45rem;
}

.crawl-icon {
  color: var(--mango-dark);
  font-size: 1.65rem;
  transform: rotate(90deg);
}

.sound-switch {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  cursor: pointer;
}

.sound-switch-copy {
  display: grid;
  gap: 3px;
}

.sound-switch-copy small {
  color: var(--ink-soft);
  line-height: 1.35;
}

.switch-control {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 30px;
}

.switch-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border: 1px solid #667f78;
  border-radius: 18px;
  background: #dce5e2;
  transition: background 150ms ease, border-color 150ms ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 5px rgba(16, 38, 34, 0.22);
  transition: transform 150ms ease;
}

.switch-control input:checked + .switch-track {
  border-color: var(--field);
  background: var(--field);
}

.switch-control input:checked + .switch-track::after {
  transform: translateX(22px);
}

.switch-control input:focus-visible + .switch-track {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.sound-choices {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.sound-choice {
  min-width: 0;
  padding: 7px 5px;
  display: grid;
  place-items: center;
  gap: 2px;
  font-size: 0.72rem;
}

.sound-choice span:first-child {
  font-size: 1.05rem;
}

.start-zone {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.primary-action,
.secondary-action,
.text-action {
  min-height: 50px;
  border: 0;
  cursor: pointer;
  font-weight: 850;
}

.primary-action {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 19px;
  color: var(--ink);
  background: var(--mango);
  box-shadow: 0 7px 0 #c78f18;
  transition: transform 130ms ease, box-shadow 130ms ease, background 130ms ease;
}

.primary-action:hover {
  background: #ffd85c;
  transform: translateY(-2px);
  box-shadow: 0 9px 0 #c78f18;
}

.primary-action:active {
  transform: translateY(5px);
  box-shadow: 0 2px 0 #c78f18;
}

.start-arrow {
  font-size: 1.35rem;
  transition: transform 150ms ease;
}

.primary-action:hover .start-arrow {
  transform: translateX(5px);
}

.operator-hints {
  margin: 16px 0 9px;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.45;
}

.hint-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #57716a;
  font-size: 0.7rem;
}

.hint-key {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  background: var(--paper);
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-weight: 800;
}

.play-layer {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: none;
  color: white;
  background: var(--field-deep);
  overflow: hidden;
  overflow: clip;
  touch-action: none;
}

.play-layer[data-active="true"] {
  display: block;
}

.play-layer :focus-visible {
  outline-color: var(--mango);
}

.game-area {
  position: absolute;
  inset: 0;
  overflow: hidden;
  overflow: clip;
  background: var(--field);
  isolation: isolate;
}

.game-area:focus-visible {
  outline: 0;
  box-shadow: inset 0 0 0 4px var(--mango);
}

.game-area::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: -15%;
  border: clamp(90px, 15vw, 230px) solid rgba(6, 43, 39, 0.55);
  border-radius: 48%;
  transform: rotate(-12deg);
}

.game-area::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 17%;
  border: 2px dashed rgba(121, 214, 165, 0.19);
  border-radius: 50%;
  pointer-events: none;
}

.prey {
  --rotation: 0deg;
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  width: 70px;
  height: 70px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--prey);
  box-shadow:
    0 0 0 15px rgba(255, 77, 69, 0.13),
    0 0 40px rgba(255, 77, 69, 0.8);
  cursor: crosshair;
  transform: translate(-50%, -50%) rotate(var(--rotation));
  will-change: left, top, transform;
  touch-action: manipulation;
}

.prey::before {
  content: "";
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background: white;
  opacity: 0.7;
}

.prey::after {
  content: "";
  position: absolute;
  inset: -22px;
  border: 2px solid rgba(255, 77, 69, 0.26);
  border-radius: 50%;
  animation: prey-pulse 1.15s ease-out infinite;
}

.prey[data-mode="bug"] {
  width: 82px;
  height: 60px;
  border-radius: 48% 52% 46% 54%;
  background: var(--mint);
  box-shadow:
    -29px 5px 0 -15px rgba(121, 214, 165, 0.8),
    29px 5px 0 -15px rgba(121, 214, 165, 0.8),
    0 0 42px rgba(121, 214, 165, 0.75);
}

.prey[data-mode="bug"]::before {
  inset: 17px 30px;
  background: var(--field-deep);
  opacity: 0.52;
}

.prey[data-mode="bug"]::after {
  border-color: rgba(121, 214, 165, 0.3);
}

.prey[data-mode="crawl"] {
  width: 90px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 45%;
  background: transparent;
  box-shadow: none;
}

.prey[data-mode="crawl"]::before,
.prey[data-mode="crawl"]::after {
  display: none;
}

.prey-segment {
  display: none;
}

.prey[data-mode="crawl"] .prey-segment {
  width: 24px;
  height: 31px;
  display: block;
  border: 3px solid #4b2e12;
  border-radius: 48%;
  background: var(--mango);
  box-shadow: 0 4px 0 #be7b12;
}

.prey[data-mode="crawl"] .prey-segment:first-child {
  width: 27px;
  height: 34px;
  background: #f5a93b;
}

.prey.is-caught {
  animation: caught-pop 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.prey.is-muted {
  filter: saturate(0.7);
}

.play-hud {
  position: absolute;
  z-index: 10;
  top: max(15px, env(safe-area-inset-top));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(-50%);
}

.hud-button {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  color: white;
  background: rgba(6, 43, 39, 0.88);
  cursor: pointer;
}

.hud-button:hover {
  border-color: var(--mango);
  color: var(--mango);
}

.hud-button[aria-pressed="true"] {
  color: var(--ink);
  border-color: var(--mango);
  background: var(--mango);
}

.score-readout {
  min-width: 138px;
  height: 54px;
  margin: 0;
  padding: 6px 22px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 11px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 30px;
  background: rgba(6, 43, 39, 0.9);
}

.score-label {
  font-size: 0.77rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#score-value {
  color: var(--mango);
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 1.55rem;
}

.hit-feedback {
  position: absolute;
  z-index: 12;
  top: 50%;
  left: 50%;
  color: var(--mango);
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: clamp(2.6rem, 7vw, 6rem);
  font-weight: 950;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -45%) scale(0.7);
  text-shadow: 0 4px 0 var(--field-deep);
}

.hit-feedback.is-visible {
  animation: score-burst 520ms ease-out both;
}

.game-area.is-miss {
  animation: arena-miss 230ms ease-out;
}

.pause-panel {
  position: absolute;
  z-index: 20;
  top: 50%;
  left: 50%;
  width: min(430px, calc(100% - 32px));
  padding: 32px;
  color: var(--ink);
  background: var(--paper-warm);
  border-top: 8px solid var(--mango);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.38);
  transform: translate(-50%, -50%);
}

.pause-panel h2 {
  margin: 7px 0 8px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 2.65rem;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.pause-panel > p:not(.console-kicker, .pause-score) {
  margin: 0;
  color: var(--ink-soft);
}

.pause-score {
  margin: 24px 0;
  padding: 13px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.pause-score strong {
  color: var(--field);
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 1.5rem;
}

.pause-actions {
  display: grid;
  gap: 10px;
}

.secondary-action {
  color: var(--ink);
  border: 1px solid var(--ink);
  background: transparent;
}

.secondary-action:hover {
  color: white;
  background: var(--ink);
}

.text-action {
  min-height: 44px;
  color: var(--ink-soft);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.text-action:hover {
  color: var(--ink);
}

.is-hidden {
  display: none !important;
}

body.is-playing {
  overflow: hidden;
}

body.is-playing .app-shell {
  visibility: hidden;
}

body.is-playing #fa-help-btn,
body.is-playing .fa-help-footer,
body.is-playing #funapp-favorite-btn,
body.is-playing .funapp-back-link {
  visibility: hidden !important;
  pointer-events: none !important;
}

.settings-dialog {
  width: min(490px, calc(100% - 28px));
  max-height: min(620px, calc(100dvh - 28px));
  padding: 0;
  color: var(--ink);
  border: 0;
  border-top: 7px solid var(--field);
  background: var(--paper-warm);
  box-shadow: 0 24px 54px rgba(6, 43, 39, 0.34);
}

.version-stamp {
  position: fixed;
  right: 10px;
  bottom: 7px;
  color: var(--ink-soft);
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 0.68rem;
  opacity: 1;
  pointer-events: none;
}

.pause-panel .console-kicker,
.settings-dialog .console-kicker {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.settings-dialog::backdrop {
  background: rgba(6, 43, 39, 0.7);
}

.dialog-header,
.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.dialog-header {
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin: 5px 0 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 1.75rem;
  letter-spacing: -0.04em;
}

.dialog-close {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  background: white;
  cursor: pointer;
  font-size: 1.55rem;
}

.dialog-close:hover {
  border-color: var(--ink);
}

.dialog-body {
  padding: 24px 26px;
}

.dialog-copy {
  margin: 0 0 20px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.dialog-field {
  display: grid;
  gap: 8px;
  font-weight: 750;
}

.dialog-field select {
  min-height: 50px;
  width: 100%;
  padding: 0 42px 0 13px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0;
  background: white;
  cursor: pointer;
  font-size: 1rem;
}

.dialog-footer {
  padding: 17px 26px;
  border-top: 1px solid var(--line);
}

.dialog-version {
  width: 100%;
  margin: 0;
  display: flex;
  justify-content: space-between;
  color: var(--ink-soft);
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 0.78rem;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@keyframes demo-hunt {
  0%,
  12% {
    left: 23%;
    top: 62%;
  }
  29%,
  42% {
    left: 67%;
    top: 26%;
  }
  58%,
  67% {
    left: 79%;
    top: 69%;
  }
  84%,
  100% {
    left: 39%;
    top: 43%;
  }
}

@keyframes paw-pounce {
  0%,
  62%,
  100% {
    transform: translate(0, 0) rotate(-24deg);
  }
  73% {
    transform: translate(-38%, -23%) rotate(-35deg) scale(1.05);
  }
  80% {
    transform: translate(-30%, -17%) rotate(-31deg);
  }
}

@keyframes prey-pulse {
  0% {
    opacity: 0.8;
    transform: scale(0.7);
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

@keyframes caught-pop {
  0% {
    transform: translate(-50%, -50%) rotate(var(--rotation)) scale(1);
  }
  45% {
    transform: translate(-50%, -50%) rotate(var(--rotation)) scale(1.48);
    filter: brightness(1.5);
  }
  100% {
    transform: translate(-50%, -50%) rotate(var(--rotation)) scale(0.15);
    opacity: 0.2;
  }
}

@keyframes score-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -35%) scale(0.58) rotate(-5deg);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -52%) scale(1.08) rotate(2deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -115%) scale(0.9);
  }
}

@keyframes arena-miss {
  0%,
  100% {
    box-shadow: inset 0 0 0 0 rgba(247, 201, 72, 0);
  }
  50% {
    box-shadow: inset 0 0 0 10px rgba(247, 201, 72, 0.23);
  }
}

@media (max-width: 1060px) {
  .setup-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(330px, 0.9fr);
    gap: 34px;
  }

  .arena-column {
    grid-template-columns: 1fr;
  }

  .arena-frame,
  .arena-caption,
  .safety-strip {
    grid-column: auto;
  }

  .arena-frame {
    min-height: 270px;
  }

  .safety-strip {
    max-width: 550px;
  }
}

@media (max-width: 780px) {
  .app-shell {
    padding:
      max(10px, env(safe-area-inset-top))
      max(15px, env(safe-area-inset-right))
      max(28px, env(safe-area-inset-bottom))
      max(15px, env(safe-area-inset-left));
  }

  .topbar {
    grid-template-columns: 48px 1fr auto;
    gap: 9px;
  }

  .home-link {
    min-width: 44px;
  }

  .home-link > span:last-child,
  .session-state,
  .settings-button > span:last-child {
    display: none;
  }

  .home-arrow {
    width: 44px;
    height: 44px;
  }

  .brand-lockup {
    justify-self: start;
  }

  .brand-mark {
    width: 31px;
    transform: scale(0.88);
  }

  .settings-button {
    width: 44px;
    justify-content: center;
    padding: 0;
  }

  .setup-layout {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 26px;
    padding: 24px 0 0;
  }

  .arena-column {
    grid-row: 2;
    gap: 17px;
  }

  .arena-frame {
    min-height: 0;
    aspect-ratio: 1.52 / 1;
  }

  .arena-caption h2 {
    max-width: 420px;
    font-size: 3rem;
  }

  .safety-strip {
    padding-left: 13px;
  }

  .owner-console {
    grid-row: 1;
    padding: 25px 19px 27px;
  }

  .mode-group {
    grid-template-columns: 1fr;
  }

  .mode-button {
    min-height: 72px;
    grid-template-columns: 36px 1fr;
    grid-template-rows: auto;
    align-items: center;
  }

  .choice-description {
    font-size: 0.76rem;
  }

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

  .sound-choice {
    min-height: 52px;
    grid-template-columns: auto 1fr;
    justify-content: start;
    padding: 8px 12px;
    text-align: left;
  }

  .hint-row {
    display: none;
  }

  .operator-hints {
    margin-bottom: 0;
  }

  .prey {
    width: 76px;
    height: 76px;
  }

  .prey[data-mode="bug"] {
    width: 86px;
    height: 64px;
  }

  .prey[data-mode="crawl"] {
    width: 94px;
    height: 60px;
  }

  .play-hud {
    width: calc(100% - 24px);
    justify-content: space-between;
  }

  .score-readout {
    min-width: 128px;
  }
}

@media (max-width: 420px) {
  .brand-copy h1 {
    font-size: 1.05rem;
  }

  .arena-frame {
    aspect-ratio: 1.42 / 1;
  }

  .arena-caption p:last-child {
    font-size: 0.94rem;
  }

  .console-intro h2 {
    font-size: 2rem;
  }

  .mode-group {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mode-button {
    min-height: 88px;
    grid-template-columns: 1fr;
    grid-template-rows: 28px auto;
    justify-items: center;
    gap: 7px;
    padding: 10px 6px;
    text-align: center;
  }

  .choice-description {
    display: none;
  }

  .pause-panel {
    padding: 26px 21px;
  }
}

@media (min-width: 700px) and (max-height: 620px) and (orientation: landscape) {
  .app-shell {
    min-height: 100dvh;
    padding:
      max(8px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }

  .topbar {
    min-height: 46px;
    grid-template-columns: 48px 1fr auto;
  }

  .home-link {
    min-width: 44px;
  }

  .home-link > span:last-child,
  .session-state,
  .settings-button > span:last-child {
    display: none;
  }

  .home-arrow,
  .settings-button {
    width: 44px;
    height: 44px;
    min-height: 44px;
    justify-content: center;
    padding: 0;
  }

  .brand-lockup {
    justify-self: start;
  }

  .brand-mark {
    transform: scale(0.8);
  }

  .setup-layout {
    height: calc(100dvh - 76px);
    min-height: calc(100dvh - 76px);
    grid-template-columns: minmax(0, 1.15fr) minmax(330px, 0.85fr);
    gap: 22px;
    align-items: center;
    padding: 6px 0 0;
  }

  .arena-column {
    grid-template-columns: minmax(0, 1fr) minmax(170px, 0.55fr);
    gap: 10px 18px;
  }

  .arena-frame {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
    aspect-ratio: 1.55 / 1;
    min-height: 0;
  }

  .arena-caption {
    align-self: end;
  }

  .arena-caption h2 {
    margin: 2px 0 7px;
    font-size: 2.35rem;
  }

  .arena-caption p:last-child {
    font-size: 0.78rem;
    line-height: 1.35;
  }

  .safety-strip {
    padding: 8px 10px;
  }

  .safety-copy {
    font-size: 0.7rem;
    line-height: 1.28;
  }

  .safety-icon {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
  }

  .owner-console {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    max-height: calc(100dvh - 86px);
    overflow: hidden;
    padding: 16px 18px 20px;
    border-top-width: 5px;
  }

  .console-controls {
    min-height: 0;
    display: block;
    overflow: auto;
    padding-right: 4px;
  }

  .console-intro h2 {
    margin: 2px 0 4px;
    font-size: 1.55rem;
  }

  .console-intro p:last-child,
  .choice-description,
  .sound-switch-copy small,
  .operator-hints,
  .hint-row {
    display: none;
  }

  .control-group {
    margin-top: 13px;
  }

  .control-group legend {
    margin-bottom: 5px;
  }

  .mode-button {
    min-height: 58px;
    padding: 8px;
  }

  .sound-switch {
    min-height: 44px;
    padding: 3px 0 6px;
  }

  .sound-choice {
    min-height: 44px;
  }

  .start-zone {
    margin-top: 10px;
    padding-top: 13px;
    background: white;
  }

  .primary-action {
    min-height: 45px;
  }

  .play-hud {
    top: max(7px, env(safe-area-inset-top));
  }

  .hud-button {
    width: 44px;
    height: 44px;
  }

  .score-readout {
    height: 46px;
  }

  .pause-panel {
    width: min(560px, calc(100% - 24px));
    padding: 18px 22px;
  }

  .pause-panel h2 {
    font-size: 1.75rem;
  }

  .pause-score {
    margin: 13px 0;
    padding: 8px 0;
  }

  .pause-actions {
    grid-template-columns: 1.15fr 1fr 1fr;
    gap: 8px;
  }

  .pause-actions .primary-action,
  .pause-actions .secondary-action,
  .pause-actions .text-action {
    min-height: 44px;
    justify-content: center;
    padding: 0 12px;
    font-size: 0.83rem;
  }
}

@media (pointer: coarse) {
  button,
  .home-link,
  .sound-switch,
  .dialog-field select {
    min-height: 48px;
  }

  .hud-button {
    width: 52px;
    height: 52px;
  }
}

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

  .demo-prey {
    left: 56%;
    top: 45%;
  }

  .demo-paw {
    transform: rotate(-24deg);
  }

  .hit-feedback.is-visible {
    animation: none !important;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}
