/* Ripple: minimal, calm, dark. No chrome, just the surface. */

:root {
    /* Deep blue-gray, near-black base. Modes shift this slightly. */
    --bg-window: #070a0f;
    --bg-pond: #071012;
    --ink: rgba(200, 224, 255, 0.85);
    --muted: rgba(180, 210, 200, 0.55);
    /* Handmade pond scrollbars: water channel + reed/pebble thumb. */
    --scroll-track: rgba(6, 18, 16, 0.55);
    --scroll-track-edge: rgba(90, 130, 110, 0.18);
    --scroll-thumb: rgba(132, 168, 148, 0.55);
    --scroll-thumb-mid: rgba(168, 196, 170, 0.62);
    --scroll-thumb-tip: rgba(198, 214, 188, 0.72);
    --scroll-thumb-hover: rgba(186, 210, 192, 0.78);
    --scroll-thumb-active: rgba(210, 224, 200, 0.88);
    --scroll-moss: rgba(70, 110, 88, 0.45);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

/*
 * Chromium / Safari / Electron:
 * Soft water-tint track with inset channel, pebble/reed thumb,
 * moss edge. Readable min size via padding-box border.
 */
*::-webkit-scrollbar {
    width: 11px;
    height: 11px;
}

*::-webkit-scrollbar-track {
    background:
        linear-gradient(90deg, var(--scroll-track-edge), transparent 28%, transparent 72%, var(--scroll-track-edge)),
        linear-gradient(180deg, rgba(12, 28, 24, 0.35), var(--scroll-track) 40%, rgba(4, 12, 10, 0.55));
    border-radius: 999px;
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.45),
        inset 0 -1px 0 rgba(140, 170, 150, 0.08);
    margin: 2px;
}

*::-webkit-scrollbar-thumb {
    background:
        linear-gradient(160deg, var(--scroll-thumb-tip) 0%, var(--scroll-thumb-mid) 42%, var(--scroll-thumb) 100%);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
    box-shadow:
        inset 0 1px 0 rgba(230, 240, 220, 0.22),
        inset 0 -1px 1px rgba(40, 70, 55, 0.35),
        0 0 0 1px var(--scroll-moss);
    min-height: 28px;
    min-width: 28px;
}

*::-webkit-scrollbar-thumb:hover {
    background:
        linear-gradient(160deg, rgba(220, 232, 210, 0.88) 0%, var(--scroll-thumb-hover) 48%, rgba(150, 180, 158, 0.7) 100%);
    border: 2px solid transparent;
    background-clip: padding-box;
    box-shadow:
        inset 0 1px 0 rgba(240, 248, 230, 0.28),
        inset 0 -1px 1px rgba(40, 70, 55, 0.3),
        0 0 0 1px rgba(100, 140, 115, 0.55);
}

*::-webkit-scrollbar-thumb:active {
    background:
        linear-gradient(160deg, var(--scroll-thumb-active) 0%, rgba(160, 188, 168, 0.8) 100%);
    border: 2px solid transparent;
    background-clip: padding-box;
    box-shadow:
        inset 0 1px 2px rgba(20, 40, 30, 0.4),
        0 0 0 1px rgba(90, 130, 105, 0.5);
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-window);
}

body {
    cursor: crosshair;
    transition: background 1.2s ease;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Dev-only kill tool: subtle cursor change while the secret menu mode is armed. */
body.dev-kill-tool,
body.dev-kill-tool canvas {
    cursor: cell;
}

body.pond {
    background: var(--bg-pond);
}

#surface {
    display: block;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    touch-action: none; /* let us handle all pointer gestures ourselves */
    opacity: 0;
    animation: surface-in 1.1s ease forwards;
}

@keyframes surface-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Hide/show chrome: always reachable, even when other menus are off. */
#ui-toggle {
    position: fixed;
    top: max(18px, env(safe-area-inset-top, 0px));
    right: max(56px, calc(16px + env(safe-area-inset-right, 0px)));
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--ink);
    opacity: 0.18;
    transition: opacity 0.4s ease, right 0.35s ease;
    z-index: 12;
}

#ui-toggle:hover,
#ui-toggle:focus-visible {
    opacity: 0.75;
    outline: none;
    box-shadow: 0 0 0 2px rgba(140, 200, 170, 0.22);
}

#ui-toggle:active {
    transform: scale(0.94);
}

body.ui-hidden #ui-toggle {
    right: 18px;
    opacity: 0.12;
}

body.ui-hidden #ui-toggle:hover,
body.ui-hidden #ui-toggle:focus-visible {
    opacity: 0.65;
}

/* Guide entry: own corner (top-left), separate from mode / menu chrome. */
#guide-btn {
    position: fixed;
    top: max(18px, env(safe-area-inset-top, 0px));
    left: max(18px, env(safe-area-inset-left, 0px));
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--ink);
    opacity: 0.22;
    transition: opacity 0.4s ease;
    z-index: 12;
}

#guide-btn:hover,
#guide-btn:focus-visible,
#guide-btn[aria-pressed="true"] {
    opacity: 0.8;
    outline: none;
    box-shadow: 0 0 0 2px rgba(140, 200, 170, 0.22);
}

#guide-btn:active {
    transform: scale(0.94);
}

body.ui-hidden #guide-btn {
    opacity: 0.14;
}

body.ui-hidden #guide-btn:hover,
body.ui-hidden #guide-btn:focus-visible,
body.ui-hidden #guide-btn[aria-pressed="true"] {
    opacity: 0.7;
}

.ico-guide {
    width: 14px;
    height: 14px;
    border: 1.4px solid currentColor;
    border-radius: 2px;
    position: relative;
}

.ico-guide::before {
    content: "";
    position: absolute;
    left: 2px;
    right: 2px;
    top: 3px;
    height: 1.4px;
    background: currentColor;
    box-shadow: 0 3px 0 currentColor, 0 6px 0 currentColor;
    opacity: 0.9;
}

.ico-ui {
    width: 12px;
    height: 10px;
    background:
        linear-gradient(currentColor, currentColor) 0 0 / 100% 1.5px no-repeat,
        linear-gradient(currentColor, currentColor) 0 4.25px / 100% 1.5px no-repeat,
        linear-gradient(currentColor, currentColor) 0 8.5px / 100% 1.5px no-repeat;
}

body.ui-hidden .ico-ui {
    opacity: 0.85;
    background:
        linear-gradient(currentColor, currentColor) 0 4.25px / 100% 1.5px no-repeat;
}

/* Minimal corner toggle: an icon only, faint until hovered. */
#mode-toggle {
    position: fixed;
    top: max(18px, env(safe-area-inset-top, 0px));
    right: max(18px, env(safe-area-inset-right, 0px));
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0.18;
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 10;
}

