:root {
  color-scheme: dark;
  --ink: #f7f1e4;
  --quiet: #c5c4c0;
  --line: #55555a;
  --panel: #242428;
  --red: #ff5140;
  --gold: #ffca44;
  --focus: #ffe27c;
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, monospace;
  --stripe: repeating-linear-gradient(120deg, #efb72f 0 6px, #171619 6px 12px);
  --metal: linear-gradient(#404046, #29292e);
  --key-shadow: inset 0 1px #ffffff20, 0 2px #101013;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  color: var(--ink);
}
* {
  box-sizing: border-box;
  /* Prevent double-tap zoom while keeping scrolling and pinch zoom. */
  touch-action: manipulation;
}
[hidden] { display:none !important; }
body {
  margin:0;
  min-height:100vh;
  background:
    radial-gradient(#0008 .9px, transparent 1px) 0 0 / 4px 4px,
    linear-gradient(149deg, transparent 0 74%, #871810 74% 75%, transparent 75% 76%, #50130f 76% 85%, transparent 85%) right bottom / 66% 75% no-repeat,
    linear-gradient(150deg, #67130e 0 16%, transparent 16% 17%, #481513 17% 20%, transparent 20%) left top / 76% 76% no-repeat,
    radial-gradient(ellipse at top, #292427, #101013 72%);
  background-color:#101013;
}
button, input, textarea { font:inherit; }
button { color:inherit; cursor:pointer; border-radius:2px; }
button:disabled { opacity:.47; cursor:default; }
:focus-visible { outline:3px solid var(--focus); outline-offset:3px; }
h1,h2,h3,p { margin:0; }

/* The emblem and slanted title form one masthead, even at phone widths. */
.masthead {
  padding:env(safe-area-inset-top) max(24px,env(safe-area-inset-right)) 0 max(24px,env(safe-area-inset-left));
  border-bottom:2px solid #d53125;
  background:linear-gradient(116deg,#a81d14 0 8%,#101013 8% 9%,#c12718 9% 10%,transparent 10% 89%,#491411 89%),#111114;
  box-shadow:0 4px 0 #070708;
}
.masthead-inner {
  max-width:1140px; min-height:111px; margin:auto; position:relative;
  display:flex; justify-content:center; align-items:center; gap:14px;
}
.wordmark { display:flex; align-items:center; gap:12px; color:inherit; text-decoration:none; }
.brand-icon { display:block; width:108px; height:auto; flex:none; filter:drop-shadow(2px 3px #050506); }
.brand-en {
  display:flex; align-items:center; gap:12px;
  font:800 .72rem/1.4 var(--mono); letter-spacing:.2em; margin:0 0 3px 4px;
}
.brand-en span:first-child { background:#c22c20; color:white; padding:1px 9px; }
.brand-en span + span { color:#c5bfc0; }
h1 {
  font-family:"Hiragino Kaku Gothic StdN","Hiragino Sans","Yu Gothic",sans-serif;
  font-size:clamp(2rem,3.5vw,3.3rem); font-weight:900; letter-spacing:-.07em; line-height:1.12;
  transform:skewX(-12deg); -webkit-text-stroke:.025em currentColor;
  text-shadow:2px 2px #09090b, 3px 4px #a42118;
}
h1 em { font-style:normal; color:var(--red); }
.help-button,.tool-button,.dialog-secondary {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  font-weight:700; border:1px solid #68686f; background:var(--metal); min-height:43px; box-shadow:var(--key-shadow);
}
.help-button { position:absolute; right:0; padding:0 16px; min-height:39px; font-size:.9rem; }
.question-icon { display:grid; place-items:center; width:1.12rem; height:1.12rem; border:1.5px solid; border-radius:50%; font:bold .78rem/1 sans-serif; }
.desk {
  width:min(calc(100% - 64px),1140px); display:grid;
  grid-template-columns:minmax(0,1fr) minmax(390px,486px) minmax(0,1fr);
  gap:clamp(24px,3.7vw,55px); margin:clamp(22px,3.8vh,44px) auto 34px; align-items:start;
}
.archive,.instructions { padding-top:12px; }
.side-heading {
  display:flex; align-items:center; gap:9px; padding:8px 0 10px;
  border-bottom:2px solid #d53729; font-size:1.22rem; font-weight:900; letter-spacing:.06em;
  text-shadow:1px 2px #090909;
}
.side-heading small { margin-left:auto; font:700 .7rem var(--mono); letter-spacing:.16em; color:#ff7564; }
.folder-icon,.guide-icon { width:21px; height:17px; transform:skew(-18deg); background:repeating-linear-gradient(90deg,var(--red) 0 4px,transparent 4px 7px); }

/* Archive sleeve, print, and stamp are made with local type and CSS. */
.file-cover {
  text-decoration:none;
  display:block; width:calc(100% - 20px); margin:49px auto 25px; position:relative;
  background:linear-gradient(100deg,#907a54,#c5ac7c 24%,#a38653);
  border:1px solid #debf82; padding:15px 12px 16px;
  transform:rotate(-4deg); box-shadow:3px 7px 0 #080809,0 14px 24px #0007;
}
.file-tab {
  position:absolute; left:-1px; top:-24px; height:24px; min-width:98px;
  background:#baa173; color:#231c18; font-size:.74rem; font-weight:800; letter-spacing:.08em;
  clip-path:polygon(0 0,85% 0,100% 100%,0 100%); padding:4px 22px 0 11px;
}
.cover-paper {
  position:relative; display:block; padding:26px 12px 15px; color:#251f1b;
  background:repeating-linear-gradient(0deg,#795b3010 0 1px,transparent 1px 5px),#e8ddbd;
  transform:rotate(6deg); box-shadow:1px 2px 5px #1f1918aa;
}
.cover-paper::before {
  content:""; position:absolute; left:11px; top:-10px; width:11px; height:37px;
  border:3px solid #666363; border-radius:9px; box-shadow:1px 1px 0 #fff7,2px 2px 2px #24191277;
}
.file-stamp {
  position:absolute; top:-5px; right:7px; z-index:1; transform:rotate(-12deg);
  font:900 1.5rem/1.1 "Hiragino Mincho ProN","Yu Mincho",serif; letter-spacing:.16em;
  padding:2px 3px 2px 7px; color:#b02417; border:3px double; background:#e7d9b9ef;
}
.cover-art {
  position:relative; display:grid; place-items:center; aspect-ratio:1.35; margin:5px 0 13px; overflow:hidden;
  border:3px solid #312c29; background:radial-gradient(#100f0ec4 1px,transparent 1px) 0 0 / 3px 3px, #514942;
}
.cover-face {
  position:relative; display:block; color:#fff4db; font-size:clamp(9px,.93vw,14px);
  line-height:1.16; font-weight:600; white-space:nowrap; filter:grayscale(1);
}
.cover-face > span { display:block; }
.cloudscape { position:absolute; inset:0; }
.cloudscape i { position:absolute; font:normal 1.5rem/1 sans-serif; color:#b8aa91; }
.cloudscape i:nth-child(1) { top:0; left:9%; }
.cloudscape i:nth-child(2) { top:9%; right:8%; font-size:1rem; }
.cloudscape i:nth-child(3) { bottom:4%; left:14%; font-size:1rem; }
.cloudscape i:nth-child(4) { bottom:0; right:3%; }
.cover-paper strong { font:900 clamp(1.25rem,1.8vw,1.55rem)/1.2 "Hiragino Mincho ProN","Yu Mincho",serif; letter-spacing:.12em; }
.archive-quote { font-size:.93rem; line-height:1.9; font-weight:600; }
.text-button,.page-footer button { border:0; background:transparent; padding:4px 0; text-decoration:underline; text-underline-offset:4px; }
.text-button { min-height:36px; color:var(--gold); font-size:.88rem; font-weight:700; }

/* The hardware frame stays outside the interactive 13-column monitor. */
.maker {
  min-width:0; border:1px solid #68676b; border-radius:6px;
  background:linear-gradient(115deg,#343438,#242427 50%,#2b2b30);
  box-shadow:inset 0 2px #85848966,0 0 0 4px #101012,0 0 0 5px #39393c,0 15px 42px #0009;
}
.specimen { margin:0; padding:0 12px; }
.specimen-head,.specimen-foot { display:flex; gap:12px; align-items:center; justify-content:space-between; }
.specimen-head { height:41px; padding:0 5px; }
.specimen-head h2 { display:flex; gap:9px; align-items:center; font-size:.95rem; letter-spacing:.08em; }
.focus-icon,.copy-primary::after {
  display:inline-block; width:9px; height:9px; flex:none; border-radius:50%;
  background:#ff5b43; box-shadow:0 0 0 2px #161417,0 0 10px #fc4639, inset 0 1px #fff9;
}
.dimensions { white-space:nowrap; margin-left:auto; font:600 .8rem var(--mono); letter-spacing:.08em; color:#e1dcd2; }
.specimen-head::after { content:""; width:58px; height:10px; background:var(--stripe); }
.specimen-field {
  display:grid; place-items:center; position:relative; overflow:hidden; padding:19px 18px;
  border:2px solid #080808; border-radius:7px;
  background:
    repeating-linear-gradient(0deg,transparent 0 3px,#0002 3px 4px),
    linear-gradient(#ff797014 1px,transparent 1px) center / 20px 20px,
    linear-gradient(90deg,#ff797014 1px,transparent 1px) center / 20px 20px,
    radial-gradient(ellipse,#572722,#221518 72%);
  box-shadow:inset 0 0 32px #000b,0 1px #757378;
}
.specimen-field::after {
  content:""; position:absolute; inset:0 0 auto; height:18%; pointer-events:none;
  background:linear-gradient(transparent,#ff634830 85%,#ff8973); opacity:0;
}
.corners {
  position:absolute; inset:10px; pointer-events:none;
  background:linear-gradient(var(--red),var(--red)) left top / 12px 2px,
    linear-gradient(var(--red),var(--red)) left top / 2px 12px,
    linear-gradient(var(--red),var(--red)) right top / 12px 2px,
    linear-gradient(var(--red),var(--red)) right top / 2px 12px,
    linear-gradient(var(--red),var(--red)) left bottom / 12px 2px,
    linear-gradient(var(--red),var(--red)) left bottom / 2px 12px,
    linear-gradient(var(--red),var(--red)) right bottom / 12px 2px,
    linear-gradient(var(--red),var(--red)) right bottom / 2px 12px;
  background-repeat:no-repeat;
}
.grid { display:grid; grid-template-columns:repeat(13,minmax(0,1fr)); width:min(100%,351px); container-type:inline-size; }
.cell {
  padding:0; margin:0; border:0; background:transparent; min-width:0;
  display:grid; place-items:center; font:1.34rem/1 var(--emoji); font-size:min(6.8cqi,27px); aspect-ratio:1; box-shadow:inset 0 0 0 .5px #ffca8a70;
}
.cell:focus-visible { background:#805536; }
@media (hover:hover) {
  .cell:hover { background:#805536; }
}
.cell:focus-visible { position:relative; z-index:1; outline-offset:0; }
.specimen-foot { min-height:36px; padding:0 5px; border-bottom:1px solid #555459; }
#selection { font-size:.92rem; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.grid-hint { flex:none; font-size:.75rem; color:var(--quiet); }
.workbench { padding:13px 17px 0; }
.picker-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:7px; }
.picker-head h2 { font-size:1rem; padding-left:9px; border-left:4px solid var(--red); }
.current-brush { display:flex; gap:6px; align-items:center; color:var(--quiet); font-size:.78rem; }
.current-brush b { font:1.22rem/1 var(--emoji); color:var(--ink); }
.categories {
  display:flex; gap:3px; overflow-x:auto; overscroll-behavior-x:contain;
  padding:3px 2px 8px; scrollbar-width:thin;
}
.category {
  flex:1 0 auto; min-height:32px; border:0; border-bottom:2px solid #65656b;
  background:#19191c; padding:3px 6px; font-size:.82rem; color:#d8d7d2; font-weight:650;
}
.category[aria-pressed="true"] { background:#661e1a; border-color:var(--red); color:white; text-decoration:underline; text-underline-offset:3px; }
.palette {
  display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); grid-auto-rows:43px; align-content:start;
  gap:5px; max-height:95px; overflow-y:auto; overscroll-behavior:contain; padding:2px; scrollbar-width:thin;
}
.emoji-choice {
  position:relative; display:grid; place-items:center; min-width:0; padding:0; border:1px solid #55555c;
  background:var(--metal); box-shadow:var(--key-shadow); font:1.45rem/1 var(--emoji);
}
.emoji-choice[aria-pressed="true"] { border:2px solid var(--gold); background:#59461e; }
.emoji-choice[aria-pressed="true"]::before { content:""; position:absolute; top:0; left:0; border:5px solid transparent; border-top-color:var(--gold); border-left-color:var(--gold); }
.category:focus-visible,.emoji-choice:focus-visible { outline-offset:-3px; }
.picker-actions { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:4px; margin-top:5px; }
.direct-button { border:0; background:transparent; padding:4px; min-height:34px; font-size:.86rem; color:var(--gold); font-weight:700; }
.direct-button span { font-size:1.05rem; }
.board-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:5px; }
.tool-button { font-size:.9rem; padding:5px; }
.copy-bar { padding:12px 17px 17px; }
.primary {
  position:relative; display:flex; align-items:center; justify-content:center; gap:11px; width:100%; min-height:49px; padding:9px 12px;
  border:1px solid #ff6958; background:linear-gradient(175deg,#da3222,#ac1e15); color:white;
  font-size:1.02rem; font-weight:850; letter-spacing:.04em;
  box-shadow:inset 0 1px #ffb39877,0 3px #6c100b,0 4px 0 1px #0e0d0f;
  text-shadow:0 1px #660e08;
}
.copy-primary::after { content:""; background:#411714; box-shadow:0 0 0 2px #6f1911,inset 0 1px 2px #000; }
.copy-primary.copied::after { background:#a3ff89; box-shadow:0 0 0 2px #412521,0 0 12px #a3ff89; }
.copy-icon { width:13px; height:15px; border:1.4px solid currentColor; border-radius:2px; position:relative; margin-left:3px; }
.copy-icon::before { content:""; position:absolute; inset:-4px 2px 2px -4px; border-top:1.4px solid; border-left:1.4px solid; border-radius:2px; }
.fill-hint { margin:6px 0 8px; font-size:.78rem; line-height:1.5; color:var(--quiet); }
#fill-all {
  margin-right:auto; min-height:39px; border:1px solid #ffda7e; padding:5px 10px;
  background:var(--gold); color:#151313; font-size:.87rem; font-weight:800; box-shadow:var(--key-shadow);
}
#fill-all:not(:disabled):hover { background:#ffdd82; }
@media (max-width:370px) {
  #fill-all { padding-inline:6px; font-size:.81rem; }
  .picker-actions .direct-button { font-size:.79rem; padding-inline:0; }
}
.steps { list-style:none; counter-reset:step; margin:23px 0 24px; padding:0; }
.steps li { position:relative; counter-increment:step; padding:0 0 23px 45px; }
.steps li:last-child { padding-bottom:0; }
.steps li::before {
  content:counter(step,decimal-leading-zero); position:absolute; top:1px; left:2px;
  width:31px; height:27px; display:grid; place-items:center; transform:skew(-11deg);
  background:#c12a1e; color:white; font:900 1.08rem/1 var(--mono);
}
.steps h3,.privacy-note strong { font-size:1rem; line-height:1.65; }
.steps p,.privacy-note p { color:var(--quiet); font-size:.9rem; line-height:1.8; margin-top:4px; }
.privacy-note { display:flex; gap:12px; border-top:1px solid var(--line); padding-top:18px; }
.lock-icon { margin-top:10px; flex:none; width:15px; height:12px; border:1.5px solid; border-radius:3px; position:relative; }
.lock-icon::before { content:""; position:absolute; left:2px; right:2px; height:7px; top:-8px; border:1.5px solid; border-bottom:0; border-radius:6px 6px 0 0; }
.page-footer { width:min(calc(100% - 64px),1140px); margin:0 auto; padding:14px 0 max(18px,env(safe-area-inset-bottom)); display:flex; justify-content:space-between; align-items:center; border-top:1px solid var(--line); color:var(--quiet); font-size:.8rem; }
.page-footer > span { font-weight:650; }
.page-footer div { display:flex; gap:18px; }
.page-footer button,.page-footer a { min-height:32px; }
.page-footer a,.archive-link { display:inline-flex; align-items:center; }
.page-footer a { color:inherit; text-underline-offset:4px; }
dialog {
  width:min(430px,calc(100% - 28px)); max-height:85vh; max-height:85dvh;
  color:var(--ink); background:var(--panel); border:1px solid #818188; border-top:4px solid var(--red);
  padding:20px; box-shadow:0 12px 40px #000a; overflow:auto; overscroll-behavior:contain;
}
dialog::backdrop { background:#070708c9; }
.dialog-head {
  position:sticky; top:-20px; z-index:1; background:var(--panel);
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  margin:-20px -20px 12px; padding:16px 20px 10px; border-bottom:1px solid var(--line);
}
.dialog-head h2 { font-size:1.2rem; }
.close { min-width:44px; min-height:44px; flex:none; border:1px solid var(--line); background:var(--metal); font-size:1.45rem; }
.close-labeled { padding:0 9px; font-size:.87rem; font-weight:700; }
.close-labeled span { font-size:1.2rem; }
dialog > p { font-size:.93rem; line-height:1.8; color:var(--quiet); }
dialog h3 { margin:17px 0 5px; font-size:1rem; }
dialog label { display:block; font-weight:700; font-size:.9rem; margin:16px 0 6px; }
dialog input,dialog textarea { width:100%; padding:9px 11px; min-height:44px; border:1px solid #8f8e90; border-radius:6px; color:var(--ink); background:#121215; font-size:1rem; }
dialog textarea { resize:vertical; line-height:1.6; }
dialog .primary { margin-top:14px; }
dialog .dialog-secondary { margin-top:11px; width:100%; font-size:.9rem; }
dialog .error { color:#ff9480; font-weight:650; }
dialog .emoji-input { font-size:1.5rem; }
dialog .input-limit { color:var(--quiet); font-size:.78rem; font-weight:400; }
.original-poem { margin:0; padding:14px 10px; color:#221e1c; background:#e8ddbd; border:1px solid #a18658; text-align:left; white-space:pre; overflow:auto; font:400 clamp(.78rem,3.3vw,1rem)/1.4 "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif; }
#notice { position:fixed; top:max(12px,env(safe-area-inset-top)); left:50%; transform:translateX(-50%); z-index:5; width:max-content; max-width:calc(100vw - 24px); pointer-events:none; font-size:.93rem; }
#notice:not(:empty) { background:#171719; color:white; border:1px solid var(--gold); padding:10px 17px; box-shadow:0 2px 10px #0008; }
@media (hover:hover) {
  :is(.help-button,.tool-button,.dialog-secondary,.emoji-choice,.category):not(:disabled):hover { border-color:var(--gold); filter:brightness(1.15); }
  .primary:hover { filter:brightness(1.13); box-shadow:0 3px #770e08,0 0 18px #ec352955; }
  .file-cover:hover .cover-paper { transform:rotate(2deg); }
  .direct-button:hover,.text-button:hover,.page-footer button:hover { color:white; }
}
@media (max-width:979px) {
  .archive,.instructions { display:none; }
  .desk { display:block; width:min(calc(100% - 36px),486px); margin:24px auto; }
  .masthead-inner { max-width:720px; min-height:83px; }
  .page-footer { max-width:720px; }
}
@media (max-width:540px) {
  .masthead { padding-left:max(14px,env(safe-area-inset-left)); padding-right:max(14px,env(safe-area-inset-right)); }
  .masthead-inner { min-height:61px; gap:8px; }
  .wordmark { gap:8px; }
  .brand-en { font-size:.56rem; letter-spacing:.14em; margin-bottom:2px; }
  h1 { font-size:clamp(1.04rem,4.8vw,1.38rem); }
  .help-button { min-height:34px; padding:0 10px; font-size:.8rem; gap:5px; }
  .desk { width:calc(100% - max(20px,env(safe-area-inset-left) + env(safe-area-inset-right) + 12px)); margin:10px auto; }
  .maker { box-shadow:0 0 0 2px #0a0a0b; }
  .specimen-head { height:33px; }
  .specimen-field { padding:15px 12px; }
  .specimen-foot { min-height:30px; }
  .workbench { padding:10px 11px 0; }
  .picker-head { margin-bottom:4px; }
  .categories { gap:3px; }
  .category { padding:2px 6px; min-height:34px; }
  .palette { grid-auto-rows:39px; max-height:87px; gap:4px; }
  .board-actions { margin-top:1px; }
  .copy-bar { padding:9px 11px 12px; }
  .page-footer { width:calc(100% - 32px); padding:0 0 max(6px,env(safe-area-inset-bottom)); border:0; justify-content:center; }
  .page-footer > span { display:none; }
  .page-footer button { min-height:31px; }
}
@media (max-width:540px) and (orientation:portrait) and (min-height:580px) {
  body { min-height:100svh; min-height:100dvh; display:flex; flex-direction:column; }
  .desk { margin-top:clamp(8px,1.6vh,16px); margin-bottom:5px; }
  .specimen-field { padding-block:clamp(10px,2.1vh,23px); }
}
@media (max-width:540px) and (max-height:715px) and (orientation:portrait) {
  .desk { margin-top:6px; margin-bottom:3px; }
  .specimen-field { padding-block:9px; }
  .grid { max-width:300px; }
  .specimen-head { height:31px; }
  .workbench { padding-top:7px; }
  .category { min-height:30px; }
  .palette { grid-auto-rows:35px; max-height:78px; }
  .primary { min-height:44px; }
}
@media (max-width:540px) and (orientation:portrait) and (min-height:750px) {
  .workbench { padding-top:15px; }
  .palette { grid-auto-rows:46px; max-height:100px; }
  .category { min-height:38px; }
  .direct-button { min-height:40px; }
  .tool-button { min-height:46px; }
  .copy-bar { padding-block:12px 15px; }
  .page-footer button { min-height:40px; }
}
@media (max-width:540px) and (orientation:portrait) {
  .copy-bar {
    position:sticky;
    bottom:0;
    background:var(--panel);
    padding-bottom:max(12px,env(safe-area-inset-bottom));
    z-index:2;
  }
}
@media (min-width:541px) and (max-height:650px) {
  .masthead-inner { min-height:66px; }
  .desk { margin-top:15px; }
}
@media (max-width:360px) {
  .wordmark { gap:5px; }
  .help-button { padding:0 7px; }
  .question-icon { display:none; }
  .board-actions { gap:5px; }
  .board-actions .tool-button { gap:3px; font-size:.78rem; }
}
@media (max-width:979px) {
  .masthead-inner { justify-content:space-between; }
  .help-button { position:static; }
  .brand-icon { width:74px; }
  .masthead { background:#161417; }
}
@media (max-width:540px) {
  .brand-icon { width:clamp(42px,13vw,59px); }
  .brand-en span:first-child { padding:1px 5px; }
  .brand-en span + span { display:none; }
  .specimen { padding-inline:6px; }
  .specimen-head,.specimen-foot { padding-inline:6px; }
  .specimen-head::after { width:34px; }
  .specimen-field { padding-inline:6px; }
  .corners { inset:4px; }
  .category { padding-inline:5px; }
  .copy-bar { box-shadow:0 -4px 10px #15151833; }
}

@media (max-width:540px) and (max-height:680px) {
  .copy-bar { position:static; }
}
@media (min-width:541px) and (max-height:820px) {
  .masthead-inner { min-height:78px; }
  .brand-icon { width:76px; }
  h1 { font-size:2rem; }
  .desk { margin-top:17px; margin-bottom:20px; }
  .specimen-field { padding-block:10px; }
  .workbench { padding-top:8px; }
  .copy-bar { padding-block:9px 12px; }
}
/* Short, action-triggered effects keep the grid readable between operations. */
@keyframes sweep {
  0% { transform:translateY(-100%); opacity:0; }
  16%,75% { opacity:1; }
  100% { transform:translateY(575%); opacity:0; }
}
@keyframes ignition {
  0% { filter:brightness(.75); }
  35% { filter:brightness(1.45) drop-shadow(0 0 4px #ff7c63); }
  100% { filter:none; }
}
@keyframes reveal-controls {
  from { opacity:0; transform:translateY(-5px); }
  to { opacity:1; transform:none; }
}
@media (prefers-reduced-motion:no-preference) {
  .cover-paper,button { transition:transform 130ms ease,box-shadow 140ms ease,filter 140ms ease,border-color 140ms ease; }
  button:not(:disabled,.cell,.file-cover):active { transform:translateY(2px); filter:brightness(1.16); box-shadow:inset 0 2px 4px #0007; }
  .specimen.scanning .specimen-field::after { animation:sweep 540ms ease-out; }
  .specimen.scanning .grid { animation:ignition 380ms ease-out; }
  dialog[open] { animation:reveal-controls 170ms ease-out; }
  .primary.copied::after { animation:ignition 350ms ease-out; }
}

/* Naming and clipboard controls */
.name-button {
  min-width:0; min-height:36px; display:inline-flex; align-items:center; gap:7px;
  background:transparent; border:0; padding:4px; color:var(--gold); text-align:left;
}
.name-button strong { text-decoration:underline; text-underline-offset:3px; }
.name-button span,.undo-icon { flex:none; font-size:1.16em; }
.name-examples { display:flex; flex-wrap:wrap; gap:6px; padding-top:8px; }
.name-examples button { min-height:34px; padding:4px 8px; border:1px solid var(--line); background:var(--metal); font-size:.82rem; }
dialog .field-hint { margin-top:5px; font-size:.8rem; }
#manual-text {
  white-space:pre; overflow:auto; overflow-wrap:normal; word-break:normal;
  resize:none; padding:7px 6px; font:400 max(16px,1rem)/1.5 var(--emoji);
}
#manual-dialog { width:min(460px,calc(100% - 20px)); padding-inline:12px; }
#manual-dialog .dialog-head { margin-inline:-12px; padding-inline:12px; }
.clipboard-source {
  position:fixed; top:0; left:0; width:2px; height:2px; min-height:0; opacity:0;
  padding:0; border:0; pointer-events:none;
}

/* Monster files */
.zukan { width:min(940px,calc(100% - 28px)); margin:22px auto 30px; }
.zukan a,.dialog-link { color:var(--gold); text-underline-offset:3px; }
.zukan-nav { margin-bottom:6px; }
.zukan-nav a,.zukan-back,.zukan-turn a { display:inline-flex; align-items:center; min-height:44px; }
.zukan-search {
  display:grid; gap:6px; margin-top:14px; padding:12px 14px;
  border:1px solid #684d4b; border-left:3px solid var(--red); background:#262124;
}
.zukan-search label { font-weight:800; }
.zukan-search input {
  width:min(100%,420px); min-height:44px; padding:7px 10px;
  border:1px solid #8f8e90; border-radius:4px; background:#151416; color:var(--ink); font-size:1rem;
}
.zukan-search p,.zukan-results { color:var(--quiet); font-size:.86rem; line-height:1.5; }
.zukan-results { margin-top:10px; }
.zukan-list {
  display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,220px),1fr));
  gap:14px; padding:0; margin:8px 0 0; list-style:none;
}
.zukan-list a {
  display:grid; height:100%; padding:10px 12px 12px; gap:6px;
  border:1px solid #80634a; border-left:4px solid #d54334; background:#262124;
  color:var(--ink); text-decoration:none; box-shadow:3px 3px #080809;
}
.zukan-list a:is(:hover,:focus-visible) { border-color:var(--gold); }
.zukan-list a:is(:hover,:focus-visible) strong { text-decoration:underline; }
.zukan-list strong { font-size:1.1rem; overflow-wrap:anywhere; }
.zukan-card-number,.zukan-number {
  color:#ffda82; font:700 .82rem/1.35 var(--mono); letter-spacing:.07em;
}
.zukan-thumb {
  margin:0; padding:8px; display:grid; place-content:center; min-height:90px;
  white-space:pre; overflow:hidden; font:400 .76rem/1.05 var(--emoji);
  background:repeating-linear-gradient(0deg,#f4765520 0 1px,transparent 1px 6px),#341d21;
}
.zukan-file {
  margin-top:12px; padding:0 clamp(11px,2.7vw,25px) clamp(11px,2.7vw,25px);
  border:1px solid #684d4b; background:#191719; box-shadow:0 10px 28px #070707a0;
}
.zukan-case {
  display:grid; grid-template-areas:"visual name" "visual notes";
  grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);
  grid-template-rows:auto 1fr; gap:12px 18px;
}
.zukan-identity {
  grid-area:name; padding:clamp(12px,2.4vw,23px);
  border-top:3px solid var(--red); background:linear-gradient(136deg,#452624,#272125 61%);
}
.zukan-number b {
  display:inline-block; margin-left:5px;
  font-size:clamp(1.45rem,4.5vw,2.15rem); color:var(--gold); letter-spacing:.01em;
}
.zukan-identity h3 {
  margin:4px 0 0; font-size:clamp(1.6rem,5vw,2.7rem); line-height:1.24;
  font-weight:900; letter-spacing:.045em; overflow-wrap:anywhere; text-shadow:2px 3px #221315;
}
.zukan-figure {
  grid-area:visual; display:flex; flex-direction:column; min-width:0; margin:0; padding:8px;
  border:1px solid #8a4943; background:#292025;
}
.zukan-caption {
  display:flex; align-items:center; justify-content:space-between; min-height:28px;
  padding:0 5px 6px; color:var(--quiet); font-size:.85rem; font-weight:750;
}
.zukan-indicator {
  width:54px; height:8px; border-radius:1px;
  background:repeating-linear-gradient(90deg,var(--gold) 0 5px,transparent 5px 9px);
}
.zukan-visual {
  position:relative; display:grid; place-items:center; flex:1; min-width:0;
  min-height:clamp(164px,32vw,280px); padding:14px 8px; overflow:hidden;
  border:1px solid #7a3c39;
  background:
    linear-gradient(#ee71662b 1px,transparent 1px) center / 18px 18px,
    linear-gradient(90deg,#ee71662b 1px,transparent 1px) center / 18px 18px,
    radial-gradient(ellipse at center,#5a2c34,#20151a 78%);
  box-shadow:inset 0 0 40px #0b050ac9;
}
.zukan-art {
  position:relative; max-width:100%; overflow:auto; margin:0; padding:4px;
  color:#ffe3d0; white-space:pre; font:400 clamp(.9rem,4.9vw,1.65rem)/1.16 var(--emoji);
}
.zukan-visual::after {
  content:""; position:absolute; inset:0 0 auto; height:26%; pointer-events:none; opacity:0;
  background:linear-gradient(0deg,#ffbc82 0 2px,#f55742b3 3px,transparent 92%);
}
.zukan-notes { grid-area:notes; align-self:start; display:grid; gap:10px; min-width:0; }
.zukan-speech,.zukan-description {
  min-width:0; padding:12px clamp(12px,2.4vw,23px) 15px;
  box-shadow:inset 3px 0 #b33c2c;
}
.zukan-speech { background:#352426; color:var(--ink); }
.zukan-description { background:#e8ddbd; color:#26201d; }
.zukan-notes h4 { margin:0 0 6px; font-size:.8rem; letter-spacing:.13em; }
.zukan-speech h4 { color:var(--gold); }
.zukan-description h4 { color:#71372e; }
.zukan-notes blockquote,.zukan-notes p {
  margin:0; white-space:pre-wrap; overflow-wrap:anywhere;
  font-size:clamp(.95rem,2.2vw,1.12rem); line-height:1.7; font-weight:600;
}
.zukan-speech blockquote { font-weight:800; }
.zukan-copy { width:min(100%,330px); margin-top:14px; }
.zukan-source { margin-top:14px; border-top:1px solid var(--line); }
.zukan-source summary {
  padding:11px 0; cursor:pointer; color:var(--gold); font-weight:700; font-size:.9rem;
}
.zukan-turn { display:flex; justify-content:space-between; flex-wrap:wrap; column-gap:14px; }
.zukan-turn a:last-child { margin-left:auto; }
@media (max-width:660px) {
  .zukan-case {
    grid-template-areas:"name" "visual" "notes";
    grid-template-columns:minmax(0,1fr); grid-template-rows:auto auto auto;
    gap:10px;
  }
}
@media (prefers-reduced-motion:no-preference) {
  .zukan-file.scanning .zukan-visual::after { animation:zukan-scan 850ms ease-in-out both; }
  .zukan-file.scanning .zukan-indicator { animation:zukan-read 850ms ease-out both; }
}
@keyframes zukan-scan {
  0% { top:-26%; opacity:0; }
  17%,76% { opacity:.83; }
  100% { top:100%; opacity:0; }
}
@keyframes zukan-read {
  0% { clip-path:inset(0 100% 0 0); }
  100% { clip-path:inset(0 0 0 0); }
}
