/* CHEATWRITER — the machine on the desk (js/cheatwriter-ui.js).
   Everything is placed in percentages of the 1672x941 painting, and the
   stage keeps that shape inside the zoom-safe viewport. Text sizes use
   container units of the stage, so the paper reads the same at any size. */
.cheat-container.cw2 {
  position: fixed; inset: 0; z-index: 1000200;
  width: var(--vw100, 100vw); height: var(--vh100, 100vh);
  display: flex; align-items: center; justify-content: center;
  background: #070605; padding: 0; overflow: hidden;
  animation: cw2In .45s ease both;
}
@keyframes cw2In { from { opacity: 0; } to { opacity: 1; } }
.cw2 .cw2-stage {
  position: relative; container-type: inline-size;
  width: min(var(--vw100, 100vw), calc(var(--vh100, 100vh) * 1672 / 941));
  aspect-ratio: 1672 / 941;
  box-shadow: 0 0 80px rgba(0,0,0,.8);
  user-select: none;
}
.cw2 .cw2-desk, .cw2 .cw2-cover { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cw2 .cw2-cover { z-index: 30; cursor: pointer; transition: opacity 1.1s ease, transform 1.1s cubic-bezier(.5,0,.3,1), filter 1.1s ease; }
.cw2 .cw2-cover.cw2-pulled { opacity: 0; transform: translateY(-6%) scale(1.02); filter: blur(2px); }
.cw2 .cw2-cover-hint {
  position: absolute; z-index: 31; left: 0; right: 0; bottom: 5%; text-align: center; pointer-events: none;
  font-family: 'Special Elite', 'Courier New', monospace; font-size: 1.15cqw; letter-spacing: .5em; text-transform: uppercase;
  color: rgba(235,214,170,.85); text-shadow: 0 1px 6px #000; animation: cw2Hint 2.4s ease-in-out infinite;
}
@keyframes cw2Hint { 50% { opacity: .35; } }

/* the lamp breathes */
.cw2 .cw2-lamp {
  position: absolute; left: 4%; top: -6%; width: 34%; height: 46%; pointer-events: none; z-index: 2;
  background: radial-gradient(ellipse at 45% 35%, rgba(255,196,120,.16), transparent 62%);
  mix-blend-mode: screen; animation: cw2Lamp 7s ease-in-out infinite;
}
@keyframes cw2Lamp { 0%,100% { opacity: .9; } 47% { opacity: 1; } 50% { opacity: .78; } 53% { opacity: 1; } }

/* the paper: typed at the platen, rolled up and fading */
.cw2 .cw2-paper {
  position: absolute; z-index: 5;
  left: 35.5%; top: 2.6%; width: 30.6%; height: 28.6%;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0 1.4cqw .5cqw 1.6cqw; box-sizing: border-box;
}
.cw2 .cw2-typed {
  flex: 1 1 auto; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 28%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 28%);
  margin: 0; padding: 0; max-height: none;
}
.cw2 .typed-line {
  font-family: 'Special Elite', 'Courier New', monospace; font-size: .98cqw; line-height: 1.38;
  color: #241a12; white-space: pre-wrap; min-height: 1.38em; margin: 0; padding: 0; background: none; border: 0;
}
.cw2 .typed-line span { display: inline-block; white-space: pre; transform: translateY(var(--dy, 0)); opacity: var(--ink, 1); text-shadow: 0 0 .5px rgba(30,20,12,.55); }
.cw2 .typed-line.system { color: #5a4636; }
.cw2 .typed-line.error { color: #7a1e14; }
.cw2 .typed-line.success { color: #1f3220; }
.cw2 .typed-line.note { color: #2a1d14; }
.cw2 .cw2-line { display: flex; align-items: baseline; gap: .5cqw; padding-top: .25cqw; border-top: 1px dashed rgba(60,45,30,.25); }
.cw2 .cw2-prompt { font-family: 'Special Elite', monospace; font-size: .98cqw; color: #7a1e14; }
.cw2 .cw2-input {
  flex: 1; background: transparent; border: 0; outline: 0; padding: 0;
  font-family: 'Special Elite', 'Courier New', monospace; font-size: .98cqw; letter-spacing: .08em;
  color: #241a12; caret-color: #7a1e14; text-transform: uppercase;
}

/* the keys: invisible until pressed */
.cw2 .cw2-keys { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.cw2 .cw2-key, .cw2 .cw2-lever {
  position: absolute; pointer-events: auto; padding: 0; margin: 0; border: 0; border-radius: 50%;
  background: transparent; cursor: pointer; transition: background .08s, box-shadow .08s, transform .08s;
}
.cw2 .cw2-key.cw2-dead { cursor: default; }
.cw2 .cw2-key.cw2-space { border-radius: .4cqw; }
.cw2 .cw2-lever { border-radius: 18%; }
.cw2 .cw2-key:hover { box-shadow: 0 0 0 1px rgba(255,214,150,.18), 0 0 1.2cqw rgba(255,190,110,.12); }
.cw2 .cw2-key.cw2-down, .cw2 .cw2-key.flash, .cw2 .cw2-key.cw2-ghost {
  background: radial-gradient(circle at 50% 42%, rgba(0,0,0,.42), rgba(0,0,0,.18) 60%, transparent 72%);
  box-shadow: inset 0 .3cqw .5cqw rgba(0,0,0,.55);
  transform: translateY(.18cqw) scale(.96);
}
.cw2 .cw2-key.cw2-ghost { box-shadow: inset 0 .3cqw .5cqw rgba(0,0,0,.55), 0 0 1cqw rgba(255,190,110,.18); }
.cw2 .cw2-lever:hover { box-shadow: 0 0 1.4cqw rgba(255,200,120,.22); }
.cw2 .cw2-lever.cw2-pull { animation: cw2Pull .38s ease; }
@keyframes cw2Pull { 40% { box-shadow: 0 0 2cqw rgba(255,210,140,.35); } }

/* brass plate */
.cw2 .cw2-plate {
  position: absolute; z-index: 7; left: 50%; top: 85.8%; transform: translateX(-50%);
  padding: .25cqw 1cqw; border-radius: .2cqw;
  background: linear-gradient(180deg, #d0a660, #94703a 55%, #b88c48);
  box-shadow: inset 0 0 0 1px rgba(255,230,170,.35), 0 .15cqw .35cqw rgba(0,0,0,.6);
  font-family: 'Special Elite', monospace; font-size: .8cqw; letter-spacing: .24em; color: #1e1408;
  text-shadow: 0 1px 0 rgba(255,235,190,.35); white-space: nowrap; pointer-events: none;
}

/* W.G.'s card */
.cw2 .cw2-card {
  position: absolute; z-index: 7; left: 77.5%; top: 59%; width: 13.2%; padding: 0; border: 0; background: none; cursor: pointer;
  transform: rotate(-5deg); filter: drop-shadow(0 .5cqw .6cqw rgba(0,0,0,.55)) brightness(.86) sepia(.15);
  transition: transform .2s, filter .2s;
}
.cw2 .cw2-card img { width: 100%; display: block; }
.cw2 .cw2-card span { position: absolute; right: 16%; bottom: 22%; font-family: 'Caveat', cursive; font-size: 1.25cqw; color: #3a2414; transform: rotate(-2deg); }
.cw2 .cw2-card:hover { transform: rotate(-3deg) translateY(-.3cqw); filter: drop-shadow(0 .7cqw .8cqw rgba(0,0,0,.6)) brightness(.95) sepia(.1); }
.cw2 .cw2-read { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(8,6,4,.55); cursor: pointer; }
.cw2 .cw2-read-card {
  width: 36%; padding: 2.2cqw 2.8cqw 2.4cqw; border-radius: .2cqw;
  background:
    radial-gradient(circle at 86% 14%, transparent 2.5cqw, rgba(120,70,30,.07) 2.8cqw, transparent 3.4cqw),
    radial-gradient(ellipse at 12% 92%, rgba(150,100,50,.18), transparent 40%),
    linear-gradient(170deg, #efe4c8, #e2d2ad 70%, #d8c497);
  box-shadow: inset 0 0 2.5cqw rgba(120,80,40,.25), 0 1cqw 2cqw rgba(0,0,0,.6);
  font-family: 'Caveat', cursive; font-size: 1.45cqw; line-height: 1.25; color: #2e1e12; transform: rotate(-2deg);
}
.cw2 .cw2-read-card p { margin: 0; }

/* used codes: yellow slips on the notebook */
.cw2 .cw2-slips {
  position: absolute; z-index: 7; left: 1.2%; top: 61.5%; width: 21%;
  display: grid; grid-template-columns: repeat(3, 6.6cqw); grid-auto-rows: 4.6cqw; gap: 0 .3cqw;   /* the old stylesheet sets gap: 20px */ pointer-events: none;
}
.cw2 .cw2-slips .cheat-notes-stack { position: relative; pointer-events: auto; width: 6.6cqw; height: 4.6cqw; padding: 0; min-height: 0; }
.cw2 .cw2-slips .cheat-notes-stack:hover { z-index: 3; }
.cw2 .cw2-slips .cheat-note-slip {
  top: 0; bottom: auto; left: 0;
  width: 6.6cqw; height: 6cqw; padding: .7cqw .5cqw; box-sizing: border-box; cursor: pointer;
  background: url(../assets/images/cheatwriter/slip.png) center/100% 100% no-repeat; border: 0; box-shadow: none;
  transform: rotate(var(--rotation, 0deg)); filter: drop-shadow(0 .25cqw .3cqw rgba(0,0,0,.5)) brightness(.88);
  font-family: 'Permanent Marker', cursive; color: #3a2a14; text-align: center;
}
.cw2 .cw2-slips .cheat-note-slip .note-stamp { display: none; }
.cw2 .cw2-slips .cheat-note-slip .note-title { font-size: .72cqw; letter-spacing: .02em; }
.cw2 .cw2-slips .cheat-note-slip .note-effect { font-family: 'Caveat', cursive; font-size: .85cqw; line-height: 1; margin-top: .2cqw; }
.cw2 .cw2-slips .cheat-note-slip .note-count { position: static; text-align: right; font-size: .72cqw; line-height: 1; color: #7a1e14; }
.cw2 .cw2-slips .cheat-note-slip .note-time { display: none; }

/* the vault tag */
.cw2 .cw2-vault {
  position: absolute; z-index: 7; left: 78%; top: 83%; width: 12.5%; padding: .55cqw .6cqw; cursor: pointer;
  background: linear-gradient(180deg, #e9dcc0, #d8c49c); border: 1px solid rgba(90,30,20,.5); border-radius: .2cqw;
  transform: rotate(3deg); box-shadow: 0 .3cqw .6cqw rgba(0,0,0,.55);
  font-family: 'Special Elite', monospace; color: #7a1e14; text-align: center; line-height: 1.2;
}
.cw2 .cw2-vault b { display: block; font-size: .72cqw; letter-spacing: .14em; }
.cw2 .cw2-vault i { display: block; font-size: .55cqw; color: #5a4636; }
.cw2 .cw2-vault:hover { transform: rotate(1deg) translateY(-.2cqw); }

.cw2 .cw2-close {
  position: absolute; z-index: 35; right: 1.2%; top: 2%; width: 2.6cqw; height: 2.6cqw; border-radius: 50%;
  border: 1px solid rgba(235,214,170,.45); background: rgba(10,8,6,.6); color: #e8d8b8; font-size: 1.2cqw; cursor: pointer;
}
.cw2 .cw2-close:hover { background: rgba(120,30,20,.8); }
/* words tried: a notepad page on the desk, pencil */
.cw2 .cw2-tried {
  position: absolute; z-index: 7; left: 76.2%; top: 34.5%; width: 14.6%; padding: .7cqw .9cqw .8cqw 1.4cqw; box-sizing: border-box;
  background:
    linear-gradient(90deg, transparent 1cqw, rgba(150,40,30,.28) 1cqw, rgba(150,40,30,.28) calc(1cqw + 1px), transparent calc(1cqw + 1px)),
    repeating-linear-gradient(180deg, transparent 0, transparent 1.35cqw, rgba(70,90,130,.22) 1.35cqw, rgba(70,90,130,.22) calc(1.35cqw + 1px)),
    linear-gradient(175deg, #ece2c8, #d9caa6);
  background-position: 0 0, 0 1.9cqw, 0 0;
  transform: rotate(2.5deg); filter: brightness(.86) sepia(.12);
  box-shadow: 0 .4cqw .8cqw rgba(0,0,0,.55);
  clip-path: polygon(0 1.5%, 6% 0, 14% 1.2%, 25% .2%, 37% 1.4%, 49% .3%, 61% 1.3%, 73% 0, 86% 1.2%, 100% .4%, 100% 100%, 0 100%);
}
.cw2 .cw2-tried-h { font-family: 'Caveat', cursive; font-size: 1.05cqw; color: #4a4038; line-height: 1.3; }
.cw2 .cw2-tried-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: .5cqw; cursor: pointer;
  font-family: 'Caveat', cursive; line-height: 1.35cqw; height: 1.35cqw; color: #34302c; white-space: nowrap; overflow: hidden;
}
.cw2 .cw2-tried-row b { font-weight: 700; font-size: .95cqw; letter-spacing: .03em; overflow: hidden; text-overflow: ellipsis; }
.cw2 .cw2-tried-row i { font-style: normal; font-size: .9cqw; color: #2e4a2e; flex: none; }
.cw2 .cw2-tried-row.cw2-yes b::before { content: '✓ '; color: #2e4a2e; }
.cw2 .cw2-tried-row.cw2-no b { text-decoration: line-through; text-decoration-thickness: 1px; color: #5d5650; }
.cw2 .cw2-tried-row.cw2-no i, .cw2 .cw2-tried-row.cw2-later i { color: #7a1e14; }
.cw2 .cw2-tried-row.cw2-later b::before { content: '~ '; color: #7a1e14; }
.cw2 .cw2-tried-row:hover b { color: #7a1e14; }
.cw2 .cw2-tried-empty { cursor: default; color: #6a625a; }
.cw2 .cw2-hidden { display: none !important; }
/* CARDS opens the card file — over the machine, not behind it */
body:has(.cheat-container.cw2) .credit-card-overlay { z-index: 1000300 !important; }
/* the page under the desk keeps still, and no first-chapter chip sits on the sheet */
html:has(.cheat-container.cw2), body:has(.cheat-container.cw2) { overflow: hidden !important; }
body:has(.cheat-container.cw2) #dlgSkipHintChip { display: none; }
@media (prefers-reduced-motion: reduce) { .cw2 .cw2-lamp, .cw2 .cw2-cover-hint { animation: none; } }

/* ── UNLOCK THE VAULT: a typed sheet on the desk, not a black terminal plate
   (the old rules live in cheat-menu-system.css; these win inside .cw2) ── */
.cw2 .cheat-access-popup {
  position: absolute; inset: 0; z-index: 45; display: flex; align-items: center; justify-content: center;
  background: rgba(8,6,4,.62); backdrop-filter: none; -webkit-backdrop-filter: none; padding: 0; animation: cw2In .25s ease both;
}
.cw2 .access-popup-content {
  position: relative; width: min(33cqw, 92%); max-width: none; min-height: 0; height: auto; padding: 2.4cqw 2.6cqw 1.8cqw; box-sizing: border-box;
  background:
    radial-gradient(circle at 86% 12%, transparent 2.5cqw, rgba(120,70,30,.07) 2.8cqw, transparent 3.4cqw),
    linear-gradient(175deg, #efe6cf, #ddd0b0);
  border: 0; border-radius: .15cqw; transform: rotate(-1deg);
  box-shadow: inset 0 0 2.5cqw rgba(120,80,40,.22), 0 1cqw 2.4cqw rgba(0,0,0,.65);
  font-family: 'Special Elite', 'Courier New', monospace; color: #241a12;
}
.cw2 .access-document { background: none; border: 0; padding: 0; box-shadow: none; text-align: left; color: inherit; font-family: inherit; }
.cw2 .access-popup-close {
  position: absolute; top: .9cqw; right: 1cqw; width: 2.2cqw; height: 2.2cqw; border-radius: 50%; padding: 0;
  background: transparent; border: 1px solid rgba(60,40,20,.45); color: #5a4636; font-size: 1cqw; line-height: 1; cursor: pointer; box-shadow: none; transform: none;
}
.cw2 .access-popup-close:hover { background: rgba(122,30,20,.12); color: #7a1e14; border-color: #7a1e14; transform: none; }
.cw2 .access-header { text-align: center; margin: 0 0 1.4cqw; }
.cw2 .access-line { display: none; }
.cw2 .access-title {
  display: inline-block; font-size: 1.5cqw; letter-spacing: .35em; color: #7a1e14; text-shadow: none;
  border: .18cqw double #7a1e14; padding: .35cqw 1.1cqw .25cqw 1.4cqw; transform: rotate(-2deg); opacity: .88; margin: 0;
}
.cw2 .access-body { padding: 0; }
.cw2 .access-intro { font-size: 1.15cqw; color: #241a12; margin: 0 0 .3cqw; text-align: left; text-shadow: none; }
.cw2 .access-sub { font-size: .95cqw; color: #6a5440; font-style: normal; margin: 0 0 1.5cqw; text-align: left; }
.cw2 .access-channels { display: block; margin: 0 0 1.5cqw; padding: 0; }
.cw2 .access-channel {
  display: flex; align-items: baseline; gap: .6cqw; padding: .55cqw .2cqw; margin: 0; text-decoration: none;
  background: none; border: 0; border-bottom: 1px dashed rgba(60,45,30,.35); border-radius: 0; box-shadow: none; transform: none; color: #241a12;
}
.cw2 .access-channel::before { content: '›'; position: static; width: auto; height: auto; background: none; opacity: 1; transform: none; color: #7a1e14; font-size: 1.1cqw; }
.cw2 .access-channel:hover { background: rgba(122,30,20,.07); border-color: #7a1e14; transform: none; box-shadow: none; }
.cw2 .channel-label { font-size: 1.05cqw; letter-spacing: .08em; color: #241a12; font-weight: normal; min-width: 0; text-shadow: none; }
.cw2 .access-channel:hover .channel-label { color: #7a1e14; text-decoration: underline; }
.cw2 .channel-dots { flex: 1; overflow: hidden; white-space: nowrap; color: transparent; border-bottom: 1px dotted rgba(60,45,30,.5); letter-spacing: 0; transform: translateY(-.3cqw); }
.cw2 .channel-desc { font-family: 'Caveat', cursive; font-size: 1.25cqw; color: #3a2414; font-style: normal; }
.cw2 .access-footer { font-size: 1cqw; color: #241a12; margin: 0 0 .2cqw; text-align: left; text-shadow: none; }
.cw2 .access-footer-sub { font-size: .9cqw; color: #6a5440; font-style: normal; margin: 0; text-align: left; }
.cw2 .access-footer-sub::after { content: '— W.G.'; display: block; margin-top: 1cqw; text-align: right; font-family: 'Caveat', cursive; font-size: 1.5cqw; color: #3a2414; transform: rotate(-2deg); }
.cw2 .access-document, .cw2 .access-body { min-height: 0; margin: 0; }
.cw2 .access-header { text-align: left; }
.cw2 .access-footer-sub { padding: 0; border: 0; }
