@supports (padding-top: env(safe-area-inset-top)) {
  html {
    --safe-area-inset-top: env(safe-area-inset-top);
    --safe-area-inset-right: env(safe-area-inset-right);
    --safe-area-inset-bottom: env(safe-area-inset-bottom);
    --safe-area-inset-left: env(safe-area-inset-left);
  }
}

:root {
  --cream: #f4ecd6;
  --gold: #ffd98a;
  --gold-deep: #e9b565;
  --ink: #0b1026;
  --glass: rgba(9, 13, 36, 0.62);
  --line: rgba(255, 236, 200, 0.16);
  --serif: "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", Georgia, serif;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  height: 100%;
  background: var(--ink);
  font-family: var(--serif);
  color: var(--cream);
}

#root {
  height: 100%;
  overflow: hidden;
  background-color: var(--ink);
  display: flex;
  touch-action: none;
}

canvas {
  display: block;
  cursor: ns-resize;
}

/* The engine's first-paint nudge: painted, but kept out of sight */
#root > p {
  position: absolute;
  right: 0;
  bottom: 0;
  margin: 0;
  font-size: 8px;
  color: #0b1026;
  pointer-events: none;
}

* {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

/* ---- HUD ---------------------------------------------------------------- */

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  text-shadow: 0 1px 10px rgba(0, 0, 20, 0.8);
}

.hud-top {
  position: absolute;
  top: calc(18px + var(--safe-area-inset-top, 0px));
  left: calc(22px + var(--safe-area-inset-left, 0px));
  transition: opacity 0.6s;
}

.hud-top.hidden {
  opacity: 0;
}

.hud-night {
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.7;
}

.hud-score {
  font-size: 30px;
  font-style: italic;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.hud-chain {
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.4s;
  color: var(--cream);
}

.hud-chain.on {
  opacity: 0.8;
}

.hud-buttons {
  position: absolute;
  top: calc(14px + var(--safe-area-inset-top, 0px));
  right: calc(96px + var(--safe-area-inset-right, 0px));
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(9, 13, 36, 0.35);
  color: var(--cream);
  font: 16px var(--serif);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0.7;
  transition:
    opacity 0.2s,
    background 0.2s;
}

.icon-button:hover {
  opacity: 1;
  background: rgba(255, 217, 138, 0.12);
}

.icon-button.off {
  text-decoration: line-through;
  opacity: 0.45;
}

.banner {
  position: absolute;
  top: 24%;
  left: 0;
  right: 0;
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 1.2s ease,
    transform 1.6s ease;
}

.banner.show {
  opacity: 1;
  transform: none;
}

.banner-sub {
  font-size: 15px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  opacity: 0.75;
}

.banner-title {
  font-size: clamp(34px, 6vw, 64px);
  font-style: italic;
  color: var(--gold);
  text-shadow:
    0 0 30px rgba(255, 200, 120, 0.35),
    0 2px 12px rgba(0, 0, 20, 0.9);
}

.hint {
  position: absolute;
  bottom: calc(7% + var(--safe-area-inset-bottom, 0px));
  left: 50%;
  width: min(640px, 86vw);
  transform: translate(-50%, 8px);
  text-align: center;
  font-size: clamp(16px, 2.1vw, 21px);
  font-style: italic;
  line-height: 1.4;
  opacity: 0;
  transition:
    opacity 0.7s,
    transform 0.7s;
}

.hint.show {
  opacity: 0.95;
  transform: translate(-50%, 0);
}

.popup {
  position: absolute;
  transform: translate(-50%, -50%);
  text-align: center;
  white-space: nowrap;
  animation: rise 2.2s ease-out forwards;
}

.popup-label {
  font-style: italic;
  font-size: 20px;
  color: var(--cream);
}

.popup-points {
  font-size: 16px;
  color: var(--gold);
  letter-spacing: 0.06em;
}

.popup.perfect .popup-label {
  color: var(--gold);
  font-size: 24px;
  text-shadow: 0 0 18px rgba(255, 210, 120, 0.8);
}

.popup.bump .popup-label {
  color: #ffb0a0;
}

@keyframes rise {
  0% {
    opacity: 0;
    transform: translate(-50%, -30%) scale(0.9);
  }
  12% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -170%) scale(1);
  }
}

/* ---- Panels ------------------------------------------------------------- */

.panel-layer {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.panel {
  pointer-events: auto;
  text-align: center;
  max-width: min(560px, 92vw);
  max-height: 94vh;
  overflow: auto;
  padding: 24px 34px 26px;
  border-radius: 22px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  box-shadow: 0 20px 80px rgba(0, 0, 10, 0.5);
  animation: panel-in 0.9s ease both;
}

.panel {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 236, 200, 0.2) transparent;
}

/* The title keeps the middle of the screen clear so the boat shows */
.panel.title {
  background: none;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  position: absolute;
  inset: 0;
  margin: 0 auto;
  max-height: none;
  width: min(820px, 94vw);
  max-width: none;
  overflow: visible;
  padding: 3vh 0 2.5vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  animation-duration: 1.6s;
  /* See-through to the pointer, so the sea can be hummed to around the text */
  pointer-events: none;
}

.panel.title button {
  pointer-events: auto;
}

