:root {
    color-scheme: light;
    --sky: #c8f6ff;
    --ocean-top: #8ee1f8;
    --ocean-mid: #2f98bf;
    --ocean-deep: #14526d;
    --foam: rgba(255, 255, 255, 0.68);
    --sand: #f0d49a;
    --sand-dark: #d9b36c;
    --palm: #1d8751;
    --palm-dark: #105936;
    --rock: #70645d;
    --progress: rgba(200, 35, 47, 0.52);
    --milestone: #f5bf63;
    --goal: #ffe28c;
    --hud-bg: rgba(7, 33, 47, 0.52);
    --hud-border: rgba(255, 255, 255, 0.18);
    --ink: #083645;
    --paper: #f4dfb1;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    font-family: Georgia, "Times New Roman", serif;
    background:
        radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.85), transparent 18%),
        linear-gradient(180deg, var(--sky) 0%, #86ddf4 16%, #4fb5d3 44%, var(--ocean-mid) 66%, var(--ocean-deep) 100%);
}

body {
    position: fixed;
    inset: 0;
    color: #fffaf0;
}

.page-shell {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    overscroll-behavior: none;
}

.scene {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background:
        radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.7), transparent 12%),
        radial-gradient(circle at 82% 10%, rgba(255, 255, 255, 0.45), transparent 14%),
        linear-gradient(
            180deg,
            rgba(196, 236, 246, 0.96) 0%,
            rgba(210, 242, 248, 0.96) 6.8%,
            rgba(206, 239, 245, 0.97) 10.7%,
            rgba(198, 234, 242, 0.97) 11%,
            transparent 11%
        ),
        radial-gradient(circle at 20% 16%, rgba(255, 255, 255, 0.6), transparent 13%),
        radial-gradient(circle at 78% 12%, rgba(255, 255, 255, 0.56), transparent 12%),
        radial-gradient(circle at 10% 64%, rgba(255, 255, 255, 0.024), transparent 18%),
        radial-gradient(circle at 75% 58%, rgba(255, 255, 255, 0.029), transparent 14%),
        radial-gradient(circle at 34% 72%, rgba(255, 255, 255, 0.1), transparent 20%),
        radial-gradient(circle at 70% 78%, rgba(255, 255, 255, 0.08), transparent 22%),
        radial-gradient(circle at 50% 55%, rgba(255, 247, 200, 0.08), transparent 36%),
        radial-gradient(circle at 55% 90%, rgba(255, 244, 214, 0.15), transparent 20%);
}

.tropical-horizon {
    display: none;
}

.tropical-horizon::before,
.tropical-horizon::after {
    display: none;
}

.tropical-horizon::before {
    display: none;
}

.tropical-horizon::after {
    display: none;
}

.scene::before,
.scene::after {
    content: "";
    position: absolute;
    inset: auto auto 0 0;
    z-index: 1;
    width: 100%;
    height: 52%;
    background:
        radial-gradient(circle at 10% 30%, rgba(255, 255, 255, 0.1), transparent 18%),
        radial-gradient(circle at 75% 20%, rgba(255, 255, 255, 0.12), transparent 14%);
    opacity: 0.24;
    pointer-events: none;
}

.scene::before {
    display: none;
}

.scene::after {
    display: none;
    top: 32%;
    height: 55%;
    mix-blend-mode: screen;
    animation: oceanSweep 14s linear infinite;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.72) 58%, rgba(0, 0, 0, 0.24) 86%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.72) 58%, rgba(0, 0, 0, 0.24) 86%, transparent 100%);
}