#mode-toggle:hover,
#mode-toggle:focus-visible {
    opacity: 0.75;
    outline: none;
    box-shadow: 0 0 0 2px rgba(140, 200, 170, 0.22);
}

#mode-toggle:active {
    transform: scale(0.94);
}

/* Immersive mode: every menu except the UI toggle itself. */
body.ui-hidden #mode-toggle,
body.ui-hidden #gold-counter,
body.ui-hidden #pond-controls,
body.ui-hidden #window-controls,
body.ui-hidden #market-panel,
body.ui-hidden #progress-panel,
body.ui-hidden #registry-panel,
body.ui-hidden #tunes-panel,
body.ui-hidden #rhythm-panel,
body.ui-hidden #food-stash,
body.ui-hidden #hint {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden;
}

/* Guide overlays stay usable even when chrome is hidden. */
body.ui-hidden #guide-gate.open,
body.ui-hidden #guide-panel.open {
    opacity: 1 !important;
    pointer-events: auto !important;
    visibility: visible;
}

/* Open dev panel stays usable even when chrome is hidden. */
body.ui-hidden #dev-panel.open {
    opacity: 0.96 !important;
    pointer-events: auto !important;
    visibility: visible;
}

/* Icon is drawn with pure CSS so there are no image assets. */
#mode-icon {
    position: relative;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--ink);
    border-radius: 50%;
    display: block;
}

/* Window mode: a small vertical divider hints at glass. */
body:not(.pond) #mode-icon::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1.5px;
    background: var(--ink);
    transform: translateX(-50%);
}

/* Pond mode: a small inner ring hints at concentric ripples. */
body.pond #mode-icon::after {
    content: "";
    position: absolute;
    inset: 4px;
    border: 1.5px solid var(--ink);
    border-radius: 50%;
    opacity: 0.7;
}

/* Gold tally sits under the guide button so the top-left corner stays clear. */
#gold-counter {
    position: fixed;
    left: max(16px, env(safe-area-inset-left, 0px));
    top: max(56px, calc(38px + env(safe-area-inset-top, 0px)));
    z-index: 10;
    display: none;
    align-items: center;
    gap: 6px;
    color: rgba(230, 200, 100, 0.85);
    font: 300 13px/1 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.08em;
    opacity: 0.35;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

body.pond #gold-counter {
    display: flex;
}

#gold-counter.active {
    opacity: 0.9;
}

#gold-count {
    min-width: 0.7em;
    text-align: right;
}

.ico-gold {
    width: 12px;
    height: 10px;
    border: 1.4px solid currentColor;
    border-radius: 50% 45% 50% 45%;
    box-shadow: inset 0 0 0 1px rgba(255, 220, 120, 0.15);
}

/* Pond aesthetics + drop sound: tucked bottom-left, quiet until hovered. */
#pond-controls {
    position: fixed;
    left: max(16px, env(safe-area-inset-left, 0px));
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    display: none;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
    opacity: 0.2;
    transition: opacity 0.4s ease;
}

body.pond #pond-controls {
    display: flex;
}

#pond-controls:hover,
#pond-controls:focus-within {
    opacity: 0.85;
}

/* Touch screens: no hover, so keep controls a little easier to spot. */
@media (pointer: coarse) {
    #pond-controls,
    #window-controls {
        opacity: 0.48;
    }

    #pond-controls:focus-within,
    #window-controls:focus-within {
        opacity: 0.88;
    }

    .scenery-btn,
    #ambient-btn,
    #drop-sound-btn,
    #looks-btn,
    #hats-btn,
    #market-btn,
    #progress-btn,
    #catcher-btn,
    #picker-btn,
    #tunes-btn,
    #rhythm-btn,
    #food-btn,
    #net-btn {
        width: 40px;
        min-height: 40px;
    }

    #ui-toggle,
    #mode-toggle {
        width: 40px;
        height: 40px;
    }
}

/* Window mode chrome: rhythm studio entry, same quiet corner feel. */
#window-controls {
    position: fixed;
    left: max(16px, env(safe-area-inset-left, 0px));
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    display: none;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
    opacity: 0.22;
    transition: opacity 0.4s ease;
}

body:not(.pond) #window-controls {
    display: flex;
}

#window-controls:hover,
#window-controls:focus-within {
    opacity: 0.85;
}

/* Looks button + horizontal aesthetic flyout (no scrollbar chrome). */
#looks-wrap {
    position: relative;
}

#looks-panel {
    position: absolute;
    left: calc(100% + 8px);
    bottom: 0;
    display: none;
    flex-flow: row wrap;
    align-content: flex-end;
    gap: 6px;
    width: max-content;
    max-width: min(248px, calc(100vw - 72px));
    padding: 6px;
    border-radius: 12px;
    border: 1px solid rgba(180, 210, 200, 0.22);
    background: rgba(8, 16, 18, 0.55);
    overflow: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    z-index: 12;
}

#looks-panel::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

#looks-panel.open {
    display: flex;
}

#looks-panel .scenery-btn,
#looks-panel #hats-btn,
#looks-panel #night-btn,
#looks-panel #crystal-btn {
    flex: 0 0 34px;
}

/* Narrow viewports: keep the grid compact, still wrap instead of scroll. */
@media (max-width: 420px) {
    #looks-panel {
        max-width: min(168px, calc(100vw - 64px));
    }
}

.scenery-btn,
#ambient-btn,
#sound-level,
#drop-sound-btn,
#looks-btn,
#hats-btn,
#market-btn,
#progress-btn,
#catcher-btn,
#picker-btn,
#tunes-btn,
#rhythm-btn,
#food-btn,
#net-btn {
    width: 34px;
    min-height: 34px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: transparent;
    border: 1px solid rgba(180, 210, 200, 0.28);
    border-radius: 10px;
    cursor: pointer;
    color: var(--muted);
    padding: 6px 0;
    transition: border-color 0.3s ease, color 0.3s ease, opacity 0.3s ease, transform 0.12s ease, box-shadow 0.2s ease, background 0.25s ease;
}

.scenery-btn:hover,
#ambient-btn:hover,
#sound-level:hover,
#drop-sound-btn:hover,
#looks-btn:hover,
#hats-btn:hover,
#market-btn:hover,
#progress-btn:hover,
#catcher-btn:hover,
#picker-btn:hover,
#tunes-btn:hover,
#rhythm-btn:hover,
#food-btn:hover,
#net-btn:hover,
.scenery-btn:focus-visible,
#ambient-btn:focus-visible,
#sound-level:focus-within,
#drop-sound-btn:focus-visible,
#looks-btn:focus-visible,
#hats-btn:focus-visible,
#market-btn:focus-visible,
#progress-btn:focus-visible,
#catcher-btn:focus-visible,
#picker-btn:focus-visible,
#tunes-btn:focus-visible,
#rhythm-btn:focus-visible,
#food-btn:focus-visible,
#net-btn:focus-visible {
    outline: none;
    border-color: rgba(200, 224, 210, 0.55);
    color: var(--ink);
    box-shadow: 0 0 0 2px rgba(140, 200, 170, 0.22);
}

