:root {
  --bg: #101418;
  --fg: #f2f4f6;
  --muted: #aab4bf;
  --accent: #f6c35a;
  --accent-fg: #1a1200;
  --card: rgba(16, 20, 24, 0.86);
  --btn: rgba(255, 255, 255, 0.12);
  --btn-border: rgba(255, 255, 255, 0.25);
  --ok: #7ad67a;
  --warn: #ffb347;
  --bad: #ff7a7a;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--fg);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%; overscroll-behavior: none; touch-action: none;
}
/* екранът при зареждане (app.js: loaderStep / loaderDone) */
#loader {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--fg); transition: opacity 0.5s ease; padding: 16px;
}
#loader.gone { opacity: 0; pointer-events: none; }
.ld-box { text-align: center; width: min(300px, 100%); }
.ld-logo { width: 64px; height: 64px; animation: ld-pulse 1.6s ease-in-out infinite; }
.ld-brand { font-size: 28px; font-weight: 700; letter-spacing: 0.02em; margin-top: 10px; color: var(--accent); }

.ld-bar { height: 4px; border-radius: 2px; background: var(--btn); margin: 24px 0 10px; overflow: hidden; }
.ld-bar i { display: block; height: 100%; width: 8%; background: var(--accent); border-radius: 2px; transition: width 0.5s ease; }
.ld-text { font-size: 13px; color: var(--muted); min-height: 1.4em; }
.ld-detail { display: inline-block; margin-top: 8px; font-size: 11px; opacity: 0.7; word-break: break-word; }
@keyframes ld-pulse { 0%, 100% { opacity: 0.55; transform: scale(0.96); } 50% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .ld-logo { animation: none; } }
/* изборът на стил на картата (app.js: openStylePick); при първото отваряне е над екрана за зареждане */
/* цялото на екрана, без превъртане: височината е видимата (dvh – без адресната лента), картинките се свиват,
   „Продължи“ е винаги отдолу */
#stylePick {
  position: fixed; inset: 0; height: 100vh; height: 100dvh; z-index: 1001; display: flex; align-items: center; justify-content: center; overflow: hidden;
  padding: calc(16px + var(--sat)) 16px calc(16px + var(--sab)); background: var(--bg); transition: opacity 0.3s ease;
}
#stylePick.inapp { background: rgba(10, 13, 16, 0.8); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
#stylePick.leaving { opacity: 0; pointer-events: none; }
.sp-box { position: relative; width: min(560px, 100%); max-height: 100%; margin: auto; text-align: center; display: flex; flex-direction: column; min-height: 0; }
#stylePick.inapp .sp-box { background: var(--card); border-radius: 16px; padding: 16px 14px 14px; }
#stylePick.inapp .sp-brand, #stylePick:not(.inapp) #spClose { display: none; }
#spTitle { flex: none; margin: 6px 0 0; font-size: 20px; }
.sp-brand { flex: none; }
.sp-lead { flex: none; margin: 10px auto 0; max-width: 30em; font-size: 12px; color: var(--muted); }
/* по две в редица (2×2), картинката отгоре, името отдолу */
#spList { flex: 0 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: minmax(0, 1fr); gap: 10px; margin-top: 12px; }
.sp-card {
  display: flex; flex-direction: column; padding: 0; overflow: hidden; text-align: left; font: inherit; color: var(--fg);
  background: var(--btn); border: 2px solid transparent; border-radius: 12px; cursor: pointer; position: relative; min-height: 0;
}
.sp-card img { display: block; width: 100%; aspect-ratio: 4 / 3; flex: 1 1 auto; min-height: 0; object-fit: cover; background: #1c232a; }
.sp-card b { flex: none; padding: 7px 10px 8px; font-size: 15px; }
.sp-card.cur { border-color: var(--accent); }
.sp-card:not(:disabled):hover, .sp-card:not(:disabled):focus-visible { border-color: var(--accent); outline: none; }
.sp-card:disabled { cursor: default; opacity: 0.55; }
.sp-card:disabled img { filter: grayscale(1); }
.sp-card i { position: absolute; top: 8px; left: 8px; padding: 2px 8px; border-radius: 10px; font-style: normal; font-size: 11px;
  background: rgba(16, 20, 24, 0.85); color: var(--fg); }
#spClose { position: absolute; top: 8px; right: 8px; }
.sp-foot { flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 12px; }
#spGo { flex: 1 1 auto; max-width: 100%; padding: 12px 18px; border-radius: 12px; font-size: 16px; }
#spList > .sp-card:last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; width: calc(50% - 5px); } /* нечетният последен – в средата */
.sp-remember { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; margin-top: 0; font-size: 14px; color: var(--muted); cursor: pointer; }
.sp-remember input { width: 18px; height: 18px; margin: 0; padding: 0; flex: none; accent-color: var(--accent); }
/* описанието на избрания стил; „Фотореалистичен“ – червено съобщение. Височината е постоянна (три реда): нищо не мърда */
.sp-note { flex: none; box-sizing: border-box; min-height: calc(4.2em + 18px); margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 1.4;
  display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); background: transparent; border: 1px solid transparent; }