.atmosphere,
.ocean-glow,
.ocean-pattern {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.atmosphere,
.ocean-glow {
    display: none;
}

.ocean-pattern {
    inset: auto;
    left: -6%;
    top: 9%;
    width: 112%;
    height: 94%;
    z-index: 0;
    opacity: 0.52;
    mix-blend-mode: screen;
    will-change: transform;
    animation: oceanPatternDrift 18s ease-in-out infinite;
}

.atmosphere-top {
    background:
        radial-gradient(circle at 20% 16%, rgba(255, 255, 255, 0.6), transparent 13%),
        radial-gradient(circle at 78% 12%, rgba(255, 255, 255, 0.56), transparent 12%);
    opacity: 0.93;
}

.atmosphere-bottom {
    background:
        radial-gradient(circle at 34% 72%, rgba(255, 255, 255, 0.1), transparent 20%),
        radial-gradient(circle at 70% 78%, rgba(255, 255, 255, 0.08), transparent 22%);
    mix-blend-mode: screen;
}

.ocean-glow {
    background:
        radial-gradient(circle at 50% 55%, rgba(255, 247, 200, 0.08), transparent 36%),
        radial-gradient(circle at 55% 90%, rgba(255, 244, 214, 0.15), transparent 20%);
}

.scene-header {
    position: absolute;
    top: 2.2vh;
    left: 2.4vw;
    max-width: min(29rem, 34vw);
    z-index: 5;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(8, 42, 58, 0.54);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.42);
}

.eyebrow {
    margin: 0;
    font-size: 0.86rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #fff4bf;
    font-weight: 700;
}

.hud {
    position: absolute;
    top: 3vh;
    right: 2.4vw;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    z-index: 5;
}

.hud-card {
    position: relative;
    min-width: 12rem;
    padding: 0.8rem 0.95rem;
    border: 1px solid var(--hud-border);
    border-radius: 1.1rem;
    background: rgba(7, 33, 47, 0.72);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.18);
}

.hud-ribbon {
    position: absolute;
    top: 0.35rem;
    right: -0.42rem;
    padding: 0.18rem 0.65rem 0.2rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #4ed06b 0%, #9af2a2 100%);
    box-shadow: 0 10px 18px rgba(39, 126, 50, 0.28);
    color: #0c3b17;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(-0.2rem) scale(0.88);
    transition:
        opacity 180ms ease,
        transform 180ms ease;
    pointer-events: none;
}

.hud-ribbon.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.hud-label {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.73rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 252, 238, 0.74);
}

.hud-progress {
    position: relative;
    width: 100%;
    height: 0.9rem;
    margin-top: 0.4rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.28);
}

.hud-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #f4c15e 0%, #ffe08d 100%);
    box-shadow: 0 0 12px rgba(255, 220, 138, 0.28);
    transition: width 260ms ease;
}

