/* One theme: fully black ground, really dark gray resting digits, and a
   single accent color (default phosphor green). The accent is user-pickable
   in the about menu; main.js updates --accent/--accent-soft live. */
:root {
  --bg: #000000;
  --ink: #aab2ac;
  --dim: #565e58;
  --accent: #4ade80;
  --accent-soft: #2f9e5f;
  --line: #1e241f;
  --panel: rgba(8, 11, 9, 0.96);
  --mono: ui-monospace, Consolas, "Cascadia Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: var(--mono);
}

#field {
  display: block;
  touch-action: none;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* first-visit hint */
#mf-hello {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--dim);
  font-size: 14px;
  letter-spacing: 0.35em;
  pointer-events: none;
  animation: mf-breathe 3s ease-in-out infinite;
  transition: opacity 1.2s;
}
#mf-hello.gone {
  opacity: 0;
  animation: none;
}
@keyframes mf-breathe {
  50% { opacity: 0.35; }
}
@media (prefers-reduced-motion: reduce) {
  #mf-hello { animation: none; }
}

/* fullscreen toggle, matching starfall's corner button */
#mf-fullscreen {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  font: 16px var(--mono);
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 9px;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.25s, border-color 0.25s;
  z-index: 5;
}
#mf-fullscreen:hover {
  opacity: 1;
  border-color: var(--accent-soft);
}

/* hint bar */
#mf-hintbar {
  position: fixed;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  opacity: 0.55;
  transition: opacity 0.2s;
}
#mf-hintbar:hover { opacity: 1; }
#mf-hintbar button,
.mf-panel button {
  font: 12px var(--mono);
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 9px;
  cursor: pointer;
}
#mf-hintbar button:hover { border-color: var(--dim); }
#mf-hintbar button.on {
  color: var(--accent);
  border-color: var(--accent-soft);
}

/* mode label */
#mf-modelabel {
  position: fixed;
  top: 10px;
  left: 12px;
  color: var(--ink);
  font-size: 12px;
  pointer-events: none;
  max-width: 70vw;
  background: var(--panel);
  border-radius: 4px;
  padding: 3px 8px;
}
#mf-modelabel:empty { display: none; }

/* panels — sized with svh so mobile browser chrome never hides the bottom,
   with a sticky header so close is always one tap away */
.mf-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 0;
  width: min(37rem, calc(100vw - 20px));
  max-height: calc(100vh - 40px);
  max-height: calc(100svh - 24px);
  overflow-y: auto;
  font-size: 13.5px;
  line-height: 1.55;
}
.mf-panel-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.mf-panel-head h1 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.2em;
  color: var(--accent);
  font-weight: 600;
}
.mf-close {
  font-size: 14px;
  padding: 5px 12px;
}
.mf-panel-body {
  padding: 14px 20px 18px;
}
.mf-panel h2 {
  margin: 16px 0 6px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 600;
}
.mf-panel p { margin: 8px 0; }
.mf-panel ul { margin: 6px 0; padding-left: 18px; }
.mf-panel li { margin: 5px 0; }
.mf-panel .accent { color: var(--accent); }
.mf-panel .fine { color: var(--dim); font-size: 12px; }
.mf-panel code {
  color: var(--accent-soft);
  font-family: var(--mono);
}
.mf-panel pre {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 9px 12px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
  color: var(--accent-soft);
}
.mf-panel kbd {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 5px;
  font-family: var(--mono);
}
.mf-panel .row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.mf-panel .tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.mf-panel .tabs button.on {
  color: var(--accent);
  border-color: var(--accent-soft);
}
.mf-panel ul.genome li b { color: var(--accent-soft); font-weight: 600; }
.mf-panel button.danger { color: #9a9a9e; }
.mf-panel button:hover { border-color: var(--dim); }
.mf-panel .menuhead { margin-top: 18px; }
.mf-panel .views button.on {
  color: var(--accent);
  border-color: var(--accent-soft);
}
.colorrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--dim);
  font-size: 12px;
}
.colorrow input[type='color'] {
  width: 44px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

/* genome editor sliders */
#mf-debug { width: min(24rem, calc(100vw - 20px)); }
.mf-slider {
  display: grid;
  grid-template-columns: 12em 1fr 3.5em;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  font-size: 12px;
  color: var(--ink);
}
.mf-slider b {
  font-weight: 400;
  color: var(--accent);
  text-align: right;
}
.mf-slider input { accent-color: var(--accent-soft); }

/* small screens: tighter panel, bigger touch targets */
@media (max-width: 480px) {
  .mf-panel {
    width: calc(100vw - 12px);
    max-height: calc(100vh - 24px);
    max-height: calc(100svh - 12px);
    font-size: 13px;
  }
  .mf-panel-body { padding: 12px 14px 16px; }
  .mf-panel-head { padding: 10px 12px; }
  .mf-panel button,
  #mf-hintbar button {
    padding: 7px 12px;
  }
  .mf-slider { grid-template-columns: 8.5em 1fr 3em; }
}