.scenery-btn:active,
#ambient-btn:active,
#drop-sound-btn:active,
#looks-btn:active,
#hats-btn:active,
#market-btn:active,
#progress-btn:active,
#catcher-btn:active,
#picker-btn:active,
#tunes-btn:active,
#rhythm-btn:active,
#food-btn:active,
#net-btn:active {
    transform: scale(0.94);
    border-color: rgba(160, 200, 170, 0.65);
    transition: transform 0.08s ease, border-color 0.08s ease;
}

.scenery-btn.on,
#looks-btn.on,
#hats-btn.on,
#market-btn.on,
#progress-btn.on,
#catcher-btn.on,
#picker-btn.on,
#food-btn.on,
#net-btn.on {
    border-color: rgba(160, 200, 170, 0.55);
    color: rgba(200, 230, 210, 0.9);
    background: rgba(60, 100, 88, 0.18);
}

#food-btn:not(.on) .ico-food {
    opacity: 0.55;
}

#food-btn:not(.on) .ico-food::before {
    content: "";
    position: absolute;
    left: -1px;
    right: -1px;
    top: 50%;
    height: 1.5px;
    background: currentColor;
    transform: rotate(-38deg);
    opacity: 0.75;
    box-shadow: none;
}

.scenery-btn:not(.on) {
    opacity: 0.45;
}

#hats-btn.locked,
#market-btn.locked,
#night-btn.locked,
#crystal-btn.locked {
    opacity: 0.42;
    border-style: dashed;
    border-color: rgba(200, 170, 80, 0.35);
    color: rgba(220, 190, 100, 0.7);
    cursor: not-allowed;
}

#hats-btn.locked.ready,
#market-btn.locked.ready {
    opacity: 0.9;
    border-color: rgba(230, 200, 90, 0.75);
    color: rgba(255, 230, 140, 0.95);
    box-shadow: 0 0 10px rgba(220, 180, 60, 0.18);
}

#hats-btn:not(.locked):not(.on),
#market-btn:not(.locked):not(.on) {
    opacity: 0.45;
}

#hats-cost,
#market-cost,
#night-lock,
#crystal-lock {
    font: 300 9px/1 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.06em;
    color: rgba(235, 200, 90, 0.95);
}

#hats-btn:not(.locked) #hats-cost,
#market-btn:not(.locked) #market-cost,
#night-btn:not(.locked) #night-lock,
#crystal-btn:not(.locked) #crystal-lock {
    display: none;
}

#catcher-btn[hidden],
#picker-btn[hidden] {
    display: none !important;
}

#drop-sound-btn {
    width: auto;
    min-width: 34px;
    padding: 6px 8px;
}

#sound-level {
    width: auto;
    min-width: 34px;
    min-height: 34px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 8px;
    background: transparent;
    border: 1px solid rgba(180, 210, 200, 0.28);
    border-radius: 10px;
    cursor: default;
    color: var(--muted);
    transition: border-color 0.3s ease, color 0.3s ease, opacity 0.3s ease;
}

#sound-level-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 72px;
    height: 4px;
    border-radius: 999px;
    background: rgba(180, 210, 200, 0.28);
    outline: none;
    cursor: pointer;
}

#sound-level-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: rgba(200, 230, 210, 0.9);
    border: 1px solid rgba(160, 200, 170, 0.55);
    cursor: pointer;
}

#sound-level-slider::-moz-range-thumb {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: rgba(200, 230, 210, 0.9);
    border: 1px solid rgba(160, 200, 170, 0.55);
    cursor: pointer;
}

.ico-vol {
    width: 12px;
    height: 10px;
    border: 1.3px solid currentColor;
    border-radius: 2px 6px 6px 2px;
    box-shadow: inset -3px 0 0 -1px currentColor;
}

#drop-sound-label {
    font: 300 9px/1 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    color: inherit;
}

/* Tiny CSS icons for the pond controls. */
.ico {
    display: block;
    position: relative;
    width: 14px;
    height: 14px;
}

.ico-looks {
    width: 12px;
    height: 12px;
    border: 1.4px solid currentColor;
    border-radius: 3px;
    position: relative;
}

.ico-looks::before {
    content: "";
    position: absolute;
    left: 2px;
    right: 2px;
    top: 2px;
    height: 2px;
    background: currentColor;
    box-shadow: 0 3px 0 currentColor, 0 6px 0 currentColor;
    opacity: 0.85;
}

.ico-stone {
    width: 11px;
    height: 8px;
    border: 1.4px solid currentColor;
    border-radius: 40% 50% 45% 55%;
}

.ico-stick {
    width: 12px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transform: rotate(-28deg);
    margin-top: 6px;
}

.ico-reed {
    width: 2px;
    height: 12px;
    background: currentColor;
    border-radius: 2px;
    margin: 0 auto;
    box-shadow: 4px 1px 0 0 currentColor, -4px 2px 0 0 currentColor;
}

.ico-lily {
    width: 12px;
    height: 12px;
    border: 1.4px solid currentColor;
    border-radius: 50%;
    border-right-color: transparent;
    transform: rotate(-20deg);
}

.ico-cattail {
    width: 2px;
    height: 11px;
    background: currentColor;
    border-radius: 2px;
    margin: 0 auto;
    box-shadow: none;
}

.ico-cattail::after {
    content: "";
    position: absolute;
    left: -2px;
    top: 0;
    width: 6px;
    height: 7px;
    border: 1.3px solid currentColor;
    border-radius: 3px;
    background: transparent;
}

.ico-duckweed {
    width: 12px;
    height: 10px;
}

.ico-duckweed::before,
.ico-duckweed::after {
    content: "";
    position: absolute;
    width: 5px;
    height: 4px;
    border: 1.2px solid currentColor;
    border-radius: 50%;
}

.ico-duckweed::before { left: 0; top: 3px; }
.ico-duckweed::after { right: 0; top: 1px; }

.ico-debris {
    width: 11px;
    height: 8px;
    border: 1.4px solid currentColor;
    border-radius: 45% 40% 50% 55%;
    transform: rotate(12deg);
}

.ico-bed {
    width: 12px;
    height: 8px;
    border: 1.3px solid currentColor;
    border-radius: 2px 2px 40% 40%;
    box-shadow: inset 0 -2px 0 0 currentColor;
}