.hud-progress-fill.weeks {
    background: linear-gradient(90deg, #7fd8ff 0%, #d8f6ff 100%);
    box-shadow: 0 0 12px rgba(165, 234, 255, 0.24);
}

.hud-progress-fill.goal {
    background: linear-gradient(90deg, #ffe08d 0%, #fff3bf 100%);
}

.route-debug-panel {
    position: absolute;
    left: 2.4vw;
    top: 5.9rem;
    z-index: 6;
    width: min(20rem, 26vw);
    padding: 0.8rem 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 1rem;
    background: rgba(7, 33, 47, 0.82);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.16);
    color: rgba(255, 250, 236, 0.92);
    cursor: move;
    user-select: none;
}

.route-debug-panel.is-dragging {
    cursor: grabbing;
}

.route-debug-title {
    margin: 0;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #fff4bf;
}

.route-debug-hint {
    margin: 0.45rem 0 0.7rem;
    font-size: 0.83rem;
    line-height: 1.35;
    color: rgba(255, 250, 236, 0.8);
}

.route-debug-output {
    margin: 0;
    max-height: 14.5rem;
    overflow: auto;
    font: 0.76rem/1.45 "SFMono-Regular", "Menlo", "Monaco", monospace;
    color: #d8f6ff;
    white-space: pre-wrap;
    user-select: text;
}

.scene-frame {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
}

.scene-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.route-track {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.route-track-bg {
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 12;
}

.route-track-progress {
    stroke: rgba(205, 26, 40, 0.34);
    stroke-width: 18;
}

.waypoint-hitbox {
    fill: transparent;
    cursor: move;
}

.island-shell {
    cursor: pointer;
}

.island-group {
    transform-box: fill-box;
    transform-origin: center center;
    transition: transform 180ms ease, filter 180ms ease, opacity 220ms ease;
}

.island-group.is-hovered {
    transform: translateY(-10px) scale(1.03);
    filter: brightness(1.07) saturate(1.08);
}

.island-label {
    font-size: 16px;
    font-weight: 700;
    text-anchor: middle;
    fill: rgba(7, 46, 54, 0.9);
    pointer-events: none;
}

.boat-debug-date {
    font-size: 14px;
    font-weight: 700;
    text-anchor: middle;
    fill: rgba(255, 248, 226, 0.96);
    stroke: rgba(7, 46, 54, 0.5);
    stroke-width: 3px;
    paint-order: stroke fill;
    pointer-events: none;
}

.reveal-major {
    transition: opacity 200ms ease, filter 200ms ease;
}

.bird-sprite,
.monkey-sprite,
.water-creature,
.water-fx-shell {
    transform-box: fill-box;
    transform-origin: center center;
}

.water-fx,
.island-ripple-image,
.route-waypoint-vortex,
.boat-wave-fx,
.water-creature-wave,
.boat-image,
.water-creature-image,
.island-sprite {
    transform-box: fill-box;
    transform-origin: center center;
}

.island-sprite {
    filter: none;
}

.island-ripple-image {
    animation: foamPulse 6s linear infinite;
}

.route-waypoint-vortex {
    animation: foamPulse 6.4s linear infinite;
    cursor: grab;
}

.route-waypoint-vortex.is-dragging {
    cursor: grabbing;
}

.island-group.is-draggable {
    cursor: move;
}

.route-debug-handle {
    fill: rgba(255, 224, 141, 0.18);
    stroke: rgba(255, 246, 216, 0.9);
    stroke-width: 1.5;
    cursor: grab;
}

.route-debug-handle.is-dragging {
    fill: rgba(255, 224, 141, 0.32);
    cursor: grabbing;
}

.route-debug-index {
    fill: rgba(8, 54, 69, 0.9);
    font-size: 10px;
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}

.boat-wave-fx {
    opacity: 0;
    animation: boatWaveAppear 6.6s ease-in-out infinite;
}

.boat-wave-fx.alt {
    animation-duration: 7.4s;
    animation-delay: -2.2s;
}

.boat-wave-fx:nth-of-type(3) {
    animation-duration: 8s;
    animation-delay: -4.1s;
}

.water-creature-wave {
    animation: foamPulse 6.8s linear infinite;
}

.water-creature-wave.alt {
    animation-duration: 7.8s;
}

.boat-image {
    animation: epsiRock 4.8s ease-in-out infinite;
}

.boat-shell.is-relaxing .boat-visual {
    display: none;
}

.goal-relax-scene {
    display: none;
    transform-box: fill-box;
    transform-origin: center center;
}

.goal-relax-image {
    filter: none;
}

.boat-shell.is-relaxing .goal-relax-scene {
    display: block;
}

.boat-visual {
    transform-box: fill-box;
    transform-origin: center center;
    transition: transform 180ms ease;
}

.boat-visual.is-left {
    transform: scaleX(-1);
}

.boat-visual.is-right {
    transform: scaleX(1);
}

.boat-wrap.is-looking .boat-image {
    transform: rotate(1deg) translateY(-2px);
}

.bird-sprite {
    animation: birdFlit 5.4s ease-in-out infinite;
}

.bird-sprite.alt {
    animation-delay: -1.4s;
}

.monkey-sprite {
    animation: monkeyPeek 6.2s ease-in-out infinite;
}

.monkey-sprite.alt {
    animation-delay: -2.1s;
}

.boat-shell {
    pointer-events: none;
}

.boat-wrap {
    transform-box: fill-box;
    transform-origin: center center;
    animation: boatBob 6.4s ease-in-out infinite;
}

.boat-shell.is-relaxing .boat-wrap {
    animation: none;
}

.scroll-tooltip {
    position: absolute;
    z-index: 8;
    width: min(18rem, 26vw);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.98);
    transition:
        opacity 180ms ease,
        transform 180ms ease,
        visibility 0s linear 180ms;
}

.scroll-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    transition:
        opacity 180ms ease,
        transform 180ms ease,
        visibility 0s linear 0s;
}

