/* flOw tribute. The page background is set by ocean.js from the game's own level colours as you scroll. */
:root {
  --sea: #00bfff;
  --ink: #fff;
  --ink-soft: rgba(255, 255, 255, 0.86);
  /* A dark halo keeps white text readable on the bright shallow levels. */
  --halo: 0 1px 2px rgba(0, 40, 80, 0.55), 0 0 12px rgba(0, 40, 80, 0.45);
  --glass: rgba(0, 28, 56, 0.42);
  --glass-edge: rgba(255, 255, 255, 0.14);
  /* Controls: thin white lines and soft glows, like the creatures. */
  --ctl-bg: rgba(0, 22, 44, 0.38);
  --ctl-bg-hover: rgba(255, 255, 255, 0.12);
  --ctl-edge: rgba(255, 255, 255, 0.3);
  --ctl-edge-hover: rgba(255, 255, 255, 0.75);
  --ctl-glow: 0 0 14px rgba(255, 255, 255, 0.28);
  --ctl-focus: 0 0 0 1px #fff, 0 0 16px rgba(255, 255, 255, 0.5);
  --ctl-h: 38px;
  --r-box: 14px;
  --r-panel: 18px;
  --field-bg: rgba(0, 12, 26, 0.45);
  --red: #ff6b4a;
  --blue: #7fd8ff;
  --round: "Comfortaa", "Quicksand", system-ui, sans-serif;
  --text: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--sea);
  color: var(--ink);
  font: 17px/1.65 var(--text);
  overflow-x: hidden;
}

/* Two canvases: the deep layer is blurred like the creatures one level below you in the game. */
#deep, #near { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#deep { z-index: 0; filter: blur(5px); opacity: 0.75; }
#near { z-index: 1; }
.hero, main, .floor { position: relative; z-index: 2; }