.ico-sun {
    width: 10px;
    height: 10px;
    border: 1.4px solid currentColor;
    border-radius: 50%;
    box-shadow:
        0 -4px 0 -2.5px currentColor,
        0 4px 0 -2.5px currentColor,
        -4px 0 0 -2.5px currentColor,
        4px 0 0 -2.5px currentColor;
}

.ico-moon {
    width: 11px;
    height: 11px;
    border: 1.4px solid currentColor;
    border-radius: 50%;
    box-shadow: inset -3px -1px 0 -1px currentColor;
    background: transparent;
}

.ico-crystal {
    width: 10px;
    height: 12px;
    border: 1.3px solid currentColor;
    clip-path: polygon(50% 0%, 100% 35%, 80% 100%, 20% 100%, 0% 35%);
    border-radius: 0;
    background: transparent;
    box-shadow: inset 0 -2px 0 -1px currentColor;
}

.ico-frog {
    width: 12px;
    height: 10px;
    border: 1.3px solid currentColor;
    border-radius: 45% 50% 40% 45%;
}

.ico-frog::before,
.ico-frog::after {
    content: "";
    position: absolute;
    width: 2.5px;
    height: 2.5px;
    border: 1.1px solid currentColor;
    border-radius: 50%;
    top: -1px;
}

.ico-frog::before { left: 1px; }
.ico-frog::after { right: 1px; }

.ico-food {
    width: 10px;
    height: 10px;
    margin-top: 2px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.18);
}

.ico-food::after {
    content: "";
    position: absolute;
    left: 2px;
    top: 2px;
    width: 3px;
    height: 3px;
    background: currentColor;
    border-radius: 50%;
    opacity: 0.5;
}

.ico-net {
    width: 12px;
    height: 12px;
    border: 1.4px solid currentColor;
    border-radius: 50%;
    box-shadow: inset 0 0 0 0.5px currentColor;
}

.ico-net::before {
    content: "";
    position: absolute;
    left: 5px;
    top: -3px;
    width: 1.4px;
    height: 5px;
    background: currentColor;
    border-radius: 1px;
    transform: rotate(28deg);
}

.ico-market {
    width: 12px;
    height: 11px;
    border: 1.3px solid currentColor;
    border-radius: 2px;
    box-shadow: inset 0 -3px 0 -1px currentColor;
}

.ico-market::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 2px;
    width: 6px;
    height: 1.4px;
    background: currentColor;
    box-shadow: 0 3px 0 0 currentColor;
}

.ico-save {
    width: 11px;
    height: 12px;
    border: 1.35px solid currentColor;
    border-radius: 2px;
    background: transparent;
}

.ico-save::before {
    content: "";
    position: absolute;
    left: 2px;
    right: 2px;
    top: 2px;
    height: 3px;
    border: 1.2px solid currentColor;
    border-bottom: none;
    border-radius: 1px 1px 0 0;
}

.ico-save::after {
    content: "";
    position: absolute;
    left: 3px;
    right: 3px;
    bottom: 2px;
    height: 3px;
    background: currentColor;
    opacity: 0.85;
}

.ico-catcher {
    width: 12px;
    height: 12px;
    border: 1.4px solid currentColor;
    border-radius: 50%;
}

.ico-catcher::after {
    content: "";
    position: absolute;
    left: 2px;
    top: 2px;
    width: 6px;
    height: 6px;
    border: 1.2px dashed currentColor;
    border-radius: 50%;
    opacity: 0.75;
}

.ico-picker {
    width: 12px;
    height: 12px;
}

.ico-picker::before {
    content: "";
    position: absolute;
    left: 1px;
    top: 5px;
    width: 10px;
    height: 5px;
    border: 1.3px solid currentColor;
    border-radius: 0 0 5px 5px;
    border-top: none;
}

.ico-picker::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 5px;
    border: 1.3px solid currentColor;
    border-bottom: none;
    border-radius: 3px 3px 0 0;
}

.ico-hat {
    width: 12px;
    height: 10px;
}

.ico-hat::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 0;
    width: 6px;
    height: 5px;
    border: 1.3px solid currentColor;
    border-bottom: none;
    border-radius: 2px 2px 0 0;
}

.ico-hat::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 1px;
    width: 12px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}

.ico-sound {
    width: 10px;
    height: 8px;
    border: 1.4px solid currentColor;
    border-left: none;
    border-radius: 0 8px 8px 0;
    margin-left: 2px;
}

.ico-sound::before {
    content: "";
    position: absolute;
    left: -4px;
    top: 1px;
    width: 3px;
    height: 4px;
    background: currentColor;
}

/* Quiet market popup: icon tile grid above pond controls. */
#market-panel {
    position: fixed;
    left: max(58px, calc(16px + env(safe-area-inset-left, 0px) + 42px));
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    z-index: 11;
    display: none;
    flex-direction: column;
    gap: 6px;
    width: min(292px, calc(100vw - 72px));
    padding: 9px 9px 8px;
    background: rgba(12, 22, 20, 0.48);
    border: 1px solid rgba(180, 210, 200, 0.18);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(4, 10, 8, 0.28);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

body.pond #market-panel.open {
    display: flex;
    opacity: 0.82;
    pointer-events: auto;
}

body.pond #market-panel.open:hover,
body.pond #market-panel.open:focus-within {
    opacity: 0.96;
}

/* Progress panel: same quiet chrome as market, free local saves only. */
#progress-panel {
    position: fixed;
    left: max(58px, calc(16px + env(safe-area-inset-left, 0px) + 42px));
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    z-index: 11;
    display: none;
    flex-direction: column;
    gap: 4px;
    min-width: 176px;
    padding: 8px 8px 7px;
    background: rgba(12, 22, 20, 0.48);
    border: 1px solid rgba(180, 210, 200, 0.18);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(4, 10, 8, 0.28);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

body.pond #progress-panel.open {
    display: flex;
    opacity: 0.78;
    pointer-events: auto;
}

body.pond #progress-panel.open:hover,
body.pond #progress-panel.open:focus-within {
    opacity: 0.95;
}

#registry-panel {
    position: fixed;
    left: max(58px, calc(16px + env(safe-area-inset-left, 0px) + 42px));
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    z-index: 11;
    display: none;
    flex-direction: column;
    gap: 8px;
    width: min(440px, calc(100vw - 80px));
    max-height: min(520px, calc(100vh - 48px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
    padding: 10px 10px 9px;
    background: rgba(12, 22, 20, 0.52);
    border: 1px solid rgba(180, 210, 200, 0.18);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(4, 10, 8, 0.28);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

body.pond #registry-panel.open {
    display: flex;
    opacity: 0.88;
    pointer-events: auto;
}

body.pond #registry-panel.open:hover,
body.pond #registry-panel.open:focus-within {
    opacity: 0.97;
}

.registry-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 0 2px;
    font: 300 11px/1.2 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.06em;
    color: rgba(210, 230, 220, 0.82);
}

