:root {
  color-scheme: dark;
  font: 100%/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #faf3e7;
  background: #132832;
  --amber: #ffc68a;
}

* { box-sizing: border-box; }
body { margin: 0; }

.shore {
  isolation: isolate;
  position: relative;
  min-height: max(32rem, 100vh);
  min-height: max(32rem, 100svh);
  overflow: hidden;
}

.scene, .shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scene {
  z-index: -2;
  background: #20384c url("assets/coast-calm.webp") 57% 50% / cover no-repeat;
}

.scene canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.shade {
  z-index: -1;
  background:
    linear-gradient(180deg, #0e1b2b9c 0%, transparent 17%, transparent 57%, #0a171d87 84%, #09151ce6 100%),
    radial-gradient(ellipse at 2% 37%, #102339c7, #11243846 31%, transparent 62%);
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  position: absolute;
  top: max(1.75rem, env(safe-area-inset-top));
  left: max(3.6vw, env(safe-area-inset-left));
  right: max(3.6vw, env(safe-area-inset-right));
}

.location {
  display: flex;
  align-items: center;
  gap: .66rem;
  font-size: .875rem;
  font-weight: 500;
  letter-spacing: .13em;
}

.pin {
  width: .59rem;
  height: .59rem;
  transform: rotate(45deg);
  border: 1px solid var(--amber);
  background: #ffbd791a;
}

.location-divider {
  width: 1.1rem;
  height: 1px;
  background: #f8ecd67a;
}

.sound {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  padding: 0 .85rem;
  background: #14263191;
  border: 1px solid #f8ecd64d;
  border-radius: 100px;
  color: inherit;
  font: inherit;
  font-size: .875rem;
  cursor: pointer;
}

.sound:hover { background: #263949e6; }

.sound-state {
  color: #d4d7d8;
  font-size: .8125rem;
}

.sound[aria-pressed="true"] .sound-state { color: var(--amber); }

.sound-icon {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  width: 16px;
  height: 16px;
  color: #c1cbd0;
}

.sound-icon i {
  width: 2px;
  height: 38%;
  border-radius: 10px;
  background: currentColor;
}

.sound-icon i:nth-child(2) { height: 92%; }
.sound-icon i:nth-child(3) { height: 66%; }
.sound[aria-pressed="true"] .sound-icon { color: var(--amber); }
.sound[aria-pressed="true"] i { animation: pulse 1.1s ease-in-out infinite alternate; }
.sound[aria-pressed="true"] i:nth-child(2n) { animation-delay: -.55s; }
@keyframes pulse { to { transform: scaleY(.48); } }

.intro {
  position: absolute;
  top: max(7rem, 21%);
  left: max(8vw, env(safe-area-inset-left));
}

h1 {
  margin: 0;
  font-family: "Songti SC", "Noto Serif CJK SC", "Noto Serif SC", "SimSun", serif;
  font-size: clamp(4.75rem, 10vw, 9rem);
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1.12;
  text-shadow: 0 5px 32px #0e22326b;
}

.intro p {
  margin: 1.1rem 0 0 .18em;
  font-size: clamp(1rem, 1.43vw, 1.2rem);
  color: #f8eee0;
  letter-spacing: .09em;
  text-shadow: 0 2px 16px #0d1b25;
}

.control {
  position: absolute;
  width: min(31rem, calc(100% - 2.5rem));
  bottom: calc(clamp(1.25rem, 5vh, 3rem) + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid #e4f5f435;
  border-radius: 1rem;
  padding: .95rem 1.35rem .85rem;
  background: #10232ce6;
  background: linear-gradient(125deg, #1f353deb, #0d2028e8);
  box-shadow: 0 18px 45px #02080955, inset 0 1px 0 #f1ded315;
}

.control-header, .scale {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}

.control-header label {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .13em;
}

output {
  color: var(--amber);
  font-size: 1.65rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  font-weight: 500;
}

output span { padding-left: .16em; font-size: .85rem; }

input[type="range"] {
  --strength: 18%;
  appearance: none;
  -webkit-appearance: none;
  display: block;
  cursor: ew-resize;
  touch-action: pan-y;
  width: 100%;
  height: 44px;
  margin: .14rem 0 0;
  border-radius: 8px;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 6px;
  background: linear-gradient(to right, #ffd3a2 var(--strength), #61727a var(--strength));
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 6px;
  background: linear-gradient(to right, #ffd3a2 var(--strength), #61727a var(--strength));
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  margin-top: -10px;
  width: 24px;
  height: 24px;
  border: 5px solid #ffdfb8;
  background: #ce8749;
  border-radius: 50%;
  box-shadow: 0 0 0 4px #ffd09a28, 0 0 18px #ffc48863;
}

input[type="range"]::-moz-range-thumb {
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  border: 5px solid #ffdfb8;
  background: #ce8749;
  border-radius: 50%;
  box-shadow: 0 0 0 4px #ffd09a28, 0 0 18px #ffc48863;
}

button:focus-visible, input:focus-visible {
  outline: 2px solid #ffdab3;
  outline-offset: 4px;
}

.scale {
  margin-top: -.1rem;
  color: #cbd5d7;
  font-size: .875rem;
  letter-spacing: .12em;
}

@media (max-width: 660px) {
  .top {
    top: calc(.9rem + env(safe-area-inset-top));
    left: calc(1.25rem + env(safe-area-inset-left));
    right: calc(1.25rem + env(safe-area-inset-right));
  }

  .location { gap: .48rem; letter-spacing: .06em; }
  .location-divider { width: .55rem; }
  .intro { top: 15%; left: max(1.4rem, env(safe-area-inset-left)); }
  h1 { font-size: clamp(4rem, 18vw, 6.5rem); }
  .intro p { margin-top: .7rem; letter-spacing: .05em; }
  .scene { background-position: 60% center; }
  .shade {
    background:
      linear-gradient(180deg, #0e1b2b8f, transparent 22%, transparent 56%, #0a171d65 79%, #09151ced 100%),
      radial-gradient(ellipse at 2% 21%, #102339a3, transparent 64%);
  }
  .control { padding-inline: 1.1rem; }
}

@media (max-height: 550px) and (min-width: 660px) {
  .shore { min-height: max(21rem, 100svh); }
  .top { top: .8rem; }
  .intro { top: 25%; }
  h1 { font-size: clamp(3.5rem, 12vh, 5.5rem); }
  .intro p { margin-top: .55rem; }
  .control { bottom: calc(.65rem + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .sound[aria-pressed="true"] i { animation: none; }
}

@media (max-height: 480px) and (orientation: landscape) {
  .shore { min-height: max(19rem, 100svh); }
  .intro { top: 24%; }
  h1 { font-size: clamp(3rem, 13vh, 4.5rem); }
  .intro p { margin-top: .45rem; }
  .control {
    left: auto;
    right: max(1.25rem, env(safe-area-inset-right));
    bottom: calc(.65rem + env(safe-area-inset-bottom));
    transform: none;
    width: min(27rem, 49%);
  }
}
