@import "./shared/world-kit/virtual-stick.css";

:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  font-size: clamp(100%, min(calc(100% + .625vw - 7.5px), calc(100% + 1.25svh - 9px)), 175%);
  color: #f4f5e7;
  background: #142019;
  overscroll-behavior: none;
  --surface: #18251e;
  --pale: #dce5a1;
  --dim: #c1ccba;
  --stroke: #687869;
  --glass: rgba(18, 29, 23, .94);
  --safe-left: max(1.125rem, env(safe-area-inset-left));
  --safe-right: max(1.125rem, env(safe-area-inset-right));
  --safe-top: max(1rem, env(safe-area-inset-top));
  --safe-bottom: max(1.125rem, 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, select, .species label, .language-choices 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, .brand-link: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, .masthead, .masthead *, .entrance, .entrance *, #swim-hud, #swim-hud * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
#water.dragging { cursor: grabbing; }
#water:focus-visible { outline: 2px solid #e2edaa; outline-offset: -3px; }
.vignette {
  z-index: -1;
  pointer-events: none;
  transition: opacity 300ms;
  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);
}
.brand-link {
  display: flex;
  align-items: center;
  gap: .625rem;
  color: inherit;
  text-decoration: none;
  line-height: 1.2;
  text-shadow: 0 1px 5px #101912;
}
.brand-mark { width: 2.5rem; height: 2.5rem; padding: .25rem; 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(24.6875rem, calc(100% - var(--safe-left) - var(--safe-right)));
  background: var(--glass);
  border: 1px solid #687868;
  box-shadow: 0 18px 65px #09110c72;
  border-radius: 1.1875rem;
  padding: 1.5rem 1.6875rem 1.375rem;
}
.entrance h1 { margin: 0 0 1rem; color: #e4eccf; font-size: .72rem; line-height: 1.4; }
.entrance h1:lang(ko) { letter-spacing: .04em; }
fieldset { margin: 0 0 .8125rem; padding: 0; border: 0; min-width: 0; }
.species { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
:is(.species, .language-choices) label {
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  min-height: 2.9375rem;
  background: #223328;
  border: 1px solid var(--stroke);
  border-radius: .625rem;
  cursor: pointer;
  padding: .25rem;
  font-size: .85rem;
  text-align: center;
  line-height: 1.1;
}
:is(.species, .language-choices) label:has(input:checked) { border-color: #c8d88b; background: #3b482c; }
:is(.species, .language-choices) label:has(input:focus-visible) { outline: 2px solid #f2f6c6; outline-offset: 2px; }
:is(.species, .language-choices) input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.species svg { flex: none; width: 1.9375rem; height: 1.25rem; 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: 3rem; padding: .5rem .875rem;
  background: var(--pale); border: 0; border-radius: .625rem; color: #202a18;
  font-weight: 680; font-size: .92rem;
}
.join:not(:disabled):hover { background: #eef2b7; }
.entry-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
#entry-watch {
  display: flex; align-items: center; justify-content: space-between; gap: .375rem;
  min-height: 3rem; padding: .5rem .875rem; border-radius: .625rem; font-weight: 650; font-size: .92rem;
}
#entry-watch .ui-icon { flex: none; }
.entry-note, .entry-time-note { margin: .625rem 0 0; font-size: .74rem; color: var(--dim); }
.entry-note { min-height: 1lh; }
.entry-time-note { line-height: 1.45; text-wrap: balance; }
.entry-time-note:lang(ko) { word-break: keep-all; }
.hud-top { position: absolute; top: var(--safe-top); right: var(--safe-right); display: flex; gap: .5rem; align-items: center; }
.entrance:not([hidden]) ~ #swim-hud #watch { display: none; }
.quiet {
  border: 1px solid #6c806d; color: #f4f5e7; background: var(--glass); border-radius: .5625rem;
  padding: .4375rem .6875rem; min-height: 2.625rem; font-size: .82rem;
}
.quiet:hover { background: #344735; }
.hud-icon { display: grid; place-items: center; width: 2.625rem; padding: 0; }
.ui-icon { display: block; width: 1.125rem; height: 1.125rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.fullscreen-option, [data-fullscreen] .fullscreen-exit, [data-fullscreen][aria-pressed="true"] .fullscreen-enter { display: none; }
[data-fullscreen][aria-pressed="true"] .fullscreen-exit { display: inline; }
.presence { display: flex; align-items: center; gap: .4375rem; margin: 0; }
.presence-track {
  display: flex; align-items: center; width: 1.125rem; height: .6875rem; padding: 1px;
  border: 1px solid #8d9e86; border-radius: 1rem; flex: none;
}
.presence-track::before {
  content: ''; width: .4375rem; height: .4375rem; border-radius: 50%; background: #afbeab;
}
.presence[aria-checked="true"] .presence-track { justify-content: flex-end; }
.presence[aria-checked="true"] .presence-track::before { background: #deba80; }
.presence.online .presence-track::before { background: #c4db82; }
.lobby-queue, .lobby-rejoin {
  position: absolute;
  top: calc(var(--safe-top) + 3.375rem);
  right: var(--safe-right);
}
.lobby-queue {
  width: min(19rem, calc(100% - var(--safe-left) - var(--safe-right)));
  padding: .875rem 1rem;
  border: 1px solid var(--stroke);
  border-radius: .75rem;
  background: var(--glass);
  overflow-wrap: anywhere;
}
.lobby-queue h2 { margin: 0 0 .375rem; font: inherit; font-weight: 650; }
.lobby-detail { color: var(--dim); font-size: .875rem; line-height: 1.4; }
.lobby-detail p { margin: 0; }
.lobby-detail p + p { margin-top: .125rem; }
.lobby-queue .quiet { margin-top: .75rem; min-width: 5rem; }
.desktop-hint {
  position: absolute; display: flex; flex-wrap: wrap; gap: .4375rem .8125rem; 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: .5625rem .75rem; border-radius: .5625rem; 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: .25rem; padding: .125rem .25rem; margin-right: .1875rem; }
.touch-controls { display: none; }
.stick {
  position: relative; width: clamp(6.5rem, 29vw, 7.5rem); aspect-ratio: 1;
  border: 2px solid #b9c7a6; background: #15271cb8;
}
.stick-thumb {
  width: 33%; aspect-ratio: 1; border: 1px solid #d9e6ad; background: #c9d5a1bd;
}
.stick-label {
  position: absolute; bottom: .3125rem; left: 50%; transform: translateX(-50%);
  padding: .125rem .375rem; border-radius: .375rem; background: var(--glass);
  font-size: .72rem; white-space: nowrap; pointer-events: none;
}
.stick.is-active .stick-label { visibility: hidden; }
.depth-buttons { display: grid; gap: .5rem; }
.depth-buttons button {
  min-width: 4.875rem; min-height: 3rem; padding: .375rem .5rem; touch-action: none;
  display: flex; justify-content: center; align-items: center; gap: .375rem;
}
.depth-buttons button span:first-child { font-size: 1.125rem; line-height: 1; }
.depth-buttons button.is-held { background: #546448; border-color: #becfa1; }
dialog {
  color: inherit; background: var(--surface); border: 1px solid #708471; border-radius: 1rem;
  width: min(25.5rem, calc(100% - 2rem)); max-height: calc(100svh - 1.5rem); padding: 0;
  box-shadow: 0 10px 55px #07110b99;
}
dialog::backdrop { background: #06100a9e; }
#daylight-prompt { width: min(22rem, calc(100% - 2rem)); }
.daylight-form { display: grid; gap: .75rem; padding: 1.1875rem; }
.daylight-form p { margin: 0; color: var(--dim); font-size: .875rem; line-height: 1.5; }
.daylight-form p:lang(ko) { word-break: keep-all; }
.daylight-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-top: .25rem; }
.daylight-actions button { justify-content: center; min-height: 2.75rem; padding: .4375rem; font-size: .85rem; }
.settings-form { display: grid; gap: .875rem; padding: 1.1875rem; }
.settings-form header, .privacy-sheet header { display: flex; justify-content: space-between; gap: .625rem; align-items: center; }
.settings-form header button, .privacy-sheet header button { flex: none; width: 2.625rem; }
h2 { font: 400 1.65rem/1.15 Georgia, serif; margin: 0; }
.language-setting { margin: 0; }
.language-setting legend { display: flex; align-items: center; gap: .4rem; padding: 0; margin-bottom: .5rem; font-size: .87rem; }
.language-setting .ui-icon { color: var(--pale); flex: none; }
.language-choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .375rem; }
.language-choices label { min-height: 2.625rem; font-size: .81rem; }
.setting { display: grid; grid-template-columns: 5.65rem minmax(0, 1fr); gap: .625rem; align-items: center; }
.speed-control {
  display: grid; grid-template-columns: minmax(0, 1fr) 3.1rem; align-items: center; gap: .5rem; min-height: 2.6875rem;
}
.speed-control input { width: 100%; min-width: 0; min-height: 2rem; margin: 0; border-radius: .4375rem; accent-color: var(--pale); }
.speed-control output { text-align: right; font-variant-numeric: tabular-nums; }
select, input[type="time"] {
  min-width: 0; width: 100%; min-height: 2.6875rem; padding: .375rem .5rem;
  border: 1px solid #71856d; border-radius: .4375rem; background: #24362a; color: inherit;
}
.settings-form select {
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3 6 5 5 5-5' fill='none' stroke='%23dce5cf' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  appearance: none;
  cursor: pointer;
  padding-inline: .75rem 2.25rem;
  background: var(--select-chevron) right .75rem center / .875rem no-repeat #24362a;
}
@supports (appearance: base-select) and (position-area: block-end center) and selector(::picker(select)) {
  #view { --select-anchor: --aquarium-view; }
  #lighting-mode { --select-anchor: --aquarium-time; }
  #lamp { --select-anchor: --aquarium-lamp; }
  .settings-form select, .settings-form select::picker(select) { appearance: base-select; }
  .settings-form select {
    anchor-name: var(--select-anchor);
    display: flex; align-items: center;
    padding-inline: .75rem; background-image: none;
  }
  .settings-form select::picker-icon {
    content: "";
    inline-size: .875rem; block-size: .875rem; flex: none;
    align-self: center; margin: 0 0 0 auto;
    background: var(--select-chevron) center / contain no-repeat;
  }
  .settings-form select::picker(select) {
    position-anchor: var(--select-anchor); position-area: block-end center; inset: auto;
    position-try-order: normal; position-try-fallbacks: flip-block;
    inline-size: anchor-size(width); min-inline-size: 0;
    max-block-size: min(14rem, 45svh); overflow-y: auto;
    margin: .25rem 0; padding: .25rem; box-sizing: border-box;
    border: 1px solid #71856d; border-radius: .4375rem;
    background: #24362a; color: #f4f5e7; box-shadow: 0 .5rem 1.4rem #07110b88;
  }
  .settings-form option {
    display: flex; align-items: center; gap: .5rem;
    min-block-size: 2.375rem; padding: .4rem .5rem; border-radius: .25rem;
  }
  .settings-form option::checkmark { order: 1; margin-inline-start: auto; color: var(--pale); }
  .settings-form option:checked { background: #384a31; }
  .settings-form option:is(:hover, :focus-visible) { background: #455b3d; }
}
.times { display: grid; grid-template-columns: 1fr 1fr; gap: .5625rem; }
.times label { display: grid; gap: .3125rem; min-width: 0; }
.settings-form p { color: #cdd9c8; margin: .4375rem 0 0; font-size: .82rem; line-height: 1.45; }
.settings-form p:lang(ko) { word-break: keep-all; }
summary { cursor: pointer; padding: .25rem 0; }
.settings-footer, .privacy-purpose { border-block-start: 1px solid #70847166; }
#open-privacy {
  min-height: 2rem; padding: .375rem .375rem .125rem 0; color: #cdd9c8;
  border: 0; background: none; font-size: .8rem; text-decoration: underline; text-underline-offset: .16em;
}
#privacy { width: min(27.5rem, calc(100% - 2rem)); }
.privacy-sheet { display: flex; flex-direction: column; max-height: calc(100svh - 1.5rem - 2px); }
.privacy-sheet header { flex: none; padding: 1rem 1.1875rem .75rem; }
.privacy-content { overflow-y: auto; padding: 0 1.1875rem 1.1875rem; }
.privacy-content:focus-visible { outline: 2px solid var(--pale); outline-offset: -3px; }
.privacy-sheet p { margin: 0; color: #cdd9c8; font-size: .86rem; line-height: 1.5; }
.privacy-sheet p + p { margin-top: .625rem; }
.privacy-sheet p:lang(ko) { word-break: keep-all; }
.privacy-sheet a { color: var(--pale); overflow-wrap: anywhere; }
.privacy-sheet a:focus-visible { outline: 2px solid var(--pale); outline-offset: 2px; }
.privacy-purpose { margin-top: 1rem; padding-top: .875rem; }
.privacy-purpose h3 { margin: 0 0 .375rem; font-size: .95rem; }
.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; display: flex; align-items: end; justify-content: space-between; pointer-events: none;
    bottom: max(var(--safe-bottom), calc(env(safe-area-inset-bottom) + .5rem));
    left: max(var(--safe-left), calc(env(safe-area-inset-left) + .5rem));
    right: max(var(--safe-right), calc(env(safe-area-inset-right) + .5rem));
  }
  .touch-controls > * { pointer-events: auto; }
  .hud-top .quiet { min-height: 3rem; }
  .hud-top .hud-icon { width: 3rem; }
}
@supports (-webkit-touch-callout: none) {
  @media (pointer: coarse) {
    :root:is(:fullscreen, :-webkit-full-screen) { --safe-top: max(3.5rem, calc(env(safe-area-inset-top) + 2.75rem)); }
  }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 420px) {
  .stick { width: 6.5rem; }
}
@media (max-width: 700px) {
  .look-hint { display: none; }
}
@media (max-width: 480px) {
  .entrance { padding: 17px 16px 14px; border-radius: 15px; }
  #swim-hud .presence { font-size: .72rem; gap: 5px; padding-inline: 6px; }
  .hud-top { gap: 5px; }
  .brand-mark { width: 34px; height: 34px; }
  .fullscreen-toggle { display: none; }
  .fullscreen-option { display: flex; width: fit-content; align-items: center; gap: .5rem; min-height: 2.75rem; }
}
@media (max-width: 360px) {
  h2 { font-size: 1.35rem; }
  .species:lang(ja) svg { width: 1.5rem; }
  .setting:is(:lang(ko), :lang(ja)) { grid-template-columns: 4.5rem minmax(0, 1fr); gap: .5rem; }
}
@media (max-height: 530px) {
  .entrance { padding: 13px 16px 10px; }
  .entrance h1 { margin-bottom: 12px; }
  .entry-note, .entry-time-note { margin-top: 6px; }
}
@media (max-height: 290px) {
  main:has(.entrance:not([hidden])) { min-height: 290px; }
}
@media (height > 290px) {
  :root { overflow: hidden; }
  .masthead, .hud-top, .lobby-queue, .lobby-rejoin, .entrance, .desktop-hint, .touch-controls { position: fixed; }
}
@media (290px < height <= 360px) {
  .entrance {
    max-height: calc(100% - var(--safe-top) - var(--safe-bottom) - 3.25rem);
    overflow-y: auto;
    padding-block: .375rem .5rem;
  }
  .entrance h1, .entrance fieldset { margin-bottom: .375rem; }
}
@media (max-height: 480px) and (min-width: 620px) {
  .entrance { width: 255px; }
  .entrance h1 { font-size: .68rem; letter-spacing: .12em; }
  .entrance .species svg { width: 24px; }
  .settings-form { gap: .5rem; padding: .625rem .875rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}

/* Watch has no camera affordances or swimming controls. */
body.watching #water { cursor: default; }
body.watching .desktop-hint, body.watching .touch-controls { display: none; }
body.watching .vignette { opacity: .45; }
.hud-top { transition: opacity 220ms ease; }
body.watching.watch-idle .hud-top { opacity: 0; pointer-events: none; }
body.watching.watch-idle #water:focus-visible { outline: none; }
.hud-top { max-width: calc(100% - var(--safe-left) - var(--safe-right)); flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 580px) {
  .brand-type { display: none; }
  .brand-link { width: 2.625rem; height: 2.625rem; justify-content: center; border-radius: 50%; }
  .hud-top { max-width: calc(100% - var(--safe-left) - var(--safe-right) - 3.375rem); }
}
.presence { min-width: 0; max-width: 100%; }
#presence-text { overflow-wrap: anywhere; }
