/* Garten · style.css (shell from nights 052–059) */
:root {
  --bg: #05070f; --ui-text: #e8e3d6; --muted: #8d97ab; --amber: #e8a84a; --violet: #a98bff;
  --panel-bg: rgba(8, 12, 22, 0.74); --panel-border: rgba(255, 255, 255, 0.1); --field: rgba(10, 14, 27, 0.92);
  --mono: ui-monospace, Menlo, "SF Mono", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); overscroll-behavior: none; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ui-text); -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none; }
button, input, output { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#cv { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; height: 100dvh; display: block;
  touch-action: none; cursor: crosshair; background: var(--bg); }

a.home { position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); left: calc(14px + env(safe-area-inset-left, 0px)); z-index: 8;
  font-size: 12px; color: #8d9ab0; text-decoration: none; padding: 4px 7px; border-radius: 5px;
  background: rgba(6, 10, 22, 0.84); border: 1px solid var(--panel-border); }
a.home:hover, a.home:focus-visible { color: var(--amber); }

.hud { position: fixed; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); left: calc(14px + env(safe-area-inset-left, 0px)); z-index: 8;
  font-family: var(--mono); font-size: 11px; line-height: 1.5; color: var(--muted); padding: 5px 8px; border-radius: 6px; white-space: pre;
  background: rgba(6, 10, 22, 0.84); border: 1px solid var(--panel-border); font-variant-numeric: tabular-nums; pointer-events: none;
  max-width: calc(100vw - 28px); overflow: hidden; }
.hud .v { color: var(--ui-text); }
.hud .note { color: var(--amber); }

.title-overlay { position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px)); z-index: 9;
  text-align: center; pointer-events: none; opacity: 1; transition: opacity 1s ease;
  max-width: min(440px, calc(100vw - 300px)); padding: 6px 18px; border-radius: 12px;
  background: rgba(8, 10, 18, 0.82); border: 1px solid var(--panel-border); }
.title-overlay.faded { opacity: 0; }
.title-overlay h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: 0.06em; color: #f0e2c4; text-shadow: 0 1px 12px rgba(0,0,0,0.95); }
.title-overlay p { margin: 1px 0 0; font-size: 11.5px; color: #b3bccb; text-shadow: 0 1px 10px rgba(0,0,0,0.95); }
@media (min-width: 64rem) {
  .title-overlay { right: auto; left: 50%; transform: translateX(-50%); width: max-content; max-width: 520px; }
}

/* ---------- toolbar ---------- */
.bar { position: fixed; z-index: 8; right: calc(14px + env(safe-area-inset-right, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 5px; padding: 6px; border-radius: 11px;
  background: var(--panel-bg); border: 1px solid var(--panel-border); max-width: calc(100vw - 28px); }
.btn { flex: 0 0 auto; min-height: 40px; min-width: 40px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--panel-border); background: rgba(18, 24, 38, 0.7); border-radius: 8px; font-size: 13px; color: var(--ui-text); cursor: pointer; white-space: nowrap;
  touch-action: manipulation; }
.btn:hover { border-color: rgba(255,255,255,0.24); }
.btn.go { color: #10131c; background: var(--amber); border-color: var(--amber); font-weight: 600; }
.btn.go:hover { background: #f0b862; }
.btn.tog[aria-pressed="true"] { color: var(--violet); border-color: rgba(169,139,255,0.6); background: rgba(30,24,48,0.75); }
.btn[aria-expanded="true"]:not(.go) { color: var(--amber); border-color: rgba(232,168,74,0.6); }
.btn.flash { color: var(--amber); border-color: rgba(232,168,74,0.7); }
.btn.go.flash { color: #10131c; }
#urlBox { flex: 1 0 100%; width: 100%; font-family: var(--mono); font-size: 11px; padding: 6px; border-radius: 6px; border: 1px solid var(--panel-border);
  background: var(--field); -webkit-user-select: text; user-select: text; }

/* ---------- panels ---------- */
.help { position: fixed; z-index: 20; top: calc(14px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px));
  max-height: calc(100vh - 100px); max-height: calc(100dvh - 100px);
  width: min(420px, calc(100vw - 28px)); display: flex; flex-direction: column; border-radius: 12px; background: rgba(8, 12, 22, 0.94);
  border: 1px solid rgba(255,255,255,0.14); box-shadow: 0 10px 40px rgba(0,0,0,0.6); }
.help-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--panel-border); }
.help-head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: 0.04em; color: #f0e2c4; }
.help-body { overflow: auto; padding: 6px 14px 14px; font-size: 12.5px; line-height: 1.45; -webkit-user-select: text; user-select: text; }
.help-body h3 { margin: 12px 0 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--amber); font-weight: 600; }
.help-body p { margin: 6px 0; color: #b3bccb; }
.help-body dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; }
.help-body dt { font-family: var(--mono); font-size: 12px; color: var(--ui-text); }
.help-body dd { margin: 0; color: var(--muted); }
.help-body code { font-family: var(--mono); font-size: 12px; color: var(--ui-text); }
.maphint { font-family: var(--mono); font-size: 11.5px; color: var(--muted) !important; }
.maphint b { color: var(--ui-text); font-weight: 500; }

