﻿:root {
  --ink: #141210;
  --parchment: #efe3c8;
  --gold: #c9a227;
  --azure: #2b4a7a;
  --cinnabar: #9e2b25;
  --font-display: 'Ruslan Display', cursive;
  --font-print: 'Old Standard TT', serif;
  --font-ui: 'Alegreya Sans', sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-ui); background: var(--ink); color: var(--parchment); min-height: 100vh; overflow: hidden; }
.hidden { display: none !important; }

.screen-bg { position: relative; margin: 0 auto; width: min(100vw, calc(100vh * (1200 / 900))); aspect-ratio: 1200 / 900; }
#screenStart { width: 100vw; height: 100vh; aspect-ratio: auto; }
#screenChat { width: min(100vw, calc(100vh * (16 / 9))); aspect-ratio: 16 / 9; }
.screen-bg img { width: 100%; height: 100%; display: block; object-fit: cover; }
.zone { position: absolute; background: transparent; border: none; cursor: pointer; }
.zone.locked { cursor: not-allowed; }

#zoneNevsky { left: 29.610%; top: 25.872%; width: 13.490%; height: 32.222%; }
#zoneIvan { left: 56.510%; top: 25.741%; width: 13.490%; height: 32.222%; }
#zoneBook { left: 5.573%; top: 52.685%; width: 10.729%; height: 22.084%; }
#zoneJug { left: 83.385%; top: 51.204%; width: 13.490%; height: 24.960%; }
#zoneStartBtn { left: 37.604%; top: 84.352%; width: 25.938%; height: 11.936%; background: url('assets/btn-start.png') center / contain no-repeat; }

#zoneHelm { left: 21.615%; top: 79.074%; width: 8.646%; height: 15.370%; }
#zoneScroll { left: 43.750%; top: 78.611%; width: 8.646%; height: 15.370%; }
#zoneBell { left: 68.021%; top: 78.796%; width: 8.646%; height: 15.370%; }

/* ===== экран беседы: оверлеи прямо на арт (холст 1920x1080) ===== */
#chatDialog { position: absolute; left: 58.542%; top: 24.630%; width: 30.260%; height: 17.870%; display: flex; flex-direction: column; gap: 3px; z-index: 2; }
.chat-log { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 4px 6px; }
#penIndicator { flex: 0 0 auto; text-align: center; font-family: var(--font-print); font-style: italic; font-size: clamp(8px, 1vw, 12px); color: var(--cinnabar); pointer-events: none; }
.chat-controls { flex: 0 0 auto; display: flex; align-items: center; gap: 5px; }
.chat-input { flex: 1 1 auto; min-width: 0; font-family: var(--font-ui); font-size: clamp(9px, 1.1vw, 13px); background: rgba(255,255,255,.55); border: 1px solid rgba(20,18,16,.3); border-radius: 6px; padding: 4px 7px; color: var(--ink); }
.chat-input::placeholder { color: rgba(20,18,16,.5); }
.chat-send { flex: 0 0 auto; width: clamp(22px, 3vw, 34px); height: clamp(20px, 2.6vw, 30px); border: none; border-radius: 6px; background: var(--gold); color: var(--ink); font-size: clamp(10px, 1.4vw, 16px); cursor: pointer; }
.chat-send:hover { filter: brightness(1.08); }

