/* BOOK · Yolly & Luca
   One stylesheet for the whole binder. Every colour is a material of the BOOK:
   ultramarine cloth, ivory paper, black pockets, mint aura, rose lettering, brass rings. */

@font-face{font-family:'Book Schola';src:url('/assets/fonts/BookSchola-Regular.woff') format('woff');font-weight:400 500;font-style:normal;font-display:swap}
@font-face{font-family:'Book Schola';src:url('/assets/fonts/BookSchola-Bold.woff') format('woff');font-weight:600 900;font-style:normal;font-display:swap}
@font-face{font-family:'Book Schola';src:url('/assets/fonts/BookSchola-Italic.woff') format('woff');font-weight:400;font-style:italic;font-display:swap}
@font-face{font-family:'Iansui';src:url('/assets/fonts/Iansui-Regular.woff2') format('woff2');font-weight:400;font-style:normal;font-display:swap}

:root{
  color-scheme:dark;
  --night:#10132e; --night-3:#20255a;
  --cloth:#262c86; --cloth-deep:#1a1f60;
  --paper:#f2eee2; --rule:#d2c9b4;
  --slot:#121915; --slot-hi:#1a2620;
  --ink:#1d2035; --ink-2:#45485f; --ink-3:#65677c;
  --moon:#eceaf5; --moon-2:#b9bbd7; --moon-3:#8b8eb4;
  --mint:#9fd2ba; --mint-deep:#2b7358;
  --rose:#b4567c; --rose-hi:#c3688d;
  --danger:#a53f2e;
  --frame-rose:#b4567c; --frame-blue:#3a71b2; --frame-gold:#b28d43; --frame-green:#3a8667;
  --serif:'Book Schola','Noto Serif TC','Songti TC','PMingLiU',serif;
  --latin:'Book Schola','Noto Serif TC',Georgia,serif;
  --hand:'Iansui','Klee','Kaiti TC','DFKai-SB',cursive;
  --ease:cubic-bezier(.2,.75,.2,1);
  --grain:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' fill='%236f6551' opacity='.55' filter='url(%23n)'/%3E%3C/svg%3E");
  --paper-grain:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' fill='%23857a62' opacity='.2' filter='url(%23n)'/%3E%3C/svg%3E");
  --weave:repeating-linear-gradient(45deg,#ffffff08 0 1px,transparent 1px 3px),repeating-linear-gradient(-45deg,#00000018 0 1px,transparent 1px 3px);
}

/* Base */
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%;scrollbar-gutter:stable;scrollbar-color:#3a3f7a var(--night)}
body{margin:0;min-height:100svh;background:var(--night);color:var(--moon);font:400 16px/1.75 var(--serif);letter-spacing:.02em;font-kerning:normal;-webkit-font-smoothing:antialiased;overflow-x:clip}
body:has(dialog[open]){overflow:hidden}
h1,h2,h3,p{margin:0}
button,input,textarea,select{font:inherit;letter-spacing:inherit;color:inherit}
button{cursor:pointer;-webkit-tap-highlight-color:transparent;touch-action:manipulation;background:none;border:0;padding:0}
button:disabled{cursor:not-allowed;opacity:.42}
[hidden]{display:none!important}
:focus-visible{outline:2px solid var(--mint);outline-offset:3px}
.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
svg{display:block}

.ambient{position:fixed;inset:0;z-index:-1;pointer-events:none;background:radial-gradient(1100px 620px at 50% -12%,#2a31926b,transparent 70%),radial-gradient(700px 520px at 96% 104%,#2b735826,transparent 70%),var(--night)}
.ambient::after{content:'';position:absolute;inset:0;background-image:var(--grain);opacity:.12;mix-blend-mode:soft-light}

/* Shared controls */
.primary{display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:50px;padding:12px 24px;border-radius:4px;background:var(--rose);color:#fff8fb;font-weight:600;letter-spacing:.12em;box-shadow:inset 0 1px 0 #ffffff38,inset 0 -2px 0 #00000026;transition:background-color .2s,transform .2s}
.primary:hover:not(:disabled){background:var(--rose-hi)}
.primary:active:not(:disabled){transform:translateY(1px)}
.secondary{min-height:46px;padding:10px 20px;border-radius:4px;border:1px solid #1d203533;color:var(--ink);font-weight:600;letter-spacing:.1em}
.secondary:hover{background:#1d20350d}
.quiet-button{min-height:40px;padding:8px 18px;border-radius:999px;border:1px solid #b9bbd645;color:var(--moon);font-size:14px;letter-spacing:.12em;transition:border-color .2s,background-color .2s}
.quiet-button:hover{border-color:var(--mint);background:#9fd2ba12}
.text-button{min-height:40px;padding:6px 2px;color:var(--moon-2);font-size:14px;letter-spacing:.08em;text-decoration:underline;text-underline-offset:5px;text-decoration-thickness:1px}
.icon-button{width:40px;height:40px;display:grid;place-items:center;border-radius:50%;border:1px solid #b9bbd645;color:var(--moon-2);transition:border-color .2s,color .2s}
.icon-button svg{width:17px;height:17px}
.icon-button:hover{border-color:var(--mint);color:var(--moon)}
.form-message{font-size:14px;line-height:1.7;color:#e7b98f}
.form-message:empty{display:none}

/* Top bar */
.topbar{max-width:1180px;margin:0 auto;padding:20px 40px 6px;display:flex;align-items:center;justify-content:space-between;gap:20px}
.brand{display:inline-flex;align-items:baseline;gap:12px;color:var(--moon);text-decoration:none}
.brand b{font:700 22px/1 var(--latin);letter-spacing:.2em}
.brand span{font:italic 400 16px/1 var(--latin);letter-spacing:.02em;color:var(--moon-2)}

/* Entry: the closed BOOK and its title slip */
.entry{max-width:1140px;min-height:calc(100svh - 170px);margin:0 auto;padding:32px 48px 56px;display:grid;grid-template-columns:minmax(0,1.1fr) auto minmax(300px,.95fr);align-items:center;column-gap:clamp(36px,5vw,76px)}
.cover-stage{position:relative;display:grid;place-items:center;padding:116px 0 78px 30px;isolation:isolate}
.cover-stage::before{content:'';position:absolute;z-index:-1;width:125%;aspect-ratio:1;border-radius:50%;background:radial-gradient(circle at 46% 44%,#9fd2ba2e 0%,#3a43b440 32%,transparent 66%)}
.cover-stage::after{content:'';position:absolute;z-index:-1;bottom:44px;left:50%;width:74%;height:44px;transform:translateX(-50%);border-radius:50%;background:radial-gradient(ellipse,#000000b3,transparent 70%);filter:blur(7px)}
/* The closed BOOK: a cloth-bound binder you can see the spine of, with a rose ribbon marking our page. */
.cover-display{--thick:40px;position:relative;width:min(100%,320px);aspect-ratio:170/220;transform-style:preserve-3d;transform:perspective(2000px) rotateX(calc(4deg + var(--tx,0deg))) rotateY(calc(28deg + var(--ty,0deg))) rotateZ(1deg);transition:transform 1s var(--ease)}
.cover-stage.is-tilting .cover-display{transition:transform .16s linear}
.cover-art{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:cover;border-radius:1px 5px 5px 1px;background:var(--cloth);transform:translateZ(0)}
.cover-back{position:absolute;inset:0;border-radius:1px 5px 5px 1px;background:var(--cloth-deep);transform:translateZ(calc(var(--thick) * -1));box-shadow:0 0 0 1px #0d1040}
.cover-pages{position:absolute;top:2%;bottom:2%;right:2px;width:calc(var(--thick) - 4px);transform-origin:right center;transform:translateZ(-2px) rotateY(-90deg);background:repeating-linear-gradient(90deg,#f1ecdc 0 1px,#cfc7b0 1px 2px)}
.cover-spine{position:absolute;top:0;bottom:0;left:calc(var(--thick) * -1);width:var(--thick);transform-origin:right center;transform:rotateY(-90deg);display:flex;flex-direction:column;align-items:center;gap:6%;padding:20% 0 0;overflow:hidden;border-radius:4px 0 0 4px;background-color:#20267a;background-image:var(--weave),linear-gradient(90deg,#0d1145 0%,#262d8a 30%,#3740a8 52%,#262d8a 74%,#11164f 100%);box-shadow:inset 0 0 0 1px #ffffff12}
.cover-spine::before,.cover-spine::after{content:'';position:absolute;left:0;right:0;height:5px;background:linear-gradient(90deg,#5c4a22,#d9bd78 40%,#fff1c4 52%,#c9a85e 66%,#5c4a22);box-shadow:0 2px 2px #00000059}
.cover-spine::before{top:9%}
.cover-spine::after{bottom:9%}
.cover-spine b{writing-mode:vertical-rl;font:700 calc(var(--thick) * .42)/1 var(--latin);letter-spacing:.34em;background:linear-gradient(180deg,#fff0c2,#d4b46a 40%,#f6e2a6 62%,#b08d42);-webkit-background-clip:text;background-clip:text;color:transparent}
.cover-spine span{writing-mode:vertical-rl;font:italic 400 calc(var(--thick) * .3)/1 var(--latin);letter-spacing:.08em;color:#e3cd91b3}
/* Two cards tucked between the pages, peeking over the top edge. */
.cover-cards{position:absolute;inset:0;transform-style:preserve-3d;pointer-events:none}
.cover-cards i{position:absolute;display:flex;flex-direction:column;width:43%;aspect-ratio:65/90;border-radius:3px;font-style:normal;overflow:hidden;container-type:inline-size}
.cover-cards i::after{content:'';position:absolute;inset:0;background:linear-gradient(180deg,#ffffff1f,transparent 22%,#00000059 58%)}
.cc-front{left:11%;top:-24%;gap:4.5%;padding:4.6%;background:#151515;transform:translateZ(calc(var(--thick) * -.32)) rotate(-7deg)}
.cc-head{flex:none;display:grid;grid-template-columns:25% 1fr 21%;height:13%;background:#efedd7;border:1px solid #c8c4a5;font:700 7.4cqw/1 var(--latin);color:#1d2035}
.cc-head b{display:grid;place-items:center;min-width:0;overflow:hidden;white-space:nowrap;border-right:1px solid #262626}
.cc-head b:nth-child(2){font:700 6.6cqw/1 var(--serif);letter-spacing:.06em}
.cc-head b:last-child{border-right:0}
.cc-window{flex:none;height:44%;border:1.2cqw solid transparent;border-image:linear-gradient(135deg,#ff9fcf,#ffe39a 25%,#9ff3cf 50%,#9fd6ff 75%,#c9a8ff) 1;background:radial-gradient(circle at 30% 40%,#9fd2ba73,transparent 45%),linear-gradient(160deg,#3a43b4,#1a1f60 55%,#2b7358)}
.cc-back{left:46%;top:-17%;padding:10% 11%;background:#f5f1e4 var(--paper-grain);background-size:160px;box-shadow:inset 0 0 0 4cqw #f5f1e4,inset 0 0 0 calc(4cqw + 1px) var(--rose);transform:translateZ(calc(var(--thick) * -.64)) rotate(8deg)}
.cc-back b{font:700 8.6cqw/1 var(--latin);letter-spacing:.06em;color:#8b3a5c}
.cc-back::before{content:'';display:block;order:2;margin-top:9%;height:1px;background:#1d203526}
.cover-ribbon{position:absolute;left:24%;top:93%;width:7.5%;height:21%;transform:translateZ(calc(var(--thick) * -.5));background:linear-gradient(90deg,#6f2645,#bf628c 38%,#e59bbb 50%,#a84f77 68%,#6f2645);clip-path:polygon(0 0,100% 0,100% 100%,50% 84%,0 100%)}
.cover-light{position:absolute;inset:0;border-radius:1px 5px 5px 1px;pointer-events:none;transform:translateZ(.5px);background:repeating-linear-gradient(45deg,#ffffff06 0 1px,transparent 1px 3px),repeating-linear-gradient(-45deg,#0000000d 0 1px,transparent 1px 3px),linear-gradient(90deg,transparent 0 6.4%,#0000004d 7%,#ffffff33 7.8%,transparent 9.2%),linear-gradient(112deg,#ffffff33 0%,#ffffff0d 24%,transparent 44%,transparent 70%,#00000033 100%);box-shadow:inset 0 0 0 1px #ffffff1f,inset 1px 1px 0 #ffffff26}
.cover-glint{position:absolute;inset:0;border-radius:1px 5px 5px 1px;pointer-events:none;transform:translateZ(1px);background:linear-gradient(105deg,transparent 42%,#ffffff40 50%,transparent 58%) 130% 0/260% 100% no-repeat;animation:cover-glint 2.4s .7s cubic-bezier(.3,.6,.2,1) both}
@keyframes cover-glint{from{background-position:130% 0}to{background-position:-30% 0}}

/* Title slip: the vertical title, a rule like a spine edge, and our ex-libris seal. */
.entry-mark{display:flex;flex-direction:column;align-items:center;gap:26px;align-self:center;padding:6px 26px 6px 0;border-right:1px solid #9fd2ba4d}
.entry-title{writing-mode:vertical-rl;margin:0;font:900 clamp(44px,4.3vw,60px)/1.05 var(--serif);letter-spacing:.2em;color:var(--moon);white-space:nowrap}
.entry-seal{display:grid;place-items:center;width:44px;height:44px;border-radius:5px;background:var(--rose);color:#fdf0f5;font:700 13px/1 var(--latin);letter-spacing:.06em;box-shadow:inset 0 0 0 3px var(--rose),inset 0 0 0 4.5px #fdf0f5d9;transform:rotate(-4deg)}
.entry-copy{max-width:390px}
.entry-description{margin:0 0 40px;font-size:19px;line-height:2;letter-spacing:.1em;color:var(--moon-2)}
#login-form label{display:block;margin-bottom:10px;font-size:14px;letter-spacing:.12em;color:var(--moon-2)}
.password-wrap{display:flex;align-items:center;min-height:54px;margin-bottom:14px;border:1px solid #b9bbd640;border-radius:4px;background:#0b0e27;transition:border-color .2s,box-shadow .2s}
.password-wrap:focus-within{border-color:var(--mint);box-shadow:0 0 0 3px #9fd2ba26}
.password-wrap input{flex:1;width:0;min-width:0;padding:14px 16px;border:0;background:none;font-size:16px;letter-spacing:.08em;color:var(--moon)}
.password-wrap input:focus{outline:none}
.password-wrap input::placeholder{color:var(--moon-3);letter-spacing:.06em}
.password-wrap button{flex-shrink:0;align-self:stretch;padding:0 16px;font-size:14px;letter-spacing:.12em;color:var(--moon-2);white-space:nowrap}
.password-wrap button:hover{color:var(--moon)}
.entry .primary{width:100%;min-height:54px;font-size:16px}
#login-form .form-message{margin-top:14px}
#preview-login{margin-top:14px}
.private-note{margin-top:28px;padding-top:18px;border-top:1px solid #b9bbd61f;font-size:13px;letter-spacing:.1em;color:var(--moon-3)}

/* Album heading and toolbar */
#album-screen{max-width:1180px;margin:0 auto;padding:6px 40px 0}
.album-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:24px;margin:2px 0 22px}
.album-heading h1{font-size:31px;font-weight:700;line-height:1.3;letter-spacing:.14em}
.collection-meta{display:flex;align-items:center;gap:16px}
.collection-map{display:grid;grid-template-columns:repeat(10,4px);align-content:center;justify-content:center;gap:2px;width:70px;height:70px;border:1px solid #b9bbd626;border-radius:3px}
.collection-map i{display:block;width:4px;height:4px;border-radius:1px;background:#b9bbd62b}
.collection-map i.on{background:var(--mint);box-shadow:0 0 4px #9fd2ba99}
.collection-map.is-free{grid-template-columns:repeat(5,4px);gap:4px}
.collection-numbers{display:grid;grid-template-columns:auto auto;align-items:baseline;justify-content:start;column-gap:4px}
#collected-count{font:400 38px/1 var(--latin);letter-spacing:.02em;color:var(--moon);font-variant-numeric:lining-nums tabular-nums}
.collection-of{font:400 17px/1 var(--latin);color:var(--moon-2)}
.collection-numbers small{grid-column:1/-1;margin-top:8px;font-size:12px;line-height:1;letter-spacing:.12em;color:var(--moon-3)}

.album-toolbar{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;padding:0 20px}
.view-tabs{display:flex;gap:4px}
.view-tabs button{display:inline-flex;align-items:baseline;gap:10px;min-height:46px;padding:12px 20px 11px;border-radius:7px 7px 0 0;background:var(--night-3);color:var(--moon-2);font-size:15px;font-weight:600;letter-spacing:.12em;box-shadow:inset 0 1px 0 #ffffff12;transition:background-color .2s,color .2s}
.view-tabs button span{font:400 13px/1 var(--latin);letter-spacing:.04em;color:var(--moon-3)}
.view-tabs button:hover:not([aria-selected=true]){background:#2a3070;color:var(--moon)}
.view-tabs button[aria-selected=true]{background:var(--paper);color:var(--ink);box-shadow:inset 0 1px 0 #fff}
.view-tabs button[aria-selected=true] span{color:var(--ink-3)}
.view-tabs button:focus-visible{outline-offset:-4px}
.sync-tools{display:flex;align-items:center;gap:10px;padding-bottom:8px}
.sync-status{display:inline-flex;align-items:center;gap:8px;margin-right:4px;font-size:13px;letter-spacing:.1em;color:var(--moon-2);white-space:nowrap}
.sync-status::before{content:'';width:6px;height:6px;border-radius:50%;background:var(--mint);box-shadow:0 0 0 3px #9fd2ba24}
.sync-status.offline::before{background:#e3a86e;box-shadow:0 0 0 3px #e3a86e24}

/* The open binder */
.book{--page-pad:clamp(22px,3vw,40px);--gap-x:clamp(12px,1.6vw,20px);--strip:30px;position:relative;display:grid;grid-template-columns:1fr 1fr;padding:14px;border-radius:7px;background-color:var(--cloth);background-image:var(--weave);box-shadow:inset 0 0 0 1px #ffffff17,inset 0 2px 0 #ffffff14,0 3px 0 var(--cloth-deep),0 5px 0 #0c0f38,0 34px 60px -24px #000000c0,0 70px 120px -50px #000000a0;scroll-margin-top:16px}
.page{position:relative;min-width:0;display:flex;flex-direction:column;padding:22px var(--page-pad) 26px;background-color:var(--paper);background-image:var(--paper-grain);background-size:160px;background-blend-mode:multiply;color:var(--ink)}
.page::before{content:'';position:absolute;top:6px;bottom:6px;width:6px;background:repeating-linear-gradient(90deg,#efe9d8 0 1px,#bdb49c 1px 2px)}
.page-left{border-radius:3px 0 0 3px;transform-origin:right center;box-shadow:inset -40px 0 34px -34px #3d342299,inset 0 0 0 1px #00000010}
.page-left::before{left:-6px;border-radius:2px 0 0 2px}
.page-right{border-radius:0 3px 3px 0;transform-origin:left center;box-shadow:inset 40px 0 34px -34px #3d342299,inset 0 0 0 1px #00000010}
.page-right::before{right:-6px;border-radius:0 2px 2px 0}
.book-spine{position:absolute;z-index:3;top:14px;bottom:14px;left:50%;width:30px;transform:translateX(-50%);display:flex;flex-direction:column;justify-content:space-around;align-items:center;pointer-events:none;background:linear-gradient(90deg,transparent,#00000024 30%,#0000004d 50%,#00000024 70%,transparent)}
.book-spine i{display:block;width:48px;height:11px;border-radius:6px;background:linear-gradient(180deg,#5c4e2c 0%,#c9b07a 22%,#fff3cf 40%,#dcc489 58%,#7c6a3e 86%,#4a3f22 100%);box-shadow:0 3px 3px #0000005c,inset 0 0 0 1px #00000026}
.page-topline{display:flex;margin-bottom:16px;font:400 13px/1 var(--latin);letter-spacing:.16em;color:var(--ink-3);font-variant-numeric:lining-nums tabular-nums}
.page-right .page-topline{justify-content:flex-end}

/* Nine pockets per page. Every pocket keeps room underneath for the edit control. */
.card-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));column-gap:var(--gap-x);row-gap:calc(var(--strip) + 14px);width:100%;max-width:500px;margin:0 auto;padding-bottom:calc(var(--strip) + 2px)}

.pocket{position:relative;display:block;width:100%;aspect-ratio:65/90;border-radius:3px;text-align:center}
.pocket.empty{container-type:inline-size;background:linear-gradient(180deg,#000000 0%,transparent 16%),var(--slot);color:#e9e7d2;box-shadow:inset 0 0 0 1px #ffffff0f,inset 0 -1px 0 #ffffff14;-webkit-mask:radial-gradient(ellipse 13% 9.4% at 50% 0,transparent 96%,#000 100%);mask:radial-gradient(ellipse 13% 9.4% at 50% 0,transparent 96%,#000 100%);transition:background-color .25s}
.pocket-number{position:absolute;inset:0;display:grid;place-items:center;font:400 19cqw/1 var(--latin);letter-spacing:.06em;color:#e9e7d2e0;font-variant-numeric:lining-nums tabular-nums;transition:color .25s,transform .25s var(--ease)}
.pocket-add{position:absolute;left:0;right:0;bottom:17%;font-size:max(11px,9cqw);line-height:1.2;letter-spacing:.14em;color:var(--mint);opacity:0;transform:translateY(4px);transition:opacity .25s,transform .25s var(--ease)}
.pocket.empty:hover{background-color:var(--slot-hi)}
.pocket.empty:hover .pocket-number,.pocket.empty:focus-visible .pocket-number{color:#fff;transform:translateY(-6%)}
.pocket.empty:hover .pocket-add,.pocket.empty:focus-visible .pocket-add{opacity:1;transform:none}
.pocket.empty:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var(--mint)}
@media (hover:none){.pocket-add{opacity:.62;transform:none}}

/* A collected card: the sleeve stays on the page, the card lifts and flips inside it. */
.gi-slot{position:relative;width:100%;aspect-ratio:65/90;min-width:0;perspective:1000px;isolation:isolate}
.gi-slot::before{content:'';position:absolute;inset:-4px;z-index:-1;border-radius:5px;background:linear-gradient(125deg,#ffffffb3,#ffffff4d 38%,#ffffff26 62%,#ffffff80);box-shadow:inset 0 0 0 1px #ffffffd9,0 1px 2px #3d342233}
.gi-card-container{position:relative;display:block;width:100%;height:100%;border-radius:3px;text-align:left;transform-style:preserve-3d;transform:translateZ(0) rotateX(var(--rx,0deg)) rotateY(var(--ry,0deg));transition:transform .55s var(--ease)}
.gi-slot.is-lit .gi-card-container{transform:translateZ(14px) rotateX(var(--rx,0deg)) rotateY(var(--ry,0deg));transition:transform .12s linear}
.gi-card-container:focus-visible{outline:2px solid var(--mint-deep);outline-offset:6px}
.gi-card{position:absolute;inset:0;transform-style:preserve-3d;transition:transform .85s var(--ease)}
.is-flipped>.gi-card{transform:rotateY(180deg)}
.gi-card-face{position:absolute;inset:0;overflow:hidden;border-radius:3px;-webkit-backface-visibility:hidden;backface-visibility:hidden;box-shadow:0 1px 1px #0000004d,0 8px 16px -8px #0000008c}
.gi-slot.is-lit .gi-card-face{box-shadow:0 2px 2px #00000033,0 22px 30px -14px #00000080}
.gi-card-back{transform:rotateY(180deg)}
.card-edit-button{position:absolute;left:50%;top:calc(100% + 9px);z-index:2;display:inline-flex;align-items:center;gap:6px;height:var(--strip);padding:0 12px;transform:translateX(-50%);border-radius:999px;color:var(--ink-2);font-size:13px;letter-spacing:.14em;white-space:nowrap;transition:background-color .2s,color .2s}
.card-edit-button svg{width:14px;height:14px;flex-shrink:0;pointer-events:none}
.card-edit-button span{pointer-events:none}
.card-edit-button:hover{background:#1d20350f;color:var(--ink)}
.card-edit-button:focus-visible{outline-color:var(--mint-deep);outline-offset:1px}

/* Card face */
[data-color=rose]{--accent:var(--frame-rose);--accent-ink:#8b3a5c}
[data-color=blue]{--accent:var(--frame-blue);--accent-ink:#285489}
[data-color=gold]{--accent:var(--frame-gold);--accent-ink:#7a5d22}
[data-color=green]{--accent:var(--frame-green);--accent-ink:#22604a}
.memory-card{--accent:var(--frame-rose);container-type:inline-size;display:flex;flex-direction:column;width:100%;height:100%;padding:4.6%;background:#151515;color:var(--ink);font-family:var(--serif);text-align:left;box-shadow:inset 0 0 0 1px #ffffff14}
.memory-card[data-color=blue]{--accent:var(--frame-blue)}
.memory-card[data-color=gold]{--accent:var(--frame-gold)}
.memory-card[data-color=green]{--accent:var(--frame-green)}
.card-header{flex-shrink:0;display:grid;grid-template-columns:23% minmax(0,1fr) 25%;height:11.6%;min-height:12px;background:#efedd7;border:1px solid #c8c4a5;line-height:1}
.card-header>span{display:flex;align-items:center;justify-content:center;min-width:0;padding:0 2%;overflow:hidden;white-space:nowrap;border-right:1px solid #262626}
.card-header .no,.card-header .rank{font:700 7.4cqw/1 var(--latin);letter-spacing:.02em;font-variant-numeric:lining-nums tabular-nums}
.card-header .name{font-size:6.6cqw;font-weight:700;letter-spacing:.08em;text-overflow:ellipsis;justify-content:center}
.card-header .rank{border-right:0;font-size:6.8cqw}
.card-photo{position:relative;flex:0 0 44%;margin:4% 0;overflow:hidden;background:#232a3a;border:max(1px,.9cqw) solid #ecead5}
.card-photo img{display:block;width:100%;height:100%;object-fit:cover}
.card-photo-placeholder{position:absolute;inset:0;display:grid;place-items:center;padding:8%;background:linear-gradient(160deg,#2b3270,#1b1f4f);color:#b9bbd7;font-size:max(11px,6.4cqw);letter-spacing:.14em;text-align:center}
.card-photo-placeholder::before{content:'';position:absolute;inset:7%;border:1px dashed #b9bbd759;border-radius:2px}
.card-description-wrap{flex:1;min-height:0;padding:4.2%;background-color:var(--accent);background-image:repeating-linear-gradient(-52deg,#ffffff47 0 .9cqw,#ffffff00 .9cqw 1.5cqw,#00000026 1.5cqw 2.1cqw,#00000000 2.1cqw 2.6cqw);box-shadow:inset 0 0 0 1px #00000040}
.card-description{height:100%;display:flex;flex-direction:column;padding:5% 6% 4%;overflow:hidden;background:#f7f4e8;border:max(1px,.9cqw) solid #1c1c1c}
.card-note-text{flex:1;min-height:0;margin:0;overflow:hidden;font:400 7.4cqw/1.5 var(--hand);color:#272836;white-space:pre-wrap;overflow-wrap:anywhere}
.pocket .card-note-text{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical}
.card-date{margin-top:2%;font:400 5.6cqw/1 var(--latin);letter-spacing:.04em;color:#6c6d7c;text-align:right;font-variant-numeric:lining-nums tabular-nums}

/* Rank is material, and the photo always comes first: the picture keeps its own colours.
   Only a narrow band of light crosses it; the rank shows in the window's edge and the frame.
   SS holographic edge with glitter in the black frame, S gold edge, A silver edge, B and C plain. */
.holographic-glare{position:absolute;inset:0;z-index:2;pointer-events:none;border-radius:inherit;background:linear-gradient(118deg,transparent 40%,#ffffff1f 48%,#ffffff3d 50%,#ffffff1f 52%,transparent 60%);background-size:260% 260%;background-position:var(--mx,24%) var(--my,22%);mix-blend-mode:soft-light;opacity:.6;transition:opacity .3s}
.gi-slot.is-lit .holographic-glare{opacity:.9}
.card-photo::after{content:'';position:absolute;inset:0;z-index:1;pointer-events:none}
.gi-card[data-rarity=A] .card-photo{border-color:#d9dee7}
.gi-card[data-rarity=A] .card-photo::after{background:linear-gradient(118deg,transparent 42%,#eef2f8 48%,#fff 50%,#e3e9f2 52%,transparent 58%) var(--mx,24%) var(--my,22%)/300% 300%;mix-blend-mode:soft-light;opacity:.4}
.gi-card[data-rarity=S] .card-photo{border-color:#e6c97e}
.gi-card[data-rarity=S] .card-photo::after{background:linear-gradient(118deg,transparent 40%,#f3c867 47%,#fff1c9 50%,#d89c3a 53%,transparent 60%) var(--mx,24%) var(--my,22%)/300% 300%;mix-blend-mode:soft-light;opacity:.55}
.gi-card[data-rarity=SS] .memory-card{background-color:#151515;background-image:url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='64'%20height='64'%3E%3Cg%20fill='%23fff'%3E%3Ccircle%20cx='20.7'%20cy='9.7'%20r='0.45'%20fill-opacity='0.30'/%3E%3Ccircle%20cx='52.6'%20cy='6.0'%20r='1.15'%20fill-opacity='0.30'/%3E%3Ccircle%20cx='58.2'%20cy='13.7'%20r='0.45'%20fill-opacity='0.60'/%3E%3Ccircle%20cx='26.8'%20cy='15.4'%20r='1.15'%20fill-opacity='0.60'/%3E%3Ccircle%20cx='3.8'%20cy='36.2'%20r='0.55'%20fill-opacity='0.30'/%3E%3Ccircle%20cx='36.9'%20cy='25.4'%20r='0.55'%20fill-opacity='0.30'/%3E%3Ccircle%20cx='35.6'%20cy='8.5'%20r='0.9'%20fill-opacity='0.42'/%3E%3Ccircle%20cx='34.6'%20cy='36.5'%20r='1.15'%20fill-opacity='0.42'/%3E%3Ccircle%20cx='6.6'%20cy='36.6'%20r='0.55'%20fill-opacity='0.54'/%3E%3Ccircle%20cx='6.2'%20cy='45.6'%20r='1.15'%20fill-opacity='0.30'/%3E%3Ccircle%20cx='39.6'%20cy='31.8'%20r='1.15'%20fill-opacity='0.60'/%3E%3Ccircle%20cx='49.7'%20cy='29.8'%20r='0.9'%20fill-opacity='0.54'/%3E%3Ccircle%20cx='19.2'%20cy='50.8'%20r='0.55'%20fill-opacity='0.30'/%3E%3Ccircle%20cx='36.8'%20cy='33.6'%20r='0.7'%20fill-opacity='0.60'/%3E%3Ccircle%20cx='18.4'%20cy='62.7'%20r='0.45'%20fill-opacity='0.60'/%3E%3Ccircle%20cx='10.6'%20cy='21.9'%20r='0.9'%20fill-opacity='0.60'/%3E%3Ccircle%20cx='2.5'%20cy='42.8'%20r='1.15'%20fill-opacity='0.54'/%3E%3Ccircle%20cx='21.8'%20cy='22.4'%20r='0.9'%20fill-opacity='0.60'/%3E%3Ccircle%20cx='4.4'%20cy='6.0'%20r='0.7'%20fill-opacity='0.60'/%3E%3Ccircle%20cx='44.6'%20cy='4.2'%20r='0.7'%20fill-opacity='0.60'/%3E%3Ccircle%20cx='18.2'%20cy='24.7'%20r='0.7'%20fill-opacity='0.30'/%3E%3Ccircle%20cx='60.2'%20cy='22.7'%20r='1.15'%20fill-opacity='0.30'/%3E%3Ccircle%20cx='31.6'%20cy='14.0'%20r='0.7'%20fill-opacity='0.42'/%3E%3Ccircle%20cx='47.3'%20cy='25.5'%20r='0.9'%20fill-opacity='0.30'/%3E%3Ccircle%20cx='10.6'%20cy='25.7'%20r='0.7'%20fill-opacity='0.42'/%3E%3Ccircle%20cx='52.4'%20cy='55.3'%20r='0.7'%20fill-opacity='0.60'/%3E%3C/g%3E%3C/svg%3E"),linear-gradient(135deg,#ff9fcf1f,#ffe39a14 30%,#9ff3cf1a 55%,#9fd6ff1f 80%,#c9a8ff1f);background-size:46px 46px,100% 100%}
.gi-card[data-rarity=SS] .card-photo{border-image:linear-gradient(135deg,#ff9fcf,#ffe39a 25%,#9ff3cf 50%,#9fd6ff 75%,#c9a8ff) 1}
.gi-card[data-rarity=SS] .card-photo::after{background:linear-gradient(118deg,transparent 38%,#ff8fc8 44%,#ffe48f 47%,#8ff5c8 50%,#8fd8ff 53%,#c49bff 56%,transparent 62%) var(--mx,24%) var(--my,22%)/300% 300%;mix-blend-mode:soft-light;opacity:.42}

/* When a card is flipped, its front's light and foil switch off so nothing shows through the back. */
.holographic-glare,.card-photo::after{transition:opacity .3s,visibility 0s .15s}
.gi-card-container.is-flipped .gi-card-front .holographic-glare,.gi-card-container.is-flipped .gi-card-front .card-photo::after{visibility:hidden;transition:opacity .3s,visibility 0s 0s}

/* Card back */
.gi-card-back{padding:7.5%;background-color:#f5f1e4;background-image:var(--paper-grain);background-size:160px;background-blend-mode:multiply;color:var(--ink)}
.gi-card-back::before{content:'';position:absolute;inset:3.6%;border:1px solid var(--accent,#b4567c);border-radius:1px;opacity:.7;pointer-events:none}
.card-back-content{position:relative;container-type:inline-size;display:flex;flex-direction:column;width:100%;height:100%;font-family:var(--serif);text-align:left}
.back-index{display:flex;justify-content:space-between;gap:4px;padding-bottom:5%;border-bottom:1px solid #1d203526;font:700 6cqw/1 var(--latin);letter-spacing:.06em;color:var(--accent-ink,#8b3a5c);white-space:nowrap}
.card-back-content h3{margin:7% 0 6%;font-size:8.6cqw;font-weight:700;line-height:1.35;letter-spacing:.1em;text-align:center;overflow-wrap:anywhere}
.back-abilities{flex:1;min-height:0;overflow:hidden}
.back-abilities>div+div{margin-top:7%}
.back-ability-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}
.back-abilities strong{display:block;margin-bottom:2.5%;font-size:5.6cqw;font-weight:700;letter-spacing:.14em;color:var(--accent-ink,#8b3a5c)}
.back-abilities p{margin:0;font-size:6.4cqw;line-height:1.65;color:#373a4f;white-space:pre-wrap;overflow-wrap:anywhere}
.back-abilities .handwritten{font-family:var(--hand);font-size:7.2cqw;line-height:1.55;color:#272836}
.back-abilities .unfilled-ability{color:var(--ink-3)}
.gi-slot .back-abilities p{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.back-limit{flex-shrink:0;display:flex;align-items:baseline;justify-content:center;flex-wrap:wrap;gap:0 .6em;margin-top:5%;padding-top:4%;border-top:1px solid #1d203526;line-height:1.4;text-align:center}
.back-limit span{font-size:4.6cqw;letter-spacing:.14em;color:var(--ink-3)}
.back-limit b{font:700 5cqw/1.4 var(--latin);letter-spacing:.1em;color:var(--ink-2)}
.back-limit small{flex-basis:100%;font:400 4.6cqw/1.4 var(--latin);letter-spacing:.06em;color:var(--ink-3)}
.back-edit-link{flex-shrink:0;min-height:34px;padding:4px 12px;border:1px solid #1d20353d;border-radius:999px;font-size:13px;letter-spacing:.12em;color:var(--ink-2)}
.back-edit-link:hover{background:#1d20350d;color:var(--ink)}

/* The back carries the rank over the whole card: SS pearl rainbow, S gold, A silver, B and C plain ivory.
   Plain gradients only (no blend modes), so nothing can show through to the other face. */
.gi-card[data-rarity=SS] .gi-card-back{background-image:var(--paper-grain),linear-gradient(135deg,#ffdcec 0%,#fff1c8 20%,#d8f5e4 42%,#d8eaff 64%,#e8dcff 84%,#ffdcec 100%);background-size:160px,100% 100%}
.gi-card[data-rarity=S] .gi-card-back{background-image:var(--paper-grain),linear-gradient(135deg,#f8e6b8 0%,#fdf4dc 40%,#f6e3b0 70%,#fbefcf 100%);background-size:160px,100% 100%}
.gi-card[data-rarity=A] .gi-card-back{background-image:var(--paper-grain),linear-gradient(135deg,#e6eaf2 0%,#f8f9fc 42%,#e1e6ef 72%,#f2f4f8 100%);background-size:160px,100% 100%}
.gi-card[data-rarity=SS] .gi-card-back::before,.gi-card[data-rarity=S] .gi-card-back::before,.gi-card[data-rarity=A] .gi-card-back::before{border:2px solid transparent;opacity:1}
.gi-card[data-rarity=SS] .gi-card-back::before{border-image:linear-gradient(135deg,#f27db4,#f5c84a 25%,#4fd8a0 50%,#4fb2f0 75%,#9a6ff0) 1}
.gi-card[data-rarity=S] .gi-card-back::before{border-image:linear-gradient(135deg,#a8782a,#f2d27f 35%,#fff0c4 50%,#d09c40 68%,#94681f) 1}
.gi-card[data-rarity=A] .gi-card-back::before{border-image:linear-gradient(135deg,#8c95a6,#e3e8f0 35%,#ffffff 50%,#b9c1cf 68%,#7d8698) 1}
.gi-card[data-rarity] .gi-card-back::after{content:'';position:absolute;inset:0;pointer-events:none;background:linear-gradient(118deg,transparent 40%,#ffffff73 50%,transparent 60%) var(--mx,24%) var(--my,22%)/260% 260% no-repeat;opacity:0;transition:opacity .3s,visibility 0s .15s}
.gi-card[data-rarity=SS] .gi-card-back::after,.gi-card[data-rarity=S] .gi-card-back::after,.gi-card[data-rarity=A] .gi-card-back::after{opacity:.6}
.gi-slot.is-lit .gi-card[data-rarity=SS] .gi-card-back::after,.gi-slot.is-lit .gi-card[data-rarity=S] .gi-card-back::after,.gi-slot.is-lit .gi-card[data-rarity=A] .gi-card-back::after{opacity:1}
.gi-card-container:not(.is-flipped) .gi-card-back::after{visibility:hidden;transition:opacity .3s,visibility 0s 0s}
.gi-card[data-rarity=SS] .back-index,.gi-card[data-rarity=SS] .back-limit{border-color:#1d203533}

/* Origin page: pocket 000 */
.origin-page{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:6px 0 18px;text-align:center}
.origin-page>.pocket,.origin-page>.gi-slot{width:min(70%,210px);flex-shrink:0}
.origin-page>h2{margin:calc(var(--strip) + 30px) 0 12px;font-size:25px;font-weight:700;line-height:1.4;letter-spacing:.24em}
.origin-page>p{font-size:15px;line-height:2;letter-spacing:.12em;color:var(--ink-2)}
.origin-page>.pocket.empty+h2{margin-top:30px}

/* Free pockets: the right page becomes a handheld console with pocket 109 as its cartridge */
.page-right.console-page{background:#a8d5c1;background-image:var(--paper-grain),linear-gradient(160deg,#b7dfcc,#94c6af);background-size:160px,100% 100%;background-blend-mode:multiply,normal;box-shadow:inset 40px 0 34px -34px #1d3a2e80,inset 0 0 0 1px #00000014}
.console-page .page-topline{color:#2c5a48}
.console{flex:1;display:flex;flex-direction:column;align-items:center;gap:26px;padding:6px 0 4px}
.console-screen{width:100%;max-width:420px;aspect-ratio:1.45;display:grid;place-content:center;gap:18px;padding:28px;border-radius:12px;background:#0f3a2a;background-image:repeating-linear-gradient(0deg,#ffffff07 0 1px,transparent 1px 3px);box-shadow:0 0 0 10px #1d2035,0 0 0 11px #00000040,inset 0 0 40px #00000080;text-align:center}
.console-screen p{font-size:20px;line-height:1.9;letter-spacing:.18em;color:var(--mint)}
.console-screen small{font:400 13px/1 var(--latin);letter-spacing:.24em;color:#9fd2ba99}
.console-controls{width:100%;max-width:420px;display:grid;grid-template-columns:1fr minmax(0,var(--console-card,128px)) 1fr;align-items:center;gap:14px;margin-top:10px}
.console-controls>.pocket,.console-controls>.gi-slot{grid-column:2}
.dpad{justify-self:center;display:grid;grid-template-columns:repeat(3,22px);grid-template-rows:repeat(3,22px)}
.dpad span{background:#1d2035;box-shadow:inset 0 2px 0 #ffffff1f}
.dpad span:nth-child(1){grid-area:1/2;border-radius:3px 3px 0 0}
.dpad span:nth-child(2){grid-area:2/1;border-radius:3px 0 0 3px}
.dpad span:nth-child(3){grid-area:2/2}
.dpad span:nth-child(4){grid-area:2/3;border-radius:0 3px 3px 0}
.dpad span:nth-child(5){grid-area:3/2;border-radius:0 0 3px 3px}
.console-buttons{justify-self:center;display:flex;gap:12px}
.console-buttons span{width:30px;height:30px;border-radius:50%;background:var(--rose);box-shadow:inset 0 2px 0 #ffffff40,0 2px 0 #6d2c47}
.console-speaker{width:120px;height:8px;margin-top:auto;border-radius:4px;background:repeating-linear-gradient(90deg,#1d2035b3 0 22px,transparent 22px 32px)}
.console-page .card-edit-button{color:#173a2d}
.console-page .card-edit-button:hover{background:#0f3a2a14}

/* Page controls */
.page-controls{display:flex;align-items:center;justify-content:center;gap:28px;margin:30px auto 0}
.page-arrow{display:inline-flex;align-items:center;gap:10px;min-width:118px;min-height:46px;padding:0 20px;justify-content:center;border:1px solid #b9bbd645;border-radius:999px;color:var(--moon);font-size:14px;letter-spacing:.14em;transition:border-color .2s,background-color .2s}
.page-arrow svg{width:17px;height:17px;flex-shrink:0}
.page-arrow:hover:not(:disabled){border-color:var(--mint);background:#9fd2ba12}
.page-center{display:grid;justify-items:center;gap:8px;min-width:120px}
#page-label{font:400 16px/1 var(--latin);letter-spacing:.18em;color:var(--moon);font-variant-numeric:lining-nums tabular-nums}
.page-dots{display:flex;gap:2px}
.page-dots button{position:relative;width:18px;height:18px}
.page-dots button::after{content:'';position:absolute;left:5px;right:5px;top:8px;height:3px;border-radius:2px;background:#b9bbd64d;transition:background-color .2s,left .2s,right .2s}
.page-dots button:hover::after{background:var(--moon-2)}
.page-dots button.active::after{left:1px;right:1px;background:var(--mint)}
.album-hint{margin:20px auto 0;max-width:40em;font-size:14px;line-height:1.9;letter-spacing:.1em;color:var(--moon-3);text-align:center;text-wrap:balance}
.site-footer{padding:56px 24px 44px;text-align:center}
.site-footer p{font:italic 400 16px/1 var(--latin);letter-spacing:.04em;color:var(--moon-3)}

/* Editor: a writing desk with the card on cloth and the form on paper */
.card-dialog{width:min(1020px,calc(100% - 48px));height:min(860px,calc(100dvh - 48px));max-height:none;padding:0;border:0;border-radius:10px;overflow:hidden;background:var(--paper);color:var(--ink);color-scheme:light;box-shadow:0 0 0 1px #00000038,0 40px 120px -30px #000000d9;overscroll-behavior:contain}
.card-dialog[open]{display:flex;flex-direction:column}
.card-dialog::backdrop,.confirm-dialog::backdrop,.cover-dialog::backdrop{background:#080a20d1;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}
.card-dialog[open],.confirm-dialog[open]{animation:dialog-in .32s var(--ease)}
.editor-topbar{position:sticky;top:0;z-index:6;flex-shrink:0;display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:62px;padding:10px 14px 10px 26px;background:var(--paper);border-bottom:1px solid var(--rule)}
.editing-number{display:flex;align-items:baseline;gap:12px}
.editing-number b{font:700 19px/1 var(--latin);letter-spacing:.08em;font-variant-numeric:lining-nums tabular-nums}
.editing-number span{font-size:14px;letter-spacing:.14em;color:var(--ink-3)}
.dialog-close{width:42px;height:42px;display:grid;place-items:center;border-radius:50%;border:1px solid #1d203529;color:var(--ink);transition:background-color .2s}
.dialog-close svg{width:18px;height:18px}
.dialog-close:hover{background:#1d20350f}
.editor-layout{flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,.88fr) minmax(0,1fr)}
.editor-preview{min-height:0;overflow:auto;display:flex;flex-direction:column;align-items:center;gap:22px;padding:40px 40px 32px;background-color:var(--cloth);background-image:var(--weave);color:var(--moon);overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#ffffff40 transparent}
.large-card{width:min(100%,318px);flex-shrink:0;perspective:1400px}
.preview-card{width:100%;aspect-ratio:65/90;text-align:left;transform-style:preserve-3d}
.preview-card .gi-card-face{box-shadow:0 2px 2px #0000004d,0 24px 40px -18px #000000b3}
.preview-card .card-note-text{font-size:clamp(17px,7cqw,22px);line-height:1.6}
.preview-card .card-header .name{font-size:6.4cqw}
.preview-card .card-date{font-size:13px}
.preview-card .gi-card-back{padding:24px}
.preview-card .gi-card-back::before{inset:10px}
.preview-card .back-index{font-size:13px;padding-bottom:12px}
.preview-card .card-back-content h3{margin:18px 0 22px;font-size:24px}
.preview-card .back-abilities{overflow:visible}
.preview-card .back-abilities>div+div{margin-top:20px}
.preview-card .back-abilities strong{font-size:13px;margin-bottom:6px}
.preview-card .back-abilities p{font-size:16px;line-height:1.8}
.preview-card .back-abilities .handwritten{font-size:20px;line-height:1.65}
.preview-card .back-limit{margin-top:22px;padding-top:12px}
.preview-card .back-limit span,.preview-card .back-limit small{font-size:12px}
.preview-card .back-limit b{font-size:13px}
.preview-card.is-flipped{height:auto;aspect-ratio:auto}
.preview-card.is-flipped>.gi-card{position:relative}
.preview-card.is-flipped .gi-card-back{position:relative;min-height:calc(min(100vw - 64px,318px) * 90 / 65)}
.preview-card .card-back-content{min-height:100%}
.preview-controls{display:grid;justify-items:center;gap:14px}
.preview-flip-button{display:inline-flex;align-items:center;gap:9px;min-height:44px;padding:0 20px;border:1px solid #ffffff4d;border-radius:999px;color:var(--moon);font-size:14px;letter-spacing:.14em;transition:background-color .2s,border-color .2s}
.preview-flip-button::before{content:'';width:15px;height:15px;background:currentColor;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12a8 8 0 0 1 13.7-5.6L20 9'/%3E%3Cpath d='M20 4v5h-5'/%3E%3Cpath d='M20 12a8 8 0 0 1-13.7 5.6L4 15'/%3E%3Cpath d='M4 20v-5h5'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12a8 8 0 0 1 13.7-5.6L20 9'/%3E%3Cpath d='M20 4v5h-5'/%3E%3Cpath d='M20 12a8 8 0 0 1-13.7 5.6L4 15'/%3E%3Cpath d='M4 20v-5h5'/%3E%3C/svg%3E") center/contain no-repeat}
.preview-flip-button:hover{background:#ffffff14;border-color:#ffffff80}
.preview-caption{font-size:13px;letter-spacing:.2em;color:var(--moon-2)}

.editor-form{min-height:0;overflow:auto;padding:30px 40px 0;background-color:var(--paper);overscroll-behavior:contain}
.editor-form h2{margin-bottom:24px;font-size:25px;font-weight:700;line-height:1.4;letter-spacing:.16em}
.editor-form label{display:block;font-size:14px;font-weight:600;line-height:1.5;letter-spacing:.1em;color:var(--ink-2)}
.editor-form input:not([type=file]):not([type=range]),.editor-form textarea,.editor-form select{display:block;width:100%;min-width:0;min-height:48px;margin-top:8px;padding:11px 13px;border:1px solid #cbc3ae;border-radius:4px;background:#fbf9f3;color:var(--ink);font-size:16px;font-weight:400;letter-spacing:.04em;box-shadow:inset 0 1px 2px #3d34220d;transition:border-color .2s,box-shadow .2s,background-color .2s}
.editor-form select{-webkit-appearance:none;appearance:none;padding-right:36px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2345485f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;background-size:18px}
.editor-form input:focus,.editor-form textarea:focus,.editor-form select:focus{outline:none;border-color:var(--mint-deep);background-color:#fff;box-shadow:0 0 0 3px #9fd2ba73}
.editor-form input::placeholder,.editor-form textarea::placeholder{color:#9d9a8d}
.editor-form textarea{resize:vertical;line-height:1.75}
.editor-form #card-note{--sheet:#fbf9f3;min-height:168px;padding:6px 14px;font:400 20px/36px var(--hand);letter-spacing:.04em;background:linear-gradient(transparent 35px,#ddd3bd 35px,#ddd3bd 36px,transparent 36px) 0 0/100% 36px repeat-y local content-box content-box,linear-gradient(var(--sheet),var(--sheet)) padding-box}
.editor-form #card-note:focus{--sheet:#fff}
.form-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(104px,.42fr);gap:16px;margin:20px 0}
.note-label{margin-top:4px}
.character-count{float:right;font:400 13px/1.5 var(--latin);letter-spacing:.04em;color:var(--ink-3);font-variant-numeric:lining-nums tabular-nums}
.editor-form .photo-upload{display:flex;align-items:center;gap:14px;min-height:76px;padding:14px 16px;border:1px dashed #a69d86;border-radius:6px;background:#ebe6d7;color:var(--ink);font-weight:600;cursor:pointer;transition:background-color .2s,border-color .2s}
.editor-form .photo-upload:hover{background:#e4ddcb;border-color:var(--ink-3)}
.photo-upload:has(+input:focus-visible){outline:2px solid var(--mint-deep);outline-offset:3px}
.upload-icon{flex-shrink:0;width:42px;height:42px;display:grid;place-items:center;border-radius:50%;background:var(--paper);color:var(--ink-2);box-shadow:inset 0 0 0 1px #1d203526}
.upload-icon svg{width:20px;height:20px}
#photo-label small{display:block;margin-top:3px;font-size:13px;font-weight:400;letter-spacing:.06em;color:var(--ink-3)}
.photo-options{display:flex;align-items:center;gap:12px;margin-top:12px}
.editor-form .photo-options label{flex-shrink:0;font-size:13px;font-weight:400;color:var(--ink-3)}
.photo-options input{flex:1;min-width:40px;accent-color:var(--mint-deep)}
.photo-options .text-button{flex-shrink:0;font-size:13px;color:var(--ink-2)}
.ability-fields{margin:24px 0 20px;padding:18px 18px 20px;border-radius:6px;background:#e9e3d3;box-shadow:inset 0 0 0 1px #1d20351a}
.ability-heading{display:flex;align-items:baseline;justify-content:space-between;flex-wrap:wrap;gap:4px 12px;margin-bottom:14px}
.ability-heading h3{font-size:16px;font-weight:700;letter-spacing:.16em}
.ability-heading small{font-size:13px;letter-spacing:.06em;color:var(--ink-3)}
.ability-inputs{display:grid;gap:16px}
.editor-form .ability-inputs textarea{min-height:92px}
.author-label{margin-top:20px}
.editor-form .form-message{margin-top:16px;color:#9c3f2a}
.save-footnote{margin:18px 0 0;font-size:13px;line-height:1.7;letter-spacing:.06em;color:var(--ink-3)}
.editor-actions{position:sticky;bottom:0;z-index:4;display:flex;align-items:center;justify-content:space-between;gap:16px;margin:14px -40px 0;padding:14px 40px calc(16px + env(safe-area-inset-bottom));background:var(--paper);border-top:1px solid var(--rule)}
.editor-actions .primary{flex:1;max-width:320px;margin-left:auto;white-space:nowrap}
.text-button.danger{color:var(--danger);font-size:14px}

/* Confirm and cover dialogs, toast */
.confirm-dialog{width:min(440px,calc(100% - 40px));padding:30px 30px 24px;border:0;border-radius:10px;background:var(--paper);color:var(--ink);color-scheme:light;box-shadow:0 0 0 1px #00000038,0 30px 90px -20px #000000cc}
.confirm-dialog h2{font-size:22px;font-weight:700;line-height:1.5;letter-spacing:.1em}
.confirm-dialog p{margin-top:10px;font-size:16px;line-height:1.85;color:var(--ink-2)}
.confirm-dialog>div{display:flex;justify-content:flex-end;gap:12px;margin-top:26px}
.danger-fill{background:var(--danger)}
.danger-fill:hover:not(:disabled){background:#b84f3c}
.cover-dialog{width:min(460px,calc(100% - 40px));padding:96px 20px 24px;border:0;background:transparent;overflow:visible;text-align:center}
.cover-dialog[open]{display:flex;flex-direction:column;align-items:center;gap:96px}
.cover-dialog .cover-display{width:min(68%,270px);margin-left:8%}
.cover-dialog .dialog-close{position:absolute;top:0;right:0;border-color:#ffffff40;color:var(--moon)}
.cover-dialog .dialog-close:hover{background:#ffffff14}
.toast{position:fixed;left:50%;bottom:calc(28px + env(safe-area-inset-bottom));z-index:100;width:max-content;max-width:calc(100% - 32px);padding:13px 22px;transform:translateX(-50%);border-radius:6px;background:var(--paper);color:var(--ink);font-size:15px;letter-spacing:.08em;box-shadow:0 0 0 1px #00000026,0 14px 40px -12px #000000b3;animation:toast-in .3s var(--ease)}
@keyframes dialog-in{from{opacity:0;transform:translateY(16px) scale(.985)}to{opacity:1;transform:none}}
@keyframes toast-in{from{opacity:0;transform:translate(-50%,10px)}to{opacity:1;transform:translateX(-50%)}}

/* Tablet: one page at a time, three pockets across */
@media (max-width:960px){
  .entry{grid-template-columns:minmax(0,1fr) auto;grid-template-areas:'cover title' 'copy copy';row-gap:28px;padding:24px 40px 48px;max-width:640px;min-height:0}
  .cover-stage{grid-area:cover;padding:96px 0 64px 30px}
  .entry-mark{grid-area:title}
  .entry-copy{grid-area:copy;max-width:none}
  #album-screen{max-width:760px;padding-inline:32px}
  .book{display:flex;flex-direction:column;padding:12px}
  .book-spine{display:none}
  .page{padding-inline:var(--page-pad)}
  .page::before{display:none}
  .page-left{border-radius:3px 3px 0 0;box-shadow:inset 0 -26px 30px -30px #3d342266,inset 0 0 0 1px #00000010}
  .page-right{border-radius:0 0 3px 3px;border-top:1px dashed #b6ad95;box-shadow:inset 0 26px 30px -30px #3d342266,inset 0 0 0 1px #00000010}
  .page-right.console-page{border-top-color:#6f9e8a}
  .page-right .page-topline{justify-content:flex-start}
  .card-grid{max-width:560px}
  .origin-page{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:auto auto;align-content:center;column-gap:clamp(20px,5vw,44px);padding:6px 0 calc(var(--strip) + 14px);text-align:left}
  .origin-page>.pocket,.origin-page>.gi-slot{grid-row:1/3;width:min(100%,200px);justify-self:end}
  .origin-page>h2{align-self:end;margin:0 0 10px}
  .origin-page>.pocket.empty+h2{margin:0 0 10px}
  .origin-page>p{align-self:start}
  .page-controls{position:sticky;bottom:calc(12px + env(safe-area-inset-bottom));z-index:8;width:fit-content;margin-top:24px;padding:8px;gap:18px;border-radius:999px;background:#161a3ef2;box-shadow:0 0 0 1px #b9bbd62e,0 16px 30px -12px #000000b3}
  .page-arrow{min-width:0;min-height:44px;border-color:transparent}
  .card-dialog{width:calc(100% - 32px)}
  .editor-preview{padding:32px 26px}
  .editor-form{padding-inline:28px}
  .editor-actions{margin-inline:-28px;padding-inline:28px}
}

/* Phone: two pockets across, a compact desk */
@media (max-width:700px){
  html{scrollbar-gutter:auto}
  .topbar{padding:14px 20px 4px}
  .brand b{font-size:20px}
  .brand span{font-size:15px}
  .quiet-button{min-height:38px;padding:6px 15px;font-size:13px}
  .entry{padding:12px 22px 32px;column-gap:18px;row-gap:22px}
  .cover-stage{justify-items:end}
  .cover-stage::before{width:130%}
  .cover-display{width:min(100%,180px);--thick:24px}
  .cover-stage{padding:64px 0 48px 22px}
  .entry-mark{padding-right:16px;gap:20px}
  .entry-title{font-size:clamp(34px,10vw,42px);letter-spacing:.16em}
  .entry-seal{width:36px;height:36px;font-size:11px}
  .entry-description{margin-bottom:30px;font-size:17px}
  .private-note{margin-top:24px}
  #album-screen{padding:0 14px}
  .album-heading{gap:12px;margin:12px 4px 18px;align-items:center}
  .album-heading h1{font-size:22px;letter-spacing:.1em}
  .collection-meta{gap:10px}
  .collection-map{grid-template-columns:repeat(10,3px);gap:2px;width:52px;height:52px}
  .collection-map i{width:3px;height:3px}
  .collection-map.is-free{grid-template-columns:repeat(5,3px);gap:4px}
  #collected-count{font-size:30px}
  .collection-of{font-size:15px}
  .collection-numbers small{margin-top:6px;font-size:11px;letter-spacing:.06em}
  .album-toolbar{flex-direction:column-reverse;align-items:stretch;gap:12px;padding:0 6px}
  .view-tabs button{flex:1;justify-content:center;gap:8px;padding:12px 10px 11px;font-size:15px;letter-spacing:.08em}
  .view-tabs button span{font-size:12px}
  .sync-tools{justify-content:flex-end;padding:0;gap:8px}
  .sync-status{margin-right:auto;font-size:13px}
  .icon-button{width:38px;height:38px}
  .book{--page-pad:16px;--gap-x:14px;--strip:30px;padding:8px;border-radius:6px}
  .page{padding:18px var(--page-pad) 20px}
  .page-topline{margin-bottom:14px}
  .card-grid{grid-template-columns:repeat(2,minmax(0,1fr));max-width:420px}
  .card-header{min-height:17px}
  .card-header .no,.card-header .rank{font-size:max(9px,7.2cqw)}
  .card-header .name{font-size:max(10px,6.8cqw)}
  .pocket .card-note-text{font-size:max(13px,8.6cqw);-webkit-line-clamp:2}
  .pocket .card-date{font-size:max(10px,6cqw)}
  .gi-slot .back-index{font-size:max(9px,6.4cqw)}
  .gi-slot .card-back-content h3{margin:6% 0 4%;font-size:max(12px,9cqw);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .gi-slot .back-abilities strong{font-size:max(9px,6.4cqw)}
  .gi-slot .back-abilities p{font-size:max(11px,7.6cqw);line-height:1.5;-webkit-line-clamp:2}
  .gi-slot .back-abilities .handwritten{font-size:max(12px,8.4cqw)}
  .gi-slot .back-acquisition p{-webkit-line-clamp:1}
  .gi-slot .back-limit span,.gi-slot .back-limit small{display:none}
  .gi-slot .back-limit b{font-size:max(8px,5.6cqw)}
  .origin-page{grid-template-columns:minmax(0,1.05fr) minmax(0,1fr);column-gap:18px}
  .origin-page>.pocket,.origin-page>.gi-slot{width:100%;max-width:170px}
  .origin-page>h2{font-size:21px;letter-spacing:.18em}
  .origin-page>p{font-size:14px;letter-spacing:.08em}
  .console{gap:20px}
  .console-screen{aspect-ratio:1.3;padding:20px;box-shadow:0 0 0 8px #1d2035,0 0 0 9px #00000040,inset 0 0 30px #00000080}
  .console-screen p{font-size:17px}
  .console-controls{gap:8px}
  .dpad{grid-template-columns:repeat(3,17px);grid-template-rows:repeat(3,17px)}
  .console-buttons{gap:8px}
  .console-buttons span{width:24px;height:24px}
  .console-speaker{width:96px}
  .page-controls{gap:8px;padding:6px}
  .page-arrow{padding:0 14px;gap:6px;font-size:13px}
  .page-center{min-width:96px;gap:6px}
  #page-label{font-size:14px}
  .page-dots button{width:14px}
  .page-dots button::after{left:4px;right:4px}
  .album-hint{margin-top:16px;padding:0 10px;font-size:13px}
  .site-footer{padding:40px 20px 36px}
  .card-dialog{width:calc(100% - 16px);height:calc(100dvh - 16px);border-radius:10px}
  .card-dialog[open]{display:block;overflow:auto}
  .editor-topbar{min-height:58px;padding:8px 10px 8px 20px}
  .editor-layout{display:block}
  .editor-preview,.editor-form{overflow:visible}
  .editor-preview{padding:28px 22px 26px}
  .large-card{width:min(100%,286px)}
  .preview-card.is-flipped .gi-card-back{min-height:calc(min(100vw - 60px,286px) * 90 / 65)}
  .preview-caption{display:none}
  .editor-form{padding:26px 20px 0}
  .editor-form h2{font-size:23px;margin-bottom:20px}
  .form-row{grid-template-columns:minmax(0,1fr) minmax(92px,.5fr);gap:12px;margin:18px 0}
  .ability-fields{padding:16px 14px 18px}
  .editor-actions{margin-inline:-20px;padding-inline:20px;gap:12px}
  .editor-actions .primary{max-width:none}
  .toast{bottom:calc(92px + env(safe-area-inset-bottom))}
}
@media (max-width:380px){
  .topbar{padding-inline:16px}
  .brand span{display:none}
  .entry{padding-inline:16px;column-gap:12px}
  .entry-title{font-size:32px}
  .entry-mark{padding-right:12px}
  #album-screen{padding:0 10px}
  .album-heading h1{font-size:20px;letter-spacing:.06em}
  .collection-map{display:none}
  .view-tabs button span{display:none}
  .book{--page-pad:12px;--gap-x:12px}
  .page-arrow span{display:none}
  .page-arrow{padding:0 12px}
  .editor-form{padding-inline:16px}
  .editor-actions{margin-inline:-16px;padding-inline:16px}
  .text-button.danger{font-size:13px}
  .editor-actions .primary{padding-inline:14px;letter-spacing:.06em}
  .origin-page{column-gap:12px}
  .origin-page>h2{font-size:18px;letter-spacing:.08em}
  .origin-page>p{font-size:13px;letter-spacing:.04em}
}

/* Respect a request for less motion: no tilts, no swings, no sweeping light */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}
  .gi-slot.is-lit .gi-card-container{transform:none}
}
