*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid #c46a3a; outline-offset: 3px; border-radius: 3px; }

:root {
  --felt: #2a1f18;
  --felt-dark: #17100b;
  --paper: #f1e6cc;
  --paper-shadow: #c8b893;
  --ink: #1a1612;
  --ink-soft: #3a322c;
  --ink-faint: #6a5f52;
  --manila: #d9b876;
  --manila-dark: #b08f52;
  --manila-deep: #7d5f30;
  --manila-shadow: #5c4520;
  --stamp-red: #9b2b1e;
  --stamp-red-ink: #7a1f15;
  --chrome: #c9ccd1;

  --font-body: "Special Elite", "Courier Prime", "Courier New", monospace;
  --font-head: "Oswald", "Impact", sans-serif;
  --font-hand: "Caveat", cursive;
  --font-mono: "IBM Plex Mono", "Menlo", monospace;
  --stage-scale: 1;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--felt-dark);
  overflow: hidden;
  min-height: 100vh;
}

.desk {
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 48%, #3a2b20 0%, #2a1f18 55%, #140c08 100%);
  overflow: hidden;
  /* Parent perspective so .stage rotations foreshorten — otherwise rotations
     just squish flat instead of having the top recede. */
  perspective: 1800px;
  perspective-origin: 50% 60%;
}
.desk-grain {
  position: absolute; inset: -4%;
  opacity: 0.25; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='7'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
.desk-vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 80% 60% at 50% 55%, transparent 50%, rgba(0,0,0,0.55) 100%);
}

.coffee-ring {
  position: absolute; bottom: 60px; left: 70px;
  width: 120px; height: 120px; border-radius: 50%;
  border: 3px solid rgba(80, 40, 10, 0.18);
  box-shadow:
    inset 0 0 0 1px rgba(60, 25, 5, 0.1),
    inset 0 0 20px rgba(50, 20, 5, 0.08);
  opacity: 0.5; pointer-events: none;
  transform: rotate(-12deg) scaleX(1.1);
}
.coffee-ring::after {
  content: ""; position: absolute; inset: 4px; border-radius: 50%;
  border: 1px solid rgba(80, 40, 10, 0.12);
}

.stage {
  --cam-tx: 0px;
  --cam-ty: 0px;
  --cam-rx: 0deg;
  --cam-rz: 0deg;
  --cam-scale: 1;
  position: absolute;
  top: 50%; left: calc(50% - 170px);
  transform:
    translate(-50%, -50%)
    translate3d(var(--cam-tx), var(--cam-ty), 0)
    rotateZ(var(--cam-rz))
    rotateX(var(--cam-rx))
    scale(calc(var(--stage-scale) * var(--cam-scale)));
  transform-origin: center center;
  transition: transform 1.4s cubic-bezier(.55,.1,.25,1);
  width: 720px; height: 900px;
  perspective: 2400px;
  perspective-origin: 50% 40%;
  z-index: 2;
}
/* Landing view: the folder rests off to the right like it's on a desk, with
   its top edge receding away from the viewer. */
.desk.is-landing .stage {
  --cam-tx: 30vw;
  --cam-ty: -4vh;
  --cam-rx: 34deg;
  --cam-scale: 0.95;
}
@media (max-width: 1100px) {
  .desk.is-landing .stage {
    --cam-tx: 24vw;
    --cam-ty: -4vh;
    --cam-rx: 30deg;
    --cam-scale: 0.82;
  }
}
@media (max-width: 820px) {
  .desk.is-landing .stage {
    --cam-tx: 0px;
    --cam-ty: 14vh;
    --cam-rx: 28deg;
    --cam-scale: 0.7;
  }
}
.stage::before {
  content: "";
  position: absolute; bottom: -18px; left: 50%;
  transform: translateX(-50%);
  width: 78%; height: 70px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.55), transparent 70%);
  filter: blur(10px); pointer-events: none;
}

.folder {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(.2,.8,.3,1);
}
.folder[data-state="open"] { transform: translate(40px, -10px); }

