/* calm: a quiet first view, then each part of the app laid on the page for you to touch */
.hero { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 72px; }
#mark { width: min(30vw, 260px); }
.typing { margin: 0; min-height: 1.8em; font-size: clamp(15px, 1.2vw, 17px); color: var(--ink); letter-spacing: .04em; }
.caret { display: inline-block; width: 1px; height: 1.15em; margin-left: 2px; vertical-align: -.2em; background: var(--ink); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.try { width: min(1080px, calc(100vw - 2 * var(--m))); margin: 0 auto; padding: 14vh 0 0; opacity: 0; translate: 0 24px; transition: opacity 1.2s ease, translate 1.2s cubic-bezier(.2,.7,.2,1); }
.try.seen { opacity: 1; translate: 0 0; }
.word { margin: 0 0 22px; font-weight: 400; font-size: clamp(20px, 2vw, 28px); letter-spacing: .01em; color: var(--ink); }
.frame { position: relative; aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; background: var(--paper); box-shadow: 0 0 0 1px var(--line); }
.screen { position: absolute; inset: 0; overflow: hidden; }
.screen iframe { position: absolute; left: 0; top: 0; width: 1440px; height: 900px; max-width: none; border: 0; transform-origin: 0 0; background: var(--paper); }
#set .screen iframe, #out .screen iframe { pointer-events: none; }

.ctl { display: flex; flex-wrap: wrap; gap: 10px 34px; align-items: center; margin-top: 16px; font-size: 12px; letter-spacing: .06em; }
.grp { display: flex; gap: 16px; align-items: center; }
.grp button { all: unset; cursor: pointer; color: var(--dim); transition: color .3s; }
.grp button:hover, .grp button[aria-pressed="true"] { color: var(--ink); }
.pics { gap: 6px; }
.pics button { width: 34px; height: 34px; border-radius: 4px; background: center / cover; opacity: .45; transition: opacity .4s; }
.pics button[aria-pressed="true"], .pics button:hover { opacity: 1; }

/* out: the same piece in each size it leaves in; the card eases between them */
.hold { height: min(72vh, 720px); display: grid; place-items: center; }
.card { height: 100%; aspect-ratio: var(--r); max-width: 100%; transition: aspect-ratio .9s cubic-bezier(.2,.7,.2,1); border-radius: 4px; }

.photos { padding: 16vh 0 0; overflow: hidden; }

/* the end: every step of the mark coming into being, laid in a row, drifting */
.end { padding: 14vh 0 var(--m); }
.flow { overflow: hidden; height: clamp(40px, 5vw, 64px); }
.run { display: flex; width: max-content; height: 100%; animation: drift 140s linear infinite; }
.run img { display: block; height: 100%; width: auto; flex: none; margin-right: 2.4vw; opacity: .9; }
.run i { display: block; height: 100%; aspect-ratio: 900 / 446; flex: none; margin-right: 1.2vw; background: var(--ink); -webkit-mask-position: center; -webkit-mask-size: contain; -webkit-mask-repeat: no-repeat; mask-position: center; mask-size: contain; mask-repeat: no-repeat; }
@keyframes drift { to { translate: -50% 0; } }
.foot { display: flex; justify-content: space-between; align-items: flex-end; padding: 8vh var(--m) 0; font-size: 11px; color: var(--dim); letter-spacing: .06em; }
.foot .dev { margin: 0; font-size: 12px; color: var(--ink); letter-spacing: .08em; }
.foot nav { display: flex; gap: 22px; }
.foot a { color: var(--dim); } .foot a:hover { color: var(--ink); }

@media (max-width: 699px) {
  #mark { width: 52vw; } .hero { gap: 28px; }
  .frame { aspect-ratio: 3 / 4; }
  .hold { height: 64vh; }
  .ctl { gap: 12px 24px; }
}
@media (prefers-reduced-motion: reduce) { .run { animation: none; } .try { transition: none; opacity: 1; translate: none; } }


/* the first screen wears the app's own edges: the sheet's name and the time in the top corners, 清書 at the middle of the
   left, the small picture with the line on it at the middle of the right; Scroll down at the bottom left */
.hc { position: absolute; margin: 0; font-size: 11px; line-height: 1.7; letter-spacing: .06em; color: var(--dim); }
.hc.tl { top: var(--m); left: var(--m); } .hc.tr { top: var(--m); right: var(--m); display: flex; gap: 18px; }
.hc.bl { bottom: var(--m); left: var(--m); display: flex; align-items: center; gap: 10px; color: var(--ink); }
.hc.br { bottom: var(--m); right: var(--m); }
button.hc { all: unset; position: absolute; cursor: pointer; }
.hc.ml { left: var(--m); top: 50%; translate: 0 -50%; font-size: 12px; letter-spacing: .08em; color: var(--dim); transition: color .3s; }
.hc.ml:hover, .hc.ml[aria-pressed="true"] { color: var(--ink); }
.hc.mr { right: var(--m); top: 50%; translate: 0 -50%; width: min(12vw, 150px); aspect-ratio: 4 / 5; border-radius: 2px; overflow: hidden; background: #0c0c0b; }
.hc.mr { touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; }
.hc.mr:active { cursor: grabbing; }
.hc.mr canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hc.mr::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.16); }
.hc.mr .cp { position: absolute; left: 11%; top: 11%; right: 11%; z-index: 1; color: #f4f2ec; font-size: 8px; line-height: 1.7; letter-spacing: .04em; }
.drip { display: block; width: 1px; height: 22px; background: var(--ink); transform-origin: top; animation: drip 2.4s cubic-bezier(.6,0,.3,1) infinite; }
@keyframes drip { 0% { scale: 1 0; } 45% { scale: 1 1; transform-origin: top; } 55% { scale: 1 1; transform-origin: bottom; } 100% { scale: 1 0; transform-origin: bottom; } }
.typing.clean .caret { opacity: 0; animation: none; }
@media (max-width: 599px) { .hc.mr { width: 84px; } .hc.ml { font-size: 11px; } }

/* the tape, as the app lays it: a pale strip a little wider than the words, torn at both ends, drawn on from the left */
.typing .tp { position: relative; display: inline-block; vertical-align: bottom; white-space: nowrap; transition: max-width .7s cubic-bezier(.4,0,.2,1), opacity .5s ease; max-width: 14em; overflow: visible; }
.typing .tp .bar { position: absolute; left: -.18em; right: -.18em; top: .12em; bottom: .12em; background: #fbfbf9; filter: drop-shadow(0 .6px .8px rgba(0,0,0,.18));
  clip-path: polygon(0 8%, 3% 0, 97% 4%, 100% 0, 98% 30%, 100% 62%, 97% 100%, 4% 94%, 0 100%, 2% 60%, 0 34%); transform-origin: left; scale: 0 1; rotate: -.6deg; transition: scale .45s cubic-bezier(.45,.05,.2,1), rotate .45s ease, translate .3s ease, opacity .3s ease; }
.typing .tp.on .bar { scale: 1 1; rotate: 0deg; }
.typing.rides { transition: opacity .3s ease; }
.typing .tp.gone { max-width: 0; opacity: 0; }
.typing .tp.gone .bar { translate: 4px -7px; rotate: -2.5deg; opacity: 0; }

/* the sheet: the app, the whole screen, no frame — it carries on from the first screen */
.sheet { height: 100svh; }
.sheet iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--paper); }


