:root {
  --desk: #17120f;
  --paper: #f3ead3;
  --paper-2: #e9dcbc;
  --ink: #2b251d;
  --ink-soft: #6b604f;
  --red: #b42a1f;
  --green: #2f6b3a;
  --blue: #23415e;
  --mono: 'PT Mono', 'Courier New', monospace;
  --serif: 'PT Serif', Georgia, serif;
  --display: 'Playfair Display', Georgia, serif;
  --stamp: 'Rubik Mono One', Impact, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--serif);
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(255, 190, 110, .14), transparent 60%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .018) 0 2px, transparent 2px 11px),
    linear-gradient(180deg, #2c231e, var(--desk));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 520px; margin: 0 auto; min-height: 100vh; }
h1, h2, h3 { font-family: var(--display); }

/* ---------- paper & buttons ---------- */

.paper {
  position: relative;
  margin: 18px 14px;
  padding: 20px 18px;
  border-radius: 3px;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 15% 10%, rgba(255, 255, 255, .6), transparent 45%),
    radial-gradient(circle at 85% 95%, rgba(160, 115, 50, .16), transparent 55%);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 12px 28px rgba(0, 0, 0, .5);
}

.btn {
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: .5px;
  border: 0;
  border-radius: 4px;
  padding: 12px 16px;
  cursor: pointer;
  transition: transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--ink); color: var(--paper); box-shadow: 0 3px 0 #000; }
.btn-light { background: var(--paper); color: var(--ink); box-shadow: 0 3px 0 #8f7f5f; display: inline-block; }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px dashed var(--ink-soft); }
.btn-small { padding: 7px 10px; font-size: 13px; }
.btn:not(.btn-primary):not(.btn-ghost):not(.btn-light) { background: var(--paper-2); color: var(--ink); }
.btn-big { width: 100%; padding: 16px; font-size: 17px; margin-top: 8px; }

/* ---------- stamps ---------- */

.stamp {
  display: inline-block;
  font-family: var(--stamp);
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--red);
  border: 3px solid currentColor;
  border-radius: 6px;
  padding: 4px 10px;
  transform: rotate(-8deg);
  opacity: .85;
}
.stamp-ok, .stamp-solved { color: var(--green); }
.stamp-cleared { color: var(--blue); }
.stamp-secret { position: absolute; top: 14px; right: 10px; font-size: 10px; }
.stamp-closed { font-size: 18px; margin-bottom: 8px; animation: stamp-in .4s .3s cubic-bezier(.2, 1.6, .4, 1) both; }
.stamp-solved { position: absolute; right: 14px; top: 14px; font-size: 11px; }

@keyframes stamp-in {
  from { transform: rotate(-8deg) scale(2.6); opacity: 0; }
  to { transform: rotate(-8deg) scale(1); opacity: .9; }
}

/* ---------- intro & finale ---------- */

