/* v107 tgclient: галерея клиента в Telegram Mini App. Только внутри body.tg (файлы ext/ подключаются на всех страницах).
   Цвета — из темы Telegram (--tg-*, v107tg.css), ширина 320–430 px без горизонтальной прокрутки. */
body.tg{overflow-x:hidden}
body.tg.tgc-noscroll{overflow:hidden}
body.tg .tgc,body.tg .tgc-msg{max-width:720px;margin:0 auto;box-sizing:border-box}
body.tg .tgc-msg{padding:28px 16px}
body.tg .tgc-msg h1,body.tg .tgc-head h1{font-size:20px;line-height:1.25;margin:2px 0 6px;overflow-wrap:anywhere}
body.tg .tgc-msg p{margin:0 0 10px}
body.tg .tgc-msg .tg-btn{margin-top:12px}
body.tg .tgc-pw label{display:block;font-size:13px;margin:10px 0 4px;color:var(--tg-hint-color,#888)}
body.tg .tgc-pw input,body.tg .tgc-sheet textarea,body.tg .tgc-vcm input{width:100%;box-sizing:border-box;font:inherit;
  padding:10px 12px;border-radius:10px;border:1px solid var(--tg-section-separator-color,rgba(127,127,127,.3));
  background:var(--tg-bg-color,#fff);color:var(--tg-text-color,#111)}
body.tg .tgc-pw .tg-btn{margin-top:12px}
body.tg .tgc-err{color:var(--tg-destructive-text-color,#d33);font-size:14px}
/* шапка */
body.tg .tgc-head{display:flex;gap:12px;align-items:center;padding:14px 12px 6px}
body.tg .tgc-cov{width:64px;height:64px;flex:none;border-radius:12px;object-fit:cover;background:var(--tg-secondary-bg-color,#eee)}
body.tg .tgc-ht{min-width:0}
body.tg .tgc-ht p{margin:0;font-size:13px}
/* панель: фильтры, папки, действия — прилипает сверху */
body.tg .tgc-bar{position:sticky;top:0;z-index:5;background:var(--tg-bg-color,#fff);padding:6px 0 4px;
  border-bottom:1px solid var(--tg-section-separator-color,rgba(127,127,127,.15))}
body.tg .tgc-chips,body.tg .tgc-acts{display:flex;gap:6px;overflow-x:auto;padding:2px 12px 4px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
body.tg .tgc-chips::-webkit-scrollbar,body.tg .tgc-acts::-webkit-scrollbar{display:none}
body.tg .tgc-chip{flex:none;border:0;border-radius:16px;padding:7px 12px;font-weight:500;font-size:14px;line-height:1.2;font-family:inherit;white-space:nowrap;
  background:var(--tg-secondary-bg-color,#f1f1f4);color:var(--tg-text-color,#111);text-decoration:none;cursor:pointer}
body.tg .tgc-chip small{opacity:.6;margin-left:2px}
body.tg .tgc-chip[aria-pressed="true"],body.tg .tgc-chip[aria-current="page"]{background:var(--tg-button-color,#2481cc);color:var(--tg-button-text-color,#fff)}
body.tg .tgc-chip.sm{font-size:13px;padding:5px 10px}
body.tg .tgc-act{flex:none;border:0;background:none;padding:6px 8px;font:inherit;font-size:14px;white-space:nowrap;cursor:pointer;
  color:var(--tg-link-color,#2481cc);text-decoration:none}
body.tg .tgc-act.wide{display:block;width:100%;text-align:center;margin-top:8px;padding:10px}
body.tg .tgc-left{margin:0;padding:0 12px 2px;font-size:13px}
body.tg .tgc-note{padding:6px 12px;margin:0;font-size:14px}
/* сетка: 3 колонки на телефоне, квадраты, просветы 2 px */
body.tg .tgc-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:2px;padding:2px}
@media (min-width:560px){body.tg .tgc-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}
body.tg .tgc-tile{position:relative;display:block;aspect-ratio:1/1;overflow:hidden;background:var(--tg-secondary-bg-color,#eee);
  -webkit-tap-highlight-color:transparent}
body.tg .tgc-tile[hidden]{display:none}
body.tg .tgc-tile img{width:100%;height:100%;object-fit:cover;display:block}
body.tg .tgc-heart{position:absolute;right:2px;bottom:2px;width:38px;height:38px;border:0;padding:0;background:none;cursor:pointer;
  color:#fff;font-size:22px;line-height:38px;text-shadow:0 1px 3px rgba(0,0,0,.6)}
body.tg .tgc-heart::before{content:"♡"}
body.tg .tgc-tile.fav .tgc-heart{color:#ff3b5c}
body.tg .tgc-tile.fav .tgc-heart::before{content:"♥"}
body.tg .tgc-tile.sent .tgc-heart::after{content:"✓";position:absolute;right:3px;top:1px;font-size:11px;line-height:1;color:#fff}
body.tg .tgc-tile.fav{outline:2px solid #ff3b5c;outline-offset:-2px}
body.tg #tgc-more{height:1px}
body.tg .tgc-foot{padding:18px 12px 90px;font-size:13px;text-align:center}
/* просмотр крупно */
body.tg .tgc-view{position:fixed;inset:0;z-index:20;background:#000;color:#fff;display:flex;flex-direction:column}
body.tg .tgc-view[hidden]{display:none}
body.tg .tgc-vtop{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 10px;font-size:13px;opacity:.85}
body.tg .tgc-vtop span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body.tg .tgc-x{border:0;background:none;color:#fff;font-size:20px;padding:4px 8px;cursor:pointer}
body.tg .tgc-stage{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;touch-action:pan-y}
body.tg .tgc-stage img{max-width:100%;max-height:100%;object-fit:contain;user-select:none;-webkit-user-drag:none}
body.tg .tgc-vcm{display:flex;gap:6px;padding:6px 10px}
body.tg .tgc-vcm[hidden]{display:none}
body.tg .tgc-vcm .tgc-act{color:#fff}
body.tg .tgc-vbot{display:flex;justify-content:space-around;gap:4px;padding:6px 6px calc(10px + env(safe-area-inset-bottom))}
body.tg .tgc-vb{border:0;background:none;color:#fff;font:inherit;font-size:13px;display:flex;flex-direction:column;align-items:center;gap:2px;
  padding:6px;min-width:64px;cursor:pointer}
body.tg .tgc-vb[hidden]{display:none}
body.tg .tgc-vb .h::before{content:"♡";font-style:normal;font-size:22px;line-height:1}
body.tg .tgc-vb[aria-pressed="true"]{color:#ff3b5c}
body.tg .tgc-vb[aria-pressed="true"] .h::before{content:"♥"}
/* нижние листы: отправка, поиск по лицу */
body.tg .tgc-sheet{position:fixed;left:0;right:0;bottom:0;z-index:30;max-height:88vh;overflow:auto;box-sizing:border-box;
  padding:16px 16px calc(16px + env(safe-area-inset-bottom));border-radius:16px 16px 0 0;
  background:var(--tg-bg-color,#fff);color:var(--tg-text-color,#111);box-shadow:0 -6px 30px rgba(0,0,0,.25)}
body.tg .tgc-sheet[hidden]{display:none}
body.tg .tgc-sheet h2{font-size:18px;margin:0 0 6px}
body.tg .tgc-sheet h3{font-size:15px;margin:8px 0}
body.tg .tgc-sheet textarea{min-height:84px;margin:10px 0}
body.tg .tgc-sheet label.tg-btn{cursor:pointer;margin-top:8px}
body.tg .tgc-consent{max-height:34vh;overflow:auto;font-size:13px;padding:8px 10px;border-radius:10px;background:var(--tg-secondary-bg-color,#f1f1f4)}
body.tg .tgc-check{display:flex;gap:8px;align-items:flex-start;font-size:14px;margin:10px 0}
body.tg .tg-btn[disabled]{opacity:.5}
body.tg .tgc-fallback{position:fixed;left:12px;right:12px;bottom:calc(12px + env(safe-area-inset-bottom));width:auto;z-index:15;
  box-shadow:0 4px 18px rgba(0,0,0,.25)}
body.tg .tgc-fallback[hidden]{display:none}
body.tg .tgc-toast{position:fixed;left:50%;bottom:calc(76px + env(safe-area-inset-bottom));transform:translateX(-50%);z-index:40;
  max-width:calc(100% - 32px);box-sizing:border-box;padding:9px 14px;border-radius:10px;font-size:14px;text-align:center;
  background:rgba(20,20,20,.88);color:#fff}
body.tg .tgc-toast[hidden]{display:none}
