/* MOFLYFish — §41 UI: tiny amber text, simple bitmap-ish controls, minimal
   decoration, Windows 95-era sensibility. The interface should never compete
   with the fish, which is the only thing in here allowed to look expensive. */

:root {
  --amber: #e2a03f;
  --fly: #ffc46b;
  --amber-dim: #9a6c29;
  --rule: #3a3a3a;
  --panel: #14120f;
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* Several panels below set display:grid or display:flex, which outranks the
   user-agent [hidden] rule. Without this they paint even when hidden. */
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%; background: #000; overflow: hidden;
  overscroll-behavior: none;
  font-family: "MS Sans Serif", Tahoma, Verdana, system-ui, sans-serif;
  -webkit-font-smoothing: none;
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}

/* body is pinned rather than sized in vh: mobile browser chrome makes 100vh
   lie, and the tank would sit under the address bar. */
body { position: fixed; inset: 0; }

#stage {
  position: absolute; inset: 0; margin: auto;
  aspect-ratio: 4 / 3; max-width: 100%; max-height: 100%;
  width: 100%; background: #000; overflow: hidden; cursor: crosshair;
}
#gl { display: block; width: 100%; height: 100%; }

/* §3 top-left: tiny logo, fish name, nothing else */
#hud {
  position: absolute; top: 0; left: 0; padding: 6px 8px;
  font-size: 11px; letter-spacing: .5px; pointer-events: none; z-index: 3;
}
#logo { color: var(--amber); font-weight: 700; font-style: italic; }
/* the fly is the part that is actually doing the thinking */
#logo .fly { color: var(--fly); }
#fishname { color: var(--amber-dim); margin-left: 9px; letter-spacing: 1.5px; }

/* §3 the bottom control zone, separated by a thin grey line */
#controls {
  position: absolute; left: 0; right: 0; bottom: 0; height: 7%;
  min-height: 34px; display: flex; align-items: center; gap: 10px;
  padding: 0 10px; border-top: 1px solid var(--rule); z-index: 3;
}
#feeders { margin-left: auto; margin-right: auto; display: flex; gap: 12px; flex: 0 0 auto; }
/* Nothing in here may push the plug off the edge, at any width. */
#controls > * { min-width: 0; }
#thermo { flex: 0 1 auto; min-width: 0; }
#shell, #plug { flex: 0 0 auto; }
.obj {
  background: none; border: 0; padding: 2px; cursor: pointer; line-height: 0;
  opacity: .82; transition: opacity .15s;
}
.obj:hover, .obj:focus-visible { opacity: 1; outline: none; }
.obj svg { height: clamp(18px, 3.4vh, 26px); width: auto; display: block; }
#plug svg { height: clamp(22px, 4.4vh, 32px); }

#thermo { display: flex; align-items: center; gap: 5px; }
.tlabel { color: var(--amber-dim); font-size: 9px; }
#temp {
  -webkit-appearance: none; appearance: none;
  width: clamp(40px, 9vw, 92px); min-width: 0; flex: 0 1 auto;
  height: 3px; background: linear-gradient(90deg, #2a4a6a, #6a5a2a, #7a3020);
  border: 0; outline: none; cursor: pointer;
}
#temp::-webkit-slider-thumb {
  -webkit-appearance: none; width: 7px; height: 13px; background: var(--amber); border: 0;
}
#temp::-moz-range-thumb { width: 7px; height: 13px; background: var(--amber); border: 0; border-radius: 0; }

/* §37 a compact late-nineties menu */
#menu {
  position: absolute; left: 10px; bottom: calc(7% + 8px); min-width: 150px;
  background: var(--panel); border: 1px solid var(--rule); z-index: 5; padding: 3px 0;
}
#menu ul { margin: 0; padding: 0; list-style: none; }
#menu li {
  padding: 4px 14px; font-size: 11px; color: var(--amber); cursor: pointer; white-space: nowrap;
}
#menu li:hover { background: var(--amber); color: #120d06; }