.panel.title h1 {
  font-size: clamp(34px, min(7.5vw, 10vh), 84px);
  white-space: nowrap;
}

.panel.title .lede {
  margin: 6px 0 0;
  font-size: clamp(15px, min(2vw, 3vh), 19px);
}

.panel.title .how {
  max-width: 480px;
}

.panel.title .buttons {
  margin-top: 0;
}

@media (max-height: 560px) {
  .panel.title .how {
    font-size: 13px;
    line-height: 1.45;
    margin-top: 10px;
  }
  .panel .small {
    display: none;
  }
}

@media (max-width: 520px) {
  .panel.title h1 {
    white-space: normal;
  }
}

.panel.leaving {
  animation: panel-out 0.45s ease both;
  pointer-events: none;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes panel-out {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.panel h1 {
  margin: 0;
  font-weight: normal;
  font-style: italic;
  font-size: clamp(40px, 7.5vw, 76px);
  line-height: 1.02;
  color: var(--gold);
  text-shadow:
    0 0 40px rgba(255, 200, 120, 0.35),
    0 3px 14px rgba(0, 0, 20, 0.9);
}

.panel h2 {
  margin: 0 0 2px;
  font-weight: normal;
  font-style: italic;
  font-size: clamp(28px, min(5vw, 7vh), 44px);
  color: var(--gold);
}

/* Results sit low, leaving the sky and the boat in view */
.panel.low {
  align-self: end;
  margin-bottom: 2vh;
}

.panel .eyebrow {
  font-size: 13px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 8px;
}

.panel .lede {
  font-size: clamp(15px, min(2.2vw, 3.2vh), 20px);
  font-style: italic;
  opacity: 0.9;
  margin: 8px 0 14px;
  line-height: 1.4;
}

.panel .how {
  font-size: 15px;
  line-height: 1.6;
  opacity: 0.78;
  margin: 18px auto 0;
  max-width: 440px;
}

.panel .how b {
  color: var(--gold);
  font-weight: normal;
}

.panel .small {
  font-size: 13px;
  opacity: 0.55;
  margin-top: 14px;
  letter-spacing: 0.04em;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}

.button {
  font: italic 18px var(--serif);
  color: var(--cream);
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 217, 138, 0.45);
  background: rgba(255, 217, 138, 0.07);
  cursor: pointer;
  transition:
    background 0.2s,
    box-shadow 0.2s,
    transform 0.15s;
}

.button:hover {
  background: rgba(255, 217, 138, 0.16);
  box-shadow: 0 0 24px rgba(255, 210, 130, 0.25);
}

.button:active {
  transform: scale(0.97);
}

.button.primary {
  color: #2a1a08;
  background: linear-gradient(180deg, #ffe6ad, var(--gold-deep));
  border-color: transparent;
  box-shadow: 0 4px 24px rgba(255, 200, 110, 0.3);
}

.button.primary:hover {
  box-shadow: 0 4px 34px rgba(255, 200, 110, 0.55);
}

.button:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.night-select {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.night-select span {
  opacity: 0.6;
  margin-right: 6px;
}

.night-button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 217, 138, 0.35);
  background: rgba(9, 13, 36, 0.4);
  color: var(--cream);
  font: italic 15px var(--serif);
  cursor: pointer;
}

.night-button:hover {
  background: rgba(255, 217, 138, 0.16);
}

.night-button:disabled {
  opacity: 0.25;
  cursor: default;
}

.ladder-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ladder-label {
  position: absolute;
  transform: translate(-100%, -50%);
  font-size: 11px;
  letter-spacing: 0.05em;
  opacity: 0.38;
}

.ladder-label.tonic {
  color: var(--gold);
  opacity: 0.6;
}

@media (max-width: 700px) {
  .ladder-labels {
    display: none;
  }
}

.portrait-note {
  display: none;
  font-size: 13px;
  font-style: italic;
  color: var(--gold);
  opacity: 0.8;
  margin-top: 8px;
}

@media (orientation: portrait) and (max-width: 600px) {
  .portrait-note {
    display: block;
  }
  .hud-night {
    display: none;
  }
}

.toggle {
  font: 15px var(--serif);
  color: var(--cream);
  opacity: 0.75;
  background: none;
  border: none;
  cursor: pointer;
  margin-top: 14px;
  text-decoration: underline dotted rgba(255, 236, 200, 0.4);
  text-underline-offset: 4px;
}

.toggle:hover {
  opacity: 1;
}

.lullaby-line {
  font-size: 15px;
  font-style: italic;
  color: var(--gold);
  margin: -4px auto 6px;
  max-width: 460px;
  line-height: 1.5;
}

.lullaby-line span {
  color: var(--cream);
  opacity: 0.65;
  margin-right: 8px;
}

.lullaby-line span::after {
  content: ":";
}

.stats {
  display: grid;
  grid-template-columns: auto auto;
  gap: 3px 24px;
  justify-content: center;
  margin: 10px auto 4px;
  font-size: clamp(14px, 2.9vh, 17px);
}

.stats dt {
  text-align: right;
  opacity: 0.65;
}

.stats dd {
  margin: 0;
  text-align: left;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.fallback {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  font-size: 20px;
  font-style: italic;
  line-height: 1.5;
}
/*$vite$:1*/