:root { font-family: "Avenir Next", Avenir, ui-rounded, system-ui, sans-serif; color: #254e4b; background: #ecf3e9; font-synthesis: none; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; padding: 30px 20px; background: radial-gradient(ellipse at 50% 0%, #f9fbf0 0, #eaf2e8 55%, #dcebe2 100%); }
button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.app { width: min(100%, 560px); margin: auto; }
.aquarium-lighting { --lamp-left: clamp(35px, 10%, 150px); position: relative; }
.aquarium-lamp { position: fixed; z-index: 30; top: 0; left: var(--lamp-screen-left, 35px); width: 120px; height: 90px; pointer-events: none; }
.light-beams { position: absolute; z-index: 2; pointer-events: none; top: var(--beam-start, 30px); bottom: 0; left: calc(var(--lamp-left) + 81px); width: calc(100% - var(--lamp-left) - 81px); height: calc(100% - var(--beam-start, 30px)); }
.topbar { position: relative; z-index: 4; display: flex; align-items: center; justify-content: space-between; padding-bottom: 23px; border-bottom: 1px solid #c8dbd0; }
.brand { margin: 0; font-weight: 400; display: flex; align-items: center; gap: 9px; color: #366e63; font-size: 11px; line-height: .95; letter-spacing: .1em; }
.brand strong { font-size: 9px; letter-spacing: .16em; }
.brand-mark { display: grid; place-items: center; width: 35px; height: 35px; border: 1px solid #78a99a; border-radius: 50%; font-family: Georgia, serif; font-size: 26px; line-height: 1; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.motion-toggle { min-height: 44px; padding: 0 12px; border: 0; border-radius: 99px; background: transparent; color: #3d7165; font-size: 12px; font-weight: 700; }
.motion-toggle:hover { background: #dcebe1; }
.reset { min-height: 44px; padding: 0 16px; border: 1px solid #bdd3c6; border-radius: 99px; background: #f7faf3; color: #3d7165; font-size: 12px; font-weight: 700; }
.reset span { font-size: 19px; vertical-align: -1px; margin-right: 4px; }
.quote-content { display: flex; align-items: flex-start; gap: 6px; min-width: 0; max-width: 100%; }
.quote-mark { color: #b5723f; font-family: Georgia, serif; font-size: 26px; line-height: .85; }
blockquote { margin: 0; color: #254f46; font-family: Georgia, serif; font-size: 15px; font-weight: 400; line-height: 1.2; }
#quote-author { display: block; margin-top: 2px; text-align: right; color: #426c5e; font-size: 11px; font-style: normal; letter-spacing: .04em; }
#quote-author::before { content: "— "; }
.tank-wrap { position: relative; overflow: hidden; isolation: isolate; border: 1px solid #5b9690; border-top: 0; border-radius: 0 0 16px 16px; background: linear-gradient(180deg, #b8e7df 0%, #86cec8 38%, #6bb8ad 75%, #a7bda3 100%); box-shadow: 0 18px 36px #356b5426, 0 4px 10px #356b541a; }
/* Thin reflections suggest glass without adding an opaque frame. */
.tank-wrap::before, .tank-wrap::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1; border-radius: inherit; }
.tank-wrap::before { background: linear-gradient(90deg, #276e69a8 0, #438c8280 5px, #b7e7d94d 12px, transparent 25px, transparent calc(100% - 25px), #b7e7d94d calc(100% - 12px), #438c8280 calc(100% - 5px), #276e69a8 100%); box-shadow: inset 0 -3px 0 #397e7950; }
.tank-wrap::after { inset: 5px 7px; border: 1px solid #d4fff570; border-top: 0; border-radius: 0 0 11px 11px; }
canvas { display: block; width: 100%; height: var(--tank-natural-height, 340px); touch-action: none; }
.aquarium-stand { position: relative; z-index: 2; margin-top: -4px; border: 1px solid #9f6d49; border-radius: 6px 6px 12px 12px; background: repeating-linear-gradient(3deg, transparent 0 8px, #8052390b 9px 10px, transparent 11px 22px), linear-gradient(180deg, #e9caa0 0%, #d8ad7e 8%, #d2a270 78%, #bf895c 100%); box-shadow: inset 0 2px 0 #f8dfba, inset 0 -5px 0 #a8724a55, 0 5px 0 #99623f, 0 10px 16px #66483238; }
.control-panel { padding: 18px 16px 20px; }
.tabletop { position: relative; height: 68px; width: calc(100% + 20px); margin: 5px 0 0 -10px; border: 1px solid #ac805f; border-radius: 5px 5px 8px 8px; background: repeating-linear-gradient(2deg, #ffffff0c 0 2px, transparent 2px 14px), linear-gradient(180deg, #e8cfac 0 28%, #c39a71 30% 62%, #ae805e 65% 100%); box-shadow: inset 0 2px 0 #fae9ce, 0 9px 15px #67503d30; }
.tabletop::before, .tabletop::after { content: ""; position: absolute; top: calc(100% - 2px); width: 96px; height: var(--table-leg-length, 200px); transform-origin: center top; background: linear-gradient(90deg, #996a49, #c7a17b 48%, #a57855); border: 1px solid #946747; border-top: 0; border-radius: 0 0 4px 4px; box-shadow: inset 3px 0 3px #f5d5ac45, 2px 5px 6px #66503a20; }
.tabletop::before { left: 5%; transform: rotate(7deg); }
.tabletop::after { right: 5%; transform: rotate(-7deg); }
.share-area { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; min-height: var(--table-leg-length, 200px); padding: 16px 12px calc(100px + env(safe-area-inset-bottom)); }
.share-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 18px; border: 1px solid #a8c9ba; border-radius: 999px; background: #f5faf1; color: #315f53; font-size: 13px; font-weight: 700; box-shadow: 0 3px 8px #356b541a; }
.share-button:hover { background: #e5f2e8; }
.share-button:active { background: #d6eadf; }
.share-button svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.share-status { margin-top: 6px; color: #315f53; font-size: 12px; }
.share-status:empty { display: none; }
.ocean-world .share-area { min-height: 0; padding-bottom: 0; }
@media (max-width: 480px) { .tabletop::before, .tabletop::after { width: 64px; } }
.controls { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pump { touch-action: none; user-select: none; display: flex; flex-direction: column; align-items: center; gap: 12px; border: 0; color: #3f6d5f; background: transparent; padding: 0; min-width: 58px; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.pump-icon { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(155deg, #f4ba83, #e3975e 65%, #cd7c49); border: 5px solid #f8d3a4; box-shadow: inset 0 2px 3px #fff4d9a8, inset 0 -4px 4px #b7603a50, 0 3px 0 #dfa068, 0 7px 0 #b96f44, 0 10px 0 #a85e3d, 0 14px 15px #87533140; color: #fff9e9; transition: transform .1s, box-shadow .1s, filter .1s; }
.pump.active .pump-icon { filter: brightness(.93); transform: translateY(7px); box-shadow: inset 0 3px 6px #a9583a80, inset 0 -1px 2px #ffe8cb80, 0 2px 0 #a85e3d, 0 5px 8px #87533130; }
.bubble-icon { width: 30px; height: 30px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.pump-key { display: none; font-size: 9px; line-height: 1; font-weight: 800; letter-spacing: 0; }
.pump-hold { color: #684631; font-size: 10px; line-height: 1; letter-spacing: .16em; }
@media (hover: hover) and (pointer: fine) { .bubble-icon { width: 25px; height: 25px; } .pump-key { display: block; margin-top: 2px; } }
.mode-picker { display: flex; align-self: flex-start; gap: 3px; margin-top: 5px; padding: 4px; background: #bd8e66; box-shadow: inset 0 2px 4px #70482d40, 0 1px 0 #f5d6ae; border-radius: 18px; }
.mode { display: grid; place-items: center; width: 58px; height: 48px; border: 0; border-radius: 14px; background: transparent; color: #4b786a; transition: background .15s, color .15s, box-shadow .15s; }
.mode svg { width: 42px; height: 35px; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.mode.active { color: #285d52; background: #fffdf4; box-shadow: 0 2px 6px #4c898533; }
button:focus-visible { outline: 3px solid #347e78; outline-offset: 4px; }
@media (max-height: 800px) and (min-width: 500px) { body { padding-block: 14px; } .app { width: min(100%, 460px); } .topbar { padding-bottom: 10px; } }
@media (max-width: 420px) { body { padding: 16px 14px; } .topbar { padding-bottom: 14px; } .pump { gap: 12px; font-size: 9px; } .pump-icon { width: 56px; height: 56px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; } }

/* Wide screens reveal more water at the sides without shrinking the play area. */
@media (min-width: 700px), (orientation: landscape) and (min-width: 500px) {
  .app { width: min(100%, 1200px); }
  canvas { height: min(62dvh, 640px); min-height: 220px; aspect-ratio: auto; }
  .control-panel { max-width: 560px; margin-inline: auto; }
}
@media (orientation: landscape) and (max-height: 500px) {
  body { padding: 8px max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left)); }
  .topbar { padding-bottom: 6px; }
  canvas { height: 55dvh; min-height: 180px; }
  .control-panel { padding: 14px 16px 18px; }
}


/* Reserve space for the fixed banner so it cannot cover the controls. */
body { padding-bottom: calc(114px + env(safe-area-inset-bottom)); }
.ad-banner { position: fixed; z-index: 10; left: 50%; bottom: 0; transform: translateX(-50%); display: grid; place-items: center; width: min(100%, 728px); height: calc(90px + env(safe-area-inset-bottom)); padding: 4px 12px calc(4px + env(safe-area-inset-bottom)); margin: 0; border: 1px solid #c6dcd0; border-bottom: 0; border-radius: 12px 12px 0 0; background: linear-gradient(120deg, #e0efe626, #f3f8ec33 48%, #dcece326); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); color: #365f56; font-family: Georgia, serif; font-style: italic; letter-spacing: .02em; }
@media (max-width: 480px), (orientation: landscape) and (max-height: 500px) {
  body { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
  .ad-banner { height: calc(50px + env(safe-area-inset-bottom)); }
  blockquote { font-size: 12px; }
  #quote-author { font-size: 10px; }
  .quote-mark { font-size: 22px; }
}

@media (max-width: 420px) { .aquarium-lighting { --lamp-left: 20px; } }

/* World selector keeps the selected scene visible as text and as a lit surface. */
.world-picker { display: flex; align-items: center; gap: 8px; width: 100%; }
.world-choice { display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 4px 9px; border: 0; border-radius: 12px; background: transparent; color: #668d82; text-align: left; font-size: 11px; line-height: .95; letter-spacing: .1em; opacity: .65; transition: background .2s, color .2s, opacity .2s, box-shadow .2s; }
.world-choice strong { font-size: 9px; letter-spacing: .16em; }
.world-choice.active { color: #174b49; opacity: 1; box-shadow: 0 2px 12px #7eac9840; }
.world-choice.active[data-world="aquarium"] { background: linear-gradient(180deg, #b8e7df, #86cec8); }
.world-choice.active[data-world="ocean"] { background: linear-gradient(180deg, #a6dee2, #73bbc5); }
.world-choice { flex: 1 1 0; min-width: 0; }
.world-choice[data-world="ocean"] { justify-content: flex-end; }
.world-icon { display: grid; place-items: center; width: 35px; height: 35px; border: 1px solid #78a99a; border-radius: 50%; font-family: Georgia, serif; font-size: 26px; line-height: 1; }
.music-toggle { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #3d7165; }
.music-toggle:hover, .music-toggle[aria-pressed="true"] { background: #e1eee3; }
.music-toggle svg { width: 21px; height: 21px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.music-toggle .sound-on, .music-toggle[aria-pressed="true"] .sound-off { display: none; }
.music-toggle[aria-pressed="true"] .sound-on { display: block; }
.submarine-interior { display: none; }
.ocean-world { background: radial-gradient(ellipse at 50% 0%, #e7f4ed 0, #d9ece8 55%, #bddbd7 100%); }
.ocean-world .aquarium-lamp, .ocean-world .light-beams, .ocean-world .tabletop { display: none; }
.ocean-world .tank-wrap { border-color: #568f96; background: linear-gradient(180deg, #a6dee2 0%, #73bbc5 38%, #5599a8 75%, #9cae9b 100%); }
.ocean-world .tank-wrap::before { background: linear-gradient(90deg, #276f7a65, transparent 3%, transparent 97%, #276f7a65); }
.ocean-world .tank-wrap::after { display: none; }
.ocean-world .aquarium-stand { overflow: hidden; border: 3px solid #557b7b; border-radius: 18px 18px 28px 28px; background: #638d88; box-shadow: inset 0 2px 0 #c7d9be, 0 7px 0 #416968, 0 12px 22px #275d5b38; }
.ocean-world .control-panel { position: relative; isolation: isolate; min-height: 150px; display: flex; align-items: end; padding: 52px 24px 18px; }
.ocean-world .submarine-interior { display: block; position: absolute; z-index: -1; inset: 0; overflow: hidden; }
.submarine-interior svg { width: 100%; height: 100%; display: block; }
.ocean-world .controls { width: 100%; }
.ocean-world .pump-hold { color: #f5f1d9; }
.ocean-world .pump-icon { background: linear-gradient(155deg, #f1c979, #db9d51 65%, #b8783c); border-color: #f7db9d; }
.ocean-world .mode-picker { background: #406765; box-shadow: inset 0 2px 4px #26484780, 0 1px 0 #adc8b6; }
.ocean-world .mode { color: #c7dcd2; }
.ocean-world .mode.active { color: #285d59; background: #f3f4df; }
@media (min-width: 700px), (orientation: landscape) and (min-width: 500px) { .ocean-world .aquarium-stand { max-width: 560px; margin-inline: auto; } }
@media (max-width: 420px) { .world-picker { gap: 3px; } .world-choice { padding-inline: 5px; } .ocean-world .control-panel { min-height: 130px; padding: 42px 16px 15px; } }
/* Curved glass canopy and two fixed feed pipes joining the guns to the hull. */
.ocean-world .aquarium-stand { border-radius: 50% 50% 28px 28px / 55px 55px 28px 28px; }
.ocean-world .control-panel { min-height: 180px; padding-top: 70px; }
.ocean-world .control-panel::before, .ocean-world .control-panel::after { content: ""; position: absolute; top: 0; width: 16px; height: 30px; border: 2px solid #6f8e87; border-top: 0; border-radius: 0 0 5px 5px; background: linear-gradient(90deg, #627f7b, #b2c8b5 48%, #63837e); z-index: 0; }
.ocean-world .control-panel::before { left: 31.5%; transform: translateX(-50%); }
.ocean-world .control-panel::after { left: 68.5%; transform: translateX(-50%); }
.ocean-world .controls { position: relative; z-index: 1; }
@media (max-width: 420px) { .ocean-world .control-panel { min-height: 150px; padding-top: 55px; } }

/* Ocean is an open seascape; the submarine continues below the controls. */
.ocean-world { overflow-x: clip; }
.ocean-world .tank-wrap { width: 100vw; margin-left: calc(50% - 50vw); border: 0; border-radius: 0; box-shadow: none; }
.ocean-world .tank-wrap::before, .ocean-world .tank-wrap::after { display: none; }
.ocean-world .aquarium-stand { margin-top: -5px; overflow: hidden; border-radius: 50% 50% 0 0 / 70px 70px 0 0; box-shadow: inset 0 2px 0 #c7d9be, 0 12px 22px #275d5b38; }
.ocean-world .control-panel { min-height: 250px; padding: 165px 24px 20px; background: #426f70; }
.ocean-world .submarine-interior { inset: 0 0 auto; height: 170px; z-index: 0; }
.ocean-world .controls { z-index: 1; }
.ocean-world .control-panel::before, .ocean-world .control-panel::after { display: none; }
.submarine-tail { display: none; }
.ocean-world .submarine-tail { display: block; position: relative; min-height: max(180px, 35dvh); margin-top: -1px; border-top: 4px solid #b0cab4; background: linear-gradient(90deg, #3d6e6e, #6c9990 15%, #81aaa0 48%, #6c9990 85%, #3d6e6e); }
.ocean-world .submarine-tail::before, .ocean-world .submarine-tail::after { content: ""; position: absolute; top: 0; bottom: 0; width: 2px; background: #c2d9c078; }
.ocean-world .submarine-tail::before { left: 12%; }
.ocean-world .submarine-tail::after { right: 12%; }
@media (max-width: 420px) { .ocean-world .control-panel { min-height: 220px; padding: 145px 16px 16px; } .ocean-world .submarine-interior { height: 150px; } }
.ocean-world { padding-bottom: 0; }
.ocean-world .stand-scene { width: 100vw; margin-left: calc(50% - 50vw); padding-bottom: calc(114px + env(safe-area-inset-bottom)); background: #b3b99f; }
.ocean-world .aquarium-stand { width: min(calc(100% - 28px), 290px); margin-inline: auto; }
@media (max-width: 480px), (orientation: landscape) and (max-height: 500px) { .ocean-world .stand-scene { padding-bottom: calc(74px + env(safe-area-inset-bottom)); } }

/* Round stern, raised dorsal fin and a propeller behind the hull. */
.ocean-world .aquarium-stand { overflow: visible; border: 0; background: transparent; box-shadow: none; }
.ocean-world .control-panel { overflow: hidden; border: 3px solid #557b7b; border-bottom: 0; border-radius: 50% 50% 0 0 / 70px 70px 0 0; }
.ocean-world .submarine-tail { isolation: isolate; margin-top: 0; border: 3px solid #557b7b; border-top: 4px solid #b0cab4; border-radius: 0 0 50% 50% / 0 0 90px 90px; box-shadow: inset 0 -7px 0 #365f5f45, 0 10px 18px #275d5b30; }
.ocean-world .submarine-tail::before, .ocean-world .submarine-tail::after { bottom: 45px; }
.dorsal-fin { position: absolute; left: 50%; top: 23px; width: 50px; height: min(58%, 190px); transform: translateX(-50%); clip-path: polygon(50% 0, 77% 20%, 76% 78%, 50% 100%, 24% 78%, 23% 20%); background: linear-gradient(90deg, #3d6d6c, #b1d1bd 47%, #578682 53%, #385f60); filter: drop-shadow(0 5px 4px #315d5c80); }
.propeller { position: absolute; z-index: -1; left: 50%; top: calc(100% - 8px); width: 116px; height: 100px; transform: translateX(-50%); }
.propeller::before { content: ""; position: absolute; left: 50%; top: -4px; width: 18px; height: 49px; transform: translateX(-50%); border-radius: 4px; background: linear-gradient(90deg, #466c6a, #aac2ad 50%, #466c6a); }
.propeller-blade { position: absolute; left: 50%; top: 20px; width: 25px; height: 76px; transform: translateX(-50%) rotate(45deg); border: 2px solid #507570; border-radius: 50% 18% 50% 18%; background: linear-gradient(90deg, #77988c, #c9d9bd 48%, #729488); }
.propeller-blade + .propeller-blade { transform: translateX(-50%) rotate(-45deg); }
.ocean-world .propeller-blade { animation: propeller-spin 2.4s linear infinite; }
.ocean-world .propeller-blade + .propeller-blade { animation-name: propeller-spin-cross; }
@keyframes propeller-spin {
  from { transform: translateX(-50%) rotate(45deg); }
  to { transform: translateX(-50%) rotate(405deg); }
}
@keyframes propeller-spin-cross {
  from { transform: translateX(-50%) rotate(-45deg); }
  to { transform: translateX(-50%) rotate(315deg); }
}
.propeller-hub { position: absolute; left: 50%; top: 48px; width: 21px; height: 21px; transform: translateX(-50%); border: 3px solid #547972; border-radius: 50%; background: #e3d19f; }
.ocean-world .stand-scene { padding-bottom: calc(210px + env(safe-area-inset-bottom)); }
@media (max-width: 480px), (orientation: landscape) and (max-height: 500px) { .ocean-world .stand-scene { padding-bottom: calc(170px + env(safe-area-inset-bottom)); } }
/* The canopy meets the hull directly, without an outer frame. */
.ocean-world .control-panel { border: 0; }
/* A compact round stern sits behind the cockpit. */
.ocean-world .control-panel { z-index: 2; }
.ocean-world .submarine-tail { z-index: 1; width: min(68%, 210px); min-height: 0; aspect-ratio: 1; margin: -30px auto 0; border: 3px solid #557b7b; border-radius: 50%; }
.ocean-world .submarine-tail::before, .ocean-world .submarine-tail::after { display: none; }
.ocean-world .dorsal-fin { top: 24%; height: 55%; }

/* Keep the glass rim while removing the larger backing panel. */
.ocean-world .control-panel { background: transparent; }
/* The hull starts beneath the canopy and carries the controls into the stern. */
.ocean-world .control-panel { background: linear-gradient(to bottom, transparent 0 145px, #719a90 145px, #4e7c79 100%); }
@media (max-width: 420px) { .ocean-world .control-panel { background: linear-gradient(to bottom, transparent 0 125px, #719a90 125px, #4e7c79 100%); } }

/* A single rounded, rust-red hull runs from the canopy to the propeller. */
.ocean-world .control-panel { background: transparent; }
.ocean-world .control-panel::before { content: ""; display: block; position: absolute; inset: 145px 0 0; width: auto; height: auto; transform: none; border: 0; border-radius: 0; z-index: -1; background: linear-gradient(90deg, #713d30, #a45d45 15%, #c08263 48%, #a45d45 85%, #713d30); }
.ocean-world .submarine-tail { width: 100%; min-height: 0; height: 115px; aspect-ratio: auto; margin: 0; border: 0; border-radius: 0 0 50% 50% / 0 0 85% 85%; background: linear-gradient(90deg, #713d30, #a45d45 15%, #c08263 48%, #a45d45 85%, #713d30); box-shadow: inset 0 -7px 0 #603a2c45, 0 10px 18px #4d302b30; }
.ocean-world .dorsal-fin { background: linear-gradient(90deg, #6e3f32, #dfa88a 47%, #a9664e 53%, #693b30); }
.ocean-world .mode-picker { background: #70493c; box-shadow: inset 0 2px 4px #422e2980, 0 1px 0 #e1b99d; }
@media (max-width: 420px) { .ocean-world .control-panel::before { top: 125px; } }
/* The boat is a separate image, with its hull crossing the waterline. */
.ocean-boat { display: none; }
/* Let the boat rise above the header while the water stays in its normal layer. */
.ocean-world .tank-wrap { overflow: visible; isolation: auto; }
.ocean-world .ocean-boat { display: block; position: absolute; z-index: 6; top: var(--boat-waterline, 35px); left: 50%; width: min(220px, 55vw); height: auto; transform: translate(-50%, -80%); transform-origin: 50% 80%; pointer-events: none; }
@media (orientation: landscape) and (max-height: 500px) { .ocean-world .ocean-boat { width: min(190px, 42vw); } }

/* Reserve room for the banner and controls on short landscape screens. */
@media (orientation: landscape) and (max-height: 500px) {
  body { padding-top: 6px; }
  .topbar { padding-bottom: 4px; }
  canvas { height: max(80px, calc(100dvh - 195px)); min-height: 80px; }
  .control-panel { padding: 6px 16px 10px; }
  .pump { gap: 5px; }
  .pump-icon { width: 46px; height: 46px; border-width: 4px; }
  .bubble-icon { width: 22px; height: 22px; }
  .pump-hold { font-size: 9px; }
  .mode-picker { margin-top: 0; padding: 3px; }
  .mode { width: 50px; height: 44px; }
  .mode svg { width: 36px; height: 30px; }
  .tabletop { display: none; }
  .ocean-world canvas { height: max(80px, calc(100dvh - 211px)); }
  .ocean-world .control-panel { min-height: 0; padding: 58px 16px 8px; overflow: visible; }
  .ocean-world .submarine-interior { inset: 0 auto auto 50%; width: min(60%, 250px); height: 58px; transform: translateX(-50%); }
  .ocean-world .control-panel::before { top: 48px; bottom: -4px; }
  .ocean-world .controls { transform: translateY(4px); }
  .ocean-world .ocean-boat { width: min(175px, 42vw); }
}

@media (orientation: landscape) and (max-height: 500px) {
  /* The compact hull and canopy share a width, while the controls retain
     touch-sized targets. */
  .ocean-world .aquarium-stand { width: min(calc(100% - 24px), 290px); }
  .ocean-world .submarine-interior { width: 100%; }
  .ocean-world .controls { gap: 4px; }
  .ocean-world .pump { min-width: 46px; }
  .ocean-world .mode { width: 44px; }
}

/* Let the water yield space to the controls on every screen size. */
canvas { min-height: 0; }
@media (min-height: 501px) {
  .ocean-world .control-panel { min-height: 0; padding: 110px 12px 12px; }
  .ocean-world .submarine-interior { height: 115px; }
  .ocean-world .control-panel::before { top: 95px; }
}

/* Give the water more room on large screens without covering the seabed. */
@media (min-width: 700px) and (min-height: 501px) {
  .ocean-world canvas { height: min(75dvh, 960px); }
}

/* The seabed continues behind the submarine with layered dunes and reefs. */
.ocean-world .stand-scene { position: relative; isolation: isolate; }
.ocean-world .stand-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url('/assets/ocean-seabed.svg') center top / 1000px 420px repeat-x;
}

/* Enlarge the seabed artwork on short landscape screens. */
@media (orientation: landscape) and (max-height: 500px) {
  .ocean-world .stand-scene::before { background-size: 1350px 567px; }
}


/* Slow foreground drift makes the stationary camera feel like forward travel. */
.ocean-world .stand-scene::before {
  background-repeat: repeat;
  animation: seabed-drift 34s linear infinite;
}
@keyframes seabed-drift { to { background-position: center 420px; } }
@media (orientation: landscape) and (max-height: 500px) {
  .ocean-world .stand-scene::before { animation-name: seabed-drift-landscape; }
}
@keyframes seabed-drift-landscape { to { background-position: center 567px; } }
.ocean-world .aquarium-stand {
  transform: translateX(var(--submarine-sway-x, 0px)) rotate(var(--submarine-sway-angle, 0deg));
  transform-origin: 50% 30%;
}
/* The turrets are mounted on the glass rim and move with the submarine. */
.submarine-guns { display: none; }
.ocean-world .submarine-guns { display: block; position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.submarine-gun { position: absolute; top: var(--gun-mount-y, 12px); left: calc(50% - var(--gun-offset, 65px)); width: 28px; height: 15px; transform: translate(-50%, -50%); border: 2px solid #536b6c; border-radius: 50%; background: linear-gradient(#a1aaa2, #697d80); }
.submarine-gun + .submarine-gun { left: calc(50% + var(--gun-offset, 65px)); }
.submarine-gun-barrel { position: absolute; left: 50%; bottom: 50%; width: 15px; height: 27px; transform: translateX(-50%) rotate(var(--gun-angle, 0rad)); transform-origin: center bottom; border: 1px solid #697d80; border-radius: 4px 4px 2px 2px; background: linear-gradient(90deg, #697d80, #c1c8bc 50%, #697d80); }
.submarine-gun-barrel::before { content: ""; position: absolute; top: -3px; left: -3px; right: -3px; height: 6px; border: 1px solid #536b6c; border-radius: 3px; background: #697d80; }
.submarine-gun-tip { position: absolute; top: -3px; left: 50%; width: 0; height: 0; }
.submarine-bubbles { display: none; }
.ocean-world .submarine-bubbles {
  display: block; position: absolute; inset: 0 -16px; z-index: 3;
  overflow: visible; pointer-events: none;
}
.submarine-bubbles span {
  position: absolute; left: var(--bubble-x); bottom: 12%;
  width: var(--bubble-size); height: var(--bubble-size); border-radius: 50%;
  border: 1px solid #e6fff2b8; background: #d9fff438;
  box-shadow: inset 1px 1px 1px #ffffffa0;
  opacity: 0; animation: hull-bubble 6s linear infinite; animation-delay: var(--bubble-delay);
}
@keyframes hull-bubble {
  0% { opacity: 0; transform: translate(0, 0) scale(.65); }
  12% { opacity: .65; }
  80% { opacity: .5; }
  100% { opacity: 0; transform: translate(var(--bubble-drift), -190px) scale(1.1); }
}

/* Counters overlay the scene and do not change the height of the controls. */
.scores { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.scoreboard { position: absolute; top: -25px; left: calc(50% - max(var(--gun-offset, 65px), 40px)); transform: translateX(-50%); color: #f8fff3; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; text-shadow: 0 1px 3px #234f4b, 0 0 2px #234f4b; }
.scoreboard + .scoreboard { left: calc(50% + max(var(--gun-offset, 65px), 40px)); }
.scoreboard-compact { font-size: 14px; }
.ocean-world .scoreboard { top: calc(var(--gun-mount-y, 12px) + 12px); left: calc(50% - max(var(--gun-offset, 65px), 60px)); }
.ocean-world .scoreboard + .scoreboard { left: calc(50% + max(var(--gun-offset, 65px), 60px)); }
@media (orientation: landscape) { .ocean-world .submarine-gun-barrel { height: 17px; } }
@media (orientation: landscape) and (max-height: 500px) { .scoreboard { font-size: 15px; top: -20px; } .scoreboard-compact { font-size: 13px; } .ocean-world .scoreboard { top: calc(var(--gun-mount-y, 12px) + 10px); } }