#registry-count {
    font-size: 10px;
    letter-spacing: 0.04em;
    color: rgba(180, 210, 200, 0.55);
}

.registry-blurb {
    margin: 0;
    padding: 0 2px;
    font: 300 11px/1.45 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.02em;
    color: rgba(190, 215, 205, 0.62);
}

.registry-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.registry-tab {
    margin: 0;
    padding: 4px 8px;
    background: transparent;
    border: 1px solid rgba(180, 210, 200, 0.16);
    border-radius: 6px;
    color: rgba(200, 220, 210, 0.62);
    font: 300 10px/1.2 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease;
}

.registry-tab:hover,
.registry-tab:focus-visible {
    outline: none;
    border-color: rgba(200, 224, 210, 0.4);
    color: rgba(235, 245, 240, 0.92);
}

.registry-tab.on {
    border-color: rgba(200, 224, 210, 0.45);
    color: rgba(235, 245, 240, 0.95);
    background: rgba(180, 210, 200, 0.1);
}

.registry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 6px;
    overflow: auto;
    padding: 2px 4px 2px 2px;
    max-height: 300px;
}

.registry-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin: 0;
    padding: 8px 4px 6px;
    background: transparent;
    border: 1px solid rgba(180, 210, 200, 0.14);
    border-radius: 8px;
    color: rgba(210, 230, 220, 0.78);
    cursor: pointer;
    transition: border-color 0.25s ease, background 0.25s ease;
}

.registry-card:hover,
.registry-card:focus-visible {
    outline: none;
    border-color: rgba(200, 224, 210, 0.4);
    background: rgba(180, 210, 200, 0.06);
}

.registry-card.selected {
    border-color: rgba(200, 224, 210, 0.5);
    background: rgba(180, 210, 200, 0.1);
}

.registry-card.locked {
    cursor: default;
    opacity: 0.78;
}

.registry-preview {
    width: 68px;
    height: 42px;
    display: block;
    border-radius: 6px;
    background: rgba(8, 14, 12, 0.35);
    pointer-events: none;
}

.registry-card.locked .registry-preview {
    background: rgba(6, 10, 9, 0.5);
}

.registry-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font: 300 9px/1.2 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.03em;
    color: rgba(200, 220, 210, 0.7);
    text-align: center;
}

.registry-card.locked .registry-name {
    color: rgba(140, 160, 150, 0.45);
}

.registry-detail {
    min-height: 2.6em;
    padding: 6px 8px;
    border: 1px solid rgba(180, 210, 200, 0.12);
    border-radius: 7px;
    font: 300 11px/1.45 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.02em;
    color: rgba(200, 220, 210, 0.72);
}

.market-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 0 2px 2px;
    font: 300 10px/1 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.06em;
    color: rgba(200, 220, 210, 0.55);
}

.market-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
}

@media (max-width: 420px) {
    #market-panel {
        width: min(240px, calc(100vw - 72px));
    }

    .market-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.market-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    margin: 0;
    min-height: 68px;
    padding: 7px 4px 5px;
    background: rgba(18, 32, 28, 0.35);
    border: 1px solid rgba(180, 210, 200, 0.14);
    border-radius: 8px;
    color: rgba(210, 230, 220, 0.82);
    cursor: pointer;
    transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease, opacity 0.25s ease;
}

.market-tile:hover:not(:disabled),
.market-tile:focus-visible:not(:disabled) {
    outline: none;
    border-color: rgba(200, 224, 210, 0.42);
    background: rgba(180, 210, 200, 0.1);
    color: rgba(235, 245, 240, 0.95);
    box-shadow: 0 0 0 2px rgba(140, 200, 170, 0.16);
}

.market-tile.can-buy {
    border-color: rgba(170, 210, 150, 0.38);
    background: rgba(60, 100, 80, 0.12);
}

.market-tile.can-buy:hover:not(:disabled),
.market-tile.can-buy:focus-visible:not(:disabled) {
    border-color: rgba(190, 230, 170, 0.55);
    box-shadow: 0 0 0 2px rgba(150, 210, 140, 0.22);
}

.market-tile:active:not(:disabled) {
    transform: scale(0.96);
    transition: transform 0.08s ease, border-color 0.08s ease;
}

.market-tile:disabled:not(.owned) {
    opacity: 0.32;
    border-style: dashed;
}

.market-tile:disabled {
    opacity: 0.4;
    cursor: default;
}

.market-tile.owned {
    opacity: 0.72;
    border-color: rgba(180, 210, 200, 0.22);
    background: rgba(180, 210, 200, 0.06);
}

.market-tile.owned:disabled {
    opacity: 0.72;
}

.market-tile-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font: 300 9px/1.15 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.03em;
    text-align: center;
    color: inherit;
}

.market-tile-cost {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font: 300 8px/1.1 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.02em;
    text-align: center;
    color: rgba(180, 210, 200, 0.52);
}

.market-tile.owned .market-tile-cost {
    color: rgba(190, 215, 205, 0.62);
}

.market-ico {
    display: block;
    position: relative;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-bottom: 1px;
    color: rgba(210, 230, 220, 0.88);
}

.market-ico-magnet {
    width: 14px;
    height: 16px;
    border: 1.5px solid currentColor;
    border-top: none;
    border-radius: 0 0 8px 8px;
    margin-top: 2px;
}

.market-ico-magnet::before,
.market-ico-magnet::after {
    content: "";
    position: absolute;
    top: -3px;
    width: 4px;
    height: 5px;
    background: currentColor;
    border-radius: 1px;
}

.market-ico-magnet::before { left: -1.5px; }
.market-ico-magnet::after { right: -1.5px; }

.market-ico-catcher {
    width: 16px;
    height: 16px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
}

.market-ico-catcher::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 8px;
    height: 8px;
    border: 1.2px dashed currentColor;
    border-radius: 50%;
    opacity: 0.75;
}

.market-ico-catcher-up {
    width: 16px;
    height: 16px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
}

.market-ico-catcher-up::before {
    content: "";
    position: absolute;
    left: 1px;
    top: 1px;
    right: 1px;
    bottom: 1px;
    border: 1.2px solid currentColor;
    border-radius: 50%;
    opacity: 0.55;
}

.market-ico-catcher-up::after {
    content: "";
    position: absolute;
    left: 3.5px;
    top: 3.5px;
    width: 7px;
    height: 7px;
    border: 1.1px dashed currentColor;
    border-radius: 50%;
    opacity: 0.8;
}

.market-ico-picker {
    width: 16px;
    height: 16px;
}

.market-ico-picker::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 7px;
    width: 12px;
    height: 7px;
    border: 1.4px solid currentColor;
    border-radius: 0 0 7px 7px;
    border-top: none;
}

