/* Версия «Как в Codex» + переключатель версий. Цвета только из переменных темы app.css. */

/* какая версия на экране */
.cx-only{display:none!important}
body.ver-codex .cx-only{display:revert!important}
body.ver-codex aside.cx-only{display:flex!important}
body.ver-codex .comp.cx-only{display:block!important}
body.ver-codex.cx-ro .comp.cx-only{display:none!important}
body.ver-codex .top-title.cx-only{display:flex!important}
body.ver-codex .btn.cx-only{display:inline-flex!important}
body.ver-codex #side,body.ver-codex #feed,body.ver-codex #comp,body.ver-codex #tplBtn,
body.ver-codex #wbBtn,body.ver-codex .top-title:not(.cx-only){display:none!important}

/* переключатель версий в шапке */
.ver-sw{display:flex;flex:none;background:var(--soft2);border-radius:10px;padding:3px;gap:2px}
.ver-sw button{border-radius:8px;padding:5px 11px;font-size:12.5px;font-weight:500;color:var(--muted);white-space:nowrap}
.ver-sw button:hover{color:var(--text)}
.ver-sw button.on{background:var(--card);color:var(--text);box-shadow:0 1px 3px rgba(0,0,0,.12)}
@media (max-width:760px){.ver-sw button{padding:5px 8px;font-size:12px}}

/* лента */
#cxFeed .col{display:flex;flex-direction:column;gap:18px}
.cx-msg{max-width:100%}
.cx-msg.user{align-self:flex-end;display:flex;flex-direction:column;align-items:flex-end;gap:6px;max-width:82%}
.cx-bubble{background:var(--soft2);border-radius:18px;padding:9px 14px;white-space:pre-wrap;word-wrap:break-word;font-size:14.5px;line-height:1.45}
.cx-atts{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.cx-att{width:64px;height:84px;border-radius:10px;overflow:hidden;background:var(--skel1);cursor:zoom-in}
.cx-att img{width:100%;height:100%;object-fit:cover;display:block}
.cx-msg.codex{align-self:stretch}
.cx-who{display:flex;align-items:center;gap:7px;font-size:12.5px;font-weight:600;color:var(--muted);margin-bottom:6px}
.logo.sm{width:20px;height:20px;border-radius:6px;font-size:11px}
.cx-text{font-size:14.5px;line-height:1.55;word-wrap:break-word}
.cx-text p{margin:0 0 8px}
.cx-text ul{margin:0 0 8px;padding-left:20px}
.cx-text a{color:var(--text);text-decoration:underline;text-underline-offset:2px;text-decoration-color:var(--muted2)}
.cx-text a:hover{text-decoration-color:var(--text)}
.cx-text code{background:var(--soft2);border-radius:5px;padding:1px 5px;font-size:13px}
.cx-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:10px;margin:6px 0}
.cx-img{margin:0;display:flex;flex-direction:column;gap:6px}
.cx-open{display:block;border-radius:12px;overflow:hidden;background:var(--skel1);cursor:zoom-in}
.cx-open img{display:block;width:100%;height:auto;aspect-ratio:auto}
.cx-img figcaption{display:flex;gap:6px;flex-wrap:wrap}
.cx-dl{font-size:12px;border:1px solid var(--line2);border-radius:8px;padding:4px 8px;color:var(--text);text-decoration:none;background:var(--card);white-space:nowrap}
.cx-dl:hover{background:var(--soft2)}
.cx-state{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--muted);margin-top:4px}
.cx-state.err{color:var(--err)}
.cx-state .muted{color:var(--muted2);margin-left:4px}
.cx-state.think{color:var(--text)}
.pulse{width:9px;height:9px;border-radius:50%;background:var(--text);animation:cxpulse 1.1s ease-in-out infinite;flex:none}
@keyframes cxpulse{0%,100%{opacity:.25;transform:scale(.8)}50%{opacity:1;transform:scale(1)}}
@media (prefers-reduced-motion:reduce){.pulse{animation:none}}

