:root {
  color-scheme: dark;
  --ink: #eaf0eb;
  --muted: #c3cfca;
  --accent: #f2bbd5;
  background: #080609;
  color: var(--ink);
  font: 15px/1.35 "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; overflow: hidden; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { color: #14221e; background: var(--accent); }

.stage { position: absolute; inset: 0; overflow: hidden; }
.stage canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
#lily-water { pointer-events: none; }
.lily-stage { background: #080609; }
#lily-flower { cursor: grab; touch-action: none; }
#lily-flower.grabbing { cursor: grabbing; }

.edge { position: fixed; z-index: 2; pointer-events: none; }
 .edge { inset: auto 0 0; height: max(26px, env(safe-area-inset-bottom)); }
.edge-panel {
  position: absolute;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s ease-out, transform .23s cubic-bezier(.18,.64,.28,1),
    visibility 0s linear .23s;
}
.edge:is([data-open], [data-near], :has(:focus-visible)) .edge-panel {
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
  transition-delay: 0s;
}

.edge svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; }
.edge-grip {
  position: absolute;
  display: grid;
  place-items: center;
  width: 36px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: #11191dd6;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
}
.edge-grip:focus-visible { opacity: 1; z-index: 1; }
.edge .edge-grip {
  right: max(7px, env(safe-area-inset-right));
  bottom: max(5px, env(safe-area-inset-bottom));
  width: 44px;
  height: 34px;
}

.dock {
  inset: auto 0 0;
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 14px;
  padding: 29px max(17px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(17px, env(safe-area-inset-left));
  background: linear-gradient(0deg, #080d10f7 12%, #080d10e8 70%, #080d1000);
  transform: translateY(6px);
}
.edge:is([data-open], [data-near], :has(:focus-visible)) .dock { transform: translateY(0); }
.fields { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(68px, 91px); gap: 9px; min-width: 0; }
.fields label { display: grid; grid-template-rows: 1fr auto; gap: 4px; color: var(--muted); font-size: .75rem; }
.fields input {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 6px 0 8px;
  border: 1px solid #526363;
  border-radius: 4px;
  background: #11181b;
  color: var(--ink);
  caret-color: var(--accent);
  font: 14px/1 Consolas, "Courier New", monospace;
}
.dock-actions { position: relative; }
.save {
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: #141e1d;
  font-size: .8rem;
  font-weight: 700;
}
.save:hover { background: var(--ink); }
.save-status {
  position: absolute;
  right: 0;
  top: 100%;
  width: max-content;
  max-width: calc(100vw - 34px);
  margin: 3px 0 0;
  color: var(--muted);
  font-size: .74rem;
  text-align: right;
}
.save-status[data-error="true"] { color: #ffbaae; }

@media (any-pointer: coarse) {
  .edge-grip { opacity: .92; pointer-events: auto; }
   .edge[data-open] .edge-grip { opacity: 0; pointer-events: none; }
}

@media (max-width: 760px) {
  .dock { display: grid; justify-items: center; gap: 10px; }
  .fields { grid-auto-flow: row; grid-template-columns: repeat(4, minmax(0, 87px)); }
  .save-status { right: 50%; transform: translateX(50%); margin: 2px 0 0; text-align: center; }
}
@media (max-width: 390px) {
  .fields label { font-size: .7rem; }

  .dock { gap: 8px; }
}

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