:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  --ink: #efffff;
  --muted: rgba(225, 249, 250, 0.72);
  --glass: rgba(5, 38, 49, 0.42);
  --glass-strong: rgba(5, 34, 45, 0.76);
  --line: rgba(210, 248, 248, 0.2);
  --accent: #b9f3ee;
  --accent-strong: #72d9d2;
  --safe-top: max(1.25rem, env(safe-area-inset-top));
  --safe-right: max(1.25rem, env(safe-area-inset-right));
  --safe-bottom: max(1.25rem, env(safe-area-inset-bottom));
  --safe-left: max(1.25rem, env(safe-area-inset-left));
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #073d4d;
}

button,
select,
input {
  font: inherit;
}

button,
select {
  color: inherit;
}

.site-return:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid #d7fffa;
  outline-offset: 3px;
}

.aquarium {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  min-height: 31.25rem;
  overflow: hidden;
  color: var(--ink);
  background-color: #0b5a67;
  background-image: image-set(
    url("./assets/environment.webp") 1x,
    url("./assets/environment.webp") 2x
  );
  background-position: center;
  background-size: cover;
}

#fish-canvas,
.water-shimmer,
.vignette {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#fish-canvas {
  z-index: 2;
}

.water-shimmer {
  z-index: 3;
  pointer-events: none;
  opacity: 0.32;
  mix-blend-mode: screen;
  background:
    radial-gradient(ellipse at 52% -20%, rgba(218, 255, 248, 0.42), transparent 52%),
    linear-gradient(100deg, transparent 30%, rgba(183, 250, 244, 0.07) 48%, transparent 66%);
  animation: shimmer 12s ease-in-out infinite alternate;
}

.vignette {
  z-index: 4;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(2, 26, 37, 0.18) 0%, transparent 25%, transparent 68%, rgba(3, 25, 29, 0.24) 100%),
    radial-gradient(ellipse at center, transparent 48%, rgba(2, 24, 31, 0.27) 105%);
}

.hud {
  position: absolute;
  z-index: 10;
  top: var(--safe-top);
  text-shadow: 0 2px 16px rgba(0, 26, 38, 0.44);
}

.hud--progress {
  left: var(--safe-left);
  width: min(18.5rem, calc(100vw - 8rem));
}

.quiet-time,
.session-count,
.next-growth {
  margin: 0;
}

.quiet-time {
  font-size: clamp(1.65rem, 2.3vw, 2.2rem);
  font-weight: 350;
  letter-spacing: 0.025em;
}

.session-count {
  margin-top: 0.35rem;
  color: rgba(241, 255, 255, 0.9);
  font-size: 0.95rem;
  white-space: nowrap;
}

.session-count strong {
  font-weight: 650;
}

.progress-track {
  width: 100%;
  height: 0.28rem;
  margin-top: 0.72rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(223, 251, 250, 0.2);
  box-shadow: inset 0 1px 2px rgba(0, 36, 45, 0.24);
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(173, 240, 237, 0.72), #d4fff9);
  box-shadow: 0 0 12px rgba(186, 255, 246, 0.55);
  transition: width 400ms ease;
}