.msg { padding: 3px 6px; border-radius: 6px; max-width: 94%; font-size: clamp(8px, 1vw, 12px); line-height: 1.3; }
.msg.user { align-self: flex-end; background: var(--azure); color: #f4efe2; font-family: var(--font-ui); }
.msg.prince { align-self: flex-start; background: rgba(20,18,16,.07); color: var(--ink); border: 1px solid rgba(20,18,16,.18); font-family: var(--font-print); }
.msg .seal { display: inline-block; margin-top: 3px; margin-left: 4px; font-family: var(--font-ui); font-size: clamp(7px, .9vw, 10px); color: var(--cinnabar); border: 1px solid var(--cinnabar); border-radius: 999px; padding: 0 6px; cursor: pointer; background: transparent; }
.fact-card { background: var(--parchment); color: var(--ink); border-radius: 6px; padding: 4px 6px; font-family: var(--font-print); font-size: clamp(7px, .9vw, 11px); box-shadow: 0 1px 4px rgba(0,0,0,.35); }

/* лента вопросов (строится qwen-ui-upgrade.js внутри #chatTapeHost) */
#chatTapeHost { position: absolute; left: 58.958%; top: 45.185%; width: 29.271%; height: 11.759%; z-index: 2; }
.qwen-tape { position: static; display: block; width: 100%; height: 100%; }
.qwen-tape-track { display: flex; gap: 1.5%; width: 100%; height: 100%; overflow-x: auto; overflow-y: hidden; }
.qwen-tape-item { position: relative; flex: 0 0 24%; height: 100%; cursor: pointer; }
.qwen-tape-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.qwen-tape-text { position: absolute; z-index: 1; inset: 0; box-sizing: border-box; padding: 6% 8% 14%; font-family: var(--font-print); font-size: clamp(6px, .85vw, 10px); line-height: 1.1; color: #141210; word-wrap: break-word; overflow-wrap: break-word; overflow: hidden; text-align: center; display: flex; align-items: center; justify-content: center; }
.qwen-tape-item.qwen-noimg { background: #efe3c8; border: 2px double #9e2b25; border-radius: 4px; }
.qwen-tape-item:hover .qwen-tape-text { color: #9e2b25; }

/* невидимая кликабельная зона поверх печати «Источник» на арте */
#chatSealBtn { position: absolute; left: 64.063%; top: 58.056%; width: 5.365%; height: 8.148%; background: transparent; border: none; cursor: pointer; z-index: 2; }

/* ===== летопись ===== */
#chronicleList { left: 59%; top: 29%; width: 34%; height: 16%; }
.desk-scroll { position: absolute; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 6px; }
.desk-badges { position: absolute; inset: 0; pointer-events: none; }
.badgeSlot { position: absolute; top: 46%; width: 9%; height: 11%; display: flex; align-items: center; justify-content: center; font-family: var(--font-ui); font-size: clamp(6px, 1vw, 10px); color: var(--cinnabar); text-align: center; }
#badge1 { left: 61%; }
#badge2 { left: 72%; }
#badge3 { left: 83%; }
#zoneBack { left: 78%; top: 58%; width: 9%; height: 10%; }
#zoneHome2 { left: 15%; top: 84%; width: 10%; height: 10%; }
#zoneChron2 { left: 45%; top: 84%; width: 10%; height: 10%; }
#zoneTeacher2 { left: 75%; top: 84%; width: 10%; height: 10%; }

/* ===== пергаментные модалки: правила и эпохи ===== */
.parch-modal { position: fixed; inset: 0; z-index: 80; background: rgba(20,18,16,.72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.scroll-panel { background: #F5E6C8; color: var(--ink); font-family: var(--font-print); width: min(92vw, 560px); max-height: 86vh; overflow-y: auto; padding: 26px 30px 22px; border-radius: 10px; border: 3px double #8B6914; box-shadow: 0 10px 44px rgba(0,0,0,.65), inset 0 0 60px rgba(139,105,20,.12); text-align: center; }
.scroll-panel h2 { font-family: var(--font-display); color: var(--cinnabar); font-size: clamp(18px, 3vw, 28px); margin-bottom: 14px; letter-spacing: .03em; }
.rules-list { list-style: none; counter-reset: rule; text-align: left; margin: 0 0 14px; padding: 0; }
.rules-list li { counter-increment: rule; position: relative; padding-left: 32px; margin-bottom: 10px; font-size: clamp(12px, 1.6vw, 16px); line-height: 1.4; }
.rules-list li::before { content: counter(rule) '.'; position: absolute; left: 6px; top: 0; color: var(--cinnabar); font-weight: 700; }
.rules-list b { color: var(--azure); }
.scroll-motto { font-style: italic; font-size: clamp(12px, 1.7vw, 17px); margin: 4px 0 16px; }
.seal-close { width: 76px; height: 76px; border-radius: 50%; border: none; cursor: pointer; background: radial-gradient(circle at 35% 30%, #c05a50, #9e2b25 62%, #7a1f1a 100%); color: #F5E6C8; font-family: var(--font-display); font-size: 11px; letter-spacing: .04em; box-shadow: 0 4px 12px rgba(0,0,0,.55), inset 0 0 0 3px rgba(245,230,200,.28), inset 0 -6px 12px rgba(0,0,0,.35); }
.seal-close:hover { filter: brightness(1.1); }
.ep-group { text-align: left; font-weight: 700; color: var(--azure); font-size: clamp(12px, 1.5vw, 15px); margin: 10px 0 5px; }
.ep-list { list-style: none; margin: 0 0 6px; padding: 0; text-align: left; }
.ep-list li { margin-bottom: 6px; font-size: clamp(12px, 1.6vw, 16px); }
.ep-active { color: var(--gold); font-weight: 700; text-shadow: 0 1px 0 rgba(20,18,16,.25); }
.ep-soon { color: #8a8578; }
.soon-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border: 1px solid #8a8578; border-radius: 999px; font-size: .72em; font-style: normal; color: #8a8578; }

#teacher { position: fixed; inset: 0; background: rgba(20,18,16,.75); display: flex; align-items: center; justify-content: center; z-index: 60; }
.teacher-panel { background: var(--parchment); color: var(--ink); padding: 24px; border-radius: 12px; max-width: 420px; font-family: var(--font-print); text-align: center; border: 2px solid var(--gold); }
.teacher-panel h2 { font-family: var(--font-display); color: var(--cinnabar); margin-bottom: 10px; }
#teacherClose { margin-top: 14px; font-family: var(--font-ui); font-weight: 700; background: var(--gold); color: var(--ink); border: none; border-radius: 8px; padding: 8px 16px; cursor: pointer; }

.qwen-modal { position: fixed; inset: 0; z-index: 99998; display: flex; align-items: center; justify-content: center; background: rgba(20,18,16,.6); padding: 16px; }
.qwen-fact-card { position: relative; width: min(92vw, 520px); aspect-ratio: 194 / 108; max-width: none; }
.qwen-fact-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.qwen-fact-card.qwen-noimg { background: #efe3c8; border: 4px double #9e2b25; border-radius: 10px; aspect-ratio: auto; min-height: 340px; }
.qwen-fact-body { position: absolute; z-index: 1; left: 12%; right: 12%; top: 8%; bottom: 34%; box-sizing: border-box; overflow-y: auto; overflow-x: hidden; font-family: var(--font-print); color: #141210; text-align: center; }
.qwen-fact-title { font-family: var(--font-display); color: #9e2b25; font-size: clamp(13px, 2.4vw, 20px); margin: 0 0 4px; text-align: center; }
.qwen-fact-line { margin: 0 0 3px; font-size: clamp(8px, 1.5vw, 12px); line-height: 1.25; text-align: left; }
.qwen-fact-label { font-weight: 700; color: #2b4a7a; }
.qwen-fact-close { position: absolute; z-index: 2; left: 50%; bottom: 6%; transform: translateX(-50%); width: 18%; aspect-ratio: 1 / 1; border-radius: 50%; background: transparent; color: #efe3c8; border: none; font-family: var(--font-display); font-size: clamp(7px, 1.2vw, 11px); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.qwen-toast { position: fixed; left: 50%; bottom: 8%; transform: translateX(-50%); z-index: 99999; box-sizing: border-box; display: flex; align-items: center; justify-content: center; background: #141210; color: #efe3c8; border: 1px solid #c9a227; border-radius: 6px; padding: 6px 14px; font-family: var(--font-print); font-size: clamp(10px, 1.2vw, 13px); line-height: 1.2; text-align: center; max-width: 80vw; white-space: normal; overflow: hidden; opacity: 0; transition: opacity .3s; pointer-events: none; }
.qwen-toast.qwen-show { opacity: 1; }