/* the end: the mark again, large, forming as you arrive; one quiet line under it */
.end { padding: 22vh 0 var(--m); display: grid; justify-items: center; }
.endmark { width: min(62vw, 720px); aspect-ratio: 900 / 446; touch-action: pan-y; cursor: grab; }
.close { margin: 5vh 0 26vh; font-size: 13px; letter-spacing: .12em; color: var(--ink); }
.foot { width: 100%; }

/* the title, 清書 and the small picture stay where they are all the way down, as the app's own edges do */
.hc.tl, .hc.tr, .hc.ml, .hc.mr { position: fixed; z-index: 5; }
.typing.rides { position: fixed; left: 0; right: 0; top: 0; z-index: 4; text-align: center; pointer-events: none; }
.typing .tp { pointer-events: auto; cursor: pointer; }
.hero .typing.rides + * { }
@media (max-width: 599px) { .hc.mr, .hc.ml { position: absolute; } }


/* phones: the corner words stay with the first screen instead of riding over the pictures; the small picture moves down
   out of the mark's way; the captions break between their parts, never inside a word; less empty wall before the end */
@media (max-width: 599px) {
  .hc.tl, .hc.tr { position: absolute; }
  .hc.mr { top: auto; bottom: calc(var(--m) + 36px); translate: none; width: 76px; }
  .typing { font-size: 14px; max-width: calc(100vw - 2 * var(--m)); text-align: center; }
  .end { padding-top: 10vh; }
  .endmark { width: 64vw; }
  .close { margin: 4vh 0 14vh; }
  .foot { flex-wrap: wrap; gap: 10px 18px; }
}
/* phones: the page scrolls on its own (no frame catching the finger, no line riding, no grain blended over everything) */
@media (max-width: 599px) {
  .sheet iframe, .piece .poster iframe { pointer-events: none; }
  body::after { display: none; }
}
@media (max-width: 599px) {
  .lead { position: relative; }
  .typing.stick { position: sticky; top: calc(max(var(--m), env(safe-area-inset-top, 0px)) + 4px); z-index: 4; text-align: center; pointer-events: none; }
  .piece .poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
}
@media (max-width: 599px) { .lead .rail { position: absolute; left: 0; right: 0; top: 0; z-index: 6; pointer-events: none; } }
@media (max-width: 599px) { .end { padding-bottom: calc(var(--m) + env(safe-area-inset-bottom, 0px) + 28px); } }
/* phones: while the line is held at the top, what scrolls by (the corner words, the small picture) goes under it, not through it */
@media (max-width: 599px) { .typing.stick { max-width: none; width: 100%; background: var(--paper); padding: 10px var(--m); box-sizing: border-box; } }
/* phones: the small picture carries no words; the corner words are tiny,
   and the two at the bottom leave as soon as the page moves */
