:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  color: #f4f5e7;
  background: #142019;
  --surface: #18251e;
  --pale: #dce5a1;
  --dim: #c1ccba;
  --stroke: #687869;
  --glass: rgba(18, 29, 23, .94);
  --safe-left: max(18px, env(safe-area-inset-left));
  --safe-right: max(18px, env(safe-area-inset-right));
  --safe-top: max(16px, env(safe-area-inset-top));
  --safe-bottom: max(18px, env(safe-area-inset-bottom));
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
main { position: relative; min-height: 100svh; isolation: isolate; }
button, select, input { font: inherit; }
button { cursor: pointer; }
button, .species label, .stick, #water { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: wait; opacity: .56; }
button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid #f2f6c6;
  outline-offset: 3px;
}
[hidden] { display: none !important; }
#water, .vignette { position: fixed; inset: 0; width: 100%; height: 100%; }
#water { display: block; z-index: -2; touch-action: none; cursor: grab; }
#water.dragging { cursor: grabbing; }
#water:focus-visible { outline: 2px solid #e2edaa; outline-offset: -3px; }
.vignette {
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, #080f0bbb, transparent 21%, transparent 72%, #080f0b8c),
    radial-gradient(ellipse at center, transparent 47%, #09150d65);
}
.masthead {
  position: absolute;
  top: var(--safe-top);
  left: var(--safe-left);
  display: flex;
  align-items: center;
  gap: 10px;
  text-shadow: 0 1px 5px #101912;
  pointer-events: none;
}
.brand-mark { width: 40px; height: 40px; padding: 4px; border-radius: 50%; background: #15271de8; color: var(--pale); border: 1px solid #71876a; }
.brand-mark svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { font-size: .65rem; font-weight: 700; letter-spacing: .17em; text-transform: uppercase; }
.brand-name { display: block; font-size: 1rem; font-weight: 580; margin-top: 1px; }
.masthead .eyebrow { color: #e4eccf; display: block; }
.entrance {
  position: absolute;
  bottom: var(--safe-bottom);
  left: var(--safe-left);
  width: min(395px, calc(100% - var(--safe-left) - var(--safe-right)));
  background: var(--glass);
  border: 1px solid #687868;
  box-shadow: 0 18px 65px #09110c72;
  border-radius: 19px;
  padding: 25px 27px 19px;
}
.tag { margin: 0; color: var(--pale); display: flex; align-items: center; gap: 7px; }
.tag span, .status-dot { width: 7px; height: 7px; border-radius: 50%; background: #c4db82; flex: none; }
h1 { margin: 6px 0 4px; font: 400 clamp(2.5rem, 5vw, 4.1rem)/1.04 Georgia, serif; letter-spacing: -.055em; }
.description { margin: 0 0 20px; color: #d6dfce; font-size: .95rem; line-height: 1.5; max-width: 28ch; }
fieldset { margin: 0 0 13px; padding: 0; border: 0; min-width: 0; }
legend { margin: 0 0 7px; padding: 0; color: var(--dim); font-size: .78rem; }
.species { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.species label {
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 47px;
  background: #223328;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  cursor: pointer;
  padding: 4px;
  font-size: .85rem;
  text-align: center;
  line-height: 1.1;
}
.species label:has(input:checked) { border-color: #c8d88b; background: #3b482c; }
.species label:has(input:focus-visible) { outline: 2px solid #f2f6c6; outline-offset: 2px; }
.species input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.species svg { flex: none; width: 31px; height: 20px; fill: #1b211b; }
.guppy .body { fill: #e5c78b; } .guppy .tail { fill: #ee916a; } .guppy .fin { fill: #baa575; }
.tetra .body { fill: #acb3b0; } .tetra .tail { fill: #ef7369; } .tetra .fin { fill: #879e9a; } .tetra .stripe { fill: none; stroke: #61d2ef; stroke-width: 1.9; }
.join {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; min-height: 48px; padding: 8px 14px;
  background: var(--pale); border: 0; border-radius: 10px; color: #202a18;
  font-weight: 680; font-size: .92rem;
}
.join:not(:disabled):hover { background: #eef2b7; }
.entry-note { margin: 10px 0 0; font-size: .74rem; color: var(--dim); min-height: 1lh; }
.hud-top { position: absolute; top: var(--safe-top); right: var(--safe-right); display: flex; gap: 8px; align-items: center; }
.quiet, .presence {
  border: 1px solid #6c806d; color: #f4f5e7; background: var(--glass); border-radius: 9px;
  padding: 7px 11px; min-height: 42px; font-size: .82rem;
}
.quiet:hover { background: #344735; }
.presence { display: flex; align-items: center; gap: 7px; margin: 0; }
.presence:not(.online) .status-dot { background: #deba80; }
.desktop-hint {
  position: absolute; display: flex; flex-wrap: wrap; gap: 7px 13px; align-items: center;
  left: var(--safe-left); bottom: var(--safe-bottom); right: var(--safe-right); width: fit-content;
  max-width: calc(100% - var(--safe-left) - var(--safe-right));
  padding: 9px 12px; border-radius: 9px; background: var(--glass); font-size: .76rem; color: #e0e6d5;
  transition: opacity 300ms; pointer-events: none;
}
.desktop-hint.subtle { opacity: .78; }
kbd { font: inherit; color: #f6f8d9; border: 1px solid #819174; border-radius: 4px; padding: 2px 4px; margin-right: 3px; }
.touch-controls { display: none; }
.stick, .depth-buttons button { touch-action: none; user-select: none; }
.stick {
  width: 94px; aspect-ratio: 1; border: 1px solid #b9c7a6; border-radius: 50%;
  background: #15271c9c; display: grid; place-items: center;
}
.stick-thumb {
  width: 38px; aspect-ratio: 1; border: 1px solid #bccba4; border-radius: 50%; background: #c9d5a17c;
  transform: translate(var(--stick-x, 0), var(--stick-y, 0)); pointer-events: none;
}
.depth-buttons { display: grid; gap: 7px; }
.depth-buttons button { width: 48px; height: 44px; font-size: 1.2rem; padding: 0; }
.depth-buttons button:active { background: #546448; }
dialog {
  color: inherit; background: var(--surface); border: 1px solid #708471; border-radius: 16px;
  width: min(408px, calc(100% - 32px)); max-height: calc(100svh - 24px); padding: 0;
  box-shadow: 0 10px 55px #07110b99;
}
dialog::backdrop { background: #06100a9e; }
.settings-form { display: grid; gap: 14px; padding: 19px; }
.settings-form header { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.settings-form header button { flex: none; width: 42px; }
h2 { font: 400 1.65rem/1.15 Georgia, serif; margin: 0; }
.setting { display: grid; grid-template-columns: 3.5rem 1fr; gap: 10px; align-items: center; }
select, input[type="time"] {
  min-width: 0; width: 100%; min-height: 43px; padding: 6px 8px;
  border: 1px solid #71856d; border-radius: 7px; background: #24362a; color: inherit;
}
.times { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.times label { display: grid; gap: 5px; min-width: 0; }
.settings-form p { color: #cdd9c8; margin: 7px 0 0; font-size: .82rem; line-height: 1.45; }
summary { cursor: pointer; padding: 4px 0; }
.leave { width: fit-content; }
.touch-controls-help { display: none; }
@media (pointer: coarse) {
  .desktop-hint, .desktop-controls-help { display: none; }
  .touch-controls-help { display: block; }
  .touch-controls { position: absolute; bottom: var(--safe-bottom); left: var(--safe-left); right: var(--safe-right); display: flex; align-items: end; justify-content: space-between; pointer-events: none; }
  .touch-controls > * { pointer-events: auto; }
}
@media (max-width: 700px) {
  .look-hint { display: none; }
}
@media (max-width: 480px) {
  .entrance { padding: 17px 16px 14px; border-radius: 15px; }
  .description { margin-bottom: 13px; }
  #swim-hud .presence { font-size: .72rem; gap: 5px; padding-inline: 6px; }
  .hud-top { gap: 5px; }
  .masthead { gap: 6px; }
  .brand-mark { width: 34px; height: 34px; }
}
@media (max-width: 360px) {
  h2 { font-size: 1.35rem; }
}
@media (max-width: 345px) {
  #swim-hud .options { padding-inline: 7px; }
  .masthead .brand-mark { display: none; }
}
@media (max-height: 530px) {
  .entrance { padding: 13px 16px 10px; }
  h1 { font-size: 2.4rem; }
  .description { margin-bottom: 9px; }
  .entry-note { margin-top: 6px; }
}
@media (max-height: 365px) {
  main:has(.entrance:not([hidden])) { min-height: 365px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}
