:root {
  --table: #161513;
  --cream: #efe9dc;
  --dim: rgba(239, 233, 220, 0.72);
  --faint: rgba(239, 233, 220, 0.14);
  --print: rgba(30, 28, 25, 0.72);
  --serif: 'Newsreader', 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; background: var(--table); color: var(--cream);
  font: 13px/1.35 var(--sans); overflow: hidden; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }

/* ---------- layout ---------- */
#app {
  position: fixed; inset: 0; display: grid;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  gap: 10px;
}
#app[data-layout="wide"] { grid-template-columns: 66px 1fr 66px; grid-template-areas: "left stage right"; }
#app[data-layout="wide"] #left, #app[data-layout="wide"] #right { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 18px; }
#app[data-layout="wide"] #swatches { grid-template-columns: 26px; }

#app[data-layout="portrait"] { grid-template-columns: 1fr; grid-template-rows: 1fr auto auto; grid-template-areas: "stage" "left" "right"; }
#app[data-layout="portrait"] #swatches { grid-auto-flow: column; justify-content: center; }
#app[data-layout="portrait"] #right { display: flex; justify-content: center; gap: 22px; }
#app[data-layout="portrait"] #papers, #app[data-layout="portrait"] .tools { flex-direction: row; }

#app[data-layout="outer"] { grid-template-columns: 1fr; grid-template-areas: "stage"; padding: 6px; }
#app[data-layout="outer"] #left, #app[data-layout="outer"] #right { display: none; }

#left { grid-area: left; } #right { grid-area: right; }
#stage { grid-area: stage; position: relative; min-height: 0; min-width: 0; }