/* species list */
.splist { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.sp { width: 100%; display: grid; grid-template-columns: 1.4em 1fr; grid-template-rows: auto auto; column-gap: 6px; text-align: left; padding: 6px 9px;
  border: 1px solid var(--panel-border); background: rgba(18, 24, 38, 0.7); border-radius: 8px; cursor: pointer; min-height: 40px; }
.sp:hover { border-color: rgba(255,255,255,0.24); }
.sp[aria-current="true"] { border-color: rgba(232,168,74,0.7); background: rgba(40, 30, 18, 0.6); }
.sp .k { grid-row: 1 / 3; font-family: var(--mono); font-size: 12px; color: var(--amber); align-self: center; }
.sp .n { font-size: 13px; color: var(--ui-text); }
.sp .p { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.searchrow { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.searchrow .maphint { margin: 0; }

/* kernel editor */
.plots { display: flex; gap: 8px; align-items: stretch; margin-top: 6px; }
#kCurve { flex: 1 1 auto; min-width: 0; height: 110px; border-radius: 8px; background: rgba(10, 14, 27, 0.9); border: 1px solid var(--panel-border); }
#kImg { flex: 0 0 auto; width: 110px; height: 110px; border-radius: 8px; image-rendering: pixelated; background: #05070f; border: 1px solid var(--panel-border); }
.sliders { display: grid; grid-template-columns: max-content 1fr 4.6em; gap: 2px 10px; align-items: center; margin-top: 10px; }
.sliders label { font-family: var(--mono); font-size: 12px; color: var(--ui-text); }
.sliders output { font-family: var(--mono); font-size: 11.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.sliders input[type="range"] { width: 100%; min-height: 28px; margin: 0; accent-color: var(--amber); touch-action: pan-y; }
.sliders input:disabled, .sliders input:disabled + output { opacity: 0.35; }

@media (prefers-reduced-motion: reduce) { .title-overlay { transition: none; } }

/* app.js measures the toolbar (--bar-h) and lifts the HUD above it when the two would meet */
.hud.above { bottom: calc(var(--bar-h, 54px) + 22px + env(safe-area-inset-bottom, 0px)); }

/* ---------- phone: two toolbar rows, panels become bottom sheets above the toolbar ---------- */
@media (max-width: 34rem) {
  a.home { top: calc(10px + env(safe-area-inset-top, 0px)); left: calc(10px + env(safe-area-inset-left, 0px)); }
  .title-overlay { top: calc(46px + env(safe-area-inset-top, 0px)); left: 10px; right: 10px; transform: none; width: auto; max-width: none;
    padding: 5px 12px; border-radius: 9px; background: rgba(8,10,18,0.8); transition: opacity 0.5s ease; }
  .title-overlay h1 { font-size: 15px; }
  .title-overlay p { font-size: 10.5px; margin-top: 1px; }
  .bar { left: calc(10px + env(safe-area-inset-left, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    max-width: none; justify-content: space-between; gap: 4px; padding: 5px; }
  .bar .btn { flex: 1 1 calc(14.28% - 4px); min-width: 0; min-height: 40px; padding: 0 1px; font-size: 11.5px; }
  .hud, .hud.above { bottom: calc(var(--bar-h, 96px) + 16px + env(safe-area-inset-bottom, 0px)); left: calc(10px + env(safe-area-inset-left, 0px));
    white-space: normal; font-size: 10.5px; line-height: 1.45; padding: 4px 7px; max-width: calc(100vw - 20px); }
  body.sheet .hud { display: none; }
  .help { top: auto; bottom: calc(var(--bar-h, 96px) + 16px + env(safe-area-inset-bottom, 0px)); right: 8px; left: 8px; width: auto;
    max-height: 46vh; max-height: 46dvh; }
  .help-head { padding: 4px 8px 4px 12px; }
  .help-head .btn { flex: 0 0 auto; padding: 0 12px; min-height: 34px; }
  .help-body { padding: 4px 10px 10px; }
  #kCurve, #kImg { height: 84px; }
  #kImg { width: 84px; }
  .sliders input[type="range"] { min-height: 26px; }
}
@media (max-width: 34rem) and (prefers-reduced-motion: reduce) { .title-overlay { transition: none; } }

.msg { position: fixed; z-index: 10; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: calc(100vw - 40px);
  font-family: var(--mono); font-size: 13px; line-height: 1.5; color: var(--ui-text); text-align: center; padding: 12px 16px; border-radius: 8px;
  background: rgba(6, 10, 22, 0.9); border: 1px solid var(--panel-border); }
.msg pre { white-space: pre-wrap; font-size: 11px; color: var(--muted); text-align: left; }