.folder__back, .folder__front {
  position: absolute; inset: 0;
  border-radius: 4px 14px 4px 4px;
  transform-style: preserve-3d;
  background: linear-gradient(178deg, var(--manila) 0%, var(--manila-dark) 100%);
  box-shadow:
    inset 0 0 60px rgba(90, 60, 20, 0.25),
    inset 0 -2px 0 rgba(255,255,255,0.08);
}
.folder__back::before, .folder__front-outer::before {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit; pointer-events: none;
  mix-blend-mode: multiply; opacity: 0.9;
  background-image:
    repeating-linear-gradient(92deg, rgba(120,85,35,0.05) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(178deg, rgba(60,40,10,0.04) 0 2px, transparent 2px 6px),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='1' seed='3'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.folder__back {
  transform: translateZ(-1px);
  box-shadow:
    0 30px 50px -10px rgba(0,0,0,0.55),
    0 8px 18px rgba(0,0,0,0.35),
    inset 0 0 80px rgba(80, 50, 15, 0.35);
}
.folder__tab {
  position: absolute; top: 6%; right: -70px;
  width: 140px; height: 46px;
  background: linear-gradient(178deg, var(--manila) 0%, var(--manila-dark) 100%);
  border-radius: 0 10px 10px 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.3em; color: var(--manila-shadow); font-weight: 600;
  box-shadow:
    6px 6px 12px rgba(0,0,0,0.35),
    inset 0 0 20px rgba(90, 60, 20, 0.25);
  transform: translateZ(0);
  z-index: 1;
}
.folder__tab::after {
  content: ""; position: absolute; inset: 4px 8px;
  border: 1px dashed rgba(80,55,15,0.35);
  border-radius: 0 6px 6px 0; pointer-events: none;
}
.folder__inner-texture {
  position: absolute; inset: 16px; border-radius: 3px;
  background: linear-gradient(178deg, #c7a368 0%, #a07f46 100%);
  opacity: 0.6; box-shadow: inset 0 0 40px rgba(60, 40, 10, 0.4);
}

.folder__front {
  transform-origin: left center;
  transform: rotateY(0deg);
  transition: transform 1.4s cubic-bezier(.55,.05,.2,1);
  cursor: pointer;
  will-change: transform;
  box-shadow: 0 14px 30px rgba(0,0,0,0.4), 0 4px 10px rgba(0,0,0,0.3);
  z-index: 6;
}
.folder[data-state="open"] .folder__front {
  transform: rotateY(-172deg);
  cursor: default;
  pointer-events: none;
  box-shadow: 0 14px 30px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.1);
}
.folder__front-inner {
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(2deg, #c7a368 0%, #a07f46 100%);
  transform: rotateY(180deg);
  backface-visibility: hidden;
  box-shadow: inset 0 0 60px rgba(60, 40, 10, 0.35);
  pointer-events: none;
}
.folder__front-inner::after {
  content: ""; position: absolute; inset: 18px;
  border: 1px solid rgba(90, 65, 25, 0.25);
  border-radius: 3px; pointer-events: none;
}

.folder__front-outer {
  position: absolute; inset: 0;
  border-radius: inherit;
  backface-visibility: hidden;
  padding: 80px 60px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 28px; overflow: hidden;
  cursor: pointer;
}
.folder[data-state="closed"] .folder__front:hover .folder__front-outer {
  filter: brightness(1.05);
}

.folder__label {
  text-align: center;
  padding: 34px 48px;
  background: linear-gradient(178deg, #f5ecd6 0%, #e6d6a8 100%);
  border: 1px solid rgba(80, 55, 15, 0.3);
  box-shadow:
    0 2px 0 rgba(255,255,255,0.4) inset,
    0 8px 20px rgba(0,0,0,0.25),
    0 2px 6px rgba(0,0,0,0.15);
  transform: rotate(-1.2deg);
  position: relative;
  pointer-events: none;
}
.folder__label::before {
  content: ""; position: absolute; inset: 6px;
  border: 1px solid rgba(80, 55, 15, 0.25);
  pointer-events: none;
}
.folder__label-top {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.32em; color: var(--ink-soft); margin-bottom: 14px;
}
.folder__label-case {
  font-family: var(--font-head); font-weight: 700;
  font-size: 34px; letter-spacing: 0.08em; color: var(--ink);
}
.folder__label-sub {
  margin-top: 12px; font-family: var(--font-body);
  font-size: 13px; letter-spacing: 0.18em; color: var(--ink-faint);
}

.folder__open-hint {
  position: absolute; bottom: 40px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.25em; color: var(--ink-soft);
  opacity: 0; pointer-events: none;
}
/* Only pulse the hint once we've left the landing screen. */
.desk:not(.is-landing) .folder[data-state="closed"] .folder__open-hint {
  animation: pulseHint 2.4s ease-in-out infinite;
}
.folder[data-state="open"] .folder__open-hint { display: none; }
@keyframes pulseHint { 0%,100%{opacity:0.4} 50%{opacity:0.85} }

.page-stack {
  position: absolute;
  top: 18px; left: 40px;
  width: calc(100% - 60px);
  height: calc(100% - 40px);
  transform: translateZ(0.5px);
  pointer-events: none;
}

.page {
  position: absolute; inset: 0;
  background: linear-gradient(178deg, #f6ecd5 0%, #ebddbc 100%);
  border-radius: 1px;
  box-shadow:
    2px 3px 0 rgba(0,0,0,0.08),
    6px 8px 18px rgba(0,0,0,0.22),
    inset 0 0 60px rgba(180, 150, 90, 0.15);
  padding: 56px 64px 64px;
  font-family: var(--font-body); color: var(--ink);
  font-size: 17.5px; line-height: 1.95;
  overflow: hidden;
  display: none;
  transform: rotate(-0.3deg);
}
.folder[data-state="open"] .page.is-current {
  display: block;
  pointer-events: auto;
  animation: pageFadeIn 0.45s ease forwards;
}
@keyframes pageFadeIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

/* On close, keep the page rendered but fade it out — the cover takes ~1.4s
   to rotate shut, so the page has to be invisible well before that. */
.page.is-current.is-closing {
  display: block;
  animation: pageFadeOut 0.5s ease forwards;
  pointer-events: none;
}
@keyframes pageFadeOut {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

.page.is-flip-in-right {
  animation: flipInRight 0.45s cubic-bezier(.2,.8,.3,1) forwards;
}
.page.is-flip-in-left {
  animation: flipInLeft 0.45s cubic-bezier(.2,.8,.3,1) forwards;
}
@keyframes flipInRight {
  0%   { opacity: 0; transform: rotate(-0.3deg) translateX(40px); }
  100% { opacity: 1; transform: rotate(-0.3deg) translateX(0); }
}
@keyframes flipInLeft {
  0%   { opacity: 0; transform: rotate(-0.3deg) translateX(-40px); }
  100% { opacity: 1; transform: rotate(-0.3deg) translateX(0); }
}

.page__grain {
  position: absolute; inset: 0; pointer-events: none;
  opacity: 0.55; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='2' seed='11'/><feColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.28 0 0 0 0 0.18 0 0 0 0.14 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
.page::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 15% 10%, rgba(140, 100, 40, 0.12), transparent 40%),
    radial-gradient(ellipse at 85% 90%, rgba(140, 100, 40, 0.1), transparent 45%);
  mix-blend-mode: multiply;
}

.paperclip {
  position: absolute; top: -14px; left: 68px;
  z-index: 5;
  filter: drop-shadow(2px 3px 3px rgba(0,0,0,0.35));
  transform: rotate(4deg);
}

.page__header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start; gap: 24px;
  padding-bottom: 22px;
  border-bottom: 1.5px solid rgba(26, 22, 18, 0.35);
  margin-bottom: 34px;
}
.page__meta {
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.1em; color: var(--ink-soft);
}
.meta-row { display: flex; gap: 10px; }
.meta-k { opacity: 0.6; min-width: 56px; }
.meta-v { font-weight: 500; border-bottom: 1px dotted rgba(26,22,18,0.35); padding: 0 6px 1px; }

.page__title { text-align: center; }
.page__title-eyebrow {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.35em; color: var(--ink-faint); margin-bottom: 8px;
}
.page__title-main {
  margin: 0; font-family: var(--font-head); font-weight: 700;
  font-size: 44px; letter-spacing: 0.18em; color: var(--ink); line-height: 1;
}
.page__title-rule {
  margin: 10px auto 0; width: 60%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--ink) 20%, var(--ink) 80%, transparent);
  opacity: 0.5;
}

.page__stamp-slot {
  position: absolute;
  top: 110px;
  right: 48px;
  width: 140px;
  min-height: 60px;
  pointer-events: none;
  z-index: 3;
}

.doc-stamp {
  position: absolute; top: 0; right: 0;
  font-family: var(--font-head); font-weight: 700;
  font-size: 22px; letter-spacing: 0.12em;
  color: var(--stamp-red-ink);
  padding: 6px 14px;
  border: 3px solid var(--stamp-red-ink);
  transform: rotate(8deg) scale(0.6);
  opacity: 0; transform-origin: center;
  filter: contrast(1.05);
  text-shadow: 0.5px 0 0 var(--stamp-red-ink);
}
.doc-stamp--in { animation: stampDown 0.42s cubic-bezier(.2,1.6,.3,1) forwards; }
/* Final resting state — used when restoring a page that was already redacted. */
.doc-stamp--static {
  transform: rotate(8deg) scale(1);
  opacity: 0.88;
}
@keyframes stampDown {
  0%   { transform: rotate(8deg) scale(1.8); opacity: 0; }
  50%  { transform: rotate(8deg) scale(0.95); opacity: 1; }
  70%  { transform: rotate(8deg) scale(1.08); opacity: 1; }
  100% { transform: rotate(8deg) scale(1); opacity: 0.88; }
}

.page__body p {
  margin: 0 0 14px;
  text-align: left;
  text-indent: 0;
  hyphens: manual;
}
.page__body {
  min-height: 360px;
  border-radius: 2px;
}
.page__body:focus {
  outline: 1px dashed rgba(26, 22, 18, 0.25);
  outline-offset: 8px;
}
.page__body:empty::before {
  content: "Start typing...";
  color: rgba(26, 22, 18, 0.38);
}

.ent {
  position: relative;
  display: inline;
  cursor: default;
  text-decoration: none !important;
  border: 0;
  background: transparent;
  color: inherit;
  /* box-decoration-break so the redaction background wraps per-line */
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: color 0.2s ease, background-color 0.2s ease;
}

/* Redaction bar is drawn via background-color + box-shadow overshoot so it
   visually expands without triggering layout shift. No fade transition here —
   we don't want a flash on page revisits; transitions during the scan itself
   are handled by .ent--scanning. */
.ent--redacted {
  background-color: #0b0a08;
  color: rgba(26, 22, 18, 0);
  box-shadow:
    0 0 0 2px #0b0a08,
    inset 0 1px 0 rgba(255,255,255,0.04),
    inset 0 -1px 0 rgba(0,0,0,0.8);
  border-radius: 1px;
  cursor: help;
}

.ent--redacted:hover {
  background-color: rgba(11, 10, 8, 0.18);
  color: rgba(26, 22, 18, 0.92);
  box-shadow:
    0 0 0 2px rgba(11, 10, 8, 0.18),
    inset 0 0 0 1px rgba(0,0,0,0.1);
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.ent--scanning {
  background-color: rgba(255, 180, 100, 0.35);
  transition: background 0.15s;
}

.ent--scan-fade {
  transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.page__footer {
  position: absolute; bottom: 48px; left: 64px; right: 64px;
  display: flex; justify-content: flex-end;
}
.page__sig--right {
  width: 220px;
  text-align: right;
}
.page__sig-line { height: 1px; background: var(--ink); opacity: 0.7; margin-bottom: 4px; }
.page__sig-label {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.22em; color: var(--ink-faint);
  margin-top: 2px;
}

.scanner {
  position: absolute; left: 0; right: 0; top: 0;
  height: 8px;
  background:
    linear-gradient(90deg, transparent, rgba(220,40,20,0.85) 15%, rgba(255,230,180,1) 50%, rgba(220,40,20,0.85) 85%, transparent);
  box-shadow:
    0 0 22px rgba(255,120,40,0.85),
    0 0 60px rgba(255,80,20,0.55);
  opacity: 0; pointer-events: none; z-index: 20;
}
.scanner--active { animation: scanSweep 1.8s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes scanSweep {
  0%   { opacity: 0; top: 0; }
  6%   { opacity: 1; }
  94%  { opacity: 1; }
  100% { opacity: 0; top: calc(100% - 8px); }
}

.pg-nav {
  position: absolute;
  top: 50%;
  width: 48px; height: 96px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(241, 230, 204, 0.85);
  background: rgba(15, 10, 6, 0.7);
  border-radius: 6px;
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease 0s, background 0.15s ease, transform 0.2s ease;
  z-index: 50;
  transform: translateY(-50%) translateZ(20px);
}
.pg-nav:hover {
  background: rgba(155, 43, 30, 0.75);
  color: #f1e6cc;
}
.pg-nav--left  { left: 12px;  transform: translateY(-50%) translateZ(20px); }
.pg-nav--right { right: 12px; transform: translateY(-50%) translateZ(20px); }
.pg-nav--left:hover  { transform: translateY(-50%) translateZ(20px) translateX(-2px); }
.pg-nav--right:hover { transform: translateY(-50%) translateZ(20px) translateX(2px); }
.folder[data-state="open"] .pg-nav {
  opacity: 1; pointer-events: auto;
  /* Wait for the cover's 1.4s rotation to finish before revealing. */
  transition-delay: 1.3s, 0s, 0s;
}
.pg-nav__hint {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  color: rgba(241, 230, 204, 0.7);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
.pg-nav--left  .pg-nav__hint { right: calc(100% + 10px); }
.pg-nav--right .pg-nav__hint { left: calc(100% + 10px); }
.folder[data-state="open"] .pg-nav:not(:disabled) .pg-nav__hint {
  opacity: 0.7;
  transition-delay: 1.4s;
}
.pg-nav:hover:not(:disabled) .pg-nav__hint { opacity: 1; transition-delay: 0s; }

.pg-nav:disabled {
  opacity: 0;
  pointer-events: none;
  cursor: not-allowed;
}
.folder[data-state="open"] .pg-nav:disabled {
  opacity: 0.25;
}

.page-counter {
  position: absolute;
  bottom: -42px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: rgba(241, 230, 204, 0.55);
  padding: 4px 14px;
  border: 1px solid rgba(241, 230, 204, 0.15);
  border-radius: 2px;
  background: rgba(15, 10, 6, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease 0.4s;
  z-index: 10;
}
.stage:has(.folder[data-state="open"]) .page-counter {
  opacity: 1;
}

.console {
  position: absolute; top: 50%; right: 34px;
  transform: translateY(-50%);
  width: 300px; z-index: 3; pointer-events: auto;
  max-height: calc(100vh - 40px);
  display: flex;
}
.console__pad {
  background: linear-gradient(178deg, #1f3830 0%, #132520 100%);
  border-radius: 10px;
  padding: 18px 18px 16px;
  box-shadow:
    0 20px 40px rgba(0,0,0,0.55),
    0 4px 10px rgba(0,0,0,0.35),
    inset 0 0 40px rgba(0,0,0,0.35),
    inset 0 2px 0 rgba(255,255,255,0.04);
  color: #c9d4ce;
  font-family: var(--font-mono);
  position: relative;
  width: 100%;
  display: flex; flex-direction: column;
  min-height: 0;
  max-height: 100%;
}
.console__pad::before {
  content: ""; position: absolute; inset: 6px;
  border: 1px solid rgba(200, 220, 210, 0.08);
  border-radius: 6px; pointer-events: none;
}
.console__header {
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px dashed rgba(200, 220, 210, 0.15);
  flex: 0 0 auto;
}
.console__title {
  font-size: 11px; letter-spacing: 0.28em;
  color: #e4dfc8; font-weight: 600;
}

.stamp-btn {
  position: relative; width: 140px; height: 140px;
  margin: 2px auto 6px; display: block;
  transition: transform 0.1s ease;
  flex: 0 0 auto;
}
.stamp-btn__ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #4a2f2a, #2e1914 70%);
  box-shadow:
    0 8px 0 #140807,
    0 10px 18px rgba(0,0,0,0.6),
    inset 0 -4px 8px rgba(0,0,0,0.5),
    inset 0 3px 0 rgba(255,255,255,0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stamp-btn__face {
  position: absolute; inset: 18px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #c13a2a 0%, #9b2b1e 60%, #7a1f15 100%);
  box-shadow:
    inset 0 0 20px rgba(80, 15, 10, 0.6),
    inset 0 2px 0 rgba(255, 150, 130, 0.25);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #f5e8d6;
  text-shadow: 0 1px 0 rgba(80, 10, 5, 0.5);
  transition: transform 0.15s ease;
}
.stamp-btn__top, .stamp-btn__bot {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.28em; opacity: 0.85;
}
.stamp-btn__big {
  font-family: var(--font-head); font-weight: 700;
  font-size: 22px; letter-spacing: 0.1em; margin: 3px 0 3px;
}
.stamp-btn__shadow {
  position: absolute; bottom: -16px; left: 50%;
  transform: translateX(-50%);
  width: 70%; height: 10px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.5), transparent 70%);
  filter: blur(4px);
}
.stamp-btn:hover:not(:disabled) .stamp-btn__ring {
  transform: translateY(-1px);
  box-shadow:
    0 9px 0 #140807,
    0 12px 20px rgba(0,0,0,0.65),
    inset 0 -4px 8px rgba(0,0,0,0.5),
    inset 0 3px 0 rgba(255,255,255,0.08);
}
.stamp-btn:active:not(:disabled) .stamp-btn__ring,
.stamp-btn--pressing .stamp-btn__ring {
  transform: translateY(6px);
  box-shadow:
    0 2px 0 #140807,
    0 3px 8px rgba(0,0,0,0.5),
    inset 0 -2px 6px rgba(0,0,0,0.5);
}
.stamp-btn:disabled { cursor: not-allowed; opacity: 0.55; }
.stamp-btn__hint {
  text-align: center; font-size: 9px;
  letter-spacing: 0.22em; color: rgba(200, 220, 210, 0.55);
  margin: 10px 0 14px; height: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 0 auto;
}

.control-group {
  margin-bottom: 14px;
  flex: 1 1 auto;
  min-height: 0;
  display: flex; flex-direction: column;
}
.control-group__head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 8px;
}
.control-group__label {
  font-size: 10px; letter-spacing: 0.25em;
  color: #e4dfc8; font-weight: 600;
}
.control-group__value {
  font-size: 10px; letter-spacing: 0.15em;
  color: rgba(200, 220, 210, 0.55);
}
.control-group__hint {
  margin-top: 8px; font-size: 9px;
  letter-spacing: 0.12em; color: rgba(200, 220, 210, 0.4);
  font-style: italic;
}

.entity-list {
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(200,220,210,0.25) transparent;
}
.entity-list::-webkit-scrollbar { width: 6px; }
.entity-list::-webkit-scrollbar-thumb { background: rgba(200,220,210,0.2); border-radius: 3px; }
.entity-list::-webkit-scrollbar-track { background: transparent; }
.ent-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 3px;
  font-size: 11px; letter-spacing: 0.08em;
  color: #c9d4ce; cursor: pointer; user-select: none;
  transition: background 0.15s;
}
.ent-row:hover { background: rgba(200,220,210,0.06); }
.ent-row__dot {
  width: 10px; height: 10px; border-radius: 2px;
  background: var(--dot, #666);
  box-shadow: 0 0 6px var(--dot, #666); opacity: 0.8;
}
.ent-row__label { color: #e4dfc8; }
.ent-row__count {
  font-family: var(--font-mono); font-size: 10px;
  color: rgba(200,220,210,0.55); min-width: 18px; text-align: right;
}
.ent-row--off .ent-row__dot { opacity: 0.2; }
.ent-row--off .ent-row__label,
.ent-row--off .ent-row__count {
  opacity: 0.35; text-decoration: line-through;
}

.ghost-btn {
  width: 100%; padding: 10px;
  border: 1px dashed rgba(200, 220, 210, 0.25);
  border-radius: 4px; color: rgba(200, 220, 210, 0.7);
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.22em; transition: all 0.15s;
  flex: 0 0 auto;
  margin-top: 10px;
}
.ghost-btn:hover:not(:disabled) {
  background: rgba(200, 220, 210, 0.06);
  color: #e4dfc8; border-color: rgba(200, 220, 210, 0.4);
}
.ghost-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.ghost-btn + .ghost-btn {
  margin-top: 8px;
}

.ctxmenu {
  position: fixed;
  background: linear-gradient(178deg, #1f3830 0%, #132520 100%);
  color: #e4dfc8;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  border: 1px solid rgba(200, 220, 210, 0.2);
  border-radius: 4px;
  box-shadow:
    0 12px 32px rgba(0,0,0,0.65),
    inset 0 1px 0 rgba(255,255,255,0.05);
  padding: 6px 0;
  min-width: 200px;
  opacity: 0; pointer-events: none;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top left;
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 200;
}
.ctxmenu--show {
  opacity: 1; pointer-events: auto;
  transform: translateY(0) scale(1);
}
.ctxmenu__header {
  padding: 4px 12px 8px;
  border-bottom: 1px dashed rgba(200, 220, 210, 0.15);
  margin-bottom: 4px;
  font-size: 9px;
  letter-spacing: 0.28em;
  color: rgba(200, 220, 210, 0.55);
}
.ctxmenu__header em {
  display: block;
  margin-top: 4px;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0;
  color: #e4dfc8;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ctxmenu__item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}
.ctxmenu__item:hover {
  background: rgba(200, 220, 210, 0.08);
  color: #f5e8d6;
}
.ctxmenu__item--danger { color: #e89a7a; }
.ctxmenu__item--danger:hover { background: rgba(180, 70, 50, 0.22); color: #fbd9c5; }
.ctxmenu__icon {
  width: 14px; height: 14px; flex: 0 0 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.ctxmenu__icon--bar { background: #0b0a08; border-radius: 1px; height: 6px; width: 14px; }
.ctxmenu__icon--reveal {
  border: 1px solid currentColor; border-radius: 1px;
  background: repeating-linear-gradient(90deg, currentColor 0 2px, transparent 2px 4px);
  opacity: 0.6;
}
.ctxmenu__sep {
  height: 1px;
  background: rgba(200, 220, 210, 0.1);
  margin: 4px 0;
}

.sig-pad {
  position: relative;
  width: 180px;
  height: 52px;
  margin-bottom: -6px;
  margin-left: auto;
  display: block;
  cursor: pointer;
  transition: background 0.2s;
  border-radius: 2px;
}
.sig-pad--signed { cursor: default; }
.sig-pad:not(.sig-pad--signed):hover {
  background: rgba(26, 22, 18, 0.04);
}
.sig-pad:not(.sig-pad--signed):hover::after {
  content: "click to sign";
  position: absolute;
  bottom: 13px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--ink-faint);
  opacity: 0.75;
  white-space: nowrap;
  pointer-events: none;
}
.sig-pad__svg {
  display: block;
  width: 100%; height: 100%;
  overflow: visible;
}
.sig-pad__path {
  fill: none;
  stroke: #1a1612;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.82;
}
.sig-pad__underline {
  fill: none;
  stroke: #1a1612;
  stroke-width: 1;
  opacity: 0.4;
}
/* dasharray is set inline per path length; offset is animated via this class */
.sig-pad__path--drawing {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.2s cubic-bezier(.5, 0.1, .4, 1);
}

.tooltip {
  position: fixed;
  padding: 6px 10px;
  background: #0f0a06; color: #f1e6cc;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.18em;
  border-radius: 2px;
  border: 1px solid rgba(241, 230, 204, 0.2);
  box-shadow: 0 4px 12px rgba(0,0,0,0.55);
  pointer-events: none; opacity: 0;
  transform: translate(-50%, calc(-100% - 10px));
  transition: opacity 0.12s;
  z-index: 100; white-space: nowrap;
}
.tooltip::after {
  content: ""; position: absolute;
  bottom: -5px; left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px; height: 8px; background: #0f0a06;
  border-right: 1px solid rgba(241, 230, 204, 0.2);
  border-bottom: 1px solid rgba(241, 230, 204, 0.2);
}
.tooltip--show { opacity: 1; }
.tooltip__kind {
  font-weight: 700; color: var(--k-color, #f1e6cc);
  font-size: 9px; letter-spacing: 0.3em; margin-bottom: 2px;
}
.tooltip__val {
  font-family: var(--font-body); font-size: 12px;
  letter-spacing: 0; color: #f1e6cc;
  max-width: 320px; white-space: normal;
}

@media (max-width: 1100px) {
  .stage { left: calc(50% - 120px); }
  .console { right: 14px; }
}
@media (max-width: 820px) {
  .stage { top: 38%; left: 50%; }
  .console { right: 50%; top: auto; bottom: 14px; transform: translateX(50%); width: 92%; max-width: 380px; }
  .stamp-btn { width: 140px; height: 140px; }
}

.desk.is-landing .console,
.desk.is-landing .page-counter {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.desk:not(.is-landing) .console {
  opacity: 1;
  transition: opacity 0.6s ease 0.9s;
}

.landing {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  pointer-events: none;
}
.landing__inner {
  pointer-events: auto;
  width: min(560px, 46vw);
  margin-left: 6vw;
  color: var(--paper);
  font-family: var(--font-body);
  opacity: 1;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.landing__title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(48px, 6.2vw, 86px);
  letter-spacing: 0.06em;
  line-height: 1.02;
  color: #f3e7c8;
  margin: 0 0 18px;
  text-shadow: 0 2px 20px rgba(0,0,0,0.55);
}
.landing__subtitle {
  font-family: var(--font-body);
  font-size: clamp(14px, 1.3vw, 18px);
  line-height: 1.55;
  color: rgba(241, 230, 204, 0.78);
  margin: 0 0 32px;
  max-width: 44ch;
}
.landing__about {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.75;
  letter-spacing: 0.04em;
  color: rgba(241, 230, 204, 0.55);
  margin: 0 0 28px;
  max-width: 52ch;
  border-left: 2px solid rgba(241, 230, 204, 0.18);
  padding: 6px 0 6px 14px;
}
.landing-load-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 16px 28px;
  background: linear-gradient(178deg, #c13a2a 0%, #9b2b1e 60%, #7a1f15 100%);
  color: #f5e8d6;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.22em;
  border-radius: 4px;
  box-shadow:
    0 10px 24px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255, 200, 180, 0.25),
    inset 0 -3px 0 rgba(0,0,0,0.35);
  text-shadow: 0 1px 0 rgba(80, 10, 5, 0.5);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.2s ease;
}
.landing-load-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    0 14px 28px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255, 200, 180, 0.3),
    inset 0 -3px 0 rgba(0,0,0,0.35);
}
.landing-load-btn:active:not(:disabled) {
  transform: translateY(1px);
}
.landing-load-btn:disabled {
  cursor: default;
  filter: saturate(0.85) brightness(0.95);
}
.landing-load-btn--loading {
  animation: landingLoadPulse 1.6s ease-in-out infinite;
}
@keyframes landingLoadPulse {
  0%, 100% { filter: brightness(0.95); }
  50%      { filter: brightness(1.1); }
}
.landing-load-btn__arrow {
  font-size: 18px;
  letter-spacing: 0;
  transition: transform 0.2s ease;
}
.landing-load-btn:hover:not(:disabled) .landing-load-btn__arrow {
  transform: translateX(4px);
}
.landing-load-btn--error {
  background: linear-gradient(178deg, #555 0%, #333 100%);
}

.landing-progress {
  margin-top: 22px;
  width: 340px;
  max-width: 100%;
  font-family: var(--font-mono);
  /* Always rendered so toggling visibility doesn't shift layout. */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.landing-progress--active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0s;
}
.landing-progress__head {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 0.24em;
  color: rgba(241, 230, 204, 0.6);
  margin-bottom: 8px;
}
.landing-progress__track {
  height: 6px;
  border-radius: 2px;
  background: rgba(241, 230, 204, 0.12);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
}
.landing-progress__fill {
  width: 0%;
  height: 100%;
  background: #e4dfc8;
  box-shadow: 0 0 12px rgba(228, 223, 200, 0.55);
  transition: width 0.2s ease;
}
.landing-progress--ready .landing-progress__fill { background: #8fbf9b; }
.landing-progress--error .landing-progress__fill { background: #d98c72; }

.landing--leaving {
  pointer-events: none;
}
.landing--leaving .landing__inner {
  opacity: 0;
  transform: translateX(-24px);
  pointer-events: none;
}
.landing[hidden] { display: none; }

@media (max-width: 820px) {
  .landing { align-items: flex-start; padding-top: 8vh; }
  .landing__inner { margin-left: 6vw; width: 88vw; }
  .landing__about { display: none; }
}