.next-growth {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.challenge-hud {
  min-height: 1.75rem;
  margin-top: 0.35rem;
  color: rgba(225, 249, 250, 0.68);
  font-size: 0.74rem;
}

.challenge-entry {
  display: inline-flex;
  max-width: 100%;
  height: 1.75rem;
  align-items: center;
  gap: 0.38rem;
  padding: 0 0.65rem;
  border: 1px solid rgba(210, 248, 248, 0.2);
  border-radius: 999px;
  color: rgba(238, 253, 253, 0.8);
  background: rgba(5, 38, 49, 0.34);
  box-shadow: 0 0.45rem 1.4rem rgba(0, 26, 36, 0.08);
  backdrop-filter: blur(0.65rem) saturate(108%);
  -webkit-backdrop-filter: blur(0.65rem) saturate(108%);
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1;
  white-space: nowrap;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.challenge-entry svg {
  width: 0.88rem;
  height: 0.88rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.challenge-entry:hover,
.challenge-entry:focus-visible {
  border-color: rgba(220, 253, 250, 0.32);
  color: rgba(248, 255, 255, 0.94);
  background: rgba(10, 57, 67, 0.48);
  transform: translateY(-1px);
}

.challenge-status button {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(223, 249, 249, 0.2);
  text-underline-offset: 0.18rem;
}

.challenge-status button:hover {
  color: rgba(244, 255, 255, 0.94);
}

.challenge-status {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  white-space: nowrap;
}

.challenge-status button {
  color: rgba(225, 249, 250, 0.55);
  font-size: 0.68rem;
}

.hud--controls {
  right: var(--safe-right);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.site-return {
  position: absolute;
  z-index: 10;
  left: var(--safe-left);
  bottom: var(--safe-bottom);
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  padding: 0 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: rgba(241, 255, 255, 0.86);
  background: var(--glass);
  box-shadow: 0 0.75rem 2.5rem rgba(0, 26, 36, 0.12);
  font-size: 0.75rem;
  text-decoration: none;
  white-space: nowrap;
  backdrop-filter: blur(0.9rem) saturate(115%);
  -webkit-backdrop-filter: blur(0.9rem) saturate(115%);
  transition: background 180ms ease, transform 180ms ease;
}

.site-return:hover {
  background: rgba(13, 66, 76, 0.62);
  transform: translateY(-1px);
}

.state-pill,
.icon-button {
  border: 1px solid var(--line);
  background: var(--glass);
  box-shadow: 0 0.75rem 2.5rem rgba(0, 26, 36, 0.12);
  backdrop-filter: blur(0.9rem) saturate(115%);
  -webkit-backdrop-filter: blur(0.9rem) saturate(115%);
}

.state-pill {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.9rem;
  border-radius: 999px;
  color: rgba(244, 255, 255, 0.92);
  font-size: 0.88rem;
}

.state-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: rgba(231, 253, 253, 0.66);
  box-shadow: 0 0 0 0.25rem rgba(225, 252, 252, 0.08);
  transition: background 300ms ease, box-shadow 300ms ease;
}

.aquarium[data-sound-state="calm"] .state-dot {
  background: #9ff1df;
  box-shadow: 0 0 0 0.25rem rgba(159, 241, 223, 0.13), 0 0 1rem rgba(159, 241, 223, 0.5);
}

.aquarium[data-sound-state="normal"] .state-dot,
.aquarium[data-sound-state="brief"] .state-dot {
  background: #f0d39a;
}

.aquarium[data-sound-state="sustained"] .state-dot {
  background: #f3ad8d;
}

.icon-button {
  display: inline-grid;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease, opacity 180ms ease;
}

.icon-button:hover:not(:disabled) {
  background: rgba(13, 66, 76, 0.62);
  transform: translateY(-1px);
}

.icon-button:disabled {
  cursor: default;
  opacity: 0.46;
}

.icon-button svg,
.start-button svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-play {
  display: none;
  fill: none;
}

.icon-fullscreen-exit {
  display: none;
}

.aquarium[data-fullscreen="true"] .icon-fullscreen-enter {
  display: none;
}

.aquarium[data-fullscreen="true"] .icon-fullscreen-exit {
  display: block;
}

.aquarium[data-paused="true"] .icon-pause {
  display: none;
}

.aquarium[data-paused="true"] .icon-play {
  display: block;
}

.welcome-panel {
  position: absolute;
  z-index: 9;
  left: 50%;
  bottom: max(3.2rem, calc(var(--safe-bottom) + 1rem));
  width: min(33rem, calc(100vw - 2.5rem));
  padding: 1.4rem 1.5rem 1.25rem;
  border: 1px solid rgba(223, 255, 254, 0.24);
  border-radius: 1.35rem;
  background: linear-gradient(145deg, rgba(5, 39, 49, 0.63), rgba(7, 56, 65, 0.44));
  box-shadow: 0 1.5rem 5rem rgba(2, 23, 31, 0.24);
  backdrop-filter: blur(1rem) saturate(116%);
  -webkit-backdrop-filter: blur(1rem) saturate(116%);
  text-align: center;
  transform: translateX(-50%);
  transition: opacity 400ms ease, transform 400ms ease;
}

.welcome-panel.is-leaving {
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 1rem);
}

.eyebrow {
  margin: 0;
  color: rgba(197, 243, 240, 0.62);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.welcome-panel h1 {
  margin: 0.45rem 0 0.65rem;
  font-size: clamp(1.35rem, 2.4vw, 1.8rem);
  font-weight: 520;
  line-height: 1.35;
}

.welcome-panel > p:not(.eyebrow, .permission-note) {
  max-width: 28rem;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.65;
}

.start-button {
  display: inline-flex;
  min-height: 3rem;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin-top: 1.1rem;
  padding: 0 1.25rem;
  border: 1px solid rgba(226, 255, 251, 0.68);
  border-radius: 999px;
  color: #083c46;
  background: rgba(224, 255, 250, 0.93);
  box-shadow: 0 0.65rem 2rem rgba(92, 198, 190, 0.18);
  cursor: pointer;
  font-weight: 650;
  transition: transform 180ms ease, background 180ms ease;
}

.start-button:hover {
  background: #effffc;
  transform: translateY(-1px);
}

.reset-aquarium-button {
  display: block;
  margin: 0.75rem auto 0;
  padding: 0.25rem 0.45rem;
  border: 0;
  color: rgba(223, 249, 249, 0.62);
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  text-decoration: underline;
  text-decoration-color: rgba(223, 249, 249, 0.22);
  text-underline-offset: 0.2rem;
}

.reset-aquarium-button:hover {
  color: rgba(240, 255, 255, 0.88);
}

.permission-note {
  margin: 0.55rem 0 0;
  color: rgba(223, 249, 249, 0.52);
  font-size: 0.72rem;
}

.returning-challenge {
  display: grid;
  gap: 0.15rem;
  margin-top: 0.75rem !important;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(223, 255, 254, 0.14);
  font-size: 0.78rem !important;
}

.returning-challenge strong {
  color: rgba(241, 255, 255, 0.9);
  font-weight: 560;
}

.calibration-panel {
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: max(3.5rem, calc(var(--safe-bottom) + 1rem));
  display: flex;
  width: min(25rem, calc(100vw - 2.5rem));
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: var(--glass-strong);
  box-shadow: 0 1rem 4rem rgba(2, 27, 34, 0.28);
  backdrop-filter: blur(1rem);
  -webkit-backdrop-filter: blur(1rem);
  transform: translateX(-50%);
}

.calibration-ring {
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  border: 2px solid rgba(194, 244, 241, 0.22);
  border-top-color: #c4f9f4;
  border-radius: 50%;
  animation: spin 1.1s linear infinite;
}

.calibration-title,
.calibration-note {
  margin: 0;
}

.calibration-title {
  font-weight: 600;
}

.calibration-note {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.reward-toast {
  position: absolute;
  z-index: 14;
  left: 50%;
  top: 20%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border: 1px solid rgba(230, 255, 249, 0.36);
  border-radius: 999px;
  color: #f4fffb;
  background: rgba(13, 75, 76, 0.77);
  box-shadow: 0 1rem 4rem rgba(2, 30, 35, 0.28), 0 0 2rem rgba(150, 240, 220, 0.1);
  backdrop-filter: blur(0.8rem);
  -webkit-backdrop-filter: blur(0.8rem);
  transform: translate(-50%, -0.5rem);
  animation: reward-in 3.7s ease both;
}

.reward-toast span:last-child {
  display: grid;
  text-align: left;
}

.reward-toast small {
  margin-top: 0.08rem;
  color: rgba(231, 255, 250, 0.7);
  font-size: 0.72rem;
}

.reward-spark {
  color: #caffed;
  font-size: 1.3rem;
}

.settings-dialog {
  width: min(29rem, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid rgba(210, 249, 247, 0.22);
  border-radius: 1.35rem;
  color: var(--ink);
  background: rgba(4, 36, 47, 0.94);
  box-shadow: 0 2rem 6rem rgba(0, 17, 24, 0.5);
  backdrop-filter: blur(1.2rem);
  -webkit-backdrop-filter: blur(1.2rem);
}

.challenge-dialog {
  width: min(31rem, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid rgba(210, 249, 247, 0.22);
  border-radius: 1.35rem;
  color: var(--ink);
  background: rgba(4, 36, 47, 0.96);
  box-shadow: 0 2rem 6rem rgba(0, 17, 24, 0.5);
  backdrop-filter: blur(1.2rem);
  -webkit-backdrop-filter: blur(1.2rem);
}

.challenge-dialog::backdrop {
  background: rgba(0, 22, 31, 0.48);
  backdrop-filter: blur(0.2rem);
}

.challenge-dialog form {
  padding: 1.3rem;
}

.challenge-dialog header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(210, 249, 247, 0.13);
}

.challenge-dialog h2 {
  margin: 0.25rem 0 0;
  font-size: 1.35rem;
  font-weight: 560;
}

.challenge-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 1rem 0 0;
  padding: 0;
  border: 0;
}

.challenge-options label {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem;
  border: 1px solid rgba(210, 249, 247, 0.15);
  border-radius: 0.9rem;
  background: rgba(219, 249, 248, 0.045);
  cursor: pointer;
}

.challenge-options label:has(input:checked) {
  border-color: rgba(185, 243, 238, 0.48);
  background: rgba(114, 217, 210, 0.12);
}

.challenge-options input {
  flex: 0 0 auto;
  accent-color: var(--accent-strong);
}

.challenge-options span {
  display: grid;
  min-width: 0;
  gap: 0.12rem;
}

.challenge-options strong {
  font-size: 0.84rem;
  font-weight: 590;
  white-space: nowrap;
}

.challenge-options small {
  color: var(--muted);
  font-size: 0.7rem;
  white-space: nowrap;
}

.challenge-note {
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.challenge-fullscreen {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.8rem;
  color: rgba(241, 255, 255, 0.86);
  font-size: 0.8rem;
}

.challenge-fullscreen input {
  accent-color: var(--accent-strong);
}

.challenge-actions {
  display: flex;
  justify-content: flex-end;
}

.challenge-start {
  min-height: 2.65rem;
  margin-top: 1rem;
  font-size: 0.84rem;
}

.settings-dialog::backdrop {
  background: rgba(0, 22, 31, 0.44);
  backdrop-filter: blur(0.15rem);
}

.catalog-dialog {
  width: min(52rem, calc(100vw - 2rem));
  max-height: min(42rem, calc(100vh - 2rem));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(210, 249, 247, 0.22);
  border-radius: 1.35rem;
  color: var(--ink);
  background: rgba(4, 36, 47, 0.94);
  box-shadow: 0 2rem 6rem rgba(0, 17, 24, 0.5);
  backdrop-filter: blur(1.2rem);
  -webkit-backdrop-filter: blur(1.2rem);
}

.catalog-dialog::backdrop {
  background: rgba(0, 22, 31, 0.48);
  backdrop-filter: blur(0.2rem);
}

.confirm-dialog {
  width: min(27rem, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid rgba(210, 249, 247, 0.22);
  border-radius: 1.25rem;
  color: var(--ink);
  background: rgba(4, 36, 47, 0.96);
  box-shadow: 0 2rem 6rem rgba(0, 17, 24, 0.5);
  backdrop-filter: blur(1.2rem);
  -webkit-backdrop-filter: blur(1.2rem);
}

.confirm-dialog::backdrop {
  background: rgba(0, 22, 31, 0.52);
  backdrop-filter: blur(0.2rem);
}

.confirm-dialog form {
  padding: 1.35rem;
}

.confirm-dialog h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 580;
}

.confirm-dialog p {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.65;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.confirm-button {
  min-height: 2.55rem;
  padding: 0 0.9rem;
  border: 1px solid rgba(213, 250, 248, 0.18);
  border-radius: 0.75rem;
  cursor: pointer;
  font-size: 0.82rem;
}

.confirm-button--secondary {
  background: rgba(225, 251, 251, 0.06);
}

.confirm-button--danger {
  border-color: rgba(255, 196, 178, 0.3);
  color: #fff5ef;
  background: rgba(164, 76, 56, 0.54);
}

.confirm-button:hover {
  filter: brightness(1.12);
}

.catalog-shell {
  max-height: min(42rem, calc(100vh - 2rem));
  padding: 1.3rem;
  overflow: auto;
}

.catalog-dialog header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(210, 249, 247, 0.13);
}

.catalog-dialog h2 {
  margin: 0.25rem 0 0;
  font-size: 1.45rem;
  font-weight: 560;
}

.catalog-count {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.catalog-tabs {
  display: flex;
  gap: 1.2rem;
  margin-top: 0.85rem;
  border-bottom: 1px solid rgba(210, 249, 247, 0.11);
}

.catalog-tabs button {
  padding: 0.45rem 0.1rem 0.6rem;
  border: 0;
  border-bottom: 2px solid transparent;
  color: rgba(225, 249, 250, 0.58);
  background: transparent;
  cursor: pointer;
  font-size: 0.82rem;
}

.catalog-tabs button[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--ink);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.catalog-card {
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid rgba(210, 249, 247, 0.13);
  border-radius: 1rem;
  background: rgba(219, 249, 248, 0.055);
}

.catalog-image {
  display: grid;
  height: 7rem;
  place-items: center;
  overflow: hidden;
  border-radius: 0.75rem;
  background: linear-gradient(160deg, rgba(146, 225, 218, 0.08), rgba(3, 28, 38, 0.18));
}

.catalog-image img {
  width: 88%;
  height: 88%;
  object-fit: contain;
}

.catalog-card.is-undiscovered .catalog-image img {
  opacity: 0.3;
  filter: brightness(0) blur(0.08rem);
}

.catalog-card h3 {
  margin: 0.7rem 0 0;
  overflow: hidden;
  font-size: 0.9rem;
  font-weight: 580;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-owned {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.events-list {
  display: grid;
  margin-top: 0.35rem;
}

.event-item {
  display: grid;
  grid-template-columns: 5.4rem minmax(0, 1fr);
  gap: 0.8rem;
  padding: 0.9rem 0.15rem;
  border-bottom: 1px solid rgba(210, 249, 247, 0.1);
}

.event-item time {
  color: rgba(197, 243, 240, 0.55);
  font-size: 0.72rem;
}

.event-item p {
  margin: 0;
  color: rgba(241, 255, 255, 0.88);
  font-size: 0.82rem;
  line-height: 1.5;
}

.events-empty {
  margin: 3rem 0;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.aquarium[data-overlay-open="true"] .water-shimmer {
  animation-play-state: paused;
}

.settings-dialog form {
  padding: 1.3rem;
}

.settings-dialog header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(210, 249, 247, 0.13);
}

.settings-dialog h2 {
  margin: 0.25rem 0 0;
  font-size: 1.35rem;
  font-weight: 560;
}

.icon-button--dialog {
  width: 2.4rem;
  height: 2.4rem;
  flex: 0 0 auto;
  background: rgba(225, 251, 251, 0.06);
}

.setting-row {
  display: flex;
  min-height: 5rem;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  border-bottom: 1px solid rgba(210, 249, 247, 0.11);
}

.setting-row span {
  display: grid;
  gap: 0.22rem;
}

.setting-row strong {
  font-size: 0.94rem;
  font-weight: 570;
}

.setting-row small,
.privacy-copy {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

.setting-row select {
  min-height: 2.4rem;
  padding: 0 2.3rem 0 0.75rem;
  border: 1px solid rgba(213, 250, 248, 0.22);
  border-radius: 0.7rem;
  background: #0c4c58;
}

.setting-row input[role="switch"] {
  width: 2.7rem;
  height: 1.5rem;
  flex: 0 0 auto;
  appearance: none;
  border: 1px solid rgba(213, 250, 248, 0.22);
  border-radius: 999px;
  background: rgba(219, 249, 248, 0.11);
  cursor: pointer;
  transition: background 180ms ease;
}

.setting-row input[role="switch"]::before {
  display: block;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0.17rem;
  border-radius: 50%;
  background: rgba(238, 255, 253, 0.8);
  content: "";
  transition: transform 180ms ease;
}

.setting-row input[role="switch"]:checked {
  background: rgba(116, 216, 204, 0.56);
}

.setting-row input[role="switch"]:checked::before {
  transform: translateX(1.18rem);
}

.privacy-copy {
  margin: 1rem 0 0;
}

.fallback-message {
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: max(1rem, var(--safe-bottom));
  max-width: calc(100vw - 2rem);
  margin: 0;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: rgba(240, 255, 255, 0.82);
  background: rgba(5, 38, 49, 0.66);
  font-size: 0.78rem;
  backdrop-filter: blur(0.7rem);
  transform: translateX(-50%);
}

[hidden] {
  display: none !important;
}

@keyframes shimmer {
  from { transform: translateX(-2%) scale(1.03); }
  to { transform: translateX(2%) scale(1.06); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes reward-in {
  0% { opacity: 0; transform: translate(-50%, 0.7rem) scale(0.96); }
  14%, 76% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -0.7rem) scale(0.98); }
}

@media (max-width: 42rem) {
  :root {
    --safe-top: max(0.85rem, env(safe-area-inset-top));
    --safe-right: max(0.85rem, env(safe-area-inset-right));
    --safe-left: max(0.85rem, env(safe-area-inset-left));
  }

  .aquarium {
    background-image: url("./assets/environment-960.webp");
  }

  .hud--progress {
    width: min(13.5rem, calc(100vw - 8rem));
  }

  .quiet-time {
    font-size: 1.45rem;
  }

  .session-count {
    font-size: 0.82rem;
  }

  .next-growth {
    font-size: 0.7rem;
  }

  .challenge-hud {
    font-size: 0.68rem;
  }

  .challenge-status {
    gap: 0.45rem;
  }

  .state-pill {
    min-width: 2.75rem;
    padding: 0 0.75rem;
  }

  .hud--controls {
    top: 4.25rem;
    gap: 0.35rem;
  }

  .site-return {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
  }

  .site-return:hover {
    transform: translateY(calc(-50% - 1px));
  }

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

  .catalog-image {
    height: 6rem;
  }

  .challenge-options {
    grid-template-columns: 1fr;
  }

  .challenge-options label {
    padding: 0.62rem 0.75rem;
  }

  .welcome-panel {
    bottom: max(1rem, var(--safe-bottom));
    padding: 1.2rem 1rem 1rem;
  }

  .aquarium[data-sound-state="demo"] .welcome-panel {
    bottom: max(4.75rem, calc(var(--safe-bottom) + 4rem));
  }

  .welcome-panel h1 {
    font-size: 1.25rem;
  }

  .welcome-panel > p:not(.eyebrow, .permission-note) {
    font-size: 0.84rem;
  }

  .confirm-actions {
    align-items: stretch;
  }

  .reward-toast {
    top: 25%;
  }
}

@media (max-width: 25rem) {
  #sound-state-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .state-pill {
    justify-content: center;
  }

  .catalog-shell {
    padding: 1rem;
  }

  .event-item {
    grid-template-columns: 4.6rem minmax(0, 1fr);
    gap: 0.55rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .water-shimmer,
  .calibration-ring {
    animation: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