.sp-note.hidden { display: none; }
.sp-note.warn { justify-content: flex-start; text-align: left; background: rgba(255, 138, 122, 0.12); border-color: rgba(255, 138, 122, 0.45); color: #ffb3a8; }
#spGo:disabled { background: var(--btn); color: var(--muted); opacity: 1; cursor: default; }
#cam {
  position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0;
  background: #000; display: none;
}
#gl { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1; display: block; }
#overlay { position: fixed; inset: 0; z-index: 2; pointer-events: auto; }
.hidden { display: none !important; }

#hud {
  position: absolute; left: 0; right: 0; top: 0; padding: calc(8px + var(--sat)) 12px 8px;
  background: linear-gradient(rgba(0,0,0,.65), rgba(0,0,0,0));
  font-size: 13px; line-height: 1.35; white-space: pre-line; text-shadow: 0 1px 2px #000;
  pointer-events: none;
}
#hint {
  text-align: center; font-size: 15px; padding: 8px 12px; margin: 0 2px 4px; border-radius: 10px;
  background: rgba(0,0,0,.6); text-shadow: 0 1px 2px #000; pointer-events: none;
}

#panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 100%; overflow-y: auto;
  padding: 16px 16px calc(16px + var(--sab)); background: var(--card);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-radius: 16px 16px 0 0; touch-action: pan-y;
}
#panel h1 { margin: 0 0 10px; font-size: 22px; }
#panel .tag { font-size: 13px; color: var(--muted); font-weight: normal; margin-left: 8px; }
#panel .lead { margin: 0 0 14px; color: var(--muted); line-height: 1.4; }
#aboutDetails .note { font-size: 14px; line-height: 1.45; }
#devDetails { margin-top: 10px; border-top: 1px solid var(--btn-border); }
#devDetails > summary { font-size: 13px; }
.caps { font-size: 14px; margin-bottom: 12px; white-space: pre-line; }
.caps .ok { color: var(--ok); } .caps .warn { color: var(--warn); } .caps .bad { color: var(--bad); }

button {
  font: inherit; color: var(--fg); background: var(--btn); border: 1px solid var(--btn-border);
  border-radius: 10px; padding: 12px 14px; min-height: 48px; cursor: pointer; touch-action: manipulation;
}
button.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; font-weight: 600; font-size: 18px; }
button.ghost { background: transparent; }
button:disabled { opacity: .5; }
.actions { display: flex; gap: 10px; margin-bottom: 12px; }
.actions button { flex: 1; }

