/* VOICE: quiet and plain, so the photo and the five REMINI are the only colour on the page
   IDEA: a white table with one photo on it; they climb up and eat it in from the edges
   PICTURE: the photo itself, large, with bite marks, crumbs and the pets on it
   COLOUR and TYPE: black on white (white on black at night), one grey; the system's own sans in each language
   LAYOUT: one narrow column: title, photo, tools, who eats, one black button, save */
:root {
  color-scheme: light dark;
  --bg: light-dark(#ffffff, #0f0f0f); --ink: light-dark(#111111, #f2f2f2); --mute: light-dark(#8a8a8a, #8f8f8f);
  --line: light-dark(#e6e6e6, #2a2a2a); --soft: light-dark(#f5f5f5, #1b1b1b);
  --face: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
}
:root[data-theme=light] { color-scheme: light; } :root[data-theme=dark] { color-scheme: dark; }
html[lang="ja"] { --face: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif; }
html[lang="ko"] { --face: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif; }
html[lang="en"] { --face: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, sans-serif; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; }
body { font: 16px/1.5 var(--face); background: var(--bg); color: var(--ink); min-height: 100vh; -webkit-font-smoothing: antialiased; }
.page { overflow-x: clip; min-height: 100vh; }
button { font: inherit; color: inherit; }
button:focus-visible, .drop:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.hidden { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px max(4vw, 16px); border-bottom: 1px solid var(--line); }
.mark { font-weight: 700; font-size: 15px; }
.langs { display: flex; gap: 2px; }
.langs button { font-size: 13px; color: var(--mute); background: none; border: 0; padding: 8px 9px; min-height: 36px; cursor: pointer; border-radius: 6px; }
.langs button:hover { color: var(--ink); }
.langs button.on { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }

main { width: min(640px, 100%); margin: 0 auto; padding: 40px 16px 24px; text-align: center; }
h1 { font-size: clamp(32px, 6vw, 44px); line-height: 1.05; font-weight: 700; margin: 0 0 10px; letter-spacing: -0.5px; text-wrap: balance; }
.sub { margin: 0 0 28px; color: var(--mute); font-size: 16px; text-wrap: balance; }

/* empty state: a dashed frame waiting for a photo */
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 30px 16px 28px; border: 1.5px dashed var(--ink); border-radius: 14px; cursor: pointer; transition: background .2s; }
.drop:hover, .drop.over { background: var(--soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-pets { display: flex; align-items: flex-end; justify-content: center; height: 104px; margin-bottom: 10px; }
.drop-pets img { height: 84px; width: auto; margin: 0 -7px; animation: peek 2.6s ease-in-out infinite; }
.drop-pets img:nth-child(2) { animation-delay: .25s; height: 92px; } .drop-pets img:nth-child(3) { animation-delay: .5s; height: 100px; }
.drop-pets img:nth-child(4) { animation-delay: .75s; height: 90px; } .drop-pets img:nth-child(5) { animation-delay: 1s; }
@keyframes peek { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.drop-title { font-size: 20px; font-weight: 600; }
.drop-sub { font-size: 14px; color: var(--mute); }

/* the photo */
.stage-wrap { display: flex; justify-content: center; }
.stage { position: relative; touch-action: none; }
.stage > canvas#view, .stage > canvas#paint { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#view { box-shadow: 0 1px 0 var(--line), 0 10px 30px rgba(0,0,0,.12); background: #fff; }
#paint { opacity: .42; cursor: crosshair; touch-action: none; }
.stage.busy #paint { cursor: default; }
.ring { position: absolute; left: 0; top: 0; border: 1.5px solid #111; border-radius: 50%; pointer-events: none; box-shadow: 0 0 0 1px rgba(255,255,255,.8); }
.actors { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.actors img { position: absolute; left: 0; top: 0; will-change: transform; filter: drop-shadow(0 4px 5px rgba(0,0,0,.2)); user-select: none; -webkit-user-drag: none; }
.fx { position: absolute; pointer-events: none; z-index: 4; }
.hint { min-height: 1.5em; margin: 16px 0 14px; font-size: 15px; color: var(--mute); }

.tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 26px; }
.seg { display: inline-flex; border: 1px solid var(--ink); border-radius: 999px; padding: 2px; }
.seg button { min-width: 44px; min-height: 38px; padding: 0 16px; font-size: 15px; background: none; border: 0; border-radius: 999px; cursor: pointer; }
.seg button.on { background: var(--ink); color: var(--bg); }
.sizes button { display: inline-flex; align-items: center; justify-content: center; padding: 0 9px; }
.sizes i { display: block; width: var(--d); height: var(--d); border-radius: 50%; background: currentColor; }
.chip { min-height: 44px; padding: 0 18px; font-size: 15px; background: none; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.chip:hover:not(:disabled) { border-color: var(--ink); }
.snd { color: var(--mute); text-decoration: line-through; }
.snd.on { color: var(--ink); text-decoration: none; }
button:disabled { opacity: .35; cursor: default; }

.who { margin-bottom: 26px; }
.who-title { margin: 0 0 12px; font-size: 15px; color: var(--mute); }
.pets { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 6px; margin-bottom: 6px; }
.pet { width: 78px; padding: 0; background: none; border: 0; cursor: pointer; font-size: 13px; color: var(--mute); }
.pet .face { position: relative; display: block; width: 62px; height: 62px; margin: 0 auto 6px; border-radius: 50%; overflow: hidden; background: var(--soft); border: 1px solid var(--line); transition: transform .15s; }
.pet .face img { position: absolute; left: 50%; top: 2px; height: 128px; width: auto; transform: translateX(-50%); }
.pet.on { color: var(--ink); }
.pet.on .face { border: 2px solid var(--ink); background: #fff; }
.pet:not(.on) .face img { filter: grayscale(1) opacity(.45); }
.pet:active .face { transform: scale(.94); }
.link { background: none; border: 0; padding: 10px 8px; min-height: 44px; font-size: 14px; color: var(--mute); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.link:hover:not(:disabled) { color: var(--ink); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 30px; font-size: 16px; border-radius: 999px; border: 1px solid var(--ink); background: none; cursor: pointer; }
.btn.primary { min-width: 220px; min-height: 54px; font-size: 18px; font-weight: 600; background: var(--ink); color: var(--bg); }
.btn.primary.stop { background: none; color: var(--ink); }
.btn:hover:not(:disabled) { opacity: .86; }
.row { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; margin-top: 14px; }
.row.small { margin-top: 6px; }
#save, #saveReplay { min-width: 200px; }
.msg { min-height: 1.4em; margin: 6px 0 0; font-size: 14px; }

footer { text-align: center; color: var(--mute); font-size: 13px; padding: 10px 16px 36px; }
footer p { margin: 2px 0; }

.preview { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,.55); }
.preview-card { background: var(--bg); border-radius: 14px; padding: 16px; max-width: min(560px, 100%); max-height: 100%; overflow: auto; text-align: center; }
.preview-card img, .preview-card video { display: block; max-width: 100%; max-height: 64vh; margin: 0 auto; -webkit-touch-callout: default; user-select: auto; }
.preview-card p { margin: 12px 0; font-size: 15px; }

@media (max-width: 480px) {
  main { padding-top: 28px; padding-left: 10px; padding-right: 10px; }
  .langs button { padding: 8px 6px; font-size: 12px; }
  .pet { width: 62px; } .pet .face { width: 54px; height: 54px; } .pet .face img { height: 112px; }
  .seg button { padding: 0 13px; }
}