#panel {
  position: absolute; inset: 12% 14% auto 14%; background: var(--panel);
  border: 1px solid var(--rule); padding: 14px 16px 12px; z-index: 6;
  max-height: 72%; overflow: auto;
}
#panel, #panel p, #panel li { color: #c9b393; font-size: 11.5px; line-height: 1.65; }
#panel h2 { color: var(--amber); font-size: 12px; margin: 0 0 8px; letter-spacing: 1px; }
#panel a { color: var(--amber); }
#panel label.pv { display: block; margin: 5px 0; cursor: pointer; }
#panel label.pv input { margin-right: 7px; vertical-align: -1px; accent-color: var(--amber); }
#panel .pv-row { margin: 11px 0 3px; }
#panel .pv-note { color: #8a7a63; font-size: 10.5px; margin: 3px 0 0; }
#panel select {
  background: #0b0906; color: var(--amber); border: 1px solid var(--rule);
  font-family: inherit; font-size: 11px; padding: 2px 4px;
}
#panel ul { margin: 5px 0 9px; padding-left: 18px; }
#panel li { margin: 2px 0; }

#panel button, #gone button, #naming button {
  margin-top: 10px; background: #221c14; color: var(--amber);
  border: 1px solid var(--rule); padding: 3px 14px; font-size: 11px; cursor: pointer;
  font-family: inherit;
}

/* §17 naming, on first launch only */
#naming {
  position: absolute; inset: 0; display: grid; place-content: center;
  gap: 10px; text-align: center; z-index: 7; background: rgba(0,0,0,.72);
}
#naming label { color: var(--amber); font-size: 12px; letter-spacing: 2px; }
#nameinput {
  background: #0b0906; border: 1px solid var(--rule); color: var(--amber);
  font-family: inherit; font-size: 15px; letter-spacing: 3px; text-align: center;
  padding: 5px 10px; width: 210px; text-transform: uppercase; outline: none;
}
#nameinput:focus { border-color: var(--amber-dim); }

#gone {
  position: absolute; inset: 0; display: grid; place-content: center; gap: 6px;
  text-align: center; z-index: 7; background: #000; color: var(--amber-dim); font-size: 11px;
}

/* §28 the kiss imprint on the inside of the glass */
#imprint {
  position: absolute; width: 26px; height: 17px; z-index: 2; pointer-events: none;
  border-radius: 50% 50% 46% 46%;
  background: radial-gradient(ellipse at 50% 42%, rgba(255,214,190,.30), rgba(255,170,150,.13) 62%, transparent 74%);
  box-shadow: inset 0 0 6px rgba(255,190,170,.20);
  transform: translate(-50%, -50%);
}

/* §43 screensaver mode: the chrome simply goes away */
body.saver #hud, body.saver #controls { opacity: 0; pointer-events: none; }
#hud, #controls { transition: opacity 1.4s ease; }

@media (max-width: 560px) {
  #menu { left: 6px; min-width: 132px; }
  #panel { inset: 8% 7% auto 7%; }
  #controls { gap: 6px; padding: 0 7px; }
  #feeders { gap: 10px; }
}
/* On the narrowest phones the C and H markers are the first thing to go: the
   gradient on the slider already says which end is which. */
@media (max-width: 400px) {
  .tlabel { display: none; }
  #feeders { gap: 8px; }
}

/* Fingers are blunter than cursors. Everything tappable grows, and the control
   strip gets tall enough to hit without aiming. */
@media (pointer: coarse) {
  #stage { cursor: default; }
  #controls { height: auto; min-height: 56px; padding: 0 14px; gap: 14px; }
  .obj { padding: 9px 7px; }
  .obj svg { height: 26px; }
  #plug svg { height: 32px; }
  #feeders { gap: 22px; }
  #menu { min-width: 184px; padding: 6px 0; }
  #menu li { padding: 10px 18px; font-size: 13px; }
  #panel { inset: 5% 5% auto 5%; max-height: 80%; padding: 16px 18px 14px; }
  #panel, #panel p, #panel li { font-size: 13px; }
  #panel label.pv { padding: 7px 0; }
  #panel label.pv input { width: 17px; height: 17px; }
  #panel button, #gone button { padding: 9px 20px; font-size: 13px; }
  #temp { width: clamp(80px, 24vw, 130px); height: 6px; }
  #temp::-webkit-slider-thumb { width: 11px; height: 20px; }
  #temp::-moz-range-thumb { width: 11px; height: 20px; }
  #nameinput { font-size: 17px; padding: 9px 12px; }
  #hud { padding: 8px 10px; font-size: 12px; }
}
