:root { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #0a0c10; color: #dfe6f0;
  height: 100vh; overflow: hidden;
}
/* The scene fills the window; the panels float over it, translucent, so the
   sim keeps its size when one is hidden. */
#panel, #assetPanel { position: absolute; top: 0; bottom: 0; padding: 14px; overflow-y: auto;
  background: rgba(13, 17, 23, .88); z-index: 2; }
#panel { left: 0; width: 320px; border-right: 1px solid #1c2230; }
#assetPanel { right: 0; width: 300px; border-left: 1px solid #1c2230; }
#panel.hidden, #assetPanel.hidden { display: none; }
/* one toggle per panel; each stays reachable once its panel is hidden. The left
   toggle sits at the window edge and does not move when the panel is toggled,
   so the "Boids" title starts past it; the right one shifts to the window edge
   while its panel is hidden, clear of the "Scene assets" title and scrollbar. */
#panelToggle, #assetToggle { position: fixed; top: 10px; z-index: 3; width: 30px; height: 26px;
  margin: 0; padding: 0; background: rgba(27, 39, 64, .9); }
#panelToggle:hover, #assetToggle:hover { background: rgba(35, 49, 80, .95); }
#panelToggle { left: 10px; }
#assetToggle { right: 20px; }
#assetPanel.hidden + #assetToggle { right: 10px; }
#panel h1 { padding-left: 32px; }
#assetList { margin-top: 10px; }
.assetSection { margin-bottom: 12px; }
.assetSectionTitle { color: #9db2cf; letter-spacing: .06em; text-transform: uppercase;
  font-size: 11px; margin-bottom: 6px; }