.intro, .finale {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 50px 14px 30px;
}
.folder {
  position: relative;
  width: 100%;
  padding: 50px 20px 26px;
  text-align: center;
  border-radius: 0 10px 10px 10px;
  background: linear-gradient(160deg, #e4c78b, #cba45c);
  box-shadow: 0 22px 44px rgba(0, 0, 0, .6), inset 0 0 50px rgba(120, 80, 20, .25);
}
.folder-tab {
  position: absolute;
  top: -26px;
  left: 0;
  padding: 6px 16px;
  border-radius: 8px 8px 0 0;
  background: #dcbc7c;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 2px;
}
.folder h1 { font-weight: 900; font-size: 32px; line-height: 1.1; margin: 8px 0 4px; }
.preload { margin: 14px 0 0; font-family: var(--mono); font-size: 13px; color: var(--ink-soft); }
.intro-text, .finale .story { font-family: var(--mono); font-size: 15px; line-height: 1.6; text-align: left; }
.case-stats { font-family: var(--mono); font-size: 13px; margin: 18px 0 6px; color: var(--ink-soft); }
.final-video { width: 100%; margin-top: 14px; border-radius: 3px; background: #000; }

.ransom {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 14px;
  margin: 20px -4px;
  padding: 18px 10px;
  background: #fbf8f0;
  transform: rotate(-1.2deg);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .3);
}
.r-word { display: inline-flex; gap: 2px; }
.r { display: inline-block; padding: 2px 4px; font-size: 20px; line-height: 1.1; box-shadow: 1px 1px 2px rgba(0, 0, 0, .3); }
.r1 { background: #111; color: #fff; font-family: var(--display); }
.r2 { background: #f4d03f; color: #111; font-family: var(--stamp); font-size: 15px; }
.r3 { background: #fff; color: var(--red); font-family: var(--serif); font-weight: 700; font-style: italic; }
.r4 { background: var(--red); color: #fff; font-family: var(--mono); }
.r5 { background: #e8e2d0; color: var(--blue); font-family: var(--display); font-size: 24px; }
.r6 { background: #fff; color: #111; font-family: var(--mono); border: 1px solid #999; }

/* ---------- top bar & tabs ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: rgba(23, 18, 15, .92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 2px;
}
.case-no { user-select: none; -webkit-user-select: none; }
.timer.late { color: #ff7a6b; }
.content { padding: 4px 0 calc(env(safe-area-inset-bottom) + 96px); }

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: 100%;
  max-width: 520px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(23, 18, 15, .96);
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 2px 8px;
  border: 0;
  background: none;
  color: rgba(243, 234, 211, .5);
  font-family: var(--mono);
  font-size: 10.5px;
}
.tab.active { color: var(--paper); }
.tab-icon { font-size: 20px; filter: grayscale(1) opacity(.7); }
.tab.active .tab-icon { filter: none; }
.dot {
  position: absolute;
  top: 7px;
  right: calc(50% - 18px);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 2px var(--desk);
  animation: pulse 1.4s infinite;
}
@keyframes pulse { 50% { transform: scale(1.3); } }

.section-title { color: var(--paper); font-size: 24px; margin: 26px 16px 0; }
.section-title.dark { color: var(--ink); margin: 26px 0 12px; }
.empty { font-family: var(--mono); font-size: 14px; color: var(--ink-soft); margin: 14px 16px; }
.empty.light { color: rgba(243, 234, 211, .6); }

/* ---------- stages ---------- */

.stage-no { font-family: var(--mono); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-soft); }
.stage h2 { font-size: 28px; margin: 4px 0 12px; }
.stage.current {
  margin-top: 26px;
  background-image:
    radial-gradient(circle at 15% 10%, rgba(255, 255, 255, .6), transparent 45%),
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(60, 90, 140, .09) 27px 28px);
}
.stage.current.enter { animation: stage-in .45s ease-out both; }
@keyframes stage-in { from { opacity: 0; transform: translateY(16px); } }
.stage.done { padding: 12px 18px; margin: 10px 14px; opacity: .8; }
.stage.done h3 { margin: 2px 0 0; font-size: 17px; }
.done-text { margin-top: 10px; padding-right: 4px; font-family: var(--mono); font-size: 13px; line-height: 1.5; color: var(--ink-soft); }
.stage.current .stamp-closed { display: table; margin: 4px auto 0; }
.story { font-family: var(--mono); font-size: 15px; line-height: 1.65; }
.task { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--ink-soft); }
.task-label { display: block; font-family: var(--mono); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }

.paperclip {
  position: absolute;
  top: -16px;
  left: 28px;
  width: 14px;
  height: 46px;
  border: 3px solid #a3a9ae;
  border-radius: 8px;
  transform: rotate(8deg);
}
.paperclip::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 7px;
  width: 4px;
  height: 26px;
  border: 3px solid #a3a9ae;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}

.code-row { display: flex; gap: 8px; }
.code-input {
  flex: 1;
  min-width: 0;
  padding: 10px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: #fffdf6;
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 4px;
  text-align: center;
  text-transform: uppercase;
  color: var(--ink);
}
.code-input:focus { outline: 3px solid rgba(180, 42, 31, .3); }
.shake { animation: shake .4s; border-color: var(--red); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* lineup */
.lineup { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.lineup-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  background: #fffdf6;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.lineup-item img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; filter: grayscale(.3); }

/* cipher key */
.cipher-key { overflow-x: auto; margin-top: 12px; padding-bottom: 4px; }
.cipher-row { display: flex; }
.cipher-row span {
  flex: 0 0 22px;
  padding: 4px 0;
  border: 1px solid rgba(43, 37, 29, .25);
  font-family: var(--mono);
  font-size: 14px;
  text-align: center;
}
.cipher-row:first-child span { background: rgba(180, 42, 31, .08); color: var(--red); }

/* safe code */
.safe-panel { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 14px 0; padding: 10px 14px; border: 1px solid rgba(243, 234, 211, .15); border-radius: 6px; background: rgba(0, 0, 0, .25); }
.safe-panel .safe-label { color: var(--paper); margin: 0; }
.safe-label { font-family: var(--mono); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-soft); margin: 18px 0 8px; }
.safe { display: flex; gap: 6px; justify-content: center; }
.safe-slot {
  width: 30px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: 2px solid #6b604f;
  background: #2b251d;
  color: #7dffa8;
  font-family: var(--mono);
  font-size: 22px;
  text-shadow: 0 0 8px rgba(125, 255, 168, .6);
}
.safe-slot.filled { border-color: #7dffa8; animation: slot-in .5s both; }
@keyframes slot-in { from { transform: scale(1.4); opacity: 0; } }
.safe.big .safe-slot { width: 52px; height: 64px; font-size: 36px; }
.digit-reward { margin-top: 18px; padding-top: 6px; border-top: 1px dashed var(--ink-soft); }
.digit-reward .safe-label { margin-top: 10px; }

/* collect stage */
.bags { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 4px 0 18px; }
.bag {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px 12px 12px;
  overflow: hidden;
  border-radius: 6px;
  border: 1.5px solid rgba(120, 110, 90, .35);
  background: linear-gradient(135deg, rgba(255, 255, 255, .8), rgba(255, 255, 255, .35) 45%, rgba(255, 255, 255, .65));
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .5), 0 5px 12px rgba(0, 0, 0, .18);
  text-align: center;
}
.bag::after {
  content: '';
  position: absolute;
  top: -20%;
  left: -15%;
  width: 35%;
  height: 140%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: rotate(25deg);
  pointer-events: none;
}
.bag-zip {
  position: absolute;
  top: 10px;
  left: 8px;
  right: 8px;
  height: 7px;
  border-top: 2px solid rgba(180, 42, 31, .75);
  border-bottom: 2px solid rgba(180, 42, 31, .75);
}
.bag-label {
  width: 100%;
  padding: 8px 6px 9px;
  background: #fff;
  border: 1px solid #e2dccb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
  transform: rotate(-2deg);
}
.bag:nth-child(even) .bag-label { transform: rotate(1.5deg); }
.bag-tag {
  display: block;
  margin-bottom: 5px;
  padding-bottom: 4px;
  border-bottom: 1.5px solid var(--red);
  color: var(--red);
  font-family: var(--stamp);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.bag-no { display: block; font-family: var(--mono); font-size: 24px; font-weight: 700; line-height: 1.1; }
.bag-title { display: block; margin-top: 4px; font-family: var(--mono); font-size: 12px; line-height: 1.3; color: var(--ink-soft); }
.bag.new { animation: bag-in .5s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes bag-in { from { transform: scale(.6) rotate(-8deg); opacity: 0; } }
.bag.empty { background: rgba(255, 255, 255, .15); border-style: dashed; border-color: var(--ink-soft); box-shadow: none; }
.bag.empty::after { display: none; }
.bag.empty .bag-zip { border-color: rgba(107, 96, 79, .35); }
.bag-q { font-family: var(--display); font-size: 44px; color: rgba(107, 96, 79, .45); }

/* ---------- suspects ---------- */

.suspect { display: flex; gap: 14px; align-items: flex-start; overflow: hidden; }
.mugshot {
  position: relative;
  flex: 0 0 100px;
  padding: 6px 6px 0;
  border: 1px solid #9c9584;
  background: repeating-linear-gradient(0deg, #d9d4c7 0 11px, #bcb6a6 11px 12px);
}
.mugshot img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; filter: grayscale(.25) contrast(1.05); }
.plate { margin: 0 -6px; padding: 3px 0; background: #111; color: #fff; font-family: var(--mono); font-size: 12px; text-align: center; }
.suspect-body { flex: 1; min-width: 0; }
.suspect h3 small { display: block; font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--ink-soft); }
.suspect h3 { margin: 0 0 6px; font-size: 20px; }
.alibi { font-size: 14px; margin: 0 0 8px; }
.note {
  margin: 6px 0;
  padding: 6px 8px;
  border-left: 3px solid var(--red);
  background: rgba(180, 42, 31, .08);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
}
.videos { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.locked { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); padding: 7px 0; }
.suspect.crossed .mugshot img { filter: grayscale(1) opacity(.55); }
.suspect.crossed .suspect-body > :not(.videos) { opacity: .55; }
.suspect.crossed .videos { position: relative; z-index: 1; }
.cross-line {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to top right, transparent calc(50% - 2px), rgba(180, 42, 31, .7) calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px));
}
.person-role { font-family: var(--mono); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--red); margin-bottom: 2px; }
.witness .person-role { color: var(--blue); }
.witness .plate { background: var(--blue); }
.card-stamp { position: absolute; right: 12px; top: 14px; font-size: 11px; white-space: nowrap; background: rgba(243, 234, 211, .85); }
.suspect.partner { box-shadow: 0 0 0 3px var(--red), 0 12px 28px rgba(0, 0, 0, .5); }

/* ---------- team ---------- */

.badge-card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-top: 40px;
  overflow: hidden;
  border: 2px solid var(--blue);
  background: linear-gradient(135deg, #f6efdc, #e4d4ad);
}
.badge-card::before {
  content: 'БЮРО РАССЛЕДОВАНИЙ';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 5px;
  background: var(--blue);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 3px;
  text-align: center;
}
.badge-photo img { display: block; width: 92px; height: 115px; object-fit: cover; border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .3); }
.badge-body { flex: 1; min-width: 0; }
.badge-role { font-family: var(--mono); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--blue); }
.badge-card h3 { margin: 2px 0 6px; font-size: 22px; }
.badge-card p { margin: 0; font-size: 14px; line-height: 1.45; }
.badge-card.compromised .badge-photo, .badge-card.compromised .badge-body { filter: grayscale(.7); opacity: .6; }
.badge-stamp { position: absolute; left: 50%; top: 58%; translate: -50% -50%; font-size: 14px; background: rgba(243, 234, 211, .8); white-space: nowrap; }

/* ---------- sms ---------- */

.sms { text-align: left; }
.sms-head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid rgba(43, 37, 29, .15); }
.sms-avatar { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--blue); font-size: 20px; }
.sms-head b { display: block; font-family: var(--serif); font-size: 17px; }
.sms-head small { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }
.sms-typing { display: inline-flex; gap: 5px; margin-top: 14px; padding: 12px 14px; border-radius: 18px 18px 18px 4px; background: #e4ddcb; overflow: hidden; animation: hide-typing .2s 1.3s forwards; }
.sms-typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-soft); animation: typing 1s infinite; }
.sms-typing i:nth-child(2) { animation-delay: .15s; }
.sms-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 50% { transform: translateY(-4px); opacity: .4; } }
@keyframes hide-typing { to { opacity: 0; height: 0; margin: 0; padding: 0; } }
.sms-bubble {
  max-width: 92%;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 18px 18px 18px 4px;
  background: #e4ddcb;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.5;
  animation: bubble-in .35s 1.4s cubic-bezier(.2, 1.3, .4, 1) both;
}
@keyframes bubble-in { from { opacity: 0; transform: translateY(10px) scale(.95); } }
.sms ~ .digit-reward { animation: bubble-in .35s 1.8s both; }

