:root {
  --paper: #f2ebdd;
  --paper-2: #e9e0cd;
  --ink: #1f1b16;
  --muted: #7a6f60;
  --a: #ff48b0;          /* fluorescent pink riso ink */
  --b: #0078bf;          /* riso blue */
  --display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --radius: 999px;
  color-scheme: light;
}
body[data-cloud="different"] { --paper: #e4e8df; --paper-2: #d7ddd0; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--paper); color: var(--ink);
  font: 15px/1.45 var(--mono);
  transition: background-color .5s ease;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 50; opacity: .38; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .4 0 0 0 0 .33 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- ink / overprint ---------- */
.ink { mix-blend-mode: multiply; }
.ink.a { color: var(--a); }
.ink.b { color: var(--b); }

/* ---------- wordmark ---------- */
.mark { font-family: var(--display); font-weight: 900; font-style: italic; margin: 0; letter-spacing: -.03em; line-height: .9; }
.mark i { color: var(--a); }
.mark .not { display: none; font-weight: 400; color: var(--b); }
body[data-cloud="different"] .mark .not { display: inline; }
.mark.big { position: relative; font-size: clamp(88px, 30vw, 170px); font-variation-settings: 'opsz' 144; }
.mark.big .ink.b { position: absolute; left: 0; top: 0; transform: translate(.035em, .02em); }

/* ---------- login ---------- */
.login { max-width: 420px; margin: 0 auto; padding: 14vh 24px 40px; }
.tag { margin: 10px 0 36px; color: var(--muted); letter-spacing: .08em; }
.login-form { display: grid; gap: 16px; }
.login-form label { display: grid; gap: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
input {
  width: 100%; font-size: 17px; padding: 14px 16px; border: 2px solid var(--ink); border-radius: 14px;
  background: color-mix(in srgb, var(--paper) 60%, #fff); outline: none;
  text-transform: none; letter-spacing: 0; color: var(--ink);
}
input:focus-visible { border-color: var(--b); box-shadow: 3px 3px 0 var(--a); }
.err { color: #c21f5b; min-height: 1.4em; margin: 0; }

.btn {
  border: 2px solid var(--ink); background: var(--ink); color: var(--paper);
  border-radius: 14px; padding: 13px 20px; font-weight: 600; letter-spacing: .04em; cursor: pointer;
  box-shadow: 3px 3px 0 var(--a); transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--a); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: 3px 3px 0 var(--b); }
.link { background: none; border: 0; padding: 8px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- app ---------- */
.app { max-width: 560px; margin: 0 auto; padding: 14px 16px 150px; }
.top { display: flex; align-items: baseline; justify-content: space-between; }
.top .mark { font-size: 40px; }

.switch {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; margin: 16px 0 10px;
  border: 2px solid var(--ink); border-radius: var(--radius); padding: 3px;
}
.switch button {
  position: relative; z-index: 1; border: 0; background: none; padding: 10px; cursor: pointer;
  font-family: var(--display); font-size: 19px; font-weight: 700; transition: color .3s;
}
.switch button[aria-selected="true"] { color: var(--paper); }
.switch button[data-cloud="different"] { font-style: italic; }
.thumb {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px);
  background: var(--ink); border-radius: var(--radius); transition: transform .35s cubic-bezier(.6,-0.2,.3,1.3);
}
body[data-cloud="different"] .thumb { transform: translateX(100%); }

.stage { position: relative; }
.cloud { position: relative; width: 100%; aspect-ratio: 1 / 1.08; max-height: 64dvh; overflow: hidden; }
.empty {
  position: absolute; inset: 0; margin: 0; display: grid; place-items: center; text-align: center; padding: 30px;
  font-family: var(--display); font-style: italic; font-size: 22px; color: var(--muted);
}

.word {
  position: absolute; left: 0; top: 0; padding: 0; border: 0; background: none; cursor: pointer;
  font-family: var(--display); line-height: 1; white-space: nowrap;
  font-variation-settings: 'opsz' 72; font-weight: 520; letter-spacing: -.01em;
  animation: pop .55s cubic-bezier(.2,1.4,.4,1) both;
  -webkit-tap-highlight-color: transparent;
}
.word.base { opacity: .75; }
.word .ink.over { position: absolute; left: 0; top: 0; transform: translate(.045em, -.03em); }
body[data-cloud="different"] .word { font-style: italic; }
.word:focus-visible { outline: 2px dashed var(--ink); outline-offset: 4px; }
@keyframes pop { from { opacity: 0; transform: scale(.4) rotate(-6deg); } }
@media (prefers-reduced-motion: reduce) { .word { animation: none; } .thumb { transition: none; } }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin: 6px 0 18px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; mix-blend-mode: multiply; }
.dot.a { background: var(--a); } .dot.b { background: var(--b); }
.dot.both { background: var(--a); box-shadow: 4px 0 0 var(--b); margin-right: 4px; }

.all { margin: 4px 0 10px; }
.all summary {
  cursor: pointer; list-style: none; font: 600 11px var(--mono); text-transform: uppercase;
  letter-spacing: .14em; color: var(--muted); padding: 8px 0;
}
.all summary::-webkit-details-marker { display: none; }
.all summary::before { content: '▸ '; } .all[open] summary::before { content: '▾ '; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  border: 1.5px solid currentColor; border-radius: var(--radius); background: transparent;
  padding: 7px 12px; font-size: 14px; cursor: pointer; display: inline-flex; gap: 6px; align-items: baseline;
}
.pill.a { color: #c0287e; } .pill.b { color: var(--b); }
.pill small { font-size: 11px; opacity: .8; }

.composer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 2px dashed color-mix(in srgb, var(--ink) 35%, transparent);
  transition: background-color .5s;
}
.composer > * { max-width: 560px; margin-inline: auto; }
.composer .row { display: flex; gap: 8px; }
.composer input { flex: 1; min-width: 0; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1.5px solid var(--ink); background: transparent; border-radius: var(--radius);
  padding: 5px 11px; font-size: 12px; cursor: pointer; letter-spacing: .04em;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.sheet {
  border: 2px solid var(--ink); border-radius: 22px 22px 0 0; padding: 22px 22px calc(22px + env(safe-area-inset-bottom));
  width: 100%; max-width: 560px; margin: auto auto 0; background: var(--paper); color: var(--ink);
}
.sheet::backdrop { background: rgba(31, 27, 22, .35); }
.sheet[open] { animation: up .3s cubic-bezier(.2,1,.3,1); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-cat { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); }
.sheet-word { font-family: var(--display); font-size: 44px; font-weight: 850; margin: 4px 0 6px; line-height: 1; overflow-wrap: anywhere; }
.sheet-who { color: var(--muted); margin: 0 0 18px; }
.sheet-word .ink.over { position: absolute; left: 0; top: 0; transform: translate(.04em, -.03em); }
.sheet-word { position: relative; display: inline-block; }
.meter { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.pips { display: flex; gap: 6px; align-items: flex-end; }
.pip { width: 14px; border: 2px solid var(--ink); border-radius: 4px; background: transparent; transition: background-color .25s, transform .25s; }
.pip.on { background: var(--ink); }
.pip.on.bump { animation: bump .4s cubic-bezier(.2,1.6,.4,1); }
@keyframes bump { 50% { transform: scaleY(1.35); } }
.size { font-family: var(--display); font-weight: 800; font-size: 22px; }
.size small { font: 12px var(--mono); color: var(--muted); margin-left: 4px; }
.btn.plus { width: 100%; font-family: var(--display); font-size: 30px; padding: 14px; margin-bottom: 14px; }
.btn.plus:disabled { opacity: .35; box-shadow: none; cursor: default; }
.btn.danger { box-shadow: 3px 3px 0 #c21f5b; }
.btn.danger.confirm { background: #c21f5b; border-color: #c21f5b; color: #fff; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.toast {
  position: fixed; left: 50%; bottom: calc(130px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 12px;
  font-size: 14px; box-shadow: 3px 3px 0 var(--a); transition: .25s; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