.market-ico-picker::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 6px;
    height: 7px;
    border: 1.4px solid currentColor;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
}

.market-ico-pet {
    width: 16px;
    height: 14px;
    margin-top: 2px;
}

.market-ico-pet::before {
    content: "";
    position: absolute;
    left: 4px;
    bottom: 0;
    width: 8px;
    height: 8px;
    border: 1.4px solid currentColor;
    border-radius: 50% 50% 45% 45%;
}

.market-ico-pet::after {
    content: "";
    position: absolute;
    left: 1px;
    top: 1px;
    width: 3.5px;
    height: 3.5px;
    border: 1.3px solid currentColor;
    border-radius: 50%;
    box-shadow:
        5.5px -1px 0 -0.1px currentColor,
        11px 1px 0 -0.1px currentColor,
        3px 5px 0 -0.15px currentColor;
}

.market-ico-current {
    width: 16px;
    height: 14px;
    margin-top: 2px;
}

.market-ico-current::before,
.market-ico-current::after {
    content: "";
    position: absolute;
    left: 1px;
    right: 1px;
    height: 4px;
    border: 1.3px solid currentColor;
    border-top: none;
    border-radius: 0 0 10px 10px;
}

.market-ico-current::before { top: 1px; }
.market-ico-current::after { top: 7px; opacity: 0.7; }

.market-ico-rainbow {
    width: 16px;
    height: 10px;
    margin-top: 4px;
    border: 1.4px solid currentColor;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
}

.market-ico-rainbow::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    right: 3px;
    height: 5px;
    border: 1.2px solid currentColor;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    opacity: 0.7;
}

.market-ico-pellet {
    width: 10px;
    height: 10px;
    margin-top: 4px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(180, 210, 200, 0.12);
}

.market-ico-pellet::after {
    content: "";
    position: absolute;
    left: 2px;
    top: 2px;
    width: 3px;
    height: 3px;
    background: currentColor;
    border-radius: 50%;
    opacity: 0.55;
}

.market-ico-mirror {
    width: 14px;
    height: 14px;
    margin-top: 2px;
    border: 1.4px solid currentColor;
    border-radius: 3px;
    transform: skewX(-8deg);
}

.market-ico-mirror::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 2px;
    width: 4px;
    height: 8px;
    border-left: 1.3px solid currentColor;
    opacity: 0.65;
}

.market-ico-storm {
    width: 12px;
    height: 14px;
    margin-top: 2px;
}

.market-ico-storm::before {
    content: "";
    position: absolute;
    left: 1px;
    top: 0;
    width: 10px;
    height: 7px;
    border: 1.4px solid currentColor;
    border-radius: 50% 50% 40% 40%;
}

.market-ico-storm::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 7px;
    width: 4px;
    height: 7px;
    background: currentColor;
    clip-path: polygon(30% 0, 100% 0, 55% 45%, 90% 45%, 0 100%, 35% 48%, 0 48%);
}

.market-ico-moon {
    width: 14px;
    height: 14px;
    margin-top: 2px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    box-shadow: inset -4px -1px 0 -1px currentColor;
}

.market-ico-platinum {
    width: 12px;
    height: 12px;
    margin-top: 3px;
    border: 1.5px solid currentColor;
    border-radius: 2px;
    transform: rotate(45deg);
}

.market-ico-platinum::after {
    content: "";
    position: absolute;
    left: 2px;
    top: 2px;
    right: 2px;
    bottom: 2px;
    border: 1.1px solid currentColor;
    opacity: 0.65;
}

.market-row {
    display: block;
    width: 100%;
    margin: 0;
    padding: 6px 8px;
    text-align: left;
    background: transparent;
    border: 1px solid rgba(180, 210, 200, 0.16);
    border-radius: 7px;
    color: rgba(210, 230, 220, 0.78);
    font: 300 11px/1.2 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: border-color 0.25s ease, color 0.25s ease, opacity 0.25s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

.market-row:hover:not(:disabled),
.market-row:focus-visible:not(:disabled) {
    outline: none;
    border-color: rgba(200, 224, 210, 0.45);
    color: rgba(235, 245, 240, 0.95);
    box-shadow: 0 0 0 2px rgba(140, 200, 170, 0.18);
}

.market-row:active:not(:disabled) {
    transform: scale(0.98);
    transition: transform 0.08s ease;
}

.market-row:disabled {
    opacity: 0.38;
    cursor: default;
}

/* Food stash: bottom-right, faint until hovered (pond only). */
#food-stash {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 10;
    display: none;
    flex-direction: row;
    flex-wrap: wrap-reverse;
    justify-content: flex-end;
    align-items: flex-end;
    gap: 7px;
    max-width: 220px;
    opacity: 0.22;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

body.pond #food-stash.has-items {
    display: flex;
    pointer-events: auto;
}

#food-stash:hover,
#food-stash:focus-within,
#food-stash.armed {
    opacity: 0.9;
}

.stash-slot {
    position: relative;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid rgba(200, 210, 220, 0.28);
    border-radius: 50%;
    cursor: pointer;
    background:
        radial-gradient(circle at 35% 30%,
            var(--stash-from, #ffe8f4) 0%,
            var(--stash-mid, #ff7eb6) 55%,
            var(--stash-to, #d63a7a) 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.stash-slot:hover,
.stash-slot:focus-visible {
    outline: none;
    border-color: rgba(220, 230, 235, 0.65);
    transform: scale(1.08);
}

.stash-slot.armed {
    border-color: rgba(255, 220, 240, 0.85);
    box-shadow:
        0 0 0 2px rgba(255, 160, 200, 0.25),
        inset 0 0 0 1px rgba(255, 255, 255, 0.15);
    transform: scale(1.12);
}

.stash-slot.stash-normal {
    border-radius: 45% 50% 48% 52%;
    border-color: rgba(160, 130, 80, 0.35);
}

.stash-slot.stash-normal.armed {
    border-color: rgba(220, 190, 120, 0.8);
    box-shadow:
        0 0 0 2px rgba(180, 140, 70, 0.22),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.stash-count {
    position: absolute;
    right: -5px;
    bottom: -4px;
    min-width: 15px;
    height: 15px;
    padding: 0 4px;
    border-radius: 8px;
    font-family: "Segoe UI", Tahoma, sans-serif;
    font-size: 10px;
    font-weight: 650;
    line-height: 15px;
    text-align: center;
    color: #f2f6fa;
    background: rgba(18, 26, 34, 0.88);
    border: 1px solid rgba(220, 230, 240, 0.28);
    pointer-events: none;
}

/* Load hint, centered and breathing softly. */
#hint {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: var(--ink);
    font: 300 15px/1 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.18em;
    text-transform: lowercase;
    pointer-events: none;
    opacity: 0.55;
    animation: breathe 3.4s ease-in-out infinite;
    transition: opacity 1s ease;
    z-index: 5;
    text-align: center;
    max-width: min(280px, calc(100vw - 48px));
    text-shadow:
        0 1px 10px rgba(4, 10, 8, 0.7),
        0 0 22px rgba(7, 16, 18, 0.45);
}

#hint.gone {
    opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
    #hint {
        animation: none;
        opacity: 0.45;
    }

    #surface {
        animation: none;
        opacity: 1;
    }
}

@keyframes breathe {
    0%, 100% { opacity: 0.28; }
    50% { opacity: 0.6; }
}

/* Secret dev menu: scrollable tool panel, market-adjacent chrome. */
#dev-panel {
    position: fixed;
    top: 16px;
    right: 58px;
    z-index: 20;
    display: none;
    flex-direction: column;
    width: min(300px, calc(100vw - 72px));
    max-height: calc(100vh - 32px);
    padding: 8px 8px 10px;
    background: rgba(10, 18, 22, 0.88);
    border: 1px solid rgba(180, 210, 200, 0.22);
    border-radius: 10px;
    color: rgba(210, 230, 220, 0.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    touch-action: none;
}

#dev-panel.open {
    display: flex;
    opacity: 0.94;
    pointer-events: auto;
}

#dev-panel.open:hover,
#dev-panel.open:focus-within {
    opacity: 0.98;
}

