html { min-height: 100%; }
body { height: 100svh; min-height: 420px; }
.page { padding-bottom: 80px; }
.page:not(.on) { visibility: hidden; transition: opacity .55s, transform .55s, visibility 0s .55s; }
.page.on { visibility: visible; }
#home { gap: clamp(1.2rem,4vw,2rem); }
.home-mark { position: relative; width: clamp(76px,18vw,110px); aspect-ratio: 300 / 218; flex: none; }
.sailboat { display: block; width: 100%; height: auto; transform-origin: 50% 88%; animation: quiet-rock 5.6s ease-in-out infinite; }
.ripples { position: absolute; width: 155%; height: 28px; top: calc(100% - 4px); left: -27.5%; overflow: hidden; mask-image: linear-gradient(90deg,transparent,#000 18%,#000 82%,transparent); }
.ripples path { fill: none; stroke: #726454; stroke-width: 1.05; stroke-linecap: round; transform-origin: center; animation: quiet-water 4.8s ease-in-out infinite; }
.ripples path:nth-child(1) { opacity: .64; }
.ripples path:nth-child(2) { opacity: .42; animation-direction: reverse; animation-delay: -1.2s; }
.wordmark { transform: translateY(0); }
.sentence { font-size: clamp(1.22rem, 3.5vw, 1.5rem); text-wrap: pretty; }
nav { z-index: 12; font-size: 11px; }
nav a { display: inline-flex; align-items: center; min-height: 28px; transition: color .25s; }
nav a:focus-visible { outline: 1px solid var(--color-rust); outline-offset: 5px; }
#pf-code { font-size: 13px; text-transform: none; }
#pf-req { font-size: 11px; }
#voyage { justify-content: flex-start; padding-top: clamp(120px, 25vh, 240px); isolation: isolate; }
.voyage-copy { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.voyage-copy .sentence { max-width: 33rem; }
.voyage-copy>a { font-size: 11px !important; padding: 8px 0; }
.voyage-actions { display: flex; align-items: center; justify-content: center; gap: 25px; }
.voyage-actions button,.voyage-actions a { appearance: none; background: none; border: 0; color: var(--color-sea); font: 11px/1.4 var(--font-label); letter-spacing: .16em; text-transform: uppercase; padding: 8px 0; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.voyage-actions button:hover,.voyage-actions a:hover { color: var(--color-rust); }
.voyage-actions #terminal-link { color: var(--color-sea); font-size: 11px; }
.voyage-actions button:disabled { cursor: wait; opacity: .6; }
.voyage-scene { position: absolute; z-index: -1; top: 37%; bottom: 90px; left: 6%; right: 6%; pointer-events: none; overflow: hidden; mask-image: linear-gradient(transparent 0%, #000 25%, #000 70%, transparent 100%),linear-gradient(90deg,transparent,#000 12%,#000 88%,transparent); mask-composite: intersect; }
.sea-input { position: absolute; z-index: 1; top: 45%; bottom: 150px; left: 6%; right: 6%; touch-action: none; cursor: grab; }
.sea-input:active { cursor: grabbing; }
.sea-input:focus-visible { outline: 1px dashed #b5a995; outline-offset: -12px; }
.sailing-controls { position: absolute; z-index: 3; bottom: 88px; left: 50%; transform: translateX(-50%); width: min(420px,90vw); color: #796f62; text-align: center; font: 10px/1.5 var(--font-label); letter-spacing: .07em; }
#sailing-hint { margin: 0; }
.desktop-hint { display: inline-flex; align-items: center; justify-content: center; gap: 12px; }
.hint-or { opacity: .55; }
.arrow-keys { display: grid; grid-template-columns: repeat(3,18px); grid-template-rows: repeat(2,17px); gap: 3px; }
.arrow-keys kbd { display: grid; place-items: center; box-sizing: border-box; border: 1px solid #bcb09f; border-radius: 2px; color: #786c5b; font: 12px/1 var(--font-label); background: #f7f2e9a0; transition: color .15s,border-color .15s,background .15s; }
.arrow-keys kbd:first-child { grid-column: 2; }
.arrow-keys kbd:nth-child(2) { grid-column: 1; grid-row: 2; }
.arrow-keys kbd:nth-child(3) { grid-column: 2; grid-row: 2; }
.arrow-keys kbd:nth-child(4) { grid-column: 3; grid-row: 2; }
.arrow-keys kbd.is-held { color: var(--color-rust); border-color: var(--color-rust); background: #b23a2610; }
.touch-hint { display: none; }
.motion-paused .sea-input { pointer-events: none; }
.voyage-scene iframe { width: 100%; height: 100%; border: none; opacity: .01; transition: opacity .4s; }
.voyage-scene iframe.ready { opacity: 1; }
.scene-fallback { position: absolute; width: 75px; height: auto; left: calc(50% - 37.5px); top: 47%; opacity: .65; transition: opacity .25s; }
.voyage-scene.loaded .scene-fallback { opacity: 0; }
#legal-body { max-height: calc(100svh - 220px); }
#legal p { font-size: 14px; line-height: 1.7; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.motion-paused *, .motion-paused *::before, .motion-paused *::after { animation-play-state: paused !important; }
@keyframes quiet-rock {
  0%,100% { transform: translate(0,0) rotate(0deg); }
  25% { transform: translate(-2px,-5px) rotate(-5deg); }
  50% { transform: translate(0,-1px) rotate(0deg); }
  75% { transform: translate(2px,-5px) rotate(5deg); }
}
@keyframes quiet-water { 0%,100% { transform: translate(-10px,0); } 50% { transform: translate(10px,1.5px); } }
@media (max-width: 680px) {
  nav { left: 22px; right: 22px; bottom: 23px; font-size: 10px; }
  nav div, .ctx { gap: 20px; }
  nav { flex-direction: column; align-items: center; gap: 10px; }
  nav div { justify-content: center; }
  .ctx:not(.on) { display: none; }
  .page { padding: 25px 25px 90px; }
  .sentence { max-width: 32rem; font-size: 22px; line-height: 1.48; }
  #voyage { padding-top: 23svh; }
  .voyage-scene { top: 47%; bottom: 110px; left: -12%; right: -12%; }
  .sea-input { top: 47%; bottom: 200px; left: 0; right: 0; }
  .sailing-controls { bottom: 116px; font-size: 9px; }
  .desktop-hint { display: none; }
  .touch-hint { display: inline; }
  .voyage-actions { gap: 18px; }
  .voyage-actions button { font-size: 10px; }
  .voyage-actions #terminal-link { font-size: 10px; }
  .voyage-copy { gap: 19px; }
  #legal-body { max-height: calc(100svh - 230px); }
}
@media (pointer: coarse) { .desktop-hint { display: none; } .touch-hint { display: inline; } }
@media (max-width: 370px) { nav div,.ctx { gap: 14px; } nav { font-size: 9px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }


/* Phones and touch tablets sail automatically; desktop keeps the existing helm. */
.ambient-sailing .sea-input, .ambient-sailing .sailing-controls { display: none; }
@media (max-width: 680px), (hover: none) and (pointer: coarse) {
  .sea-input, .sailing-controls { display: none; }
}
