/* Чат с Peplan — как экран «ИИ» в приложении. */
#ai-screen.pc-screen { padding: 0; overflow: hidden; }
#ai-screen.pc-screen.active { display: flex; flex-direction: column; }

.pc-top { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; padding: 14px 14px 8px; flex: none; }
.pc-icon-btn { width: 44px; height: 44px; border: 0; background: none; border-radius: 14px; display: grid; place-items: center; cursor: pointer; color: var(--ink); transition: background .15s ease; }
.pc-icon-btn:hover { background: rgba(17, 36, 15, .06); }
.pc-icon-btn svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
#pc-new svg { color: var(--green-700); }
.pc-title { text-align: center; min-width: 0; }
.pc-name { font: 800 20px/1.1 var(--display); letter-spacing: -.02em; }
.pc-sub { font-size: 13px; font-weight: 600; color: var(--text-600); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-sub:empty { display: none; }

.pc-scroll { flex: 1; overflow-y: auto; padding: 8px 18px 16px; overscroll-behavior: contain; scroll-behavior: auto; }

.pc-empty { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px 10px; }
.pc-frog { width: 132px; height: auto; animation: pcFloat 3.6s ease-in-out infinite; }
@keyframes pcFloat { 50% { transform: translateY(-6px) rotate(-2deg); } }
.pc-empty h2 { font: 800 28px/1.1 var(--display); letter-spacing: -.035em; margin-top: 18px; }
.pc-empty p { color: var(--text-600); font-size: 15px; line-height: 1.5; margin-top: 8px; max-width: 30ch; }

.pc-bottom { flex: none; padding: 0 14px 104px; }
.pc-suggest { display: flex; gap: 10px; overflow-x: auto; padding: 4px 4px 12px; scrollbar-width: none; }
.pc-suggest::-webkit-scrollbar { display: none; }
.pc-sg { flex: 0 0 auto; width: 210px; text-align: left; padding: 14px 16px; border-radius: 20px; background: #fff; border: 1.5px solid rgba(17, 36, 15, .22); cursor: pointer; font-family: inherit; color: var(--ink);
  animation: pcSlide .46s cubic-bezier(.2, .8, .2, 1) both; transition: transform .15s ease, border-color .15s ease; }
.pc-sg:hover { border-color: var(--ink); }
.pc-sg:active { transform: scale(.97); }
.pc-sg-e { display: block; font-size: 22px; margin-bottom: 6px; }
.pc-sg b { display: block; font-size: 15px; font-weight: 700; }
.pc-sg span:last-child { display: block; font-size: 13.5px; color: var(--text-600); margin-top: 2px; }
@keyframes pcSlide { from { opacity: 0; transform: translateX(40px); } }

.pc-composer { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 18px; background: #fff; border: 1.5px solid rgba(17, 36, 15, .3); border-radius: 30px; box-shadow: 0 6px 20px -14px rgba(17, 36, 15, .5); transition: border-color .15s ease; }
.pc-composer:focus-within { border-color: var(--green-600); }
.pc-composer textarea { flex: 1; border: 0; outline: none; resize: none; background: transparent; font-family: inherit; font-size: 16px; line-height: 1.45; color: var(--ink); padding: 11px 0; max-height: 160px; }
.pc-composer textarea::placeholder { color: rgba(17, 36, 15, .45); }
.pc-send { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: var(--green-600); color: #fff; transition: background .2s ease, transform .15s ease; }
.pc-send:disabled { background: #f0eadb; color: rgba(17, 36, 15, .4); cursor: default; }
.pc-send:not(:disabled):active { transform: scale(.92); }
.pc-send svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pc-note { text-align: center; font-size: 12px; font-weight: 600; color: var(--text-600); margin-top: 8px; }

.pc-msg { display: flex; margin: 0 0 18px; animation: pcIn .28s ease both; }
@keyframes pcIn { from { opacity: 0; transform: translateY(8px); } }
.pc-user { justify-content: flex-end; }
.pc-bubble { max-width: 82%; padding: 12px 16px; border-radius: 22px 22px 6px 22px; background: #efe8d6; font-size: 16px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.pc-bot { gap: 10px; align-items: flex-start; }
.pc-ava { width: 34px; height: 34px; border-radius: 50%; flex: none; object-fit: cover; background: var(--green-100); border: 2px solid var(--green-700); }
.pc-answer { flex: 1; min-width: 0; padding-top: 4px; }
.pc-md { font-size: 16px; line-height: 1.6; word-wrap: break-word; }
.pc-md p { margin: 0 0 10px; }
.pc-md h3, .pc-md h4, .pc-md h5 { font-family: var(--display); font-weight: 800; letter-spacing: -.03em; margin: 14px 0 8px; line-height: 1.2; }
.pc-md h3 { font-size: 21px; } .pc-md h4 { font-size: 17px; } .pc-md h5 { font-size: 15px; }
.pc-md > :first-child { margin-top: 0; }
.pc-md ul, .pc-md ol { margin: 0 0 10px; padding-left: 22px; }
.pc-md li { margin: 4px 0; }
.pc-md ul li::marker { color: var(--green-600); }
.pc-md ol li::marker { color: var(--green-600); font-weight: 800; }
.pc-md strong { font-weight: 700; }
.pc-md code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .9em; background: #f0eadb; padding: 2px 6px; border-radius: 6px; }
.pc-md pre { background: #f0eadb; border-radius: 16px; padding: 14px 16px; overflow-x: auto; margin: 0 0 10px; }
.pc-md pre code { background: none; padding: 0; }
.pc-md blockquote { margin: 0 0 10px; padding: 2px 0 2px 14px; border-left: 3px solid var(--sun); color: var(--text-600); font-style: italic; }
.pc-caret { display: inline-block; margin-left: 2px; color: var(--green-600); animation: pcBlink .9s steps(2, start) infinite; }
@keyframes pcBlink { to { visibility: hidden; } }
.pc-copy { margin: 2px 0 0 -8px; width: 36px; height: 36px; border: 0; background: none; border-radius: 10px; display: grid; place-items: center; cursor: pointer; color: var(--text-600); animation: pcIn .3s ease both; }
.pc-copy:hover { background: rgba(17, 36, 15, .06); }
.pc-copy svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pc-copy.ok { color: var(--green-600); }

.pc-dots { display: flex; align-items: center; gap: 5px; padding: 10px 0; }
.pc-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--green-600); animation: pcWave 1.2s linear infinite; }
.pc-dots i:nth-child(2) { animation-delay: .15s; } .pc-dots i:nth-child(3) { animation-delay: .3s; }
.pc-dots span { margin-left: 8px; font-size: 14px; color: var(--text-600); }
@keyframes pcWave { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-6px); opacity: 1; } }

.pc-down { position: absolute; left: 50%; bottom: 200px; transform: translateX(-50%); width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid rgba(17, 36, 15, .25); background: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 16px -8px rgba(17, 36, 15, .45); z-index: 5; }
.pc-down svg { width: 20px; height: 20px; stroke: var(--ink); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.pc-drawer-back { position: fixed; inset: 0; background: rgba(17, 36, 15, .35); opacity: 0; pointer-events: none; transition: opacity .25s ease; z-index: 60; }
.pc-drawer-back.open { opacity: 1; pointer-events: auto; }
.pc-drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(320px, 84vw); background: var(--bg); border-right: var(--stroke); z-index: 61; transform: translateX(-102%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; }
.pc-drawer.open { transform: none; }
.pc-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 16px 12px; }
.pc-drawer-head b { font: 800 20px var(--display); letter-spacing: -.03em; }
.pc-new-chat { border: var(--stroke); border-radius: 14px; background: var(--green-600); color: #fff; font-family: inherit; font-weight: 700; font-size: 14px; padding: 9px 12px; box-shadow: 2px 2px 0 var(--ink); cursor: pointer; }
.pc-chats { flex: 1; overflow-y: auto; padding: 4px 10px 20px; }
.pc-chat { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 11px 12px; border-radius: 14px; cursor: pointer; font-family: inherit; color: var(--ink); }
.pc-chat:hover { background: rgba(17, 36, 15, .05); }
.pc-chat.on { background: var(--green-100); }
.pc-chat b { display: block; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-chat span { display: block; font-size: 13px; color: var(--text-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.pc-chats-empty { color: var(--text-600); padding: 12px; }
.hidden { display: none !important; }
@media (prefers-reduced-motion: reduce) { .pc-msg, .pc-sg, .pc-frog, .pc-dots i, .pc-caret { animation: none !important; } }

/* Фото, поиск и источники */
.pc-tool { width: 40px; height: 40px; flex: none; border: 0; background: none; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--text-600); transition: background .15s ease, color .15s ease; align-self: flex-end; margin-bottom: 3px; }
.pc-tool:hover { background: rgba(17, 36, 15, .06); }
.pc-tool svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pc-tool.on { background: rgba(26, 138, 66, .16); color: var(--green-600); }
.pc-composer { padding-left: 8px; }
.pc-photo { display: flex; align-items: center; gap: 12px; padding: 8px 10px; margin: 0 0 8px; border-radius: 18px; background: #efe8d6; font-size: 14px; }
.pc-photo.hidden { display: none; }
.pc-photo img { width: 56px; height: 56px; object-fit: cover; border-radius: 12px; }
.pc-photo small { display: block; color: var(--text-600); font-size: 12px; }
.pc-photo .pc-icon-btn { width: 32px; height: 32px; margin-left: auto; }
.pc-spin { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid rgba(17, 36, 15, .15); border-top-color: var(--green-600); animation: pcSpin .8s linear infinite; }
@keyframes pcSpin { to { transform: rotate(360deg); } }
.pc-user-col { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-width: 82%; }
.pc-user-col .pc-bubble { max-width: 100%; }
.pc-photo-msg { max-width: 240px; max-height: 280px; border-radius: 18px; object-fit: contain; background: #f0eadb; }
.pc-photo-gone { color: var(--text-600); }
.pc-sources { margin-top: 10px; display: grid; gap: 6px; }
.pc-sources-t { font-size: 12.5px; font-weight: 600; color: var(--text-600); }
.pc-source { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; border-radius: 12px; background: #efe8d6; color: var(--ink); text-decoration: none; font-size: 14px; }
.pc-source:hover { background: #e8dfc8; }
.pc-source b { color: var(--green-600); }
.pc-source span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.pc-source small { display: block; color: var(--text-600); font-size: 12px; }
@media (prefers-reduced-motion: reduce) { .pc-spin { animation: none; } }