.assetItems { display: flex; flex-wrap: wrap; gap: 4px; }
.assetItem { position: relative; width: 96px; height: 96px; overflow: hidden;
  border: 1px dashed #2c3d5c; border-radius: 6px; cursor: grab; }
.assetItem:active { cursor: grabbing; }
.assetItem img { width: 100%; height: 100%; object-fit: contain; display: block; }
.assetItem span { position: absolute; top: 0; left: 0; right: 0; padding: 2px 4px;
  font-size: 10px; color: #dfe6f0; text-align: center; overflow-wrap: anywhere;
  background: linear-gradient(rgba(10, 12, 16, .75), rgba(10, 12, 16, 0)); pointer-events: none; }
#assetHint { margin: 0; color: #5f728c; font-size: 11px; }
/* the selected asset's context; hidden (inline style) when nothing is selected */
#assetContext { margin-top: 12px; padding: 10px; border: 1px solid #2c3d5c;
  border-radius: 6px; background: #101827; }
.ctxTitle { color: #9db2cf; letter-spacing: .06em; text-transform: uppercase;
  font-size: 11px; overflow-wrap: anywhere; }
#assetContext input[type=range], #assetContext select { margin-top: 2px; }
#assetContext .row { margin-top: 8px; }
#assetContext .check { margin-top: 8px; }
/* fixed: the canvas scrolls under it, so it is placed at the canvas rect */
#gizmo { position: fixed; pointer-events: none; overflow: visible; }
.gizmoBox { position: absolute; box-sizing: border-box; border: 1px dashed #ffffff;
  pointer-events: auto; cursor: grab; }
.gizmoBox:active { cursor: grabbing; }
.gizmoHandle { position: absolute; box-sizing: border-box; pointer-events: auto;
  transform: translate(-50%, -50%); }
.gizmoEdge { height: 20px; }
.gizmoEdge.col { width: 20px; }
.gizmoCorner { width: 22px; height: 22px; }
.gizmoRot { width: 30px; height: 30px; cursor: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%3E%3Cpath%20d='M15%2010a5%205%200%201%201-1.5-3.5'%20fill='none'%20stroke='%23dfe6f0'%20stroke-width='2'%20stroke-linecap='round'/%3E%3Cpath%20d='M13.5%206.5l1%203-3%200z'%20fill='%23dfe6f0'/%3E%3C/svg%3E") 10 10, crosshair; }
/* The scene fills the window at one uniform scale: the canvas is the world at
   "cover" size times the user zoom (set by fitCanvas in core/assets.js), so the
   axis that does not fit scrolls instead of being stretched. The scrollbars are
   hidden — the wheel, trackpad or shift+wheel pan, ctrl/cmd+wheel zooms — and
   the gizmo is a fixed overlay, kept in step with the scroll by a listener.
   flex + margin:auto centres the canvas when zoomed out below cover, and still
   scrolls (auto margins collapse) when it overflows. */
#stage { position: absolute; inset: 0; overflow: auto; scrollbar-width: none; display: flex; }
#stage::-webkit-scrollbar { display: none; }
canvas { display: block; flex: none; margin: auto; background: #05070a; }
h1 { font-size: 13px; margin: 0 0 4px; letter-spacing: .06em; text-transform: uppercase; color: #9db2cf; }
.sub { margin: 0 0 12px; color: #5f728c; font-size: 11px; }
/* Sliders sit tight: the label row hugs its track and one slider's gap from the
   last is small, so a whole section fits on screen at once. */
.row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
  line-height: 1.2; margin-top: 6px; }
.row label { color: #8aa0bd; }
input[type=range] { width: 100%; height: 14px; accent-color: #3d7dff; }
select { background: #1b2740; color: #dfe6f0; border: 1px solid #2c3d5c;
  border-radius: 6px; padding: 4px 6px; font: inherit; }
input[type=color] { width: 44px; height: 22px; padding: 0; background: #1b2740;
  border: 1px solid #2c3d5c; border-radius: 4px; cursor: pointer; }
details { margin-top: 14px; border-top: 1px solid #1c2230; padding-top: 10px; }
summary { cursor: pointer; color: #9db2cf; letter-spacing: .06em; text-transform: uppercase;
  font-size: 11px; user-select: none; }
summary:hover { color: #dfe6f0; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: #8aa0bd; }
button { width: 100%; margin-top: 14px; padding: 8px; background: #1b2740; color: #dfe6f0;
  border: 1px solid #2c3d5c; border-radius: 6px; cursor: pointer; font: inherit; }
button:hover { background: #233150; }
#status { margin-top: 14px; color: #8aa0bd; font-size: 11px; white-space: pre-wrap; }
#status.err { color: #ff8f8f; }
/* The mode indicator, bottom left: Edit and Play icons, the active mode lit.
   Always visible, in both modes; the Tab handler in core/play.js flips it.
   The open settings panel owns the bottom-left corner, so the indicator sits
   just past its right edge instead of under it; in play mode the panel is gone,
   so it returns to the window edge. */
#modeSwitch { position: fixed; left: 12px; bottom: 12px; z-index: 4;
  display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid #1c2230;
  border-radius: 8px; background: rgba(13, 17, 23, .88); }
/* Its own box, sitting just above the switch and shifting with it. */
#modeHint { position: fixed; left: 12px; bottom: 52px; z-index: 4;
  display: flex; flex-direction: column; gap: 1px; padding: 6px 8px;
  border: 1px solid #1c2230; border-radius: 8px; background: rgba(13, 17, 23, .88);
  color: #8aa0bd; font-size: 11px; line-height: 1.25; white-space: nowrap; }
body:not(.play) #panel:not(.hidden) ~ #modeHint { left: 332px; } /* #panel 320 + 12 gap */
/* The app icon, bottom right: just the art, no box, with a small credit under
   it. It clears the scene panel while that is open, and sits in the corner once
   it is collapsed. */
#appIcon { position: fixed; right: 12px; bottom: 12px; z-index: 4;
  display: flex; flex-direction: column; align-items: center; gap: 4px; }
#appIcon img { display: block; width: 64px; height: 64px; object-fit: contain; }
.appCredit { display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 4px 8px; border-radius: 8px; background: rgba(13, 17, 23, .5);
  color: #8aa0bd; font-size: 11px; text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
.appCredit a { display: inline-flex; align-items: center; gap: 4px; color: #9db2cf;
  text-decoration: none; }
.appCredit a:hover { color: #ff3860; }
.appCredit svg { display: block; width: 13px; height: 13px; flex: none; }
body:not(.play) #assetPanel:not(.hidden) ~ #appIcon { right: 312px; } /* #assetPanel 300 + 12 gap */
body:not(.play) #panel:not(.hidden) ~ #modeSwitch { left: 332px; } /* #panel 320 + 12 gap */
#modeSwitch button { width: 30px; height: 26px; margin: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 5px; color: #5f728c; cursor: pointer; }
#modeSwitch button:hover { background: none; color: #9db2cf; }
#modeSwitch button.on, #modeSwitch button.on:hover { background: #1b2740; color: #dfe6f0; }
#modeSwitch svg { display: block; width: 16px; height: 16px; }
/* Play mode (Tab): the editor chrome goes away and the food bar takes the
   bottom edge. The panels keep their own hidden class, so leaving play mode
   restores whichever ones were open. */
body.play #panel, body.play #assetPanel,
body.play #panelToggle, body.play #assetToggle, body.play #gizmo { display: none; }
#foodBar { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  z-index: 4; display: none; gap: 18px; align-items: flex-end; padding: 10px 16px;
  border: 1px solid #1c2230; border-bottom: 0; border-radius: 8px 8px 0 0;
  background: rgba(13, 17, 23, .5); }
body.play #foodBar { display: flex; }
/* Two sections of icons: the art is the button, with its price under it. */
.barSection { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.barSection + .barSection { border-left: 1px solid #ffffff; padding-left: 18px; }
.barTitle { color: #ffffff; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.barItems { display: flex; gap: 10px; align-items: flex-end; }
/* one slot per icon: the art, with its price (or a net's buy button) under it */
.barItem { display: flex; flex-direction: column; align-items: center; gap: 2px; }
#foodBar button { position: relative; width: auto; margin: 0; padding: 2px 4px; background: none; border: 0;
  transition: transform .16s ease, opacity .16s ease; }
#foodBar button:hover { background: none; transform: translateY(-4px); }
#foodBar img { display: block; position: relative; width: 64px; height: 64px;
  object-fit: contain; transition: transform .16s ease, filter .16s ease; }
#foodBar button:hover img { transform: scale(1.1); }
#foodBar .price { display: block; margin-top: 1px; color: #ffffff; font-size: 10px; }
/* the net's badge rides the icon's top right corner, clear of the art */
#foodBar .netCount { position: absolute; top: -3px; right: -3px; margin: 0; padding: 0 4px;
  border: 1px solid #2c3d5c; border-radius: 7px; background: #1b2740; line-height: 14px; }
#foodBar button.sel img { transform: scale(1.1); filter: drop-shadow(0 0 6px #ffffff); }
#foodBar button.sel .price { color: #ffffff; }
#foodBar button.dim { opacity: .4; }
/* the little "one more for $5" control under a net icon */
#foodBar .netBuy { padding: 2px 5px; border: 1px solid #ffffff; border-radius: 4px; font-size: 10px; }
#foodBar .netBuy:hover { transform: none; }
/* the piece in hand, following the pointer */
#foodGhost { position: fixed; z-index: 5; width: 64px; height: 64px;
  object-fit: contain; pointer-events: none; transform: translate(-50%, -50%); opacity: .8; }
/* The item in hand is the cursor over the water, so the pointer is hidden there —
   but not over the bar, the HUD or the panels, which stay normal to use. */
body.holding canvas { cursor: none; }
/* The play-mode head count and spawn timer, top left. */
#playHud { position: absolute; top: 0; left: 0; z-index: 4; display: none;
  padding: 10px 12px 11px; min-width: 148px; border: 1px solid #1c2230; border-top: 0;
  border-left: 0; border-radius: 0 0 8px 0; background: rgba(13, 17, 23, .88); }
body.play #playHud { display: block; }
.hudRow { display: flex; justify-content: space-between; gap: 12px; color: #8aa0bd; }
.hudRow b { color: #dfe6f0; font-weight: 600; }
#fishTimer { height: 6px; margin-top: 9px; border-radius: 3px; background: #1b2740; overflow: hidden; }
#fishTimerBar { width: 0; height: 100%; background: #3d7dff; }
#fishTimerText { margin-top: 4px; color: #8aa0bd; font-size: 11px; }
/* The purse, top centre, and the catch waiting to be sold, top right. */
#money { position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 4;
  display: none; padding: 8px 16px; border: 1px solid #1c2230; border-top: 0;
  border-radius: 0 0 8px 8px; background: rgba(13, 17, 23, .88); color: #f9f06b; }
body.play #money { display: block; }
#catchBox { position: absolute; top: 0; right: 0; z-index: 4; display: none;
  padding: 10px 12px 12px; min-width: 196px; border: 1px solid #1c2230; border-top: 0;
  border-right: 0; border-radius: 0 0 0 8px; background: rgba(13, 17, 23, .88); }
body.play #catchBox.show { display: block; }
/* The goal ticket: half over the top edge, right of the purse, turned 45°. The
   visible half is the buy button; the label sits just under it. */
#ticketGoal { position: absolute; top: 0; left: calc(50% + 140px); z-index: 4;
  display: none; transform: translate(-50%, -50%); cursor: pointer; }
body.play #ticketGoal { display: block; }
#ticketGoal img { display: block; width: 130px; height: 130px; object-fit: contain;
  transform: rotate(45deg); transition: transform .16s ease, filter .16s ease; }
#ticketGoal:hover img { transform: rotate(45deg) scale(1.06); }
#ticketGoal.dim img { opacity: .45; }
#ticketGoal .ticketPrice { position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%); color: #f9f06b; font-size: 11px; white-space: nowrap; }
/* The intro note's small copy, mirrored to the ticket: it peeks over the top
   edge left of the purse and opens the full note. */
#introGoal { position: absolute; top: 0; left: calc(50% - 140px); z-index: 4;
  display: none; transform: translate(-50%, -50%); cursor: pointer; }
body.play #introGoal { display: block; }
#introGoal img { display: block; width: 90px; height: 90px; object-fit: contain;
  transform: rotate(-45deg); transition: transform .16s ease; }
#introGoal:hover img { transform: rotate(-45deg) scale(1.06); }
/* The congratulations menu: full screen over the frozen water. The art, text and
   buttons sit as one centred block, evenly spaced. */
#winBox { position: fixed; inset: 0; z-index: 6; display: none;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; text-align: center; padding: 24px; background: rgba(10, 12, 16, .82); }
body.won #winBox { display: flex; }
/* Art sized by its own aspect (no square letterbox), so the flex gap reads the
   same above and below the text. */
#winBox img { display: block; max-width: min(80vw, 560px); max-height: 52vh; }
#winBox .winText p { margin: 0; color: #dfe6f0; font-size: 16px; }
#winBox .winText p.sub { margin-top: 4px; color: #8aa0bd; font-size: 12px; }
.winActions { display: flex; gap: 10px; }
#winBox button { width: auto; margin: 0; padding: 8px 22px; }
/* The intro note's full copy: the same full-screen treatment as the win menu. */
#introBox { position: fixed; inset: 0; z-index: 6; display: none;
  flex-direction: column; align-items: center; justify-content: center;
  text-align: center; background: rgba(10, 12, 16, .88); }
body.showIntro #introBox { display: flex; }
#introBox img { display: block; max-width: min(80vw, 520px); max-height: 46vh; }
#introBox .note { max-width: min(64ch, 84vw); margin-top: 12px; }
#introBox .note .noteTitle { color: #9db2cf; letter-spacing: .06em; text-transform: uppercase;
  font-size: 11px; }
#introBox .note ul { margin: 8px 0 0; padding-left: 20px; text-align: left; color: #dfe6f0; }
#introBox .note li { margin: 6px 0; font-size: 15px; }
#introBox button { width: auto; margin-top: 18px; padding: 8px 22px; }
#catchBox .catchRow { display: flex; align-items: baseline; gap: 6px; margin-top: 7px; }
#catchBox .catchRow span { color: #8aa0bd; flex: 1; }
#catchBox .catchRow b { color: #dfe6f0; min-width: 22px; text-align: right; }
#catchBox .catchRow em { color: #5f728c; font-style: normal; font-size: 10px; }
#catchBox button { width: auto; margin: 0; padding: 3px 7px; font-size: 11px; }
#catchBox .catchTotal { display: flex; justify-content: space-between; gap: 6px;
  margin-top: 9px; padding-top: 7px; border-top: 1px solid #1c2230; color: #8aa0bd; }
#catchBox .catchTotal b { color: #f9f06b; }
#catchBox .catchAll { display: flex; gap: 6px; margin-top: 9px; }
#catchBox .catchAll button { flex: 1; padding: 6px; }
/* One bar under each net, draining as the net's time runs out. */
#netBars { position: fixed; inset: 0; z-index: 3; display: none; pointer-events: none; }
body.play #netBars { display: block; }
.netBar { position: absolute; height: 5px; transform: translateX(-50%);
  border-radius: 3px; background: rgba(13, 17, 23, .8); border: 1px solid #2c3d5c; }
.netBarFill { height: 100%; background: #3d7dff; }
