:root { --paper: #f1efea; --ink: #26231f; --muted: #7f7a71; }
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--paper);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
canvas { position: fixed; inset: 0; display: block; }
#flesh { image-rendering: pixelated; background: #e3ddd0; }
#stage { touch-action: none; user-select: none; -webkit-user-select: none; }
#loading {
  position: fixed; inset: 0; display: grid; place-items: center;
  font: 400 11px/1 "JetBrains Mono", ui-monospace, monospace; letter-spacing: .04em;
  color: var(--muted); background: var(--paper);
}
#final-ui {
  position: fixed; right: 64px; bottom: 36px; display: flex; gap: 20px;
  opacity: 0; transform: translateY(6px);
  transition: opacity .5s ease, transform .5s ease;
}
#final-ui[hidden] { display: none; }
#final-ui.on { opacity: 1; transform: none; }
#final-ui button {
  font: 400 12px/1 "JetBrains Mono", ui-monospace, monospace; letter-spacing: .03em;
  color: var(--ink); background: none; border: 0; padding: 10px 2px; cursor: pointer;
  border-bottom: 1px solid rgba(38,35,31,.25);
}
#final-ui button:hover { border-bottom-color: var(--ink); }
#final-ui button:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
@media (max-width: 640px) { #final-ui { right: 16px; bottom: 20px; } }

/* mode toggle: normal cursor / scissors, bottom centre */
#modes {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: flex; gap: 4px; padding: 4px;
  background: rgba(250,249,246,0.86); border: 1px solid rgba(38,35,31,0.12);
  border-radius: 999px; box-shadow: 0 2px 10px rgba(40,30,20,0.08);
  transition: opacity .3s ease;
}
#modes.gone { opacity: 0; pointer-events: none; }
#modes button {
  width: 48px; height: 40px; border: 0; border-radius: 999px; padding: 0;
  display: grid; place-items: center; cursor: pointer;
  background: transparent; color: rgba(38,35,31,0.5);
  transition: background .18s ease, color .18s ease;
}
#modes button:hover { color: var(--ink); }
#modes button.on { background: var(--ink); color: #f6f4ef; }
#modes button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* sound toggle, top right in the conversation */
#sound {
  position: fixed; top: 20px; right: 20px; width: 36px; height: 36px;
  display: grid; place-items: center; padding: 0; cursor: pointer;
  border: 1px solid rgba(38,35,31,0.12); border-radius: 999px;
  background: rgba(250,249,246,0.86); color: rgba(38,35,31,0.55);
  transition: opacity .3s ease, color .18s ease;
}
#sound:hover { color: var(--ink); }
#sound:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
#sound .off { display: none; }
#sound[aria-pressed="false"] .on { display: none; }
#sound[aria-pressed="false"] .off { display: block; }
#sound.gone { opacity: 0; pointer-events: none; }

/* expanded image (normal mode) */
#lightbox {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(236,233,226,0.9); cursor: zoom-out;
  opacity: 0; transition: opacity .25s ease;
}
#lightbox[hidden] { display: none; }
#lightbox.on { opacity: 1; }
#lightbox canvas {
  position: static; inset: auto; display: block;
  width: min(88vmin, 960px); height: auto; border-radius: 10px;
  box-shadow: 0 18px 60px rgba(40,30,20,0.18);
}

/* full prompt, opened from "Show more" */
#lightbox .prompt-card {
  position: relative; max-width: min(680px, calc(100vw - 32px)); max-height: 80vh; overflow: auto;
  margin: 16px; padding: 28px 32px; cursor: default;
  background: #fbfaf7; border: 1px solid rgba(38,35,31,0.1); border-radius: 14px;
  box-shadow: 0 18px 60px rgba(40,30,20,0.16);
}
#lightbox .prompt-card p {
  margin: 0; font: 500 16px/1.6 "Inter", system-ui, sans-serif; color: var(--ink);
  text-wrap: pretty;
}
