/* Просмотр исследований */

.study-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.study-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); color: inherit; text-decoration: none; transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
.study-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.study-pic { position: relative; aspect-ratio: 16 / 10; background: #000; }
.study-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.study-mod { position: absolute; left: 12px; top: 12px; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .9); color: #1d2228; font-size: 12px; font-weight: 700; }
.study-body { padding: 16px 18px 18px; }
.study-body h3 { margin: 0 0 6px; font-size: 17px; line-height: 1.3; }
.study-body p { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.study-body p.muted { margin-top: 4px; color: var(--muted); }
.study-drop { cursor: default; }
.study-drop b { font-size: 16px; }
.study-drop p { max-width: 640px; margin-left: auto; margin-right: auto; }
.study-pick { display: flex; justify-content: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.study-src { margin-top: 18px; font-size: 12.5px; color: var(--muted); }
a.tech { display: block; color: inherit; text-decoration: none; }
.nav a.nav-opt { display: none; }
@media (min-width: 1740px) { .nav a.nav-opt { display: inline-block; } }
@media (max-width: 1320px) { .nav.open a.nav-opt { display: block; } }
@media (max-width: 1080px) { .study-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .study-grid { grid-template-columns: minmax(0, 1fr); } }


body.viewer-mode { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.viewer-mode .header { display: none; }
body.viewer-mode #app { flex: 1; min-height: 0; position: relative; animation: none; }
.viewer-page { position: absolute; inset: 0; overflow: hidden; }

.dv {
  --dv-bg: #0b0d10;
  --dv-panel: #10141a;
  --dv-line: #1f252d;
  --dv-ink: #d7dce2;
  --dv-muted: #8a95a3;
  --dv-accent: #3b82f6;
  position: absolute; inset: 0;
  display: grid; grid-template-rows: 52px 46px minmax(0, 1fr) 28px;
  background: var(--dv-bg); color: var(--dv-ink);
  font-size: 13.5px; line-height: 1.4;
  user-select: none; -webkit-user-select: none;
}
.dv button { font: inherit; }
.dv svg { width: 20px; height: 20px; flex: none; }

.dv-top { display: flex; align-items: center; gap: 12px; padding: 0 10px; background: var(--dv-panel); border-bottom: 1px solid var(--dv-line); min-width: 0; }
.dv-back { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px 7px 6px; border-radius: 8px; color: var(--dv-ink); text-decoration: none; font-weight: 500; white-space: nowrap; }
.dv-back:hover { background: #1a2028; }
.dv-title { flex: 1; min-width: 0; }
.dv-title b { display: block; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-title span { display: block; font-size: 12.5px; color: var(--dv-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-acts { display: flex; gap: 2px; }

.dv-bar { display: flex; align-items: center; gap: 4px; padding: 0 8px; background: #0e1217; border-bottom: 1px solid var(--dv-line); overflow-x: auto; scrollbar-width: none; }
.dv-bar::-webkit-scrollbar { display: none; }
.dv-group { display: flex; align-items: center; gap: 2px; flex: none; }
.dv-sep { width: 1px; height: 22px; background: #262e38; margin: 0 6px; flex: none; }
.dv-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 8px; background: transparent; color: #c2cad3; cursor: pointer; flex: none; }
.dv-btn:hover { background: #1b222b; color: #fff; }
.dv-btn.on { background: var(--dv-accent); color: #fff; }
.dv-btn:disabled { opacity: .32; cursor: default; background: transparent; color: #c2cad3; }
.dv-wide { width: auto; padding: 0 10px; font-size: 13px; font-weight: 600; }
.dv-sel { height: 32px; padding: 0 8px; border: 1px solid #29313c; border-radius: 8px; background: #141a21; color: var(--dv-ink); font: inherit; font-size: 13px; cursor: pointer; }
.dv-sel:focus { outline: 1px solid var(--dv-accent); }

.dv-body { position: relative; overflow: hidden; display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 0; }
.dv-side { position: relative; overflow-y: auto; padding: 8px 8px 16px; background: var(--dv-panel); border-right: 1px solid var(--dv-line); scrollbar-width: thin; scrollbar-color: #2a323d transparent; }
.dv-study { margin-bottom: 8px; border-radius: 10px; }
.dv-study-h { display: block; width: 100%; padding: 7px 8px; border: 0; border-radius: 8px; background: none; color: inherit; text-align: left; cursor: pointer; }
.dv-study-h:hover { background: #171d25; }
.dv-study-h b { display: block; font-size: 13px; font-weight: 600; line-height: 1.3; }
.dv-study-h span { display: block; margin-top: 2px; font-size: 12px; color: var(--dv-muted); }
.dv-study.on { background: #141a21; }
.dv-study.on > .dv-study-h b { color: #fff; }
.dv-thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px 4px 6px; }
.dv-th { display: block; padding: 0 0 6px; border: 1px solid #232b35; border-radius: 8px; background: #050607; color: #c9d1d9; text-align: left; cursor: pointer; overflow: hidden; }
.dv-th:hover { border-color: #3a4554; }
.dv-th img, .dv-th i { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: #000; }
.dv-th span { display: block; padding: 5px 6px 0; font-size: 11.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-th small { display: block; padding: 0 6px; font-size: 11px; color: #7b8695; }
.dv-th.shown { border-color: #33557f; }
.dv-th.on { border-color: var(--dv-accent); box-shadow: 0 0 0 1px var(--dv-accent); }
.dv-note { margin: 12px 4px 0; font-size: 12.5px; line-height: 1.5; color: var(--dv-muted); }

.dv-grid { display: grid; gap: 2px; min-width: 0; min-height: 0; background: #1b2028; }
.g-1x1 { grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
.g-1x2 { grid-template: minmax(0, 1fr) / repeat(2, minmax(0, 1fr)); }
.g-1x3 { grid-template: minmax(0, 1fr) / repeat(3, minmax(0, 1fr)); }
.g-2x2 { grid-template: repeat(2, minmax(0, 1fr)) / repeat(2, minmax(0, 1fr)); }
.dv-grid.maxed { grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
.dv-grid.maxed .dv-vp:not(.max) { display: none; }
.dv-vp { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #000; touch-action: none; }
.dv-vp.active::after { content: ''; position: absolute; inset: 0; border: 1px solid var(--dv-accent); pointer-events: none; }
.dv-vp canvas { position: absolute; inset: 0; display: block; }
.dv-scroll { position: absolute; top: 12px; right: 4px; bottom: 12px; width: 8px; border-radius: 4px; background: rgba(255, 255, 255, .07); cursor: pointer; touch-action: none; }
.dv-scroll i { position: absolute; top: 0; left: 0; right: 0; border-radius: 4px; background: rgba(255, 255, 255, .38); }
.dv-scroll:hover i { background: rgba(255, 255, 255, .6); }
.dv-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; color: var(--dv-muted); font-size: 14px; text-align: center; pointer-events: none; }

.dv-load { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(8, 10, 13, .88); }
.dv-load > div { width: min(380px, 84%); text-align: center; }
.dv-load b { font-size: 15px; font-weight: 600; }
.dv-load.err b { color: #ff9e8f; font-weight: 500; line-height: 1.5; }
.dv-prog { height: 6px; margin: 14px 0 8px; border-radius: 3px; background: #1d242d; overflow: hidden; }
.dv-prog i { display: block; width: 0; height: 100%; background: var(--dv-accent); transition: width .15s; }
.dv-load span { font-size: 12.5px; color: var(--dv-muted); }

.dv-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 12px; background: var(--dv-panel); border-top: 1px solid var(--dv-line); font-size: 12px; color: var(--dv-muted); white-space: nowrap; overflow: hidden; }
.dv-foot > span:first-child { color: #c2cad3; font-variant-numeric: tabular-nums; white-space: pre; }
.dv-hint { overflow: hidden; text-overflow: ellipsis; }

.dv-drawer { position: absolute; top: 0; right: 0; bottom: 0; z-index: 6; width: min(360px, 92%); padding: 0 16px 24px; background: #11161c; border-left: 1px solid #252d37; overflow-y: auto; transform: translateX(105%); transition: transform .22s ease; user-select: text; -webkit-user-select: text; }
.dv-drawer.open { transform: none; }
.dv-dh { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 12px 0 8px; background: #11161c; }
.dv-dh b { font-size: 15px; }
.dv-drawer h5 { margin: 14px 0 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--dv-muted); }
.dv-kv, .dv-keys { display: grid; grid-template-columns: 42% 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.dv-kv dt, .dv-keys dt { color: var(--dv-muted); }
.dv-kv dd, .dv-keys dd { margin: 0; overflow-wrap: anywhere; }
.dv-keys dt { color: #e6ebf0; font-weight: 600; }
.dv-keys dd { color: #b3bdc8; }

.dv-ask { position: absolute; z-index: 4; display: flex; gap: 6px; padding: 6px; border: 1px solid #2b3440; border-radius: 10px; background: #141a21; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.dv-ask input { width: 170px; height: 30px; padding: 0 8px; border: 1px solid #2d3743; border-radius: 6px; background: #0b0e12; color: #fff; font: inherit; font-size: 13px; outline: none; }
.dv-ask input:focus { border-color: var(--dv-accent); }
.dv-ask button { height: 30px; padding: 0 10px; border: 0; border-radius: 6px; background: var(--dv-accent); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }

.dv-flash { position: absolute; left: 50%; bottom: 18px; z-index: 7; padding: 9px 14px; border-radius: 10px; background: #1c242e; color: #e8edf2; font-size: 13px; opacity: 0; transform: translate(-50%, 16px); transition: opacity .2s, transform .2s; pointer-events: none; max-width: 90%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-flash.show { opacity: 1; transform: translate(-50%, 0); }

.dv-3dpanel { position: absolute; top: 10px; left: 10px; z-index: 3; display: flex; flex-direction: column; gap: 10px; width: 236px; padding: 10px; border: 1px solid #252d37; border-radius: 10px; background: rgba(14, 18, 23, .86); }
.dv-3dpanel .dv-sel { width: 100%; }
.dv-3dbody { display: flex; flex-direction: column; gap: 10px; }
.dv-3dtoggle { display: none; align-items: center; gap: 6px; padding: 4px 6px; border: 0; border-radius: 6px; background: none; color: #c9d1d9; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.dv-3dtoggle svg { width: 16px; height: 16px; }
.dv-3dpanel.collapsed { width: auto; padding: 4px; }
.dv-3dpanel.collapsed .dv-3dbody { display: none; }
.dv-3dpanel.collapsed .dv-3dtoggle, .g-2x2 .dv-3dtoggle { display: inline-flex; }
.dv-range { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-size: 12.5px; color: #b8c1cb; }
.dv-range input { width: 100%; accent-color: var(--dv-accent); }
.dv-range b { min-width: 60px; text-align: right; font-weight: 600; color: #e6ebf0; font-variant-numeric: tabular-nums; }
.dv-views { display: flex; flex-wrap: wrap; gap: 4px; }
.dv-views button { padding: 5px 8px; border: 1px solid #29323d; border-radius: 6px; background: #19202a; color: #c9d1d9; font-size: 12px; cursor: pointer; }
.dv-views button:hover { background: #222b36; color: #fff; }
.dv-3dlabels b { position: absolute; color: #f1c26b; font-size: 13px; font-weight: 700; pointer-events: none; text-shadow: 0 0 3px #000; }
.dv-3dlabels .l { left: 12px; top: 50%; transform: translateY(-50%); }
.dv-3dlabels .r { right: 12px; top: 50%; transform: translateY(-50%); }
.dv-3dlabels .t { top: 10px; left: 50%; transform: translateX(-50%); }
.dv-3dlabels .d { bottom: 10px; left: 50%; transform: translateX(-50%); }

.dv:fullscreen { position: fixed; }

@media (max-width: 760px) {
  .dv { grid-template-rows: 48px 46px minmax(0, 1fr); }
  .dv-back span, .dv-title span, [data-act="help"], .dv-hint { display: none; }
  .dv-back { padding: 7px; }
  .dv-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 96px; }
  .dv-side { order: 2; display: flex; gap: 8px; padding: 6px; overflow-x: auto; overflow-y: hidden; border-right: 0; border-top: 1px solid var(--dv-line); }
  .dv-study { display: flex; flex: none; gap: 6px; margin: 0; padding-right: 4px; }
  .dv-study-h { width: 112px; flex: none; }
  .dv-thumbs { display: flex; gap: 6px; padding: 0; }
  .dv-th { width: 70px; flex: none; padding-bottom: 4px; }
  .dv-th small { display: none; }
  .dv-foot { display: none; }
  .dv-3dpanel { width: 196px; padding: 8px; gap: 8px; }
  .dv-3dtoggle { display: inline-flex; }
  .dv-views button { padding: 4px 6px; }
}