details { margin-top: 4px; }
summary { cursor: pointer; padding: 8px 0; color: var(--muted); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; margin: 10px 0; }
label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 4px; }
input {
  font: inherit; font-size: 16px; color: var(--fg); background: rgba(255,255,255,.08);
  border: 1px solid var(--btn-border); border-radius: 8px; padding: 8px 10px; width: 100%;
}
.row { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.row button { flex: 1; }
.msg { min-height: 1.4em; margin: 8px 0 0; color: var(--accent); font-size: 14px; }
.foot { margin: 10px 0 0; font-size: 12px; color: var(--muted); }

#controls {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px calc(10px + var(--sab));
  display: flex; flex-direction: column; gap: 8px;
  background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.7));
}
.ctl-row { display: flex; gap: 8px; }
.ctl-row button { flex: 1; padding: 10px 6px; font-size: 14px; background: rgba(0,0,0,.55); }
.ctl-row[data-mode] { display: none; }
#controls[data-mode="xr"] .ctl-row[data-mode="xr"],
#controls[data-mode="compass"] .ctl-row[data-mode="compass"],
#controls[data-mode="view"] .ctl-row[data-mode="view"] { display: flex; }
#controls[data-mode="view"] #btnDisp { display: none; } /* при разглеждане мащабът е приближаването */
#controls, #hud, #overlay.viewing { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; } /* влаченето не бива да маркира текста на бутоните */
#overlay.viewing { cursor: grab; }
#overlay.viewing:active { cursor: grabbing; }
.actions { flex-wrap: wrap; }
.actions #btnView { flex: 1 1 100%; }                    /* главният бутон е сам на ред */
.actions #btnLife, .actions #btnStart { font-size: 15px; } /* „Оживи“ и „Виж го на място“ са под него */
#controls:not([data-mode="view"]) #btnViewAr { display: none; }
.ctl-row button.active { border-color: var(--ok); color: var(--ok); }
.ctl-row[data-mode="view"] button { font-size: 13px; padding: 10px 2px; white-space: nowrap; flex: 1 1 auto; } /* пет бутона на един ред и на тесен телефон: ширината е по надписа */
.ctl-row[data-mode="view"] { gap: 6px; }
/* сцената на превземането: вместо бутоните на разглеждането стои нейният ред с плъзгача */
#controls:not(.siege) #siegeRow, #controls.siege .ctl-row[data-mode="view"]:not(#siegeRow) { display: none !important; }
#siegeRow { align-items: center; }
#siegeRow input[type=range] { flex: 4 1 80px; min-width: 60px; padding: 0; height: 36px; background: transparent; border: 0; accent-color: var(--accent); touch-action: pan-x; }
#siegeRow button { flex: 0 1 auto; padding: 10px 9px; }

@media (min-width: 700px) {
  #panel { left: 50%; transform: translateX(-50%); width: 560px; bottom: 16px; border-radius: 16px; }
}

#planWrap { margin: 4px 0 12px; }
#plan {
  display: block; width: 100%; aspect-ratio: 1 / 1; border-radius: 12px;
  background: #0b0e11; border: 1px solid var(--btn-border); touch-action: none;
}
.plan-row { margin: 8px 0 0; }
.plan-row button { padding: 10px 6px; font-size: 14px; min-height: 42px; }
.plan-row button.active { border-color: var(--ok); color: var(--ok); }

#preset, #tex, #quality {
  font: inherit; font-size: 15px; color: var(--fg); background: rgba(255,255,255,.08);
  border: 1px solid var(--btn-border); border-radius: 10px; padding: 10px 12px; width: 100%; margin-bottom: 8px;
}
.note { margin: 8px 2px 0; font-size: 13px; color: var(--muted); line-height: 1.4; }

#snap {
  position: absolute; inset: 0; z-index: 5; background: rgba(0,0,0,.92); display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: calc(12px + var(--sat)) 12px calc(12px + var(--sab)); gap: 10px;
}
#snap img { max-width: 100%; max-height: 72vh; border-radius: 10px; box-shadow: 0 4px 24px rgba(0,0,0,.6); }
#snap .row { width: 100%; max-width: 480px; }
#controls[data-mode="compass"] [data-xr-only] { display: none; }

/* ---------------------------------------------------------------- разглеждане: карта с котви */
#viewUi { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
#viewUi button, #vCard, .vsheet { pointer-events: auto; }
#overlay.viewing #controls { display: none !important; }   /* старите бутони са само за добавената реалност */
#overlay.viewing #hud { display: none; }
#vTop { position: absolute; left: 0; right: 0; top: 0; padding: calc(8px + var(--sat)) 10px 8px; display: flex; gap: 8px; align-items: center;
  background: linear-gradient(rgba(0,0,0,.45), rgba(0,0,0,0)); }
.vround { width: 46px; min-width: 46px; height: 46px; min-height: 46px; padding: 0; border-radius: 50%; background: rgba(16,20,24,.82); font-size: 18px;
  display: flex; align-items: center; justify-content: center; flex-direction: column; line-height: 1; }
