:root {
  --rose: #e0567a;
  --rose-2: #ff8fab;
  --plum: #2a1222;
  --plum-2: #3d1a31;
  --cream: #fff6f3;
  --gold: #d8b277;
  --text: #fbeef2;
  --muted: #d6b3c0;
  --glass: rgba(42, 18, 34, 0.62);
  --border: rgba(255, 190, 210, 0.22);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: Nunito, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--plum); color: var(--text); font-family: var(--sans); }
[hidden] { display: none !important; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#scene.dragging { cursor: grabbing; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Ортақ ---------- */
.glass { background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--border); border-radius: 16px; }
.card { position: relative; width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; background: linear-gradient(160deg, #3d1a31, #24101d); border: 1px solid var(--border); border-radius: 22px; padding: 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
h1, h2 { font-family: var(--serif); font-weight: 700; margin: 0 0 6px; letter-spacing: 0.3px; }
h1 { font-size: 40px; text-align: center; }
h2 { font-size: 30px; }
.muted { color: var(--muted); margin: 0 0 18px; }
label { display: block; margin: 14px 0 0; font-size: 14px; font-weight: 700; color: var(--muted); }
input, select, textarea { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--border); border-radius: 12px; outline: none; font-weight: 600; font-size: 16px; transition: border-color .2s, background .2s; }
input:focus, select:focus, textarea:focus { border-color: var(--rose-2); background: rgba(255, 255, 255, 0.11); }
select option { background: var(--plum-2); }
textarea { resize: vertical; font-family: var(--serif); font-size: 19px; line-height: 1.4; }
input[type="date"] { color-scheme: dark; }
.field-title { margin: 16px 0 8px; font-size: 14px; font-weight: 700; color: var(--muted); }
.error { color: #ff9aa9; font-weight: 700; margin: 12px 0 0; }

.btn { border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 800; cursor: pointer; background: rgba(255, 255, 255, 0.1); transition: transform .15s, filter .15s, background .2s; }
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--rose-2); outline-offset: 2px; }
.btn.primary { background: linear-gradient(135deg, var(--rose), #c43c6a); color: #fff; box-shadow: 0 8px 24px rgba(224, 86, 122, 0.35); }
.btn.danger { background: rgba(255, 80, 100, 0.18); color: #ffb3bf; }
.btn.danger.confirm { background: #e23a55; color: #fff; }
.btn.big { width: 100%; margin-top: 22px; padding: 15px; font-size: 17px; }
.btn.icon { width: 44px; height: 44px; padding: 0; font-size: 20px; }
.btn:disabled { opacity: .6; cursor: wait; }

/* ---------- Кіру ---------- */
.screen { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: radial-gradient(circle at 30% 20%, #6b2346 0, transparent 45%), radial-gradient(circle at 80% 80%, #4b1f5e 0, transparent 50%), #1f0d19; }
.login-card .logo { font-size: 56px; text-align: center; animation: beat 1.6s infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.15); } 30% { transform: scale(1); } 45% { transform: scale(1.1); } }
.login-card .muted { text-align: center; }
.avatar-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.avatar-pick button { padding: 14px; border-radius: 14px; border: 2px solid var(--border); background: rgba(255, 255, 255, 0.05); font-weight: 800; font-size: 16px; cursor: pointer; transition: .2s; }
.avatar-pick button.active { border-color: var(--rose-2); background: rgba(224, 86, 122, 0.22); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches button { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25); transition: transform .15s; }
.swatches button.active { border-color: #fff; transform: scale(1.12); }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
.top-left { position: absolute; top: 16px; left: 16px; padding: 12px 18px; max-width: 46vw; }
.hud-title { font-family: var(--serif); font-size: 24px; font-weight: 700; line-height: 1.1; }
.hud-days { color: var(--rose-2); font-weight: 800; font-size: 14px; margin-top: 2px; }
.hud-days:empty { display: none; }
.hud-room { margin-top: 6px; font-weight: 700; font-size: 14px; color: var(--muted); }
.top-right { position: absolute; top: 16px; right: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.tool-row { display: flex; gap: 8px; }
.tool-row .btn.primary { height: 44px; }
.online { padding: 8px 14px; font-size: 14px; font-weight: 700; }
.online .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 6px 0 2px; vertical-align: middle; }

#chat { position: absolute; left: 16px; bottom: 16px; width: min(380px, calc(100vw - 32px)); display: flex; flex-direction: column; overflow: hidden; }
#chatLog { max-height: 220px; overflow-y: auto; padding: 12px 14px 4px; font-size: 14.5px; line-height: 1.4; scrollbar-width: thin; }
#chatLog .msg { margin-bottom: 6px; word-wrap: break-word; animation: fadeIn .3s; }
#chatLog .msg b { margin-right: 6px; }
#chatLog .msg time { color: var(--muted); font-size: 11px; margin-left: 6px; opacity: .7; }
#chatLog .sys { color: var(--muted); font-style: italic; font-size: 13px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } }
#chatForm { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--border); }
#chatForm input { margin: 0; padding: 10px 12px; font-size: 15px; }
#chatForm .btn { padding: 0 14px; }

#toast { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); padding: 10px 18px; border-radius: 12px; background: rgba(42, 18, 34, 0.9); border: 1px solid var(--border); font-weight: 700; animation: fadeIn .25s; }

/* Кейіпкер үстіндегі аттар мен хабарлар */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.tag { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; transform: translate(-50%, -100%); will-change: transform; }
.tag .name { padding: 3px 10px; border-radius: 999px; background: rgba(42, 18, 34, 0.75); font-weight: 800; font-size: 13px; white-space: nowrap; border: 1px solid rgba(255, 255, 255, 0.15); }
.tag .bubble { order: -1; max-width: 240px; margin-bottom: 6px; padding: 8px 12px; border-radius: 14px; background: #fff; color: #3b1d2e; font-weight: 700; font-size: 14px; line-height: 1.35; text-align: center; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25); position: relative; opacity: 0; transform: translateY(6px) scale(.9); transition: opacity .25s, transform .25s; word-wrap: break-word; }
.tag .bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-top-color: #fff; border-bottom: 0; }
.tag .bubble.show { opacity: 1; transform: none; }

/* ---------- Телефон: джойстик және ықшам HUD ---------- */
.touch-only { display: none !important; }
body.touch .touch-only { display: revert !important; }
body.touch .desk-only { display: none !important; }
html, body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button, .btn { touch-action: manipulation; }
#hud > * { z-index: 2; }
#joyZone { position: absolute; left: 0; bottom: 0; width: 46vw; height: 58vh; z-index: 1 !important; touch-action: none; }
#joystick { position: absolute; left: calc(22px + env(safe-area-inset-left)); bottom: calc(26px + env(safe-area-inset-bottom)); width: 128px; height: 128px; border-radius: 50%; background: radial-gradient(circle, rgba(42, 18, 34, 0.25), rgba(42, 18, 34, 0.55)); border: 2px solid rgba(255, 190, 210, 0.35); pointer-events: none; opacity: .7; transition: opacity .2s; }
#joystick.active { opacity: 1; bottom: auto; }
#joystick .knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: linear-gradient(135deg, var(--rose-2), #c43c6a); box-shadow: 0 4px 14px rgba(0, 0, 0, .35), inset 0 2px 0 rgba(255, 255, 255, .3); }
#joystick::after { content: "♥"; position: absolute; left: 50%; top: -26px; transform: translateX(-50%); font-size: 13px; color: rgba(255, 214, 224, .7); }
#joystick.active::after { display: none; }
#btnChat { position: relative; }
#btnChat.on { background: rgba(224, 86, 122, .45); }
#btnChat.unread::after { content: ""; position: absolute; top: 6px; right: 6px; width: 10px; height: 10px; border-radius: 50%; background: #ff4d6d; box-shadow: 0 0 0 2px #2a1222; }
#btnView[aria-pressed="true"] { background: rgba(224, 86, 122, .45); }
.btn.icon { display: inline-grid; place-items: center; }
#btnEdit .ico { margin-right: 6px; }
.login-lang { display: flex; justify-content: flex-end; margin: -10px -8px 0 0; }
.help-lang { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); font-weight: 800; color: var(--muted); font-size: 14px; }
.card { max-height: calc(100dvh - 32px); }

body.touch .top-left { top: calc(10px + env(safe-area-inset-top)); left: calc(10px + env(safe-area-inset-left)); padding: 8px 12px; max-width: 52vw; }
body.touch .hud-title { font-size: 17px; }
body.touch .hud-days, body.touch .hud-room { font-size: 12px; }
body.touch .top-right { top: calc(10px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); gap: 8px; }
body.touch .online { font-size: 12px; padding: 6px 10px; }
body.touch #btnEdit { width: 44px; padding: 0; display: inline-grid; place-items: center; }
body.touch #btnEdit .lbl { display: none; }
body.touch #btnEdit .ico { margin: 0; font-size: 18px; }
/* чат телефонда жиулы, 💬 басқанда ашылады */
body.touch #chat { display: none; left: calc(8px + env(safe-area-inset-left)); right: calc(8px + env(safe-area-inset-right)); bottom: calc(8px + env(safe-area-inset-bottom)); width: auto; z-index: 6; }
body.touch #chat.open { display: flex; animation: fadeIn .2s; }
body.touch #chatLog { max-height: 26vh; }
body.touch .prompt { bottom: calc(176px + env(safe-area-inset-bottom)); padding: 13px 22px; font-size: 17px; }
body.touch .prompt kbd { display: none; }
body.touch .stand-btn { bottom: calc(18px + env(safe-area-inset-bottom)); left: auto; right: calc(16px + env(safe-area-inset-right)); transform: none; padding: 14px 18px; font-size: 16px; }
body.touch .stand-btn kbd { display: none; }
body.touch #toast { top: auto; bottom: calc(240px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); text-align: center; font-size: 14px; }
body.touch .tag .name { font-size: 12px; }

/* тік телефон: батырмалар оң жақта бағанмен */
@media (orientation: portrait) and (max-width: 600px) {
  body.touch .top-right { flex-direction: row-reverse; align-items: flex-start; }
  body.touch .tool-row { flex-direction: column; }
  body.touch .online { display: none; }
  body.touch #roomIntro { top: 18vh; }
  body.touch #introTitle { font-size: 32px; }
}
/* көлденең телефон: бәрі ықшамырақ */
@media (orientation: landscape) and (max-height: 520px) {
  body.touch .top-left { max-width: 34vw; padding: 6px 10px; }
  body.touch .hud-title { font-size: 15px; }
  body.touch .hud-days { display: none; }
  body.touch .btn.icon, body.touch #btnEdit { width: 40px; height: 40px; font-size: 18px; }
  body.touch .tool-row { gap: 6px; }
  body.touch #joyZone { width: 40vw; height: 70vh; }
  body.touch #joystick { width: 112px; height: 112px; bottom: calc(14px + env(safe-area-inset-bottom)); }
  body.touch .prompt { bottom: calc(18px + env(safe-area-inset-bottom)); }
  body.touch #toast { bottom: auto; top: calc(12px + env(safe-area-inset-top)); }
  body.touch #roomIntro { top: 9vh; }
  body.touch #introTitle { font-size: 30px; }
  body.touch #introSub { font-size: 16px; }
  body.touch #chatLog { max-height: 34vh; }
  body.touch #chat { left: auto; width: min(420px, 55vw); }
  .card { padding: 20px; }
  .login-card .logo { font-size: 36px; }
  h1 { font-size: 30px; }
}

/* ---------- Модальдар ---------- */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(15, 5, 12, 0.6); backdrop-filter: blur(4px); animation: fadeIn .2s; }
.close { position: absolute; top: 12px; right: 14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.08); font-size: 24px; line-height: 1; cursor: pointer; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; padding: 4px; background: rgba(255, 255, 255, 0.05); border-radius: 14px; }
.tabs button { border: 0; padding: 10px; border-radius: 10px; background: transparent; font-weight: 800; cursor: pointer; }
.tabs button.active { background: rgba(224, 86, 122, 0.3); }
.drop { margin-top: 14px; padding: 18px; border: 2px dashed var(--border); border-radius: 14px; text-align: center; cursor: pointer; color: var(--muted); transition: .2s; }
.drop:hover, .drop.over { border-color: var(--rose-2); background: rgba(224, 86, 122, 0.08); }
.drop input { display: none; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; margin-top: 10px; }
.previews:empty { display: none; }
.previews img, .previews video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.progress { height: 8px; margin-top: 16px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--rose), var(--rose-2)); transition: width .2s; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid2 input { margin: 0; }

.viewer-card { width: min(980px, calc(100vw - 32px)); }
.viewer-media { display: grid; place-items: center; margin: 6px 0 16px; border-radius: 14px; overflow: hidden; background: #12060e; }
.viewer-media img, .viewer-media video { max-width: 100%; max-height: 66vh; display: block; }
.viewer-media .note { width: 100%; padding: 28px 32px; background: #fffaf0; color: #3b1d2e; font-family: var(--serif); font-size: 23px; line-height: 1.5; white-space: pre-wrap; max-height: 62vh; overflow: auto; }
.row-end { display: flex; justify-content: flex-end; }
.help { padding-left: 18px; line-height: 2; }
kbd { display: inline-block; min-width: 26px; padding: 1px 7px; margin-right: 3px; border-radius: 6px; background: rgba(255, 255, 255, 0.12); border: 1px solid var(--border); font-family: var(--sans); font-weight: 800; font-size: 13px; text-align: center; }

/* ---------- v2: мұражай ---------- */
.note-box { margin: 0 0 6px; padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border); font-size: 14px; color: var(--muted); line-height: 1.45; }

#roomIntro { position: absolute; left: 50%; top: 13vh; transform: translateX(-50%); text-align: center; pointer-events: none; opacity: 0; text-shadow: 0 2px 18px rgba(30, 5, 15, 0.85), 0 0 2px rgba(30, 5, 15, .6); width: min(90vw, 760px); }
#roomIntro.show { animation: intro 4.2s ease forwards; }
@keyframes intro { 0% { opacity: 0; transform: translate(-50%, 10px); } 15%, 72% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -6px); } }
#introNum { font-family: var(--sans); font-weight: 800; letter-spacing: 4px; text-transform: uppercase; font-size: 13px; color: #ffd6e0; }
#introTitle { font-family: var(--serif); font-weight: 700; font-size: clamp(34px, 5vw, 58px); line-height: 1.1; color: #fff; margin-top: 4px; }
#introSub { font-family: var(--serif); font-style: italic; font-size: clamp(18px, 2.4vw, 24px); color: #ffe6ec; margin-top: 2px; }

.prompt { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 10px 18px 10px 10px; border-radius: 999px; border: 1px solid rgba(255, 200, 215, .45); background: rgba(42, 18, 34, 0.82); backdrop-filter: blur(10px); color: #fff; font-weight: 800; font-size: 16px; cursor: pointer; animation: promptIn .25s ease, glowPulse 2s ease-in-out infinite; }
.prompt kbd { background: var(--rose); border-color: transparent; color: #fff; }
@keyframes promptIn { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes glowPulse { 50% { box-shadow: 0 0 26px rgba(255, 120, 160, .55); } }
@media (pointer: coarse) { .prompt kbd { display: none; } .prompt { padding: 12px 20px; bottom: 170px; } }

.close.dark { background: rgba(60, 20, 35, 0.08); color: #5a2a3a; }

/* Хат: конверт анимациясы */
.letter-modal { perspective: 1200px; }
.envelope { position: absolute; left: 50%; top: 50%; width: 340px; height: 220px; margin: -110px 0 0 -170px; transition: transform .7s ease, opacity .6s ease; animation: envIn .45s ease; }
@keyframes envIn { from { transform: translateY(30px) scale(.9); opacity: 0; } }
.env-back { position: absolute; inset: 0; border-radius: 10px; background: #e9cdb8; box-shadow: 0 30px 60px rgba(0, 0, 0, .45); }
.env-front { position: absolute; inset: 0; border-radius: 10px; background: linear-gradient(to top right, #f6e3d3 50%, transparent 50.5%) left / 50.5% 100% no-repeat, linear-gradient(to top left, #f3dcc9 50%, transparent 50.5%) right / 50.5% 100% no-repeat; z-index: 3; }
.env-flap { position: absolute; left: 0; right: 0; top: 0; height: 130px; background: #efd6c2; clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; transition: transform .6s ease; z-index: 4; }
.env-seal { position: absolute; left: 50%; top: 104px; width: 52px; height: 52px; margin-left: -26px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #d33a57, #8e0f28); color: #ffd6df; display: grid; place-items: center; font-size: 24px; z-index: 5; box-shadow: 0 4px 10px rgba(0, 0, 0, .3); transition: opacity .3s; }
.letter-modal.flap-open .env-flap { transform: rotateX(180deg); z-index: 1; }
.letter-modal.flap-open .env-seal { opacity: 0; }
.letter-modal.opened .envelope { transform: translateY(60vh) scale(.8); opacity: 0; }
.letter-paper { position: relative; width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; padding: 44px 48px 36px; border-radius: 6px; color: #3a1f2a; background: radial-gradient(circle at 20% 10%, rgba(255, 255, 255, .8), transparent 40%), repeating-linear-gradient(transparent 0 37px, rgba(201, 90, 120, .13) 37px 38px), #fdf6ea; box-shadow: 0 40px 90px rgba(0, 0, 0, .55); opacity: 0; transform: translateY(80px) scale(.6); pointer-events: none; transition: opacity .6s ease, transform .7s cubic-bezier(.2, .9, .3, 1.2); }
.letter-paper::before { content: "♥"; position: absolute; top: 14px; left: 50%; transform: translateX(-50%); color: #c94b6b; font-size: 22px; }
.letter-modal.opened .letter-paper { opacity: 1; transform: none; pointer-events: auto; }
#letterTitle { font-family: var(--serif); font-size: 38px; text-align: center; color: #7d1f3b; margin-bottom: 18px; }
#letterText { font-family: Caveat, var(--serif); font-size: 27px; line-height: 38px; white-space: pre-wrap; }
#letterSign { font-family: Caveat, var(--serif); font-size: 28px; text-align: right; color: #a3304f; margin: 22px 0 0; }

.gift-card { text-align: center; width: min(560px, calc(100vw - 32px)); background: radial-gradient(circle at 50% 0, #6b2140, transparent 60%), linear-gradient(160deg, #3d1a31, #24101d); animation: giftIn .6s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes giftIn { from { transform: scale(.6); opacity: 0; } }
.gift-icon { font-size: 60px; animation: beat 1.6s infinite; }
#giftTitle { font-size: 36px; margin: 6px 0 14px; }
#giftImage { max-width: 100%; max-height: 50vh; border-radius: 14px; margin-bottom: 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, .4); }
#giftText { font-family: var(--serif); font-size: 22px; line-height: 1.5; white-space: pre-wrap; margin: 0; }

/* ---------- v3: болашаққа хаттар ---------- */
.small { font-size: 14px; }
.write-card { width: min(560px, calc(100vw - 32px)); text-align: center; background: radial-gradient(circle at 50% 0, #7a3050, transparent 60%), linear-gradient(160deg, #3d1a31, #24101d); }
.write-card textarea { text-align: left; min-height: 150px; background: #fdf6ea; color: #3a1f2a; font-family: Caveat, var(--serif); font-size: 24px; line-height: 1.35; border-color: transparent; }
.write-card textarea:focus { background: #fffaf2; border-color: var(--rose-2); }
.write-icon { font-size: 50px; animation: fly 3s ease-in-out infinite; }
@keyframes fly { 50% { transform: translate(8px, -6px) rotate(-6deg); } }
.attach { display: block; margin-top: 12px; padding: 12px; border: 2px dashed var(--border); border-radius: 12px; cursor: pointer; color: var(--muted); transition: .2s; }
.attach:hover { border-color: var(--rose-2); background: rgba(224, 86, 122, .08); }
.attach input { display: none; }
.attach em { font-style: normal; opacity: .7; font-weight: 600; }
.write-preview { position: relative; margin-top: 10px; }
.write-preview img { max-width: 100%; max-height: 200px; border-radius: 10px; border: 6px solid #fbf5ea; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.write-preview .btn { position: absolute; top: -8px; right: calc(50% - 130px); width: 32px; height: 32px; padding: 0; border-radius: 50%; background: #e23a55; color: #fff; }
.archive-card { width: min(680px, calc(100vw - 32px)); }
.archive-list { display: grid; gap: 14px; margin-top: 8px; }
.archive-item { padding: 16px 18px; border-radius: 14px; background: #fdf6ea; color: #3a1f2a; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); border-left: 5px solid #e9a35b; }
.archive-item.mine { border-left-color: var(--rose); }
.archive-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.archive-head b { color: #7d1f3b; }
.archive-head time { color: #9a6b7a; font-weight: 700; }
.archive-item p { margin: 8px 0 0; font-family: Caveat, var(--serif); font-size: 23px; line-height: 1.3; white-space: pre-wrap; word-wrap: break-word; }
.archive-item img { display: block; max-width: 100%; max-height: 220px; margin-top: 10px; border-radius: 8px; border: 5px solid #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, .2); }
.archive-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.archive-actions .btn { background: rgba(125, 31, 59, .1); color: #7d1f3b; padding: 8px 12px; font-size: 14px; }
.archive-actions .btn.danger { background: rgba(226, 58, 85, .12); color: #c0223f; }
.archive-actions .btn.danger.confirm { background: #e23a55; color: #fff; }
#letterDate { text-align: center; margin: -12px 0 14px; color: #9a6b7a; font-weight: 700; font-size: 14px; }
#letterDate:empty { display: none; }
#letterImage { display: block; max-width: 100%; max-height: 320px; margin: 0 auto 18px; border: 8px solid #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); transform: rotate(-1.5deg); }
#noAccess a { color: var(--rose-2); font-weight: 800; }

/* ---------- Құпия код ---------- */
.code-card { text-align: center; }
.code-card #codeInput { text-align: center; font-size: 22px; letter-spacing: 3px; margin-top: 4px; }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }

/* ---------- Кинода отыру ---------- */
.stand-btn { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20; background: var(--glass); border: 1px solid var(--border); backdrop-filter: blur(10px); padding: 10px 18px; }
.stand-btn:active { transform: translateX(-50%) scale(.97); }
.stand-btn kbd { margin-left: 6px; font: 700 11px var(--sans); padding: 2px 6px; border-radius: 6px; background: rgba(255,255,255,.12); }

/* ---------- Тіл ауыстырғыш ---------- */
.lang-switch { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid var(--border); gap: 2px; }
.lang-switch button { border: 0; background: transparent; padding: 6px 10px; border-radius: 999px; font-weight: 800; font-size: 12px; letter-spacing: .5px; cursor: pointer; color: var(--muted); }
.lang-switch button.on { background: var(--rose); color: #fff; }
body.touch .btn.icon.glass { background: rgba(42, 18, 34, 0.78); border: 1px solid rgba(255, 190, 210, 0.3); }

/* ---------- «Ты меня любишь?» ---------- */
.ask-screen { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; overflow: hidden; padding: 20px; text-align: center; background: radial-gradient(circle at 50% 35%, #ff8fab 0, #e0567a 30%, #8e1b44 70%, #3d0f22 100%); transition: opacity .6s; }
.ask-screen.leave { opacity: 0; }
.ask-hearts { position: absolute; inset: 0; pointer-events: none; }
.ask-hearts span { position: absolute; bottom: -40px; color: rgba(255, 255, 255, .45); animation: askRise linear infinite; }
@keyframes askRise { to { transform: translateY(-115vh) rotate(25deg); opacity: 0; } }
.ask-box { position: relative; max-width: 640px; }
.ask-emoji { font-size: clamp(64px, 14vw, 110px); line-height: 1; animation: beat 1.5s infinite; }
.ask-screen h1 { font-family: var(--serif); font-size: clamp(40px, 9vw, 76px); color: #fff; margin: 14px 0 6px; text-shadow: 0 4px 24px rgba(80, 0, 30, .45); line-height: 1.05; }
.ask-sub { min-height: 1.5em; margin: 0 0 10px; font-weight: 800; font-size: clamp(17px, 3.6vw, 22px); color: #ffe4ec; }
.ask-buttons { display: flex; justify-content: center; align-items: center; gap: 26px; min-height: 190px; }
.ask-btn { --s: 1; border: 0; border-radius: 999px; padding: 15px 40px; font: 900 24px var(--sans); cursor: pointer; transform: scale(var(--s)); transition: transform .35s cubic-bezier(.2, 1.4, .4, 1), left .35s ease, top .35s ease, opacity .3s; touch-action: manipulation; }
.ask-btn.yes { background: #fff; color: #d23a68; box-shadow: 0 12px 34px rgba(90, 0, 35, .4); }
.ask-btn.yes:hover { filter: brightness(1.04); }
.ask-btn.yes.only { animation: yesPulse 1.2s ease-in-out infinite; }
@keyframes yesPulse { 50% { box-shadow: 0 0 0 18px rgba(255, 255, 255, .18), 0 12px 34px rgba(90, 0, 35, .4); } }
.ask-btn.no { background: rgba(255, 255, 255, .18); color: #fff; border: 2px solid rgba(255, 255, 255, .55); }
.ask-btn.no.flee { position: fixed; z-index: 41; margin: 0; }
.ask-screen.yes .ask-btn.yes { opacity: 0; pointer-events: none; }
.ask-screen .burst { position: absolute; left: 50%; top: 45%; font-size: 30px; pointer-events: none; animation: askBurst 1.6s ease-out forwards; }
@keyframes askBurst { from { transform: translate(-50%, -50%) scale(.3); opacity: 1; } to { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1.2); opacity: 0; } }

/* ---------- Демо ---------- */
body.demo #chat, body.demo #btnChat { display: none !important; }
.demo-bar { position: absolute; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 16px; border-radius: 999px; background: rgba(42, 18, 34, .86); border: 1px solid rgba(255, 190, 210, .35); backdrop-filter: blur(10px); color: #fff; text-decoration: none; font-weight: 800; font-size: 14px; white-space: nowrap; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.demo-bar span { color: var(--muted); }
.demo-bar b { padding: 9px 16px; border-radius: 999px; background: linear-gradient(135deg, var(--rose), #c43c6a); }
.demo-bar:hover b { filter: brightness(1.1); }
body.touch .demo-bar { left: auto; right: calc(12px + env(safe-area-inset-right)); transform: none; font-size: 13px; }
body.touch .demo-bar span { display: none; }
@media (orientation: portrait) and (max-width: 600px) { body.touch.demo .prompt { bottom: calc(190px + env(safe-area-inset-bottom)); } }

/* Кинотеатр: билет / басқару картасы */
.cine-card { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 12px 14px; max-width: calc(100vw - 24px); border-radius: 18px; background: rgba(23, 10, 14, 0.88); border: 1px solid #3a1c26; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 12px 40px rgba(0, 0, 0, .5); color: var(--text); animation: promptIn .25s ease; }
.cine-card[hidden] { display: none; }
.cine-card .ticket { display: flex; flex-direction: column; padding-right: 6px; }
.cine-card .ticket small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; }
.cine-card .ticket strong { font-size: 15px; }
.cine-card .btn.ghost { color: var(--text); border: 1px solid rgba(255, 255, 255, .12); }
body.touch .cine-card { bottom: calc(96px + env(safe-area-inset-bottom)); }
@media (orientation: landscape) and (max-height: 500px) { body.touch .cine-card { bottom: calc(12px + env(safe-area-inset-bottom)); padding: 8px 10px; } }