.scroll-inner {
    position: relative;
    padding: 1.25rem 1.4rem 1.05rem;
    color: var(--ink);
    background:
        radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.22), transparent 20%),
        linear-gradient(180deg, #f8e9bf 0%, #f1d79f 52%, #dfbe81 100%);
    border: 2px solid rgba(120, 70, 22, 0.35);
    border-radius: 1.3rem 1.1rem 1.4rem 1.2rem;
    box-shadow: 0 20px 38px rgba(0, 0, 0, 0.25);
}

.scroll-inner::before,
.scroll-inner::after {
    content: "";
    position: absolute;
    top: 0.9rem;
    bottom: 0.9rem;
    width: 0.62rem;
    background: linear-gradient(180deg, #c08b43 0%, #8f5c1e 100%);
    border-radius: 999px;
}

.scroll-inner::before {
    left: -0.34rem;
}

.scroll-inner::after {
    right: -0.34rem;
}

.scroll-week {
    margin: 0;
    font-size: 0.74rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(8, 54, 69, 0.7);
}

.scroll-inner h2 {
    margin: 0.35rem 0 0.7rem;
    font-size: 1.18rem;
    line-height: 1.05;
}

.scroll-inner dl {
    margin: 0;
    display: grid;
    gap: 0.45rem;
}

.scroll-inner dl div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.98rem;
}

.scroll-inner dt {
    font-weight: 700;
}

.scroll-inner dd {
    margin: 0;
    text-align: right;
}

@keyframes oceanSweep {
    0% {
        transform: translateX(-1.2%) translateY(0);
    }
    50% {
        transform: translateX(1.2%) translateY(0.8%);
    }
    100% {
        transform: translateX(-1.2%) translateY(0);
    }
}

@keyframes oceanPatternDrift {
    0% {
        transform: translate3d(-1.6%, 0.2%, 0);
    }
    50% {
        transform: translate3d(1.8%, -0.4%, 0);
    }
    100% {
        transform: translate3d(-1.6%, 0.2%, 0);
    }
}

@keyframes boatBob {
    0%,
    100% {
        transform: translateY(0) rotate(-1.4deg);
    }
    50% {
        transform: translateY(-8px) rotate(1.6deg);
    }
}

@keyframes epsiRock {
    0%,
    100% {
        transform: rotate(-1deg);
    }
    50% {
        transform: rotate(2deg);
    }
}

@keyframes foamPulse {
    0%,
    100% {
        opacity: 0.2;
    }
    50% {
        opacity: 0.48;
    }
}

@keyframes boatWaveAppear {
    0% {
        opacity: 0;
        transform: scale(0.78) translateY(4px);
    }
    18% {
        opacity: 0.32;
        transform: scale(0.92) translateY(2px);
    }
    46% {
        opacity: 0.52;
        transform: scale(1.06) translateY(0);
    }
    74% {
        opacity: 0.28;
        transform: scale(1.12) translateY(-1px);
    }
    100% {
        opacity: 0;
        transform: scale(0.86) translateY(-3px);
    }
}

@keyframes birdFlit {
    0%,
    100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-6px) scale(1.04);
    }
}

@keyframes monkeyPeek {
    0%,
    100% {
        transform: translateX(-3px) rotate(-2deg);
    }
    50% {
        transform: translateX(5px) rotate(2deg);
    }
}

@media (max-width: 1100px) {
    .scene-header {
        max-width: 42vw;
    }

    .hud {
        gap: 0.55rem;
    }

    .hud-card {
        min-width: 7rem;
    }

    .route-debug-panel {
        width: min(17rem, 42vw);
    }
}

@media (max-aspect-ratio: 1/1) {
    .scene-header {
        top: 1rem;
        max-width: 60vw;
    }

    .hud {
        top: 1rem;
        right: 1rem;
        bottom: auto;
        flex-direction: column;
        align-items: stretch;
        max-width: min(13rem, 34vw);
    }

    .scene-svg {
        width: 100vw;
        height: auto;
    }

    .route-debug-panel {
        top: auto;
        bottom: 5.7rem;
        width: min(15rem, 44vw);
    }
}