.cx-hero{text-align:center;max-width:520px;margin:12vh auto 0}
.cx-hero h2{margin:0 0 10px;font-size:22px;font-weight:600}
.cx-hero p{margin:0 0 8px;line-height:1.5}
.cx-hero .small{font-size:13px}

/* поле ввода */
#cxBox textarea{padding-top:6px}
#cxClip{gap:6px}
#cxClip svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
#cxSend svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
#cxSend.stop svg{fill:currentColor;stroke:none}
.cx-spin{position:absolute;inset:0;margin:auto;width:18px;height:18px;border-radius:50%;border:2px solid rgba(255,255,255,.5);border-top-color:#fff;animation:cxspin .8s linear infinite}
.tr.up img{opacity:.55}
@keyframes cxspin{to{transform:rotate(360deg)}}

@media (max-width:760px){
  .top-title.cx-only .sub{display:none}
  #cxComp .foot>span:not(#cxQueue){display:none}
  .cx-msg.user{max-width:92%}
  .cx-grid{grid-template-columns:repeat(2,1fr);gap:8px}
  .cx-hero{margin-top:6vh}
  .cx-dl{padding:6px 8px}
}

/* ZIP одной серии под ответом и плашка чужого чата по ссылке */
.cx-turn-zip{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:8px 0 2px}
.cx-turn-zip .btn{text-decoration:none}
.cx-turn-zip .small{font-size:12px}
.cx-ro-note{font-size:13px;color:var(--muted);background:var(--soft2);border:1px solid var(--line2);border-radius:10px;padding:8px 12px;margin:0 0 14px}

/* таблицы в ответе ChatGPT: на телефоне листаются вбок, а не рвут слова */
.cx-text .cx-h{font-weight:600;margin:10px 0 6px}
.cx-tbl{overflow-x:auto;margin:4px 0 10px;border:1px solid var(--line2);border-radius:10px;-webkit-overflow-scrolling:touch}
.cx-tbl table{border-collapse:collapse;width:100%;font-size:13.5px;line-height:1.4}
.cx-tbl th,.cx-tbl td{padding:7px 10px;border-bottom:1px solid var(--line2);text-align:left;vertical-align:top;min-width:64px}
.cx-tbl th{background:var(--soft2);font-weight:600;white-space:nowrap}
.cx-tbl tr:last-child td{border-bottom:0}
.cx-tbl .a-right{text-align:right;font-variant-numeric:tabular-nums}
.cx-tbl .a-center{text-align:center}

/* файлы из папки чата: карточка с кнопкой «Скачать» */
.cx-files{display:flex;flex-direction:column;gap:8px;margin:6px 0 8px;max-width:520px}
.cx-file{display:flex;align-items:center;gap:10px;border:1px solid var(--line2);border-radius:12px;padding:8px 8px 8px 10px;background:var(--card)}
.cx-ext{flex:none;width:44px;height:44px;border-radius:9px;background:var(--soft2);color:var(--text);display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;letter-spacing:.3px}
.cx-fname{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.cx-fname b{font-weight:600;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cx-fname .muted{font-size:12px}
.cx-fdl{flex:none;text-decoration:none}
.cx-fdl svg,.cx-turn-zip svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
@media (max-width:760px){
  .cx-tbl th{white-space:normal}
  /* 4+ колонки с фразами на телефоне не читаются: строка = карточка, у значения подпись колонки */
  .cx-tbl.wide{border:0;overflow:visible;border-radius:0}
  .cx-tbl.wide thead{display:none}
  .cx-tbl.wide table,.cx-tbl.wide tbody,.cx-tbl.wide tr,.cx-tbl.wide td{display:block;width:auto}
  .cx-tbl.wide tr{border:1px solid var(--line2);border-radius:10px;margin:0 0 8px;padding:6px 11px}
  .cx-tbl.wide td{display:flex;gap:10px;border:0;padding:4px 0;text-align:left;min-width:0}
  .cx-tbl.wide td::before{content:attr(data-th);flex:none;width:36%;color:var(--muted);font-size:12.5px;line-height:1.5}
  .cx-tbl.wide td:first-child{font-weight:600}
}