@media (max-width: 599px) {
  .hc.tl, .hc.tr { font-size: 8.5px; letter-spacing: .08em; }
  .hc.mr .cp { display: none; }
  .hc.bl, .hc.br { transition: opacity .35s ease; }
  body.moved .hc.bl, body.moved .hc.br { opacity: 0; }
  .typing.stick { transition: background-color .3s ease, color .3s ease; }
}

@media (max-width: 599px) { .sheet.live iframe, .piece .poster.live iframe { pointer-events: auto; } .piece .poster { cursor: pointer; } }
.hc.bl, .hc.br { transition: opacity .25s ease; }



/* the tape hides what is under it; a pointer over it (or a finger held on it) lets you peek, as in the app */
.typing .tp:hover .bar, .typing .tp.peek .bar { opacity: .28; }


/* the first screen holds still: the mark forms where it is, the line is written under it, nothing glides */
.hero { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 56px; }
#mark { position: static; width: min(26vw, 240px); translate: none; scale: none; transition: none; }
.typing, .typing.rides { position: static !important; translate: none !important; text-align: center; width: auto; opacity: 1 !important; }
.typing .caret { opacity: 0; }
.typing.writing .caret { opacity: 1; }
.typing.done .caret, .typing.clean .caret { opacity: 0; animation: none; }
@media (max-width: 699px) { #mark { width: 48vw; } .hero { gap: 36px; } }

/* the end: a screen of its own, the mirror of the first — the mark, and the line again, its tape now closed */
.end { position: relative; height: 100svh; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 40px; overflow: visible; }
.endmark { width: min(26vw, 240px); margin: 0; aspect-ratio: 900 / 446; }
.close { margin: 0; font-size: clamp(15px, 1.2vw, 17px); letter-spacing: .04em; color: var(--ink); }
.ec { position: absolute; bottom: var(--m); margin: 0; font-size: 11px; letter-spacing: .06em; color: var(--dim); display: flex; gap: 22px; }
.ec.bl { left: var(--m); color: var(--ink); } .ec.br { right: var(--m); }
.ec a { color: var(--dim); } .ec a:hover { color: var(--ink); }
.end .foot { display: none !important; }
@media (max-width: 699px) { .endmark { width: 48vw; } .end { gap: 26px; } .ec { font-size: 10px; gap: 14px; } }

/* the words on the small picture are set upright, from its top right, as a poster would set them */
.hc.mr .cp { writing-mode: vertical-rl; left: auto; right: 12%; top: 10%; bottom: 10%; font-size: 9px; line-height: 1.9; letter-spacing: .14em; }

/* the opening, in order: the mark forms alone on the paper, the line is written under it, the tape goes on,
   and only then the rest of the first screen comes in around it, corners first, the picture last */
html:not(.arrived) .hero .hc { opacity: 0 !important; pointer-events: none; }
html.opening:not(.opened) .typing { opacity: 0; }
.hero .typing { transition: opacity .8s ease; }
html.arrived .hero .hc { opacity: 1; transition: opacity 1.1s ease; }
html.arrived .hero .hc.tl, html.arrived .hero .hc.tr { transition-delay: 0s; }
html.arrived .hero .hc.ml { transition-delay: .35s; }
html.arrived .hero .hc.bl, html.arrived .hero .hc.br { transition-delay: .7s; }
.hero .hc.mr { clip-path: inset(100% 0 0 0); transition: clip-path 1.4s cubic-bezier(.65,0,.15,1) .5s, opacity .01s .5s !important; }
html.arrived .hero .hc.mr { clip-path: inset(0 0 0 0); }
html.revisit .hero .hc, html.revisit .hero .typing { transition: none !important; }

/* 2026-11-20: the first screen's line is small, like the corners */
.typing { font-size: 12px; letter-spacing: .1em; }
@media (max-width: 699px) { .typing { font-size: 12px; } }

/* 2026-11-20: the corner words, much smaller */
.hc.tl, .hc.tr { font-size: 8px !important; letter-spacing: .12em; font-weight: 300; }

/* the words on the small picture: two short columns, well inside the edge, like the posters */
.hc.mr .cp { white-space: pre-line; right: 18%; top: 14%; bottom: auto; font-size: 8px; line-height: 2.3; letter-spacing: .22em; font-weight: 300; }

/* the small picture carries no words now (only the picture) */
.hc.mr .cp { display: none; }
/* the two corner words stay on the page all the way down */
.hc.tl, .hc.tr { position: fixed; z-index: 30; }