/* ---------- tool strips ---------- */
#swatches { display: grid; gap: 8px; }
.swatch {
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(255,255,255,.55), rgba(255,255,255,0) 42%), var(--c);
  box-shadow: inset 0 -2px 3px rgba(0,0,0,.25), inset 0 0 0 1px rgba(255,255,255,.16); transition: transform .15s;
}
.swatch.on { box-shadow: 0 0 0 2px var(--table), 0 0 0 3.5px var(--cream); transform: scale(1.08); }
.wheel-btn { background: conic-gradient(#f33, #fd0, #3c3, #0cf, #33f, #c3f, #f33); position: relative; }
.wheel-btn::after { content: '+'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 15px; text-shadow: 0 0 3px rgba(0,0,0,.6); }

#papers, .tools { display: flex; flex-direction: column; gap: 10px; align-items: center; }
#papers button, .tool { display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--dim); font-size: 12px; font-weight: 500; letter-spacing: .01em; min-width: 44px; }
#papers button i { width: 26px; height: 26px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); transition: box-shadow .15s; }
#papers [data-p="plain"] i { background: #f4f1ea; }
#papers [data-p="textured"] i { background: radial-gradient(circle at 30% 30%, #fff 0 18%, transparent 20%) 0 0/5px 5px, #ece6da; }
#papers [data-p="linen"] i { background: repeating-linear-gradient(0deg, rgba(0,0,0,.07) 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, rgba(0,0,0,.06) 0 1px, transparent 1px 3px), #eeece6; }
#papers [data-p="fibre"] i { background: repeating-linear-gradient(115deg, rgba(255,255,255,.75) 0 1px, transparent 1px 4px), #e7dfcd; }
#papers button.on { color: var(--cream); }
#papers button.on i { box-shadow: 0 0 0 2px var(--table), 0 0 0 3.5px var(--cream); }
.tool svg { width: 26px; height: 26px; fill: none; stroke: var(--dim); padding: 3px; }
#splat svg { fill: var(--dim); stroke: none; }   /* the only solid icon */
.tool:active svg { stroke: var(--cream); }
#splat:active svg { fill: var(--cream); }
.tool[hidden] { display: none; }
.tool:disabled { opacity: .3; }
#app:not([data-state="drip"]) #undo { display: none; }
#newBlot { color: var(--cream); }
#newBlot svg { stroke: #1a1917; background: var(--cream); border-radius: 50%; padding: 5px; }
#app:not([data-state="drip"]) #splat, #app:not([data-state="drip"]) #papers { opacity: .3; pointer-events: none; }

/* ---------- sheet + print layer (sizes in --u = 1% of a full sheet's width) ---------- */
#sheet { position: absolute; --u: 6px; }
#ink { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; border-radius: 2px;
  box-shadow: 0 1px 1px rgba(0,0,0,.3), 0 14px 34px rgba(0,0,0,.45); }
.print { position: absolute; inset: 0; pointer-events: none; color: var(--print); font-size: max(12px, calc(var(--u) * 1.1)); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.print > * { position: absolute; transition: opacity .4s; }
.p-fold { left: 50%; top: 9%; bottom: 9%; border-left: 1px dashed rgba(30,28,25,.22); }
#app:not([data-state="drip"]) .p-fold { opacity: 0; }
.p-tl { left: 3%; top: 4%; }
.p-tr { right: 3%; top: 4%; }
.p-title { left: 50%; top: 2.6%; transform: translateX(-50%); font: 300 max(16px, calc(var(--u) * 3.4))/1 var(--serif); letter-spacing: 0; text-transform: none; color: rgba(30,28,25,.75); }
.p-steps { list-style: none; margin: 0; padding: 0; left: 3%; bottom: 4%; display: flex; gap: calc(var(--u) * 1.6); }
.p-steps li { color: rgba(30,28,25,.5); transition: color .3s; }
.p-steps li b { font: 300 1.25em/1 var(--serif); letter-spacing: 0; }
.p-steps li.done { color: rgba(30,28,25,.55); }
.p-steps li.now { color: #1e1c19; font-weight: 600; }
.p-steps li.now b { font-weight: 400; }
.p-tag { right: 3%; bottom: 4%; }
.p-by { left: 50%; top: 9.2%; transform: translateX(-50%); white-space: nowrap; font-size: max(12px, calc(var(--u) * 0.95)); color: rgba(30,28,25,.45); }
#app[data-view="back"] .p-by { display: none; }
#app[data-view="back"] .p-tl, #app[data-view="back"] .p-tr, #app[data-view="back"] .p-title, #app[data-view="back"] .p-tag { display: none; }
#app[data-view="back"] .p-steps { left: 50%; transform: translateX(-50%); top: 4%; bottom: auto; }
#app[data-state="revealed"] .p-steps, #app[data-state="revealing"] .p-steps, #app[data-state="revealed"] .p-tag { opacity: 0; }

/* cue: printed on the paper. Sheet view: centred on the empty right half. Back view: lower part of the page. */
#cue { left: 52%; right: 2%; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: calc(var(--u) * 0.8); text-transform: none; letter-spacing: 0; color: #2a2723; }
#app[data-view="sheet"] #cue[data-icon="drip"] { left: 2%; right: 52%; }
#app[data-view="back"] #cue { left: 6%; right: 6%; top: auto; bottom: 7%; transform: none; }
#app[data-state="folding"] #cue, #app[data-state="revealing"] #cue, #app[data-state="revealed"] #cue { opacity: 0; pointer-events: none; }
#cueTitle { font: 300 max(18px, calc(var(--u) * 3.6))/1.05 var(--serif); }
#cueBody { font-size: max(12px, calc(var(--u) * 1.45)); line-height: 1.4; color: rgba(30,28,25,.78); max-width: 22em; }
#cueBody:empty { display: none; }
.pill { pointer-events: auto; margin-top: calc(var(--u) * 0.8); background: #1e1c19; color: var(--cream); padding: 9px 18px; border-radius: 999px; font: 500 13px/1 var(--sans); letter-spacing: 0; transition: transform .15s; }
/* secondary button: outlined, same size as the primary (easy to tap) */
.pill.ghost { background: rgba(246,243,236,.6); color: #1e1c19; padding: 10px 18px; min-height: 40px; font: 500 13px/1 var(--sans); text-decoration: none; box-shadow: inset 0 0 0 1.5px rgba(30,28,25,.55); }
.pill.ghost:active { background: rgba(30,28,25,.08); }
.pill:active { transform: scale(.96); }
.pill[hidden] { display: none; }

.p-guess { left: 0; right: 0; bottom: 2.5%; display: flex; flex-direction: column; align-items: center; opacity: 0; transition: opacity .6s; pointer-events: none; }
#guess {
  width: 60%; border: 0; background: none; text-align: center; color: #1e1c19; outline: none;
  font: 300 max(20px, calc(var(--u) * 4))/1.1 var(--serif); padding: 4px 0;
  border-bottom: 1px solid rgba(30,28,25,.2); -webkit-user-select: text; user-select: text; border-radius: 0;
}
#guess::placeholder { color: rgba(30,28,25,.35); }
#app[data-state="revealed"] .p-guess { opacity: 1; pointer-events: auto; }

#hint {
  position: absolute; left: 75%; top: 50%; transform: translate(-50%, -50%);
  background: #1e1c19; color: var(--cream); padding: 7px 12px; border-radius: 999px; font-size: 12px;
  opacity: 0; pointer-events: none; transition: opacity .25s; white-space: nowrap;
}
#hint.show { opacity: 1; }
#error[hidden] { display: none; }
#error { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 24px; text-align: center; color: #ff8a80; background: var(--table); font: 12px/1.4 ui-monospace, Menlo, monospace; white-space: pre-wrap; }

/* cue icons (drawn in the print colour) */
.cue-icon { width: 40px; height: 40px; position: relative; --ic: #2a2723; }
#cue:not([data-icon]) .cue-icon, #cue[data-icon=""] .cue-icon { display: none; }
.ico { position: absolute; inset: 0; display: none; perspective: 120px; }
#cue[data-icon="fold"] .ico-fold, #cue[data-icon="open"] .ico-open, #cue[data-icon="rub"] .ico-rub, #cue[data-icon="drip"] .ico-drip { display: block; }
/* same proportions as the Duo drawing: each half 7:8 */
.ico-fold i, .ico-open i { position: absolute; top: 11px; width: 16px; height: 18px; border: 1.5px solid var(--ic); box-sizing: border-box; }
.ico-fold i:first-child, .ico-open i:first-child { left: 4px; border-radius: 4px 1px 1px 4px; }
.ico-fold i:last-child, .ico-open i:last-child { left: 20px; transform-origin: left center; background: #f1eee7; border-radius: 1px 4px 4px 1px; }
.ico-fold i:last-child { animation: fold 3.8s ease-in-out infinite; }
.ico-open i:last-child { animation: fold 3.8s ease-in-out infinite reverse; }
@keyframes fold { 0%, 15% { transform: rotateY(0); } 55%, 85% { transform: rotateY(-178deg); } 100% { transform: rotateY(0); } }
/* the closed phone: exactly one half, same size as the halves in the fold/open icons */
.ico-rub::before { content: ''; position: absolute; left: 12px; top: 11px; width: 16px; height: 18px; border: 1.5px solid var(--ic); border-radius: 4px; box-sizing: border-box; }
.ico-rub i { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--ic); opacity: .8; left: 50%; top: 50%; margin: -3.5px; animation: rub 2.2s ease-in-out infinite; }
@keyframes rub { 0% { transform: translate(-2.5px, -3px); } 25% { transform: translate(2.5px, -1px); } 50% { transform: translate(-2.5px, 1.5px); } 75% { transform: translate(2.5px, 3px); } 100% { transform: translate(-2.5px, -3px); } }
@media (prefers-reduced-motion: reduce) { .ico i { animation: none !important; } }

/* ---------- outer-screen nudge (phone closed, nothing to rub) ---------- */
#nudge { display: none; }
#app[data-layout="outer"][data-nudge="1"] #stage { display: none; }
#app[data-layout="outer"][data-nudge="1"] #nudge {
  grid-area: stage; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 24px 18px; gap: 14px; position: relative;
}
.nudge-top { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
#nudgeTitle { margin: 0; font: 300 58px/0.95 var(--serif); }
#nudgeBody { margin: 0; color: var(--dim); font-size: 14px; line-height: 1.45; max-width: 15em; }
.nudge-tip { position: absolute; bottom: 10px; left: 0; right: 0; margin: 0; font-size: 12px; color: rgba(239,233,220,.35); }
.nudge-tip[hidden] { display: none; }

/* ---------- share ---------- */
.p-guess { gap: calc(var(--u) * 0.9); }
.p-sign { position: static !important; display: flex; align-items: center; gap: 10px; opacity: 0; transform: translateY(4px); transition: opacity .4s, transform .4s; pointer-events: none; }
#app[data-signing="1"] .p-sign { opacity: 1; transform: none; pointer-events: auto; }
.p-sign label { font-size: max(12px, calc(var(--u) * 1.1)); letter-spacing: .06em; text-transform: uppercase; color: var(--print); }
#sign { width: 11em; border: 0; border-bottom: 1px solid rgba(30,28,25,.2); background: none; outline: none; border-radius: 0; padding: 3px 0;
  font: 500 max(12px, calc(var(--u) * 1.5))/1.2 var(--sans); color: #1e1c19; -webkit-user-select: text; user-select: text; }
#sign::placeholder { color: rgba(30,28,25,.35); }
#guessGo { margin: 0; padding: 7px 14px; }
.tool.share svg { stroke: #1a1917; background: var(--cream); border-radius: 50%; padding: 5px; }
.tool.share { color: var(--cream); }
#share { position: fixed; inset: 0; z-index: 20; background: rgba(14,13,12,.94); display: grid; place-items: center; padding: max(12px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom)); }
#share[hidden] { display: none; }
.share-card { display: flex; gap: 22px; align-items: center; max-width: 760px; max-height: 100%; }
#sharePreview:not([src]) { display: none; }
#sharePreview { height: min(78vh, 520px); max-width: 52vw; object-fit: contain; border-radius: 4px; box-shadow: 0 14px 40px rgba(0,0,0,.5); background: #eee; }
.share-side { display: flex; flex-direction: column; gap: 10px; width: 220px; }
.share-side h2 { margin: 0; font: 300 34px/1 var(--serif); }
.share-side p { margin: 0 0 6px; color: var(--dim); font-size: 12px; line-height: 1.45; }
.pill.big { background: var(--cream); color: #1a1917; padding: 12px 18px; font-size: 14px; position: relative; overflow: hidden; text-align: center; }

.pill.big:disabled { opacity: .85; }
.pill.big .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: rgba(30,28,25,.14); transition: width .2s; }
.pill.big .lbl { position: relative; }
.share-saves { display: flex; gap: 16px; }
.name-row { display: flex; flex-direction: column; gap: 4px; margin: 2px 0 6px; }
.name-row label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
#name { background: none; border: 0; border-bottom: 1px solid var(--faint); color: var(--cream); font: 300 22px/1.2 var(--serif); padding: 4px 0; outline: none; border-radius: 0; -webkit-user-select: text; user-select: text; }
#name:focus { border-bottom-color: var(--dim); }
#name::placeholder { color: rgba(239,233,220,.3); }
.share-saves a[hidden] { display: none; }
.share-saves a { color: var(--dim); }
#shareClose { position: absolute; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(239,233,220,.1); }
#shareClose svg { width: 22px; height: 22px; stroke: var(--cream); }
#shareClose:active { background: rgba(239,233,220,.2); }
@media (max-aspect-ratio: 1/1) {
  .share-card { flex-direction: column; gap: 14px; }
  #sharePreview:not([src]) { display: none; }
#sharePreview { height: auto; width: min(70vw, 340px); max-width: none; max-height: 52vh; }
  .share-side { width: min(80vw, 320px); }
}

/* ---------- colour wheel ---------- */
#wheel { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 10; }
#wheel[hidden] { display: none; }
.wheel-card { background: #22201d; color: var(--cream); border-radius: 20px; padding: 16px; width: min(280px, calc(100vw - 32px)); box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.wheel-wrap { position: relative; width: 100%; aspect-ratio: 1; max-height: 50vh; margin: 0 auto; }
.wheel { width: 100%; height: 100%; display: block; touch-action: none; border-radius: 50%; }
.wheel-knob { position: absolute; left: -12px; top: -12px; width: 24px; height: 24px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.3), 0 2px 6px rgba(0,0,0,.3); pointer-events: none; }
.wheel-val { width: 100%; margin: 14px 0 12px; -webkit-appearance: none; appearance: none; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #000, var(--hue, #00f)); }
.wheel-val::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.wheel-row { display: flex; align-items: center; gap: 8px; }
.wheel-preview { width: 26px; height: 26px; border-radius: 50%; }
.wheel-hex { color: var(--dim); font-size: 12px; margin-right: auto; }
.wheel-row button { padding: 7px 13px; border-radius: 999px; color: var(--dim); }
.wheel-done { background: var(--cream) !important; color: #1a1917 !important; font-weight: 500; }


/* while the page swings, the printed labels fade (they live on the flat page) */
.print { transition: opacity .3s; }
#app[data-state="folding"] .print, #app[data-state="revealing"] .print { opacity: 0; }

/* Light display serif, normal case, tight (Newsreader Light) */
.p-title, #cueTitle, #guess, #nudgeTitle, .share-side h2, #name, .p-steps li b, .p-right {
  font-optical-sizing: auto; letter-spacing: -0.02em; font-style: normal;
}
#cueTitle { line-height: 0.98; }
.p-steps li b { font-weight: 300; font-size: 1.35em; }

/* the share panel plays the reveal video once it's ready */
#sharePreviewVideo { height: min(78vh, 520px); max-width: 52vw; aspect-ratio: 4 / 5; object-fit: contain; border-radius: 4px; box-shadow: 0 14px 40px rgba(0,0,0,.5); background: #000; }
#sharePreviewVideo[hidden] { display: none; }
@media (max-aspect-ratio: 1/1) { #sharePreviewVideo { height: auto; width: min(70vw, 340px); max-height: 52vh; } }

/* bigger, calmer cue animations */
.cue-icon { width: 64px; height: 64px; }
.ico { transform: scale(1.75); transform-origin: 20px 20px; left: 12px; top: 12px; width: 40px; height: 40px; }

/* drip: a bead swells at the dropper tip, stretches, lets go, falls under gravity, splats and ripples */
.ico-drip b { position: absolute; left: 16px; top: 0; width: 8px; height: 4px; background: var(--ic); border-radius: 1px 1px 3px 3px; }
.ico-drip i { position: absolute; left: 15px; top: 4px; width: 10px; height: 12px; transform-origin: 50% 0; opacity: 0; animation: dripFall 3.6s infinite; }
.ico-drip i::before { content: ''; position: absolute; left: 0; bottom: 0; width: 10px; height: 10px; background: var(--ic); border-radius: 0 50% 50% 50%; transform: rotate(45deg); }
.ico-drip u { position: absolute; left: 8px; top: 33px; width: 24px; height: 6px; border-radius: 50%; background: var(--ic); opacity: 0; transform: scale(0); animation: dripPool 3.6s infinite; }
.ico-drip s { position: absolute; left: 3px; top: 31px; width: 34px; height: 10px; border-radius: 50%; border: 1.2px solid var(--ic); opacity: 0; transform: scale(.3); animation: dripRing 3.6s infinite; }
@keyframes dripFall {
  0%   { transform: translateY(0) scale(.15); opacity: 0; animation-timing-function: cubic-bezier(.3, 0, .3, 1); }
  8%   { opacity: 1; }
  40%  { transform: translateY(0) scale(1, 1.08); opacity: 1; animation-timing-function: cubic-bezier(.45, 0, .55, 1); }
  50%  { transform: translateY(1.5px) scale(.92, 1.28); opacity: 1; animation-timing-function: cubic-bezier(.55, 0, 1, .5); }
  64%  { transform: translateY(23px) scale(.82, 1.34); opacity: 1; }
  65%  { transform: translateY(24px) scale(1.4, .35); opacity: 0; }
  100% { transform: translateY(24px) scale(1.4, .35); opacity: 0; }
}
@keyframes dripPool {
  0%, 64% { transform: scale(0, 0); opacity: 0; }
  65%  { transform: scale(.3, .7); opacity: 1; animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
  78%  { transform: scale(1.06, 1); opacity: 1; animation-timing-function: ease-in-out; }
  84%  { transform: scale(1, 1); opacity: 1; }
  94%  { transform: scale(1.03, 1); opacity: .9; }
  100% { transform: scale(1.05, 1); opacity: 0; }
}
@keyframes dripRing {
  0%, 65% { transform: scale(.3); opacity: 0; }
  67%  { opacity: .6; animation-timing-function: cubic-bezier(.2, .7, .3, 1); }
  92%  { transform: scale(1.18); opacity: 0; }
  100% { transform: scale(1.18); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .ico-drip i, .ico-drip u, .ico-drip s { animation: none; } .ico-drip i { opacity: 1; } }

/* outer-screen icon: two outlined panels, the right one swings open (same language as the cue icons) */

/* outer-screen illustration: a book-style foldable phone that opens */
/* closed: cover rests on the left half, outer screen facing you; then it swings open like a book */

/* after the reveal the tool strips fade away; the sheet itself never moves or resizes */
#left, #right { transition: opacity .5s ease, visibility .5s; }
#app[data-state="revealing"] #left, #app[data-state="revealing"] #right,
#app[data-state="revealed"] #left, #app[data-state="revealed"] #right { opacity: 0; visibility: hidden; }
#newBlot2 { margin: 0; }
#newBlot2:active { background: rgba(30,28,25,.08); }

/* 12px minimum: keep small screens tidy */
.nudge-top { letter-spacing: .04em !important; gap: 12px; }
#app[data-layout="portrait"] .p-tag { display: none; }                 /* steps need the whole bottom line on a small sheet */
#app[data-layout="portrait"] #right { gap: 12px !important; overflow-x: auto; justify-content: flex-start !important; padding: 0 4px; scrollbar-width: none; }
#app[data-layout="portrait"] #right::-webkit-scrollbar { display: none; }
#app[data-layout="portrait"] #papers, #app[data-layout="portrait"] .tools { gap: 8px; flex-shrink: 0; }

/* cue changes cross-fade */
#cue { transition: opacity .45s ease; }
#cue.swap { opacity: 0 !important; }

/* bigger tap targets for the on-paper buttons */
#cueBtn:not(.ghost), #guessGo { padding: 10px 18px; min-height: 40px; }

/* after the reveal: a soft paper-white fade behind the title + "Made by" so they stay readable over ink (screen only, not exported) */
.print::before { content: ''; position: absolute; left: 12%; right: 12%; bottom: 0; height: 26%; pointer-events: none; opacity: 0; transition: opacity .6s;
  /* a soft glow only behind the title + "Made by", so the rest of the blot keeps its full strength */
  background: radial-gradient(50% 70% at 50% 72%, rgba(246,243,236,.9) 0%, rgba(246,243,236,.75) 45%, rgba(246,243,236,0) 100%); }
#app[data-state="revealed"] .print::before { opacity: 1; }

/* ---------- accessibility ---------- */
:focus-visible { outline: 2px solid #8fb4ff; outline-offset: 3px; border-radius: 6px; }
#guess:focus-visible, #sign:focus-visible { outline: 2px solid #1d3fbf; outline-offset: 4px; }
#papers button:disabled, .tool:disabled { cursor: default; }
.p-priv { color: inherit; pointer-events: auto; text-decoration: underline; text-underline-offset: 2px; }
.nudge-priv { position: absolute; bottom: 30px; font-size: 12px; color: var(--dim); }
#sharePreviewVideo { cursor: pointer; }
@media (prefers-reduced-motion: reduce) {
  #cue, .print, #hint, .p-guess, .p-sign { transition: none !important; }
}
.share-priv { font-size: 12px; color: var(--dim); align-self: flex-start; margin-top: 4px; }

/* outer-screen illustration: a plain outline of the foldable opening like a book (2D flip = crisp edges) */
.duo { position: relative; width: 196px; height: 112px; margin: 14px 0 34px; animation: duoCenter 5.6s cubic-bezier(.65,0,.35,1) infinite; }
/* keep the phone centred: shift right by half a page while closed */
@keyframes duoCenter { 0%, 18% { transform: translateX(49px); } 55%, 85% { transform: translateX(0); } 100% { transform: translateX(49px); } }
.duo i { position: absolute; top: 0; width: 98px; height: 112px; box-sizing: border-box; border: 2px solid var(--cream); }
.duo-l { left: 0; border-radius: 14px 7px 7px 14px; }
.duo-r { left: 98px; border-radius: 7px 14px 14px 7px; transform-origin: 0 50%; background: var(--table);
  will-change: transform; animation: duoOpen 5.6s cubic-bezier(.65,0,.35,1) infinite; }
/* closed: the cover lies exactly on the left half; then it swings open */
@keyframes duoOpen { 0%, 18% { transform: scaleX(-1); } 55%, 85% { transform: scaleX(1); } 100% { transform: scaleX(-1); } }
@media (prefers-reduced-motion: reduce) { .duo, .duo-r { animation: none; } }

/* ---------- upright screens (regular iPhone, or the Duo's inner screen turned sideways) ----------
   one centred block: sheet, then inks, then tools, instead of a sheet floating far from its controls */
#app[data-layout="portrait"] { grid-template-rows: auto auto auto; align-content: center; gap: 18px; }
#app[data-layout="portrait"] #stage { width: 100%; aspect-ratio: 1.41421356; max-height: 62vh; justify-self: center; }
#app[data-layout="portrait"] #right { justify-content: center !important; }
#app[data-layout="portrait"][data-big="1"] { gap: 26px; padding-left: max(28px, env(safe-area-inset-left)); padding-right: max(28px, env(safe-area-inset-right)); }
#app[data-layout="portrait"][data-big="1"] .p-tag { display: block; }   /* room for the credit on a big upright screen */
#app[data-layout="portrait"][data-big="1"] .swatch { width: 34px; height: 34px; }
#app[data-layout="portrait"][data-big="1"] #swatches { gap: 14px; }
.turn-tip { display: none; text-align: center; color: var(--dim); font-size: 13px; margin: 0; }
#app[data-layout="portrait"][data-big="1"][data-duo="1"] .turn-tip { display: block; grid-row: 4; }
#app[data-layout="portrait"][data-state="revealing"], #app[data-layout="portrait"][data-state="revealed"] { grid-template-rows: auto auto auto; }

/* secondary save option */
.pill.big.alt { background: none; color: var(--cream); box-shadow: inset 0 0 0 1.5px rgba(239,233,220,.45); }

/* credit link to Instagram */
.ig { color: inherit; pointer-events: auto; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: currentColor; }
.ig:active { opacity: .6; }