a { color: #fff; text-decoration-color: rgba(255, 255, 255, 0.5); text-underline-offset: 3px; }
a:hover { text-decoration-color: #fff; }
code { font-size: 0.88em; background: rgba(255, 255, 255, 0.08); padding: 0 0.25em; border-radius: 6px; overflow-wrap: anywhere; }

/* ---------- Hero ---------- */
.hero {
  min-height: 92vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 48px 16px 24px;
}
.hero > * { max-width: 100%; }
.kicker { margin: 0; font: 700 0.8rem/1 var(--text); letter-spacing: 0.22em; text-transform: uppercase; color: #fff; text-shadow: var(--halo); }
.title {
  margin: 0.1em 0 0.1em; display: flex; align-items: center; justify-content: center;
  font: 400 clamp(4rem, 15vw, 9rem)/1 "DM Serif Display", Georgia, "Times New Roman", serif;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 2px 6px rgba(0, 40, 80, 0.35), 0 0 30px rgba(255, 255, 255, 0.5);
}
.title .word { white-space: nowrap; }
.title .o { font-size: 1.9em; line-height: 0.8; margin: 0 -0.02em; vertical-align: -0.12em; }
/* The ribbons that run out of the logo on the game's title screen. */
.wave { width: clamp(70px, 22vw, 240px); height: auto; flex: none; margin: 0.45em 0.05em 0 0; overflow: visible; }
.wave.right { transform: scaleX(-1) scaleY(-1); margin: 0.45em 0 0 0.05em; }
.wave path { fill: none; stroke: rgba(255, 255, 255, 0.7); stroke-width: 3; stroke-linecap: round; filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6)); }
.tagline { margin: 0.4em 0 1.6em; font: 600 clamp(1.05rem, 3vw, 1.35rem)/1.4 var(--round); color: #fff; text-shadow: var(--halo); }
.note { margin: -0.6em 0 1.8em; font: 600 0.88rem/1.5 var(--text); color: #fff; text-shadow: var(--halo); }
.kicker a { text-decoration-color: rgba(255, 255, 255, 0.6); }
.dive {
  text-shadow: var(--halo);
  display: inline-flex; align-items: center; justify-content: center;
  width: 92px; height: 92px; border-radius: 50%;
  border: 2px solid #fff; color: #fff; text-decoration: none;
  font: 600 1.05rem/1 var(--round);
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.45), inset 0 0 18px rgba(255, 255, 255, 0.25);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.dive:hover, .dive:focus-visible { transform: scale(1.06); background: rgba(255, 255, 255, 0.12); box-shadow: 0 0 36px rgba(255, 255, 255, 0.7), inset 0 0 18px rgba(255, 255, 255, 0.35); }
.depth-hint { margin: 3.2em 0 0; font: 400 0.75rem/1 var(--round); letter-spacing: 0.3em; color: #fff; text-shadow: var(--halo); }
.depth-hint::after { content: ""; display: block; width: 1px; height: 38px; margin: 12px auto 0; background: linear-gradient(#fff, transparent); opacity: 0.6; }

/* ---------- Play ---------- */
main { max-width: 1040px; margin: 0 auto; padding: 0 16px 40px; }
.play { scroll-margin-top: 24px; }
.stage {
  position: relative; width: 100%; aspect-ratio: 2 / 1;
  border-radius: 14px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%, rgba(255, 255, 255, 0.16), rgba(0, 40, 80, 0.25) 70%);
  isolation: isolate;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 18px 60px rgba(0, 20, 40, 0.35), 0 0 40px rgba(255, 255, 255, 0.12);
}
.stage:fullscreen { border-radius: 0; background: #00bfff; }
.stage ruffle-player { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.fs {
  position: absolute; right: 10px; bottom: 10px; z-index: 2; width: 38px; height: 38px; padding: 8px;
  border: 0; border-radius: 10px; background: transparent; color: #fff; cursor: pointer; opacity: 0.55;
  transition: opacity 0.2s ease, background 0.2s ease;
}
.fs:hover, .fs:focus-visible { opacity: 1; background: rgba(255, 255, 255, 0.14); }
.fs svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 3px rgba(0, 40, 80, 0.5)); }
.start.error .start-sub { letter-spacing: 0.04em; max-width: 34ch; text-align: center; line-height: 1.4; }
.start {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: none; border: 0; color: #fff; cursor: pointer; font: inherit;
}
.start-ring {
  width: 108px; height: 108px; border-radius: 50%; margin-bottom: 10px;
  border: 2px solid #fff; position: relative;
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.3);
  transition: transform 0.3s ease;
}
.start-ring::before { content: ""; position: absolute; inset: 38%; border-radius: 50%; background: #fff; box-shadow: 0 0 16px #fff; }
.start-ring::after { content: ""; position: absolute; inset: -14px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.35); animation: pulse 2.6s ease-out infinite; }
@keyframes pulse { from { transform: scale(0.85); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .start-ring::after { animation: none; } }
.start:hover .start-ring, .start:focus-visible .start-ring { transform: scale(1.07); }
.start:focus-visible { outline: none; }
.start:focus-visible .start-ring { box-shadow: var(--ctl-focus), 0 0 40px rgba(255, 255, 255, 0.6), inset 0 0 20px rgba(255, 255, 255, 0.35); }
.dive:focus-visible { outline: none; box-shadow: var(--ctl-focus), inset 0 0 18px rgba(255, 255, 255, 0.35); }
.fs:focus-visible { outline: none; box-shadow: var(--ctl-focus); }
.start-label { font: 600 1.5rem/1 var(--round); text-shadow: var(--halo); }
.start-sub { font: 600 0.8rem/1 var(--round); letter-spacing: 0.18em; color: #fff; text-shadow: var(--halo); }

.controls {
  background: var(--glass); border: 1px solid var(--glass-edge); border-radius: var(--r-box);
  list-style: none; margin: 14px 0 0; padding: 14px 18px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px 22px;
  font-size: 0.95rem; color: #fff;
}
.controls .touch { display: none; }
@media (pointer: coarse) { .controls .touch { display: list-item; } }
.controls li { padding-left: 20px; position: relative; }
.controls li::before { content: ""; position: absolute; left: 2px; top: 0.62em; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid #fff; opacity: 0.8; }
.controls b { color: #fff; font-weight: 700; }
.controls .red { color: var(--red); }
.controls .blue { color: var(--blue); }

/* ---------- Panels ---------- */
.panel {
  margin: 72px 0 0; padding: 28px clamp(18px, 4vw, 40px);
  background: var(--glass); border: 1px solid var(--glass-edge); border-radius: var(--r-panel);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  scroll-margin-top: 24px;
}
/* Panel text is centred, using the panel's full width. Editor parts switch back to left-aligned below. */
.panel { text-align: center; }
.panel h2 { margin: 0 0 0.7em; font: 400 clamp(1.45rem, 4vw, 1.9rem)/1.25 var(--round); text-shadow: 0 0 18px rgba(255, 255, 255, 0.35); }
.panel p { margin: 0 0 1em; overflow-wrap: break-word; }
.panel p:last-child { margin-bottom: 0; }



.why { list-style: none; margin: 0; padding: 0; }
.why li { margin: 0 0 1.1em; }
/* A small ring instead of a bullet, which would sit oddly on centred lines. */
.why li::before { content: ""; display: block; width: 8px; height: 8px; margin: 0 auto 8px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.8); box-shadow: var(--ctl-glow); }
.why li:last-child { margin-bottom: 0; }
.people { list-style: none; margin: 0 0 1.2em; padding: 0; display: grid; gap: 10px; }
.people b { font: 600 1.05rem/1.3 var(--round); display: block; }
.people span { color: var(--ink-soft); font-size: 0.92rem; }
.small { font-size: 0.85rem; color: var(--ink-soft); }

.floor { height: 40vh; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 28px; }
.floor span { font: 400 0.72rem/1 var(--round); letter-spacing: 0.3em; color: rgba(255, 255, 255, 0.3); }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .panel { margin-top: 48px; border-radius: 14px; }
  .start-ring { width: 78px; height: 78px; }
  .wave { width: 12vw; }
  .kicker { letter-spacing: 0.12em; line-height: 1.5; }
}

/* ---------- Controls: one look for buttons, selects, fields ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 0.86rem/1.1 var(--round); color: #fff; text-decoration: none; cursor: pointer; white-space: nowrap;
  min-height: var(--ctl-h); padding: 8px 16px; border-radius: 999px; border: 1px solid var(--ctl-edge); background: var(--ctl-bg);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}
.btn:hover { border-color: var(--ctl-edge-hover); background: var(--ctl-bg-hover); box-shadow: var(--ctl-glow); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible, .btn.file:focus-within { outline: none; border-color: #fff; box-shadow: var(--ctl-focus); }
.btn.primary { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.7); box-shadow: var(--ctl-glow); }
.btn.primary:hover { background: rgba(255, 255, 255, 0.28); }
.btn:disabled, .btn.primary:disabled { opacity: 0.4; cursor: default; box-shadow: none; border-color: var(--ctl-edge); background: var(--ctl-bg); transform: none; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 32px; padding: 6px 12px; font-size: 0.8rem; }
/* Armed delete glows like the game's red food. */
.btn.danger[data-armed] { border-color: var(--red); background: rgba(255, 107, 74, 0.16); color: #ffd0c4; box-shadow: 0 0 14px rgba(255, 107, 74, 0.45); }
.btn.file { overflow: hidden; }
.btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Custom select (ui.js). The marker is the game's food, a ring with a curling stalk; it turns when the list opens.
   Options use the same ring, filled with a dot when chosen. Action menus (data-fsel="action") have no rings. */
.fsel-native { display: none; }
.fsel { position: relative; display: inline-block; max-width: 100%; vertical-align: middle; }
.fsel-btn { max-width: 100%; justify-content: space-between; gap: 14px; padding-right: 14px; }
.level-row .fsel-btn { min-width: 15.5em; }
.fsel-value { overflow: hidden; text-overflow: ellipsis; }
.fsel-mark { flex: none; position: relative; width: 11px; height: 11px; margin-right: 5px; border-radius: 50%; border: 1.5px solid #fff; transition: transform 0.25s ease; }
.fsel-mark::before { content: ""; position: absolute; left: 100%; top: 50%; width: 6px; height: 5px; margin-top: -5px; border-top: 1.5px solid #fff; border-right: 1.5px solid #fff; border-radius: 0 6px 0 0; }
.fsel.open .fsel-mark { transform: rotate(180deg); }
.fsel.open .fsel-btn { border-color: var(--ctl-edge-hover); background: var(--ctl-bg-hover); }
.fsel-list {
  position: absolute; z-index: 30; left: 0; top: calc(100% + 6px); min-width: 100%; max-width: min(90vw, 420px); max-height: 300px; overflow: auto;
  margin: 0; padding: 6px; list-style: none; text-align: left;
  background: rgba(0, 18, 36, 0.97); border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 20px;
  box-shadow: 0 14px 40px rgba(0, 10, 25, 0.45), 0 0 22px rgba(255, 255, 255, 0.12);
  animation: fsel-in 0.16s ease-out;
}
.fsel.up .fsel-list { top: auto; bottom: calc(100% + 6px); }
.fsel-list[hidden] { display: none; }
@keyframes fsel-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .fsel-list { animation: none; } .fsel-mark { transition: none; } }
.fsel-list li {
  position: relative; padding: 9px 16px 9px 36px; border-radius: 999px; cursor: pointer;
  font: 600 0.88rem/1.3 var(--round); color: rgba(255, 255, 255, 0.88); white-space: nowrap;
}
.fsel-list li::before { content: ""; position: absolute; left: 14px; top: 50%; width: 10px; height: 10px; margin-top: -6px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.55); }
.fsel-list li[aria-selected="true"] { color: #fff; }
.fsel-list li[aria-selected="true"]::before { border-color: #fff; background: radial-gradient(circle, #fff 0 3px, transparent 3.5px); box-shadow: var(--ctl-glow); }
.fsel-list li.active { background: rgba(255, 255, 255, 0.12); color: #fff; }
.fsel-list li.active::before { border-color: #fff; box-shadow: var(--ctl-glow); }
.fsel.action .fsel-list li { padding-left: 16px; }
.fsel.action .fsel-list li::before { display: none; }

.field {
  font: 600 0.95rem/1.2 var(--text); color: #fff; width: 100%;
  background: var(--field-bg); border: 1px solid var(--ctl-edge); border-radius: var(--r-box); padding: 10px 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.field:hover { border-color: rgba(255, 255, 255, 0.5); }
input.field { min-height: var(--ctl-h); border-radius: 999px; padding: 8px 18px; }
.field:focus-visible { outline: none; border-color: #fff; box-shadow: var(--ctl-glow); }

/* ---------- Level sets ---------- */
.level-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 10px;
  padding: 12px 16px; background: var(--glass); border: 1px solid var(--glass-edge); border-radius: var(--r-box); font-size: 0.92rem;
}
.level-row label { font: 600 0.9rem/1 var(--round); }
.level-note { flex: 1 1 260px; color: var(--ink-soft); font-size: 0.86rem; line-height: 1.45; }

.lv-start { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 14px; }
.lv-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; text-align: left; }
.lv-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 8px 16px; border-radius: var(--r-box); background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); }
.lv-list li.empty { background: none; border: 0; padding: 0; color: var(--ink-soft); font-size: 0.9rem; justify-content: center; }
.lv-list li.empty:focus { outline: none; }
.lv-name { font: 600 0.98rem/1.3 var(--round); overflow-wrap: anywhere; }
.lv-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.lv-fix { font-style: normal; font-size: 0.78rem; color: #ffd0c4; margin-left: 6px; }

.lv-guard { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 14px 0 0; padding: 10px 14px; border-radius: var(--r-box); background: var(--glass); border: 1px solid rgba(255, 255, 255, 0.55); box-shadow: var(--ctl-glow); text-align: left; }
.lv-guard[hidden] { display: none; }
.lv-guard span { font-weight: 700; margin-right: auto; display: inline-flex; align-items: center; gap: 10px; }
.lv-guard span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px rgba(255, 107, 74, 0.8); }

.lv-editor { margin-top: 18px; display: grid; gap: 12px; text-align: left; }
.lv-editor[hidden] { display: none; }
.lv-field { display: grid; gap: 6px; font: 600 0.9rem/1 var(--round); }
.lv-editor textarea.field {
  border-radius: var(--r-box); min-height: 360px; resize: vertical; tab-size: 2; white-space: pre; overflow-wrap: normal; overflow-x: auto;
  font: 500 13px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: #e8f6ff; padding: 12px 14px;
}
.lv-hint { margin: -6px 0 0; }
.lv-strip { display: grid; gap: 14px; }
.lv-campaign > span { display: block; font: 600 0.8rem/1 var(--round); color: var(--ink-soft); margin-bottom: 6px; }
.lv-swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.lv-swatch { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.55); background: var(--c); cursor: pointer; padding: 0; position: relative; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
.lv-swatch.big::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.85); }
.lv-swatch:hover { transform: scale(1.15); border-color: #fff; box-shadow: var(--ctl-glow); }
.lv-swatch:focus-visible { outline: none; transform: scale(1.15); box-shadow: var(--ctl-focus); }
.lv-report p { margin: 0 0 6px; font-weight: 700; }
.lv-good { color: #b9ffd9; }
.lv-bad { color: #ffd0c4; }
.lv-report ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 0.88rem; }
.lv-report li::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; vertical-align: 0; }
.lv-report li.err::before { border: 1.5px solid #ffb3a1; box-shadow: 0 0 8px rgba(255, 107, 74, 0.5); }
.lv-report li.warn::before { border: 1.5px solid #ffe08a; box-shadow: 0 0 8px rgba(255, 224, 138, 0.45); }
.lv-line { font: 600 0.78rem/1 var(--round); color: #fff; background: var(--ctl-bg); border: 1px solid var(--ctl-edge); border-radius: 999px; padding: 5px 10px; cursor: pointer; transition: border-color 0.18s ease, box-shadow 0.18s ease; }
.lv-line:hover { border-color: var(--ctl-edge-hover); box-shadow: var(--ctl-glow); }
.lv-line:focus-visible { outline: none; border-color: #fff; box-shadow: var(--ctl-focus); }
.lv-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

/* The reference: a summary with the food marker instead of the browser's triangle. */
.lv-help { margin-top: 20px; }
.lv-help summary { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; font: 600 0.95rem/1.4 var(--round); border-radius: 999px; padding: 6px 14px; border: 1px solid transparent; transition: border-color 0.18s ease, background 0.18s ease; }
.lv-help summary:hover { border-color: var(--ctl-edge); background: var(--ctl-bg-hover); }
.lv-help summary::-webkit-details-marker { display: none; }
.lv-help summary::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #fff; transition: background 0.2s ease; }
.lv-help[open] summary::before { background: radial-gradient(circle, #fff 0 3px, transparent 3.5px); box-shadow: var(--ctl-glow); }
.lv-help summary:hover::before { box-shadow: var(--ctl-glow); }
.lv-help summary:focus-visible { outline: none; border-color: #fff; box-shadow: var(--ctl-focus); }
.lv-help dt code { background: none; padding: 0; }
.lv-help dl { margin: 12px 0 0; font-size: 0.9rem; text-align: left; }
.lv-help dt { margin-top: 10px; }
.lv-help dd { margin: 4px 0 0; color: var(--ink-soft); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.start[hidden], .fs[hidden] { display: none; }

/* Phone tweaks for the controls; after the control rules so they win. */
@media (max-width: 600px) {
  .lv-start .btn, .lv-start .fsel, .lv-start .fsel-btn { width: min(100%, 300px); }
  .level-row .fsel, .level-row .fsel-btn { width: 100%; min-width: 0; }
  #lv-store { margin-top: 12px; }
}
