@font-face { font-family: 'Omi'; src: url('../assets/font/omi.woff2') format('woff2'); font-display: swap; }
:root { --ink: #121214; --paper: #f6f4ec; --bg: #07080b; --dim: #8a877e; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; color: var(--paper); font-family: 'Omi', ui-monospace, monospace; -webkit-font-smoothing: none; }

/* the baked room poster is the first view; the 3D fades in over it at the same framing */
#poster { position: fixed; inset: 0; display: block; }
#poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; outline: none; opacity: 0; transition: opacity .7s ease; }
body.ready #gl { opacity: 1; }
#load { position: fixed; z-index: 40; left: 0; right: 0; top: 0; height: 2px; pointer-events: none; transition: opacity .5s .3s; }
#load-bar { height: 100%; background: var(--paper); box-shadow: 0 0 8px rgba(246, 244, 236, .6); transform-origin: left; transform: scaleX(0); transition: transform .25s linear; }
body.ready #load { opacity: 0; }
body.waiting #poster img { cursor: progress; }

/* ---------- chrome ---------- */
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
#back, #sound { position: fixed; z-index: 20; top: max(14px, env(safe-area-inset-top)); height: 34px; padding: 0 14px; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); font-size: 15px; }
#sound { right: max(14px, env(safe-area-inset-right)); display: flex; align-items: center; gap: 8px; }
#sound i { width: 12px; height: 12px; border: 1px solid var(--ink); background: repeating-linear-gradient(45deg, var(--ink) 0 1px, transparent 1px 3px); }
#sound.on i { background: var(--ink); }
#back { left: max(14px, env(safe-area-inset-left)); opacity: 0; pointer-events: none; transition: opacity .3s; }
body.in-mac #back { opacity: 1; pointer-events: auto; }
#back:active, #sound:active, .sbtn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
#tip { position: fixed; z-index: 16; left: 0; top: 0; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); padding: 4px 9px; font-size: 13px; pointer-events: none; opacity: 0; transition: opacity .15s; white-space: nowrap; }
#tip.on { opacity: 1; }
#os-input { position: fixed; left: 0; bottom: 0; width: 2px; height: 2px; opacity: 0; font-size: 16px; border: 0; padding: 0; resize: none; background: transparent; color: transparent; caret-color: transparent; }

/* ---------- the sales bar: a small omi OS strip, visible from the first second ---------- */
#sell { position: fixed; z-index: 22; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 14px; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); font-size: 15px; white-space: nowrap; max-width: calc(100vw - 24px); }
#sell b { font-weight: normal; text-shadow: .6px 0 0 var(--ink); }
.sell-short { display: none; }
.sbtn { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; color: var(--ink); text-decoration: none; border: 1px solid var(--ink); border-radius: 6px; background: var(--paper); }
.sbtn.def { outline: 2px solid var(--ink); outline-offset: 2px; margin-left: 4px; margin-right: 3px; }
.sbtn:hover { background: var(--ink); color: var(--paper); }
body.poster-mode #sell, body.poster-mode #sound, body.poster-mode #load, body.poster-mode #back { display: none; }
@media (max-width: 760px) {
  #sell { left: 8px; right: 8px; transform: none; bottom: max(10px, env(safe-area-inset-bottom)); padding: 6px 6px 6px 10px; gap: 6px; font-size: 13px; justify-content: space-between; max-width: none; }
  .sell-long { display: none; } .sell-short { display: inline; }
  #sell .sell-txt { overflow: hidden; text-overflow: clip; min-width: 0; flex: 1 1 auto; white-space: normal; line-height: 1.15; }
  .sbtn { height: 30px; padding: 0 10px; flex: none; }
}
@media (max-width: 360px) { #sell b { display: none; } }

/* ---------- lightbox (a 1-bit window) ---------- */
#lightbox { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(7, 8, 11, .62); opacity: 0; pointer-events: none; transition: opacity .25s; padding: 16px; }
#lightbox.on { opacity: 1; pointer-events: auto; }
#lightbox .win { width: min(1100px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); transform: scale(.96); transition: transform .25s; }
#lightbox.on .win { transform: none; }
.tbar { position: relative; height: 24px; border-bottom: 1px solid var(--ink); display: flex; align-items: center; justify-content: center; background: repeating-linear-gradient(180deg, var(--paper) 0 4px, var(--ink) 4px 5px, var(--paper) 5px 6px) 0 0 / 100% 100% no-repeat; background-clip: content-box; padding: 4px 3px; }
.tbar span { background: var(--paper); padding: 0 10px; font-size: 15px; }
#lb-close { position: absolute; left: 8px; top: 5px; width: 14px; height: 13px; background: var(--paper); border: 1px solid var(--ink); }
#lb-img { display: block; width: 100%; min-height: 0; flex: 1 1 auto; object-fit: contain; background: #0c0c0e; max-height: calc(100vh - 170px); }
.lb-foot { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--ink); }
.lb-foot p { margin: 0; font-size: 14px; line-height: 1.35; max-height: 6.8em; overflow-y: auto; padding-right: 6px; }
#lb-open { flex: none; padding: 5px 14px; border: 1px solid var(--ink); border-radius: 6px; outline: 2px solid var(--ink); outline-offset: 2px; background: var(--paper); font-size: 14px; }
.nos { position: fixed; inset: auto 16px 16px; color: var(--paper); }
@media (max-width: 640px) { .lb-foot { flex-direction: column; align-items: stretch; } }
@media (prefers-reduced-motion: reduce) { #gl { transition-duration: .01s; } }

/* ---------- Октет the guide ---------- */
#guide { position: fixed; inset: 0; z-index: 25; pointer-events: none; display: none; }
#guide.on { display: block; }
#g-img { position: absolute; left: 0; top: 0; width: var(--sz, 176px); height: var(--sz, 176px); transition: transform .7s cubic-bezier(.34, 1.42, .6, 1); pointer-events: auto; user-select: none; }
#guide.instant #g-img { transition: none; }
#g-bubble { position: absolute; left: 0; top: 0; pointer-events: auto; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); padding: 10px 12px 9px; font-size: 15px; line-height: 1.32; opacity: 0; transition: opacity .25s ease .15s; box-sizing: border-box; }
#g-bubble.on { opacity: 1; }
#g-text { margin: 0; overflow-wrap: anywhere; }
.g-btns { display: flex; gap: 6px; margin-top: 9px; align-items: center; flex-wrap: wrap; }
.g-sp { flex: 1 1 0; }
.g-btns button { height: 26px; padding: 0 10px; border: 1px solid var(--ink); border-radius: 6px; background: var(--paper); color: var(--ink); font-size: 14px; white-space: nowrap; }
.g-btns button.def { outline: 2px solid var(--ink); outline-offset: 2px; margin: 0 3px; }
.g-btns button:hover { background: var(--ink); color: var(--paper); }
#g-skip { border-color: transparent !important; text-decoration: underline; padding: 0 4px !important; }
#g-hint { position: fixed; left: 0; top: 0; z-index: 21; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); padding: 5px 10px; font-size: 14px; pointer-events: none; opacity: 0; transition: opacity .4s; white-space: nowrap; }
#g-hint.on { opacity: 1; animation: ghint 1.6s ease-in-out infinite; }
#g-hint::after { content: ''; position: absolute; left: var(--tx, 50%); bottom: -7px; width: 10px; height: 10px; background: var(--paper); border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); transform: translateX(-50%) rotate(45deg); }
@keyframes ghint { 50% { margin-top: -4px; } }
#guide.last .g-btns button.def { flex: 1 0 100%; order: 9; margin: 5px 3px 3px; height: 30px; }
/* desktop: the bar and the guide bubble scale with the viewport (phones keep their own sizes above) */
@media (min-width: 761px) {
  #sell { font-size: clamp(15px, 0.42vw + 9px, 22px); gap: clamp(10px, 0.6vw, 16px); padding: clamp(8px, 0.45vw, 12px) clamp(9px, 0.5vw, 13px) clamp(8px, 0.45vw, 12px) clamp(14px, 0.9vw, 22px); bottom: max(clamp(14px, 1.1vw, 26px), env(safe-area-inset-bottom)); }
  .sbtn { height: clamp(32px, 0.75vw + 24px, 46px); padding: 0 clamp(12px, 0.75vw, 20px); border-radius: 7px; }
  .sbtn.def { background: var(--ink); color: var(--paper); outline-offset: 3px; margin-left: 6px; margin-right: 4px; }
  .sbtn.def:hover { background: var(--paper); color: var(--ink); }
  #g-bubble { font-size: clamp(15px, 0.3vw + 11px, 20px); padding: .7em .85em .6em; }
  .g-btns { gap: .45em; margin-top: .65em; }
  .g-btns button { height: 1.95em; padding: 0 .75em; font-size: .94em; }
  #guide.last .g-btns button.def { height: 2.2em; background: var(--ink); color: var(--paper); }
  #guide.last .g-btns button.def:hover { background: var(--paper); color: var(--ink); }
}
@media (min-width: 761px) and (max-width: 1000px) { #sell { font-size: 14px; } }

#shy-tip { position: fixed; left: 0; top: 0; z-index: 21; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); padding: 5px 10px; font-size: 14px; pointer-events: none; opacity: 0; transition: opacity .35s; white-space: nowrap; }
#shy-tip.on { opacity: 1; }
#shy-hearts { position: fixed; left: 0; top: 0; z-index: 21; width: 60px; height: 40px; filter: drop-shadow(0 0 1.5px #fff); pointer-events: none; opacity: 0; transition: opacity .35s; }
#shy-hearts.on { opacity: 1; }
#shy-hearts i { position: absolute; bottom: 0; width: 14px; height: 13px; background: #ff5a6a; clip-path: polygon(50% 100%, 4% 52%, 0 30%, 8% 8%, 28% 0, 50% 18%, 72% 0, 92% 8%, 100% 30%, 96% 52%); }
#shy-hearts.on i { animation: shyup 1.8s ease-out forwards; }
#shy-hearts i:nth-child(1) { left: 6px; }
#shy-hearts i:nth-child(2) { left: 26px; animation-delay: .25s; }
#shy-hearts i:nth-child(3) { left: 44px; animation-delay: .5s; }
@keyframes shyup { from { transform: translateY(0) scale(.6); opacity: 0; } 20% { opacity: 1; } to { transform: translateY(-46px) scale(1.1); opacity: 0; } }

/* the wall lightbox plays videos; a clear close button with an x (32 px hit area on touch) */
#lb-vid { display: none; width: 100%; min-height: 0; flex: 1 1 auto; object-fit: contain; background: #0c0c0e; max-height: calc(100vh - 170px); }
#lb-close { left: 6px; top: 3px; width: 20px; height: 18px; padding: 0; display: grid; place-items: center; cursor: pointer; }
#lb-close svg { width: 11px; height: 11px; stroke: var(--ink); stroke-width: 1.7; fill: none; }
#lb-close:hover { background: var(--ink); } #lb-close:hover svg { stroke: var(--paper); }
#lb-close::before { content: ''; position: absolute; inset: -6px; }
@media (pointer: coarse) { #lb-close::before { inset: -10px -12px -10px -8px; } }

/* phones: the OS full screen as a flat CRT with a thin beige bezel */
#flat { position: fixed; z-index: 15; display: none; box-sizing: border-box; padding: 7px; background: #d8cfba; border-radius: 16px; box-shadow: 0 0 0 1px #8f8672, 0 10px 40px rgba(0,0,0,.55); opacity: 0; transform: scale(.94); transition: opacity .28s ease, transform .32s cubic-bezier(.2,.9,.3,1); }
body.flat #flat { display: block; }
#flat.on { opacity: 1; transform: none; }
#flat .scr { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 10px; background: #f6f4ec; box-shadow: inset 0 0 0 1px #1a1a1c; }
#flat .scr canvas { display: block; }
#flat .scr::after { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: 10px;
  background: repeating-linear-gradient(180deg, rgba(0,0,0,.045) 0 1px, transparent 1px 3px), radial-gradient(120% 100% at 50% 50%, transparent 62%, rgba(20,18,14,.28) 100%);
  box-shadow: inset 0 0 18px rgba(255,255,240,.25); }
body.flat-land #sell, body.flat-guide #sell { display: none; }

/* AERO TV: the YouTube player laid over the OS window on the screen (always visible while it plays) */
.yt-screen { position: fixed; left: 0; top: 0; z-index: 16; transform-origin: 0 0; background: #000; }
.yt-screen iframe { display: block; width: 100%; height: 100%; border: 0; }

/* «Заказать»: the same chip as «звук», to its left; on phones a round corner button */
#order { position: fixed; z-index: 20; top: max(14px, env(safe-area-inset-top)); right: 150px; height: 34px; padding: 0 14px; display: flex; align-items: center; gap: 8px; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); font-size: 15px; text-decoration: none; }
#order svg { width: 16px; height: 16px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; }
#order:hover { background: var(--ink); color: var(--paper); } #order:hover svg { stroke: var(--paper); }
#order:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
body.poster-mode #order { display: none; }
@media (max-width: 760px) {
  #order { top: auto; right: max(14px, env(safe-area-inset-right)) !important; bottom: max(14px, env(safe-area-inset-bottom)); width: 48px; height: 48px; padding: 0; border-radius: 50%; justify-content: center; }
  #order span { display: none; } #order svg { width: 22px; height: 22px; }
  body.flat #order, body.guide-on #order { display: none; }
}
#bell-hint { position: fixed; left: 0; top: 0; z-index: 21; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); padding: 5px 10px; font-size: 14px; pointer-events: none; opacity: 0; transition: opacity .4s; white-space: nowrap; }
#bell-hint.on { opacity: 1; animation: ghint 1.6s ease-in-out infinite; }
#bell-hint::after { content: ''; position: absolute; left: var(--tx, 50%); bottom: -7px; width: 10px; height: 10px; background: var(--paper); border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); transform: translateX(-50%) rotate(45deg); }
#order svg .f { fill: var(--ink); stroke: none; } #order:hover svg .f { fill: var(--paper); }

/* the receipt from under the bell: a Soviet service form on thin paper, slides out from the bell to the middle */
#receipt { position: fixed; inset: 0; z-index: 40; display: none; perspective: 1400px; background: rgba(4, 5, 8, 0); transition: background .45s; }
#receipt.show { display: block; }
#receipt.on { background: rgba(4, 5, 8, .42); }
.rc-paper { --rx: 50vw; --ry: 80vh; position: absolute; left: 50%; top: 50%; width: min(380px, calc(100vw - 32px)); padding: 18px 20px 20px;
  color: #23305e; font: 15px/1.35 'Arial Narrow', 'Roboto Condensed', 'Liberation Sans Narrow', Arial, sans-serif; font-stretch: condensed; -webkit-font-smoothing: antialiased;
  background: radial-gradient(120% 80% at 30% 10%, #fbf6e9 0%, #f1e8d2 70%, #e7dbbd 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 18px 40px rgba(0,0,0,.45), 0 3px 8px rgba(0,0,0,.3);
  transform-origin: 50% 0; transform: translate(calc(var(--rx) - 50vw - 50%), calc(var(--ry) - 50vh)) rotateX(68deg) scale(.22); opacity: 0;
  transition: transform .62s cubic-bezier(.2, .9, .25, 1.06), opacity .25s; }
#receipt.on .rc-paper { transform: translate(-50%, -50%) rotateX(4deg) rotateZ(-1.2deg); opacity: 1; }
#receipt.out .rc-paper { transition: transform .45s cubic-bezier(.5, 0, .8, .4), opacity .3s .15s; }
/* the curl: the bottom right corner lifts and throws a shadow */
.rc-paper::after { content: ''; position: absolute; right: 0; bottom: 0; width: 46px; height: 46px; background: linear-gradient(135deg, rgba(0,0,0,0) 48%, rgba(0,0,0,.22) 50%, #efe4ca 52%, #fffaf0 75%, #e2d4b2 100%);
  box-shadow: -3px -3px 6px rgba(0,0,0,.12); border-top-left-radius: 70% 40%; pointer-events: none; }
.rc-paper::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(0deg, rgba(60,70,120,.05) 0 1px, transparent 1px 22px); }
.rc-top { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid #23305e; padding-bottom: 6px; }
.rc-title { margin: 12px 0 8px; font-size: 25px; font-weight: 700; letter-spacing: .12em; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.rc-title span { font-size: 17px; letter-spacing: 0; font-weight: 400; } .rc-title b { font-family: 'Courier New', monospace; font-size: 19px; color: #3a3a40; }
.rc-row { display: flex; gap: 10px; align-items: baseline; margin: 5px 0; }
.rc-row span { flex: none; font-size: 13px; }
.rc-row b { flex: 1; font: 16px 'Courier New', monospace; color: #3a3a40; border-bottom: 1px dotted #23305e; padding: 0 2px 1px; }
.rc-sub { margin: 14px 0 6px; font-size: 13px; }
.rc-line { display: flex; width: 100%; align-items: center; gap: 12px; padding: 9px 4px; margin: 0; border: 0; border-bottom: 1px solid rgba(35,48,94,.55); background: none; color: inherit; font: inherit; font-size: 18px; text-align: left; cursor: pointer; }
.rc-line:hover span, .rc-line:focus-visible span { text-decoration: underline; text-underline-offset: 3px; }
.rc-line:focus-visible { outline: 1px dashed #23305e; outline-offset: 1px; }
.rc-box { flex: none; width: 22px; height: 22px; border: 1.5px solid #23305e; display: grid; place-items: center; }
.rc-box svg { width: 22px; height: 22px; fill: none; stroke: #3a3a40; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; transform: translate(2px, -3px); }
.rc-line.ticked .rc-box svg { transition: stroke-dashoffset .22s ease-out; stroke-dashoffset: 0; }
.rc-foot { display: flex; justify-content: space-between; align-items: baseline; margin-top: 16px; font-size: 13px; }
.rc-sign { font: italic 22px 'Segoe Script', 'Brush Script MT', cursive; color: #3a3a40; transform: rotate(-6deg); }
.rc-stamp { position: absolute; right: 26px; bottom: 34px; padding: 6px 12px 4px; border: 3px double #2c50c4; border-radius: 6px; color: #2c50c4; text-align: center; transform: rotate(-14deg) scale(2.4); opacity: 0;
  mix-blend-mode: multiply; filter: url(#ink); pointer-events: none; }
.rc-stamp span { display: block; font: 700 26px/1 'Arial Narrow', Arial, sans-serif; letter-spacing: .14em; }
.rc-stamp small { display: block; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; margin-top: 2px; }
.rc-stamp.slam { animation: rcslam .32s cubic-bezier(.3, 0, .4, 1) forwards; }
@keyframes rcslam { 0% { opacity: 0; transform: rotate(-14deg) scale(2.4); } 70% { opacity: .95; transform: rotate(-11deg) scale(.94); } 100% { opacity: .88; transform: rotate(-11deg) scale(1); } }
.rc-paper.thud { animation: rcthud .25s ease-out; }
@keyframes rcthud { 0% { margin-top: 0; } 30% { margin-top: 3px; } 100% { margin-top: 0; } }
@media (prefers-reduced-motion: reduce) { .rc-paper { transition-duration: .01s; } .rc-stamp.slam { animation-duration: .01s; } }
.rc-top span:last-child { white-space: nowrap; }

/* ---------------------------------------------------------------- phase 2: the TV corner (the shop) */
#tvbtn { position: fixed; z-index: 20; top: max(14px, env(safe-area-inset-top)); right: 290px; height: 34px; padding: 0 14px; display: flex; align-items: center; gap: 8px; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); font-size: 15px; text-decoration: none; }
#tvbtn svg { width: 17px; height: 17px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#tvbtn:hover { background: var(--ink); color: var(--paper); } #tvbtn:hover svg { stroke: var(--paper); }
#tvbtn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
body.poster-mode #tvbtn, body.in-tv #tvbtn, body.in-tv #order, body.in-mac #tvbtn, body.in-tv #sound { display: none; }
@media (max-width: 760px) {
  #tvbtn { top: auto; right: max(14px, env(safe-area-inset-right)) !important; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 60px); width: 48px; height: 48px; padding: 0; border-radius: 50%; justify-content: center; }
  #tvbtn span { display: none; } #tvbtn svg { width: 22px; height: 22px; }
  body.flat #tvbtn, body.guide-on #tvbtn { display: none; }
}
#tv-wait { position: fixed; z-index: 46; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 10px 18px; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); font-size: 16px; opacity: 0; transition: opacity .3s; pointer-events: none; }
#tv-wait.on { opacity: 1; animation: ghint 1.6s ease-in-out infinite; }
#tvbtn[hidden] { display: none !important; }
