:root {
  --chalk: #e9e2d5;
  --chalk-muted: #bdb7aa;
  --ink: #252521;
  --muted: #57534b;
  --paper: #e9e1cf;
  --field: #f4eee0;
  --line: #a69b84;
  --line-light: #c9bda2;
  --red: #803d38;
  --red-dark: #632b2a;
  --green: #3b5547;
  --shadow: 0 3px 5px #0007, 0 19px 40px #0005;
  --paper-cut: polygon(0 .5%,3% 0,8% .4%,13% .1%,17% 0,22% .45%,29% .1%,35% .4%,41% 0,49% .32%,55% .1%,61% .45%,67% .12%,72% .42%,78% .04%,84% .38%,91% 0,98% .42%,99.8% .1%,99.9% 7%,99.5% 15%,100% 24%,99.7% 32%,100% 40%,99.6% 48%,99.9% 55%,99.5% 64%,100% 72%,99.65% 79%,99.93% 86%,99.55% 93%,99.85% 99.65%,95% 99.45%,91% 99.9%,84% 99.55%,78% 100%,72% 99.72%,68% 100%,62% 99.52%,54% 99.92%,49% 99.55%,42% 99.93%,33% 99.62%,28% 100%,22% 99.65%,18% 99.91%,12% 99.52%,6% 99.92%,.1% 99.62%,.38% 91%,0 82%,.3% 74%,.06% 64%,.32% 54%,0 43%,.3% 34%,.02% 26%,.36% 18%,.05% 10%);
}
body {
  color: var(--chalk);
  background-color: #191b1b;
  background-image:
    radial-gradient(ellipse at 39% 10%,#7e787243,transparent 65%),
    radial-gradient(ellipse at 68% 53%,#9a8c7a18,transparent 53%),
    radial-gradient(ellipse at 50% 35%,transparent 42%,#030406b8 100%),
    repeating-linear-gradient(169deg,#a69d9413 0 .5px,transparent .6px 4px),
    repeating-linear-gradient(94deg,#aaa8a40e 0 .5px,transparent .6px 7px);
}
.masthead { background: #141515; border-color: #766c5d48; }
.mast-inner { min-height: 64px; }
.brand { color: var(--chalk); }
.brand small,.account-name,.page-foot { color: var(--chalk-muted); }
.header-actions .ghost { color: var(--chalk); }
.header-actions .ghost:hover { background: #ffffff17; }
.page-foot { border-color: #c0b5a23e; }
body > .page > .loading { color: var(--chalk-muted); }
.eyebrow { letter-spacing: .135em; }
.button { color: var(--ink); background: #ded2b8; border-color: #9e8f74; }
.button:hover { background: #f3e8cc; }
.button.primary { color: #fff7e7; border-color: #713431; background: linear-gradient(160deg,#8c463f,#763834); box-shadow: inset 0 1px #c5937950; }
.button.primary:hover { background: #66302e; }
.quiet-link { color: #d9aa98; }
.paper, .weathered, .archive-card, .slot { color: var(--ink); }
.paper .quiet-link { color: var(--red-dark); }
.paper {
  background: radial-gradient(ellipse at 6% 108%,#ad94794f,transparent 53%),linear-gradient(166deg,#eee7d6,#e1d6bd);
  box-shadow: var(--shadow);
}
.weathered { position: relative; isolation: isolate; background: transparent; }
.weathered::before, .weathered::after { content: ""; position: absolute; pointer-events: none; z-index: -1; }
.weathered::before {
  inset: 1px -3px -3px 2px; transform: rotate(-.34deg);
  background: #958772; clip-path: var(--paper-cut);
  box-shadow: 0 10px 28px #0007;
}
.weathered::after {
  inset: 0; clip-path: var(--paper-cut);
  background:
    radial-gradient(ellipse at 1% 8%,#98785662,transparent 26%),
    radial-gradient(ellipse at 95% 101%,#87725765,transparent 26%),
    radial-gradient(ellipse at 51% 5%,#f8f0d4ad,transparent 53%),
    radial-gradient(ellipse at 15% 62%,#b89f7630,transparent 31%),
    repeating-linear-gradient(8deg,#6e5f400b 0 .45px,transparent .5px 3px),
    repeating-linear-gradient(111deg,#9a826008 0 .5px,transparent .55px 7px),
    linear-gradient(130deg,#e9e1cc,#e5dcc7 75%,#d6c7a8);
}
.toast { color: #f2e8d7; border: 1px solid #867563; background: #232322; pointer-events: none; }
body[data-view=editor] .toast { top: 72px; bottom: auto; }
.auth-wall {
  display: grid; grid-template-columns: 1.16fr minmax(350px,.84fr); align-items: center;
  column-gap: clamp(35px,7vw,105px); width: min(100%,1070px); margin: 0 auto; padding: 28px 0 45px;
  min-height: min(680px,calc(100dvh - 210px));
}
.auth-scene { position: relative; isolation: isolate; padding: 38px 0 140px 7px; }
.auth-scene .eyebrow,.warehouse-hero .eyebrow { color: #d5a89b; }
.auth-scene h1 {
  position: relative; z-index: 2; margin: 12px 0 20px; font-size: clamp(4.15rem,8.4vw,7.5rem);
  line-height: .93; letter-spacing: .11em; text-shadow: 3px 3px #070707, -1px 1px #b2a08463;
}
.auth-scene p { position: relative; z-index: 2; color: #d2c9ba; max-width: 330px; }
.auth-paper { padding: clamp(27px,4.1vw,49px); filter: drop-shadow(0 19px 17px #0008); }
.auth-paper h2 { margin: 0 0 7px; font-size: clamp(1.7rem,3vw,2.4rem); }
.auth-paper form { display: grid; gap: 14px; margin-top: 24px; }
.auth-paper input:not([type=checkbox]) { min-height: 46px; box-shadow: inset 0 1px 2px #3e311e17; background: #f8f3e5; }
.auth-paper .button.primary { min-height: 47px; }
.auth-paper .remember { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .875rem; width: fit-content; cursor: pointer; }
.auth-paper .remember input { width: 16px; height: 16px; }
.auth-choice { text-align: center; border-top: 1px solid #a7917357; padding-top: 10px; }
.auth-clip {
  position: absolute; top: -11px; left: 40px; z-index: 2; width: 53px; height: 21px;
  background: linear-gradient(180deg,#766d5d,#272625 42%,#5b554b 52%,#252424 72%,#4c4640);
  border: 1px solid #918578; border-radius: 3px 3px 5px 5px; box-shadow: 1px 4px 4px #160f0c75; transform: rotate(-5deg);
}
.auth-clip::before { content:""; position: absolute; width: 23px; height: 22px; left: 14px; top: -17px; border: 2px solid #9d9180; border-radius: 8px; transform: perspective(25px) rotateX(24deg); }
.evidence-photo { margin: 0; padding: 7px 7px 19px; background: #a69d88; box-shadow: 0 5px 13px #0009, inset 0 0 0 1px #d6cdb257; }
.evidence-photo img { width: 100%; aspect-ratio: 1.45; object-fit: cover; filter: grayscale(.79) contrast(.91) brightness(.82); background: #3c3b37; }
.auth-photo { position: absolute; bottom: -49px; left: 36%; width: 43%; z-index: 1; transform: rotate(-10deg); }
.auth-photo::after,.warehouse-aside .evidence-photo::after {
  content:""; position: absolute; top: -4px; left: 56%; width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 38% 29%,#aa7a6d,#6d2d29 60%,#2c1b19); box-shadow: 1px 3px 4px #0008;
}
.auth-map,.board-scrap {
  background: repeating-linear-gradient(0deg,#72654f3b 0 1px,transparent 1px 10px),
    repeating-linear-gradient(90deg,#72654f32 0 1px,transparent 1px 10px),linear-gradient(130deg,#8c8679,#bbb197);
  border: 6px solid #a89d83; box-shadow: 0 5px 14px #000a; opacity: .58; clip-path: var(--paper-cut);
}
.auth-map { position: absolute; width: 39%; height: 160px; bottom: -29px; left: 12%; transform: rotate(14deg); }
.auth-traces { position: absolute; inset: 5% 0; pointer-events: none; z-index: -1; }
.auth-traces i, .warehouse-wire, .board-wire { position: absolute; display: block; height: 2px; background: linear-gradient(#98594e,#642c2d); box-shadow: 0 2px 2px #0008; transform-origin: 0 50%; }
.auth-traces i:nth-child(1) { width: 93%; left: 4%; top: 17%; rotate: 32deg; }
.auth-traces i:nth-child(2) { width: 88%; left: 0; top: 77%; rotate: -38deg; }
.auth-traces i:nth-child(3) { width: 70%; left: 26%; top: 8%; rotate: 56deg; opacity: .64; }
.warehouse-hero { min-height: 180px; gap: 24px; }
.warehouse-hero p { color: var(--chalk-muted); }
.warehouse-aside { position: relative; align-self: center; justify-self: center; width: min(200px,80%); }
.warehouse-aside .evidence-photo { position: relative; rotate: 7deg; z-index: 1; }
.warehouse-wire { width: 190%; top: 72%; left: -40%; rotate: -13deg; }
body[data-view=warehouse] .section-head { border-color: #c2b29b57; }
body[data-view=warehouse] .counter, .topline .code { color: var(--chalk-muted); }
.slot {
  background: radial-gradient(ellipse at 80% 100%,#b8a1836e,transparent 51%),linear-gradient(145deg,#e4dcc8,#cfc2a6);
  border-color: #b8ab91; box-shadow: 0 6px 18px #0009; padding: 10px;
}
.slot::after { content:""; position: absolute; left: 48%; top: -5px; width: 21px; height: 10px; transform: rotate(-8deg); background: #a69b82cf; border: 1px solid #aba089; pointer-events: none; }
.slot-media { background: #3a3c3b; border: 1px solid #7b7767; }
.slot-media::before { border-color: #d5c7ac5c; }
.slot-media .silhouette { color: #aaa9a1; opacity: .76; }
.slot-media .plus { background: #dcd0b6; color: #6d302d; }
.slot-media img { filter: saturate(.67); }
body[data-view=editor] .page { width: min(1480px,calc(100% - 30px)); padding: 16px 0 16px; min-height: auto; }
body[data-view=editor] .page-foot { min-height: 35px; }
.board-layout { max-width: none; }
.board-layout .topline,.board-layout .trail { width: min(100%,1000px); margin-inline: auto; }
.board-layout .topline { margin-bottom: 11px; }
.board-layout .wizard-title h1 { font-size: clamp(1.58rem,3.1vw,2.55rem); }
.board-layout .trail { margin-bottom: 9px; }
.board-layout .trail::before { height: 1px; background: #98594e; }
.board-layout .trail li { transform: none; }
.board-layout .trail-card {
  min-height: 34px; padding: 4px 9px; color: #e1d6c5; background: #2b2d2c;
  border-color: #83756496; box-shadow: 1px 3px 5px #0008;
}
.board-layout .trail-card[aria-current=step] { background: #75403a; border-color: #a96c5e; }
.board-layout .trail-card:disabled { opacity:.54; }
.board-layout .trail-card:not(:disabled):hover { border-color: #d6a388; }
.board-stage { height: max(510px,calc(100dvh - 183px)); }
.board-viewport {
  position: relative; height: 100%; min-width: 0;
  overflow: clip; isolation: isolate;
  background: #202121; border: 1px solid #716658; box-shadow: 0 12px 32px #050606b5;
}
.board-viewport::before, .board-viewport::after { content:""; position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.board-viewport::before { box-shadow: inset 0 0 0 2px #82745c5c,inset 0 0 54px 1px #0006; }
.board-viewport::after { background: linear-gradient(90deg,#06070842,transparent 6% 94%,#06070855); }
.board-world {
  position: absolute; top: 0; left: 0; height: 100%;
  transition: transform .9s cubic-bezier(.25,.69,.23,.995);
}
.board-viewport:is([data-still],[data-skill-keyboard]) .board-world { transition: none !important; }
.board-grain {
  position: absolute; inset: -100% 0; 
  background-image: radial-gradient(ellipse at 7% 37%,#a297832e,transparent 34%),
    radial-gradient(ellipse at 46% 62%,#100f0f6e,transparent 36%),
    radial-gradient(ellipse at 76% 25%,#9d9b9748,transparent 34%),
    repeating-linear-gradient(14deg,#96908816 0 .55px,transparent .6px 5px),
    repeating-linear-gradient(93deg,#c9b49c10 0 .6px,transparent .7px 7px);
  background-color: #252626;
}
.board-connections { position: absolute; inset: 0; pointer-events: none; }
.board-wire { height: 3px; }
.board-clue { position: absolute; transform: rotate(-13deg); filter: brightness(.79); }
.board-clue:nth-of-type(even) { transform: rotate(14deg); }
.board-clue.board-scrap { aspect-ratio: .78; }
.board-sheet {
  position: absolute; display: flex; flex-direction: column; padding: 19px clamp(21px,5vw,58px) 17px;
  min-width: 0; min-height: 0; filter: drop-shadow(0 12px 12px #0009);
}
.board-sheet:nth-child(odd) { rotate: -.23deg; }
.board-sheet:nth-child(even) { rotate: .17deg; }
.paper-pin {
  position: absolute; top: -5px; left: 61px; width: 12px; height: 12px; z-index: 1;
  background: radial-gradient(circle at 34% 31%,#b17765,#77352c 54%,#482625 78%);
  border-radius: 50%; box-shadow: 1px 3px 3px #201411b0;
}
.board-sheet .step-head { flex: none; margin-block: 3px 13px; padding: 0 0 8px; border-bottom: 1px solid #8c795353; }
.board-sheet .step-head h2 { font-size: clamp(1.4rem,3vw,2.15rem); margin: 2px 0 4px; }
.board-sheet .step-head p { font-size: .85rem; }
.board-sheet .step-head h2:focus { outline: 0; }
.paper-form { display: flex; flex: 1; min-height: 0; min-width: 0; flex-direction: column; }
.paper-body { flex: 1; overflow: auto; min-height: 0; scrollbar-color: #9c8866 #d8cbb0; scrollbar-width: thin; padding: 4px 5px 9px 2px; }
.paper-body.skill-paper-body { display: flex; flex-direction: column; overflow: clip; }
.board-sheet .step-actions { flex: none; margin-top: 8px; padding-top: 9px; }
.board-sheet .step-actions .button { min-height: 36px; }
.board-sheet .step-actions .button.primary { min-width: 98px; }
.board-sheet .grid { gap: 10px 13px; }
.board-sheet .field > span { font-size: .84rem; }
.board-sheet .field input:not([type=checkbox]),.board-sheet select { min-height: 39px; }
.board-sheet .subsection { margin-top: 16px; padding-top: 12px; }
.board-sheet .inset { background: #b8a88a41; border-color: #ab9a7d; }
/* Keep keyboard fit measurements independent of reduced-motion transition timings. */
.board-viewport, .board-sheet, .skill-paper-body, .skill-toolbar { transition-property: none !important; }
.board-viewport[data-skill-keyboard] {
  position: fixed; inset: var(--skill-vv-top) 0 auto; height: var(--skill-vv-height); z-index: 9;
}
.board-viewport[data-skill-keyboard] .board-sheet { rotate: none; padding: 7px 9px; }
.board-viewport[data-skill-keyboard] :is(.board-connections,.paper-pin,.step-head,.step-actions,.skill-toolbar h3) { display: none; }
.board-viewport[data-skill-keyboard] .skill-paper-body { padding: 0; }
.board-viewport[data-skill-keyboard] .skill-toolbar { margin-bottom: 4px; }
.paper-placeholder { height: 100%; position: relative; padding-top: 22px; opacity: .56; }
.paper-placeholder span {
  display: block; height: 61%; margin-top: 24px;
  background: repeating-linear-gradient(180deg,transparent 0 25px,#7e6d4a3b 26px 27px,transparent 28px 32px);
}
.archive-card { background: radial-gradient(ellipse at 99% 101%,#b59b7560,transparent 40%),linear-gradient(150deg,#eee6d5,#e8dfc7); border-color: #b7a585; }
.keeper-card-heading .hint { color: var(--chalk-muted); }
.invite-dialog, .return-dialog { color: var(--ink); width: min(475px,calc(100% - 30px)); padding: 25px; }
:is(.invite-dialog,.return-dialog)::backdrop { background: #0c0e0eda; backdrop-filter: blur(1px); }
:is(.invite-dialog,.return-dialog) .dialog-actions { margin-top: 16px; flex-wrap: wrap; }
:is(.invite-dialog,.return-dialog) h2 { font-size: 1.7rem; }
.return-dialog > p:not(.error) { margin-top: 9px; color: var(--muted); font-size: .9rem; }
.invite-dialog .field { margin-top: 12px; }
.invite-entry { width: 100%; color: var(--ink); text-align: left; }
.invite-entry:hover { border-color: var(--red); background: #f4ebd7; }
.invite-date { display: block; }
.button.danger { color: #762c2b; border-color: #b18d79; }
.kp-content.weathered { border-color: transparent; box-shadow: none; filter: drop-shadow(0 12px 12px #0008); }
@media(max-width: 760px) {
  .auth-wall { grid-template-columns: 1fr; gap: 28px; max-width: 520px; padding-top: 0; }
  .auth-scene { padding: 2px 0 18px; overflow: hidden; }
  .auth-scene h1 { font-size: clamp(2.75rem,8.6vw,4.6rem); line-height: 1.05; margin: 9px 0 12px; }
  .auth-scene h1 br { display: none; }
  .auth-photo { left: auto; right: -3%; bottom: -28%; width: 35%; opacity: .34; }
  .auth-map { left: auto; right: 8%; bottom: -72%; width: 26%; opacity: .22; }
  .auth-paper { width: 100%; }
}
@media(max-width: 580px) {
  .mast-inner { min-height: 51px; }
  .warehouse-hero { grid-template-columns: 1fr 33%; min-height: 132px; gap: 8px; overflow: clip; }
  .warehouse-aside { width: 91%; }
  .board-layout .trail { gap: 4px; margin-bottom: 6px; }
  .board-layout .trail-card { font-size: .69rem; padding: 4px 2px; min-height: 34px; }
  body[data-view=editor] .page { width: calc(100% - 12px); padding: 9px 0; }
  .board-layout .topline { padding-inline: 6px; }
  .board-stage { height: max(490px,calc(100dvh - 142px)); }
  .board-sheet { padding: 13px 12px; }
  .board-sheet .step-head p { font-size: .8rem; }
  .paper-pin { left: 35px; }
}
@media(prefers-reduced-motion: reduce) { .board-world { transition: none; } }