.vchip { flex: 1; min-height: 46px; border-radius: 23px; background: rgba(16,20,24,.82); font-weight: 600; font-size: 16px; display: flex; align-items: center; justify-content: center; gap: 6px; overflow: hidden; white-space: nowrap; }
.vchip .caret { opacity: .7; font-size: 13px; flex: none; }
#vObjName { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#vNorth small { font-size: 9px; color: var(--muted); margin-top: 1px; }
#vNorthArrow { display: inline-block; color: #ff6b5a; font-size: 14px; transition: transform .15s linear; }
/* дясната колона: мащабът и управлението, винаги над картичката (app.js: layoutRight) */
#vRight { position: absolute; right: 10px; bottom: 120px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#vScale { display: flex; flex-direction: column; gap: 6px; }
#vScale button { min-height: 40px; padding: 6px 10px; font-size: 13px; border-radius: 10px; background: rgba(16,20,24,.78); text-align: center; }
#vScale button.active { background: var(--accent); color: var(--accent-fg); border-color: transparent; font-weight: 600; }
#vBottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 10px calc(10px + var(--sab)); display: flex; flex-direction: column; gap: 8px; }
#vHintSlot #hint { margin: 0; pointer-events: none; }
#vCard { background: var(--card); border: 1px solid var(--btn-border); border-radius: 14px; padding: 10px 12px; max-height: 42vh; overflow-y: auto; }
#vCardHead { display: flex; align-items: center; gap: 6px; }
/* езичето над картичката: сваля я надолу (остава само името) и я вдига обратно */
#vCardGrip { align-self: center; width: 64px; height: 24px; min-height: 0; padding: 0; margin-bottom: -9px; border-radius: 12px 12px 0 0; font-size: 15px; line-height: 1; background: var(--card); border: 1px solid var(--btn-border); border-bottom: none; }
#vCard.min #vCardBody, #vCard.min #vCardUp, #vCard.min #vCardSrcBtn, #vCard.min #vCardSrc, #vCard.min #vCardDist { display: none !important; }
#vCardTitle { font-weight: 600; font-size: 16px; min-width: 0; cursor: pointer; text-decoration: underline dotted rgba(255,255,255,.45); text-underline-offset: 4px; } /* името центрира обекта */
#vClean { min-height: 36px; padding: 4px 12px; font-size: 13px; border-radius: 10px; background: rgba(16,20,24,.78); }
/* „Скрий“: лентите се изтеглят към краищата и избледняват; „Покажи“ ги връща (visibility – след края на прехода) */
#vTop, #vScale, #vCtl, #vBottom { transition: opacity .25s ease, transform .25s ease, visibility 0s linear 0s; }
#viewUi.clean #vTop, #viewUi.clean #vScale, #viewUi.clean #vCtl, #viewUi.clean #vBottom { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .25s ease, transform .25s ease, visibility 0s linear .25s; }
#viewUi.clean #vTop { transform: translateY(-16px); }
#viewUi.clean #vBottom { transform: translateY(24px); }
#viewUi.clean #vScale, #viewUi.clean #vCtl { transform: translateX(24px); }
#vRight { transition: bottom .25s ease; }
/* менютата и управлението: влизат отдолу с избледняване, излизат обратно (hideEl – клас .leaving) */
@keyframes vIn { from { opacity: 0; transform: translateY(14px); } }
.vsheet, #vPad { animation: vIn .2s ease-out; }
.vsheet.leaving, #vPad.leaving { opacity: 0; transform: translateY(14px); transition: opacity .18s ease-in, transform .18s ease-in; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .vsheet, #vPad { animation: none; }
  #vTop, #vScale, #vCtl, #vBottom, #vRight { transition: none; }
}
#viewUi.clean #vClean { background: var(--accent); color: var(--accent-fg); border-color: transparent; font-weight: 600; }
/* дългите имена: до два реда, после многоточие; епохата е под името */
#vCardName { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; } /* името (до два реда) и под него епохата; бутоните – на същия ред вдясно */
#vCardTitle { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: anywhere; } /* дългата дума се пренася (със знак за пренасяне, където браузърът може) */
#vCardCentury { color: var(--accent); font-size: 12px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#vCardCentury { flex: 0 1 auto; min-width: 0; }
#vCardToggle { min-height: 30px; padding: 2px 10px; font-size: 13px; background: transparent; }
#vCardBody { font-size: 14px; line-height: 1.4; color: var(--muted); margin-top: 4px; }
#vCard.short #vCardBody { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* „Днес: …“ – какво има на мястото сега; най-отгоре на картичката и на подробната картичка */
.vnow { display: block; color: var(--fg); border-left: 3px solid var(--accent); padding: 1px 0 1px 8px; margin: 2px 0 6px; }
.vnow b { color: var(--accent); font-weight: 600; }
/* „Внимание! Това е възстановка.“ – изречение веднага след „Днес:“, с главни букви и червено */
.vnotice { color: #ff8a7a; text-transform: uppercase; }
#vInfoNow { font-size: 15px; line-height: 1.45; margin: 4px 0 10px; }
#vCardDist { font-size: 13px; margin-top: 6px; color: #8fc4e8; }
#vCardDist:empty { display: none; }
#vCardDist button { min-height: 32px; padding: 4px 8px; margin: 4px 4px 0 0; font-size: 13px; }
#vBar { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
#vViews { min-height: 46px; border-radius: 23px; background: rgba(16,20,24,.82); padding: 0 16px; white-space: nowrap; }
#vTourCtl { display: flex; align-items: center; gap: 2px; min-height: 46px; border-radius: 23px; background: var(--accent); padding: 0 4px; }
#vTourCtl.hidden { display: none; }
#vTourCtl button { min-height: 42px; min-width: 40px; padding: 0 8px; border: 0; background: transparent; color: var(--accent-fg); font-size: 16px; font-weight: 600; border-radius: 20px; }
#vTourCtl button:active { background: rgba(0,0,0,.12); }
#vTourPlay { white-space: nowrap; }
#vMe.on { background: #2f8cff; }
#vMe.follow { background: #2f8cff; box-shadow: 0 0 0 3px rgba(47,140,255,.4); }
.vsheet { position: absolute; left: 8px; right: 8px; bottom: calc(70px + var(--sab)); max-height: 62vh; overflow-y: auto; background: var(--card);
  border: 1px solid var(--btn-border); border-radius: 14px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.vsheet h3 { margin: 6px 4px 2px; font-size: 13px; color: var(--muted); font-weight: 600; }
.vsheet button { text-align: left; min-height: 42px; padding: 8px 12px; font-size: 15px; }
.vsheet button small { color: var(--muted); margin-left: 6px; }
.vsheet button.active { border-color: var(--accent); }
.vtoggle.on { border-color: var(--ok); color: var(--ok); }
/* тематичните слоеве: в менюто „Слоеве“ и в заглавията на групите в списъка */
.vmenuh { margin: 8px 4px 2px; font-size: 13px; color: var(--muted); font-weight: 600; }
#vLayerToggles { display: contents; }
.vlayerh { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vlayerh.off span { opacity: 0.6; }
.vsheet button.vlayersw { min-height: 28px; padding: 2px 10px; font-size: 12px; border-radius: 14px; flex: none; }
.vsheet button.vlayersw:not(.on) { border-color: var(--accent); color: var(--accent); } /* „Покажи“ – слоят е скрит */
.vsheet button.off { opacity: 0.55; }
.vabout { margin: 2px 6px 6px; font-size: 14px; line-height: 1.45; color: var(--fg); }
.vabout.small { font-size: 12.5px; color: var(--muted); }
.vlink { background: transparent; border: 0; color: #8fc4e8; min-height: 30px; padding: 4px 0; font-size: 13px; text-align: left; white-space: normal; line-height: 1.35; }
.vlink:disabled { color: var(--muted); opacity: 1; cursor: default; }
#vCardSrc { font-size: 12.5px; line-height: 1.4; color: var(--muted); border-left: 2px solid var(--btn-border); padding-left: 8px; margin-top: 2px; }
.vsheet { background: #12171c; z-index: 4; box-shadow: 0 -6px 24px rgba(0,0,0,.45); } /* плътни: картичката отдолу не прозира */
#vCtl { width: 150px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#vCtlToggle { min-height: 36px; padding: 4px 12px; font-size: 13px; border-radius: 10px; background: rgba(16,20,24,.78); }
#vCtlToggle.on { background: var(--accent); color: var(--accent-fg); border-color: transparent; font-weight: 600; }
#vCtl #vPad { width: 100%; }
#vPad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
#vPad.hidden { display: none; }
#vPad button { grid-column: span 2; min-height: 42px; padding: 0; font-size: 19px; border-radius: 10px; background: rgba(16,20,24,.78);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#vPad button.wide { grid-column: span 3; font-size: 12.5px; white-space: nowrap; }
#vPad button.held { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
#vCardMore { min-height: 30px; padding: 2px 10px; font-size: 13px; margin-left: auto; background: var(--accent); color: var(--accent-fg); border-color: transparent; border-radius: 15px; font-weight: 600; }
#vCardMore + #vCardToggle { margin-left: 0; }
#vInfo { position: absolute; inset: 0; z-index: 6; background: #12171c; pointer-events: auto; }
#vInfoScroll { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; } /* скролът – само на картичката, без да „дърпа“ страницата */
#vInfo { touch-action: pan-y; }
#vInfoImg { display: block; width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; background: #1b2329; }
#vInfoBody { max-width: 680px; margin: 0 auto; padding: 14px 16px calc(28px + var(--sab)); }
#vInfoBody h2 { margin: 2px 0 2px; font-size: 24px; }
#vInfoCentury { color: var(--accent); font-size: 14px; margin-bottom: 6px; }
#vInfoBody h3 { margin: 18px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
#vInfoBody p { margin: 0 0 10px; font-size: 16px; line-height: 1.55; }
#vInfoSources { margin: 0; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.45; }
#vInfoSources li { margin-bottom: 4px; }
#vInfoActions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; align-items: center; }
#vInfoActions button { min-height: 44px; padding: 8px 16px; border-radius: 12px; }
#vInfoActions button.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; font-weight: 600; }
#vInfoNav { color: #8fc4e8; font-size: 14px; padding: 8px 2px; }
#vInfoClose { position: absolute; top: calc(10px + var(--sat)); right: 10px; z-index: 1; background: rgba(16,20,24,.8); }
#vInfoBody figure { margin: 0 0 16px; }
#vInfoBody figure img { display: block; width: 100%; height: auto; background: #fff; border-radius: 8px; }
#vInfoBody figcaption { font-size: 13px; line-height: 1.4; color: var(--muted); margin-top: 5px; }
.vcardnav { flex: none; min-width: 34px; min-height: 34px; padding: 0 4px; font-size: 26px; line-height: 1; background: transparent; border: 0; color: var(--fg); }
.vcardnav:active { color: var(--accent); }
/* ред „Изглед за QR кода“ — само в картата, отворена от админа (?draft) */
#vAdmin { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; background: var(--card); border: 1px dashed #5aa0e8; border-radius: 12px; padding: 6px 10px; font-size: 13px; }
#vAdmin span { flex: 1 1 100%; color: #5aa0e8; }
#vAdmin button { padding: 6px 10px; font-size: 13px; }
/* източниците като линкове (sources.js): в картичката и в подробната картичка */
#vCardSrc .srclinks { margin-top: 4px; }
#vCardSrc a, #vInfoSources a { color: #9cc9f0; text-decoration: underline; text-underline-offset: 2px; word-break: break-word; }
#vCardSrc a:visited, #vInfoSources a:visited { color: #c3a9e8; }

/* галерията в подробното описание и снимката на цял екран */
.vgallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 0 0 12px; }
.vgallery button { padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: #1b2329; aspect-ratio: 4 / 3; }
.vgallery img { display: block; width: 100%; height: 100%; object-fit: cover; }
#vPhoto { position: absolute; inset: 0; z-index: 8; background: #05070a; display: flex; align-items: center; justify-content: center; touch-action: none; }
#vPhoto.hidden { display: none; }
#vPhotoImg { max-width: 100%; max-height: calc(100% - 90px); object-fit: contain; user-select: none; -webkit-user-drag: none; }
#vPhotoBar { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(14px + var(--sab)); display: flex; gap: 12px; justify-content: space-between; font-size: 14px; line-height: 1.4; color: #e9eef2; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
#vPhotoNum { color: var(--muted); white-space: nowrap; }
#vPhotoPrev, #vPhotoNext { position: absolute; top: 50%; transform: translateY(-50%); font-size: 26px; }
#vPhotoPrev { left: 10px; } #vPhotoNext { right: 10px; }
#vPhotoClose { position: absolute; top: calc(10px + var(--sat)); right: 10px; }