#dev-panel.dragging {
    transition: none;
    opacity: 0.98;
    user-select: none;
}

.dev-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 2px 8px;
    border-bottom: 1px solid rgba(180, 210, 200, 0.12);
    margin-bottom: 6px;
    cursor: grab;
    touch-action: none;
}

.dev-head:active {
    cursor: grabbing;
}

.dev-title {
    font: 500 11px/1 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(200, 230, 210, 0.7);
}

.dev-close {
    margin: 0;
    padding: 4px 8px;
    background: transparent;
    border: 1px solid rgba(180, 210, 200, 0.2);
    border-radius: 6px;
    color: rgba(210, 230, 220, 0.75);
    font: 300 11px/1 "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
    touch-action: auto;
}

.dev-close:hover,
.dev-close:focus-visible {
    outline: none;
    border-color: rgba(200, 224, 210, 0.5);
    color: rgba(240, 250, 245, 0.95);
}

.dev-scroll {
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

.dev-section-title {
    margin: 0 0 4px;
    padding: 0 2px;
    font: 500 10px/1 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(170, 200, 190, 0.55);
}

.dev-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.dev-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 5px 7px;
    background: transparent;
    border: 1px solid rgba(180, 210, 200, 0.16);
    border-radius: 6px;
    color: rgba(210, 230, 220, 0.8);
    font: 300 10px/1.15 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.dev-row:hover,
.dev-row:focus-visible {
    outline: none;
    border-color: rgba(200, 224, 210, 0.45);
    color: rgba(240, 250, 245, 0.98);
}

.dev-row.on {
    border-color: rgba(140, 200, 170, 0.55);
    background: rgba(60, 120, 100, 0.22);
    color: rgba(220, 245, 230, 0.98);
}

.dev-row.warn {
    border-color: rgba(210, 140, 100, 0.35);
}

.dev-hint {
    margin: 0;
    padding: 0 2px 2px;
    font: 300 10px/1.35 "Segoe UI", Roboto, sans-serif;
    color: rgba(170, 195, 185, 0.45);
}


.ico-ambient::before,
.ico-ambient::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.85;
}
.ico-ambient::before {
    width: 8px;
    height: 8px;
}
.ico-ambient::after {
    width: 14px;
    height: 14px;
    opacity: 0.45;
}
#ambient-btn.on {
    opacity: 0.95;
}
#ambient-btn.on .ico-ambient {
    color: #7ec8e8;
}

/* Rhythm studio (window) and tunes panel (pond). */
#rhythm-panel,
#tunes-panel {
    position: fixed;
    left: 58px;
    bottom: 16px;
    z-index: 11;
    display: none;
    flex-direction: column;
    gap: 6px;
    min-width: 248px;
    max-width: min(560px, calc(100vw - 72px));
    max-height: min(78vh, 640px);
    overflow: auto;
    padding: 8px 8px 7px;
    background: rgba(12, 22, 20, 0.52);
    border: 1px solid rgba(180, 210, 200, 0.18);
    border-radius: 10px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

body:not(.pond) #rhythm-panel.open {
    display: flex;
    opacity: 0.88;
    pointer-events: auto;
    min-width: min(520px, calc(100vw - 72px));
}

body.pond #tunes-panel.open {
    display: flex;
    opacity: 0.82;
    pointer-events: auto;
}

body:not(.pond) #rhythm-panel.open:hover,
body:not(.pond) #rhythm-panel.open:focus-within,
body.pond #tunes-panel.open:hover,
body.pond #tunes-panel.open:focus-within {
    opacity: 0.96;
}

.rhythm-transport,
.rhythm-save-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.market-row.rhythm-mini {
    width: auto;
    flex: 1 1 auto;
    min-width: 44px;
    padding: 5px 7px;
    text-align: center;
}

.market-row.rhythm-len.on,
#rhythm-metro.on {
    border-color: rgba(160, 210, 200, 0.55);
    color: rgba(210, 240, 230, 0.95);
    background: rgba(60, 100, 90, 0.35);
}

.rhythm-bpm-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 2px;
    font: 300 10px/1 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.06em;
    color: rgba(200, 220, 210, 0.6);
}

.rhythm-bpm-wrap input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    background: rgba(160, 190, 180, 0.28);
    border-radius: 2px;
    outline: none;
}

.rhythm-bpm-wrap input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(210, 230, 220, 0.85);
    cursor: pointer;
}

#rhythm-name {
    flex: 1 1 120px;
    min-width: 0;
    margin: 0;
    padding: 5px 7px;
    background: rgba(8, 14, 14, 0.35);
    border: 1px solid rgba(180, 210, 200, 0.18);
    border-radius: 7px;
    color: rgba(230, 240, 235, 0.9);
    font: 300 11px/1.2 "Segoe UI", Roboto, sans-serif;
}

#rhythm-name::placeholder {
    color: rgba(180, 200, 190, 0.4);
}

.rhythm-grid {
    display: grid;
    grid-template-columns: 40px repeat(32, minmax(0, 1fr));
    gap: 2px;
    padding: 2px 2px 10px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb-mid) var(--scroll-track);
}

/* Horizontal reed rail: a bit more presence when the loop is long. */
.rhythm-grid::-webkit-scrollbar {
    height: 12px;
}

.rhythm-grid::-webkit-scrollbar-track {
    margin: 0 4px;
}

.rhythm-grid[data-steps="16"] {
    grid-template-columns: 40px repeat(16, minmax(0, 1fr));
}

