* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
  font:
    16px/1.35 system-ui,
    sans-serif;
  background: #092d3b;
  color: #fff;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  border: 1px solid #ffffff50;
  border-radius: 14px;
  padding: 12px 20px;
  background: #174b5e;
  color: white;
  min-height: 48px;
}
button:hover {
  background: #22647a;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #ffdf6b;
  outline-offset: 4px;
}
a {
  color: inherit;
}
.run-header {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px clamp(14px, 4vw, 48px);
  background: #092d3b;
}
.run-header a {
  text-decoration: none;
  font-weight: 800;
}
.run-header h1 {
  font-size: clamp(17px, 2.4vw, 27px);
  margin: 0;
}
.run-header h1 span {
  color: #7ee5d6;
}
.run-header .home {
  font-size: 14px;
  letter-spacing: 0.1em;
}
.run-shell {
  max-width: 1300px;
  margin: auto;
  display: flex;
  flex-direction: column;
  min-height: calc(100svh - 62px);
  padding: 0 16px 12px;
}
.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
}
.hud strong {
  font-size: 24px;
}
.hud span {
  font-size: 14px;
  color: #c2e4ed;
}
.hud .tide-pill {
  font-size: 14px;
  background: #1c566b;
  padding: 8px 13px;
  border-radius: 99px;
}
.playfield {
  position: relative;
  flex: 1;
  min-height: 330px;
  max-height: 680px;
  overflow: hidden;
  border: 1px solid #5694a5;
  border-radius: 22px;
  touch-action: none;
  background: #168399;
}
.playfield svg {
  position: absolute;
  width: 100%;
  height: 100%;
  display: block;
}
.scene-text {
  font-family: system-ui, sans-serif;
  fill: #fbf9e9;
  font-weight: 800;
  letter-spacing: 0.15em;
}
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(transparent, #042d4870);
}
.overlay[hidden] {
  display: none;
}
.card {
  text-align: center;
  background: #082c40e8;
  border: 1px solid #83cbd5;
  border-radius: 22px;
  padding: 24px 30px;
  max-width: calc(100% - 34px);
  box-shadow: 0 15px 60px #02233470;
}
.card h2 {
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.08;
  margin: 0 0 10px;
}
.card p {
  font-size: 17px;
  color: #d3eaf1;
  max-width: 320px;
  margin: 0 auto 18px;
}
.card button {
  background: #ffdc64;
  color: #123745;
  border-color: #ffe6a0;
  font-size: 20px;
  min-width: 180px;
}
.card button:hover {
  background: #ffeb9e;
}
.result-num {
  display: block;
  font-size: 40px;
  color: #ffdc64;
  margin: 8px 0;
}
.controls {
  display: grid;
  grid-template-columns: 72px 1fr 72px;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
}
.controls button {
  font-size: 25px;
  touch-action: none;
  user-select: none;
}
.controls p {
  text-align: center;
  font-size: 15px;
  margin: 0;
  color: #d6ebee;
}
.controls b {
  color: white;
}
.run-footer {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #a8c8d2;
  padding: 10px 0 2px;
}
.run-footer details {
  text-align: center;
}
.run-footer details p {
  max-width: 600px;
  margin: 8px auto;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.wave-line {
  animation: drift 5s linear infinite;
}
.light-beam {
  animation: glow 3s ease-in-out infinite alternate;
}
.crate-ring {
  animation: ring 1.3s ease-in-out infinite alternate;
}
.demo-caption {
  position: absolute;
  top: 15px;
  left: 18px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #e5fbff;
}
.feedback {
  position: absolute;
  left: 50%;
  bottom: 23%;
  transform: translateX(-50%);
  font-weight: 800;
  color: #fff7b5;
  text-shadow: 0 2px 4px #143b4b;
  white-space: nowrap;
  pointer-events: none;
}
.paused .wave-line,
.paused .light-beam,
.paused .crate-ring {
  animation-play-state: paused;
}
@keyframes drift {
  to {
    transform: translateX(-100px);
  }
}
@keyframes glow {
  to {
    opacity: 0.18;
  }
}
@keyframes ring {
  to {
    opacity: 0.3;
  }
}
@media (max-width: 600px) {
  .run-header {
    height: 56px;
    padding: 8px 15px;
  }
  .run-header .home {
    font-size: 12px;
  }
  .run-shell {
    padding: 0 10px 8px;
    min-height: calc(100svh - 56px);
  }
  .hud strong {
    font-size: 21px;
  }
  .hud .tide-pill {
    font-size: 12px;
    padding: 7px 9px;
  }
  .playfield {
    min-height: clamp(230px, calc(100svh - 220px), 370px);
    border-radius: 17px;
  }
  .controls {
    grid-template-columns: 60px 1fr 60px;
    gap: 7px;
  }
  .controls p {
    font-size: 13px;
  }
  .card {
    padding: 24px 20px;
  }
  .run-footer {
    font-size: 12px;
    gap: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .wave-line,
  .light-beam,
  .crate-ring {
    animation: none;
  }
}