/* ---------- finale ---------- */

.letter { margin: 10px 0 4px; padding: 20px 18px; background: #fbf8f0; text-align: left; transform: rotate(-.6deg); box-shadow: 0 8px 18px rgba(0, 0, 0, .3); font-family: var(--serif); font-size: 17px; line-height: 1.55; }
.letter p { margin: 0; }
.letter .signature { margin-top: 14px; text-align: right; font-style: italic; }
.finale .safe-label { color: var(--ink); }
.last-line { margin: 18px 0 0; font-family: var(--display); font-size: 22px; font-weight: 700; line-height: 1.3; }

/* ---------- modal, twist, toasts ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 8, 6, .72);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .2s;
}
.modal-backdrop.show { opacity: 1; }
.modal { width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; margin: 0; text-align: center; transform: scale(.92); transition: transform .25s; }
.modal-backdrop.show .modal { transform: none; }
.modal.wide { max-width: 520px; padding: 14px; }
.modal .stamp { font-size: 22px; margin: 6px 0 16px; animation: stamp-in .35s cubic-bezier(.2, 1.6, .4, 1) both; }
.modal-text { font-family: var(--mono); font-size: 15px; line-height: 1.6; text-align: left; margin: 0; }
.modal-text.center { text-align: center; margin-top: 12px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }
.proof-label { margin-top: 16px; text-align: left; }
.accuse-photo img { width: 140px; aspect-ratio: 4 / 5; object-fit: cover; border: 4px solid #fff; box-shadow: 0 4px 10px rgba(0, 0, 0, .3); }
.video-title { font-family: var(--mono); font-size: 13px; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 10px; }
.video { width: 100%; max-height: 65vh; border-radius: 3px; background: #000; }
.video-missing { font-family: var(--mono); font-size: 14px; color: var(--ink-soft); padding: 30px 0; }

.twist {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  background: radial-gradient(circle, #4a110b, #0d0605);
  opacity: 0;
  transition: opacity .4s;
}
.twist.show { opacity: 1; }
.twist-label { color: #ff8a7a; font-family: var(--mono); font-size: 13px; letter-spacing: 3px; text-transform: uppercase; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .3; } }
.twist-card { position: relative; padding: 10px 10px 14px; background: var(--paper); transform: rotate(-3deg); box-shadow: 0 20px 50px #000; }
.twist-card img { display: block; width: 200px; height: 250px; object-fit: cover; filter: grayscale(.4) contrast(1.1); }
.twist-name { margin-top: 8px; font-family: var(--display); font-size: 22px; text-align: center; }
.twist-card .stamp {
  position: absolute;
  left: 50%;
  top: 46%;
  translate: -50% -50%;
  max-width: 94%;
  font-size: 15px;
  line-height: 1.25;
  text-align: center;
  background: rgba(243, 234, 211, .8);
  animation: stamp-in .4s 1s cubic-bezier(.2, 1.6, .4, 1) both;
}
.twist-text { max-width: 340px; margin: 0; color: var(--paper); font-family: var(--mono); line-height: 1.6; text-align: center; }
.twist.fly .twist-card { transition: transform .6s ease-in; transform: translateY(-120vh) rotate(25deg); }

#toasts {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 58px);
  left: 0;
  right: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  animation: toast-in .3s both;
  transition: opacity .4s, transform .4s;
}
.toast.hide { opacity: 0; transform: translateY(-10px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

.confetti { position: fixed; inset: 0; z-index: 90; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -20px; width: 8px; height: 14px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