.rhythm-grid[data-steps="32"] {
    grid-template-columns: 40px repeat(32, minmax(0, 1fr));
}

.rhythm-grid[data-steps="64"] {
    grid-template-columns: 40px repeat(64, minmax(8px, 1fr));
    min-width: 640px;
}

.rhythm-lane-label {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    margin: 0;
    padding: 0 2px;
    border: none;
    background: transparent;
    font: 300 9px/1 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.04em;
    color: rgba(190, 210, 200, 0.55);
    cursor: pointer;
    user-select: none;
    text-align: left;
}

.rhythm-lane-label.muted {
    color: rgba(140, 150, 145, 0.35);
    text-decoration: line-through;
}

.rhythm-cell {
    aspect-ratio: 1;
    min-width: 0;
    min-height: 12px;
    padding: 0;
    border: 1px solid rgba(180, 210, 200, 0.14);
    border-radius: 3px;
    background: rgba(20, 32, 30, 0.35);
    cursor: pointer;
    color: transparent;
}

.rhythm-cell.bar {
    border-left-color: rgba(220, 230, 210, 0.28);
}

.rhythm-cell.on {
    background: rgba(140, 200, 180, 0.55);
    border-color: rgba(180, 230, 210, 0.45);
}

.rhythm-cell.tone.on {
    background: rgba(160, 190, 230, 0.55);
    border-color: rgba(190, 210, 245, 0.5);
}

.rhythm-cell.clap.on {
    background: rgba(210, 180, 140, 0.55);
    border-color: rgba(230, 200, 160, 0.5);
}

.rhythm-cell.beat {
    box-shadow: inset 0 0 0 1px rgba(255, 230, 170, 0.55);
}

.rhythm-cell:focus-visible {
    outline: none;
    border-color: rgba(220, 240, 230, 0.7);
}

#rhythm-record.on,
#rhythm-play.on,
#tunes-btn.on,
#rhythm-btn.on {
    border-color: rgba(160, 210, 200, 0.55);
    color: rgba(210, 240, 230, 0.95);
}

.rhythm-library {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rhythm-tune-row {
    display: flex;
    gap: 4px;
    align-items: stretch;
}

.rhythm-tune-row .market-row {
    flex: 1;
}

.rhythm-tune-row .rhythm-del {
    flex: 0 0 auto;
    min-width: 44px;
}

.rhythm-empty {
    margin: 0;
    padding: 2px;
    font: 300 10px/1.35 "Segoe UI", Roboto, sans-serif;
    color: rgba(170, 195, 185, 0.5);
}

.rhythm-empty[hidden] {
    display: none;
}

.ico-rhythm,
.ico-tunes {
    position: relative;
    width: 14px;
    height: 12px;
    display: block;
}

.ico-rhythm::before,
.ico-rhythm::after,
.ico-tunes::before,
.ico-tunes::after {
    content: "";
    position: absolute;
    bottom: 0;
    width: 2.5px;
    background: currentColor;
    border-radius: 1px;
}

.ico-rhythm::before { left: 2px; height: 6px; }
.ico-rhythm::after { left: 6px; height: 11px; }
.ico-tunes::before { left: 3px; height: 8px; }
.ico-tunes::after { left: 8px; height: 12px; }

.ico-rhythm {
    background:
        linear-gradient(currentColor, currentColor) 10px 2px / 2.5px 9px no-repeat,
        linear-gradient(currentColor, currentColor) 14px 5px / 2.5px 6px no-repeat;
    width: 16px;
}

.ico-tunes {
    background: linear-gradient(currentColor, currentColor) 13px 3px / 2.5px 9px no-repeat;
    width: 16px;
}

/* ==========================================================================
   User guide: disclaimer gate + scrollable sheet
   Keep guide copy in index.html in sync when mechanics or fish change.
   ========================================================================== */
#guide-gate,
#guide-panel {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: rgba(4, 8, 10, 0.62);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#guide-gate.open,
#guide-panel.open {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.guide-card,
.guide-sheet {
    width: min(520px, calc(100vw - 32px));
    max-height: min(84vh, 720px);
    display: flex;
    flex-direction: column;
    padding: 18px 18px 16px;
    border-radius: 14px;
    border: 1px solid rgba(180, 210, 200, 0.22);
    background: rgba(10, 18, 20, 0.94);
    color: rgba(210, 230, 220, 0.9);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.guide-sheet {
    width: min(640px, calc(100vw - 32px));
}

.guide-card h2,
.guide-sheet-head h2 {
    margin: 0 0 10px;
    font: 500 16px/1.25 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.04em;
    color: rgba(230, 245, 238, 0.95);
}

.guide-card p,
.guide-sheet-body p,
.guide-sheet-body li {
    margin: 0 0 10px;
    font: 300 13px/1.55 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.01em;
    color: rgba(200, 220, 210, 0.82);
}

.guide-ask {
    margin-top: 4px !important;
    color: rgba(230, 240, 235, 0.92) !important;
}

.guide-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.guide-action {
    margin: 0;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(180, 210, 200, 0.22);
    background: transparent;
    color: rgba(210, 230, 220, 0.88);
    font: 300 12px/1.2 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.guide-action:hover,
.guide-action:focus-visible {
    outline: none;
    border-color: rgba(200, 224, 210, 0.5);
    color: rgba(240, 250, 245, 0.98);
}

.guide-action.primary {
    border-color: rgba(160, 200, 180, 0.45);
    background: rgba(60, 110, 95, 0.28);
}

.guide-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(180, 210, 200, 0.14);
    margin-bottom: 10px;
}

.guide-sheet-head h2 {
    margin: 0;
}

.guide-close {
    margin: 0;
    padding: 5px 10px;
    border-radius: 7px;
    border: 1px solid rgba(180, 210, 200, 0.22);
    background: transparent;
    color: rgba(210, 230, 220, 0.8);
    font: 300 12px/1 "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
}

.guide-close:hover,
.guide-close:focus-visible {
    outline: none;
    border-color: rgba(200, 224, 210, 0.5);
    color: rgba(240, 250, 245, 0.98);
}

.guide-sheet-body {
    overflow: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
}

.guide-updated {
    font-size: 11px !important;
    letter-spacing: 0.04em !important;
    color: rgba(170, 195, 185, 0.55) !important;
}

.guide-sheet-body section {
    margin-bottom: 16px;
}

.guide-sheet-body h3 {
    margin: 0 0 6px;
    font: 500 12px/1.3 "Segoe UI", Roboto, sans-serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(180, 210, 200, 0.7);
}

.guide-sheet-body ul {
    margin: 0 0 8px;
    padding-left: 1.15em;
}

.guide-sheet-body li {
    margin-bottom: 6px;
}
