/* ═══════════════════════════════════════════════════════════════════════
   Runo — дизайн (чат 47 «дизайнер», 2026-11-22).
   Только внешний вид: цвета, фоны, шрифты, тени, скругления, анимации.
   Подключается ПОСЛЕДНИМ в <head>. Раскладку (.panel, #app, .scroll, .stage
   высоты, .modal.show …) не трогает — её держат index.html / face.js / talk.js.
   Стили face.js и talk.js вставляются позже, поэтому их перебиваем через #app.
   Телефон: анимируется только transform/opacity, без backdrop-filter.
   ═══════════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@500;700;800;900&family=Unbounded:wght@800;900&display=swap');

:root {
  --bg: #060318;
  --panel: rgba(20, 13, 52, .82);
  --panel2: #1d1550;
  --line: rgba(190, 170, 255, .16);
  --txt: #f4f1ff;
  --dim: #b1a8d8;
  --pink: #ff6ad5;
  --cyan: #38d8ff;
  --gold: #ffd166;
  --ok: #5dff9b;
  --vio: #8a5cff;
  --grad: linear-gradient(135deg, #8a4bff 0%, #d84fd0 55%, #ff7aa8 100%);
  --grad-cool: linear-gradient(135deg, #19c3a0 0%, #1aa6e0 100%);
  --glow-v: 0 6px 22px rgba(138, 75, 255, .45);
  --glow-c: 0 6px 22px rgba(26, 166, 224, .45);
}

body {
  font-family: Nunito, system-ui, "Segoe UI", sans-serif;
  background: #060318;
}

/* ── живой фон: северное сияние + звёзды (одна картинка, двигается только transform) ── */
body::before, body::after {
  content: ""; position: fixed; pointer-events: none; z-index: 0;
}
body::before {
  inset: -30%;
  background:
    radial-gradient(38% 30% at 78% 12%, rgba(150, 70, 255, .55), transparent 70%),
    radial-gradient(32% 28% at 12% 88%, rgba(20, 140, 200, .45), transparent 70%),
    radial-gradient(26% 22% at 30% 20%, rgba(255, 90, 200, .22), transparent 70%),
    radial-gradient(30% 26% at 85% 80%, rgba(60, 40, 200, .35), transparent 70%);
  animation: runoAurora 26s ease-in-out infinite alternate;
  will-change: transform;
}
body::after {
  inset: 0;
  background-image:
    radial-gradient(1.3px 1.3px at 12% 18%, rgba(255,255,255,.75), transparent 60%),
    radial-gradient(1px 1px at 27% 64%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(1.4px 1.4px at 41% 33%, rgba(190,220,255,.7), transparent 60%),
    radial-gradient(1px 1px at 58% 82%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1.2px 1.2px at 69% 22%, rgba(255,200,250,.7), transparent 60%),
    radial-gradient(1px 1px at 83% 55%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(1.4px 1.4px at 92% 12%, rgba(200,240,255,.7), transparent 60%),
    radial-gradient(1px 1px at 6% 46%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1.2px 1.2px at 49% 7%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1px 1px at 77% 93%, rgba(255,255,255,.45), transparent 60%);
  background-size: 640px 640px;
  opacity: .8;
  animation: runoTwinkle 5s ease-in-out infinite alternate;
}
@keyframes runoAurora {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  50%  { transform: translate3d(-4%, 3%, 0) rotate(8deg) scale(1.08); }
  100% { transform: translate3d(3%, -2%, 0) rotate(-6deg) scale(1.03); }
}
@keyframes runoTwinkle { from { opacity: .45; } to { opacity: .9; } }
#app { position: relative; z-index: 1; }
.modal, .toast, .confetti { z-index: 50; }
.toast { z-index: 60; }
.confetti { z-index: 55; }

/* ── кнопки ── */
.btn {
  background: linear-gradient(180deg, rgba(48, 36, 110, .95), rgba(30, 22, 78, .95));
  border: 1px solid var(--line);
  border-radius: 14px;
  font-weight: 700;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .08);
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.btn:hover { background: linear-gradient(180deg, rgba(64, 48, 140, .95), rgba(40, 30, 100, .95)); border-color: rgba(200, 170, 255, .35); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.97); }
.btn.on, .btn.main {
  background: var(--grad);
  border-color: transparent;
  box-shadow: var(--glow-v), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn.go {
  background: var(--grad-cool);
  box-shadow: var(--glow-c), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.btn.go:hover { filter: brightness(1.08); }
.btn.warn { background: rgba(255, 91, 110, .14); border-color: rgba(255, 91, 110, .5); }
.btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ── шапка ── */
.ttl h1 {
  font-family: Unbounded, Nunito, system-ui, sans-serif;
  font-weight: 900;
  letter-spacing: 4px;
  background: linear-gradient(90deg, #ff7de0, #b38bff, #5fe0ff, #ff7de0);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: runoShine 8s linear infinite;
  filter: drop-shadow(0 2px 10px rgba(180, 110, 255, .35));
}
@keyframes runoShine { to { background-position: 300% 0; } }
/* 🤖 v5 (чат 84): лицо в шапке — робот: тёмный экран-лицо, «наушники» (две тени), антенна с огоньком.
   Цвета — переменными: эмоции и состояния меняют только --shell / --fglow / --ear / --tip. */
.face { --shell: radial-gradient(circle at 35% 28%, #d3c4ff, #6f42ff 46%, #1d0c55 100%); --fglow: rgba(150, 95, 255, .7);
  --ear: #3b2296; --tip: #ff6ad5; --ex: 25px; --es: -19px; }
#app #face {
  background: radial-gradient(ellipse 38% 30% at 50% 57%, #0f0833 0 90%, rgba(200, 230, 255, .5) 94%, transparent 100%), var(--shell);
  box-shadow: calc(-1 * var(--ex)) 0 0 var(--es) var(--ear), var(--ex) 0 0 var(--es) var(--ear), 0 0 26px var(--fglow), inset 0 -6px 14px rgba(0, 0, 0, .45);
}
#app #face::before {    /* антенна: палочка + огонёк */
  content: ""; position: absolute; left: 50%; top: -10px; width: 10px; height: 14px; margin-left: -5px; pointer-events: none;
  background: radial-gradient(circle at 50% 4px, var(--tip) 0 3.3px, transparent 3.9px), linear-gradient(#cdbdff, #cdbdff) 50% 6px / 2px 9px no-repeat;
  filter: drop-shadow(0 0 3px var(--tip)); transition: transform .3s; transform-origin: 50% 100%;
}
#app #face.talk::before, #app #face.think::before { animation: runoTip .45s ease-in-out infinite alternate; }
@keyframes runoTip { to { opacity: .45; } }
.face.think { --fglow: rgba(42, 209, 255, .9); --tip: #38d8ff; }
.face.happy { --fglow: rgba(93, 255, 155, .85); --tip: #5dff9b; }
.face::after {          /* блик на макушке */
  content: ""; position: absolute; left: 24%; top: 7%; width: 26%; height: 13%;
  border-radius: 50%; background: rgba(255, 255, 255, .4); filter: blur(1.5px); pointer-events: none; transform: rotate(-20deg);
}
.lvl { font-weight: 700; }
.lvl .bar { height: 8px; background: rgba(255, 255, 255, .08); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .4); }
.lvl .bar i {
  background: linear-gradient(90deg, var(--pink), var(--vio), var(--cyan));
  box-shadow: 0 0 10px rgba(255, 106, 213, .6);
}

/* ── вкладки — «таблетки» ── */
.tabs { padding: 4px; border-radius: 18px; background: rgba(12, 8, 34, .55); border: 1px solid var(--line); }
.tabs .btn { background: transparent; border-color: transparent; box-shadow: none; color: var(--dim); }
.tabs .btn:hover { background: rgba(255, 255, 255, .06); color: var(--txt); transform: none; }
.tabs .btn.on { background: var(--grad); color: #fff; box-shadow: var(--glow-v); }

/* ── главная панель: стеклянная карточка с цветной рамкой ── */
.panel {
  border: 1px solid transparent;
  border-radius: 22px;
  background:
    linear-gradient(170deg, rgba(26, 17, 66, .9), rgba(14, 9, 40, .9)) padding-box,
    linear-gradient(140deg, rgba(255, 106, 213, .55), rgba(138, 92, 255, .25) 40%, rgba(56, 216, 255, .5)) border-box;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45), 0 0 40px rgba(120, 70, 255, .12);
}

/* ── сцена с большим лицом (face.js) — только фон и цвета ── */
#app .stage {
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(260px 150px at 95px 50%, rgba(150, 90, 255, .32), transparent 70%),
    radial-gradient(500px 160px at 70% 120%, rgba(56, 216, 255, .1), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, .03), transparent);
}
#app .stage .sub { font-weight: 700; }
#app .stage .fold { transition: background .2s; }
#app .stage .fold:hover { background: rgba(255, 255, 255, .14); color: var(--txt); }

/* ── сообщения ── */
.scroll { scrollbar-width: thin; scrollbar-color: rgba(170, 140, 255, .35) transparent; }
.scroll::-webkit-scrollbar { width: 8px; }
.scroll::-webkit-scrollbar-thumb { background: rgba(170, 140, 255, .3); border-radius: 8px; }
.msg .bub { padding: 10px 14px; border-radius: 18px; font-weight: 600; line-height: 1.45; }
.msg.me .bub {
  background: var(--grad);
  border-bottom-right-radius: 6px;
  box-shadow: 0 6px 18px rgba(200, 75, 210, .35);
}
.msg.runo .bub {
  background: linear-gradient(160deg, rgba(48, 34, 115, .95), rgba(30, 22, 82, .95));
  border: 1px solid rgba(170, 140, 255, .25);
  border-bottom-left-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .06);
}
/* 🤖 v5: маленький Runo у сообщений — такой же робот, как большой (экран-лицо, «наушники», антенна .an) */
.msg.runo .av {
  --shell: radial-gradient(circle at 35% 28%, #d3c4ff, #6f42ff 48%, #1d0c55 100%); --glow: rgba(150, 95, 255, .7); --ear: #4a2cb8; --tip: #ff6ad5;
  width: 32px; height: 32px; margin-left: 4px;
  box-shadow: -15px 0 0 -13px var(--tip), 15px 0 0 -13px var(--tip), -14px 0 0 -10px var(--ear), 14px 0 0 -10px var(--ear),
    0 0 14px var(--glow), inset 0 -3px 6px rgba(0, 0, 0, .35);
}
.msg.runo .av .an {      /* антенна: палочка + огонёк (элемент добавляет emotion.js) */
  position: absolute; left: 50%; top: -6px; width: 2px; height: 8px; margin-left: -1px; border-radius: 2px; background: #cdbdff;
  pointer-events: none; transform-origin: 50% 100%; transition: transform .3s;
}
.msg.runo .av .an::after {
  content: ""; position: absolute; left: 50%; top: -4px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%;
  background: var(--tip); box-shadow: 0 0 5px var(--tip), inset -1px -1px 0 rgba(0, 0, 0, .2);
}
.msg.runo.typing .av { --tip: #38d8ff; --glow: rgba(42, 209, 255, .75); }
.msg.runo.typing .av .an::after { animation: runoTip .45s ease-in-out infinite alternate; }
/* 👤 своя аватарка — в круглой рамке цветов Runo */
html.hasav .msg.me .meav {
  width: 32px; height: 32px; border: 2px solid transparent;
  background: var(--meav) center / cover padding-box, linear-gradient(135deg, #ff6ad5, #8a5cff 50%, #38d8ff) border-box;
  box-shadow: 0 0 12px rgba(255, 106, 213, .45);
}
/* новое сообщение «выпрыгивает» (только последнее — при перерисовке чата не мигает всё) */
.scroll > .msg:last-child { animation: runoPop .35s cubic-bezier(.2, .9, .3, 1.3); transform-origin: bottom left; }
.scroll > .msg.me:last-child { transform-origin: bottom right; }
@keyframes runoPop { from { opacity: 0; transform: translateY(10px) scale(.94); } to { opacity: 1; transform: none; } }
/* «Runo думает…» — дышит */
.typing .bub { animation: runoBreath 1.2s ease-in-out infinite; }
@keyframes runoBreath { 50% { opacity: .55; } }
.msg .tools button { border-radius: 10px; font-weight: 700; transition: background .2s, transform .15s; }
.msg .tools button:hover { background: rgba(255, 255, 255, .14); }
.msg .tools button:active { transform: scale(.95); }
.web img { border-radius: 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, .4); }
.web a { font-weight: 700; }
.teach { border-radius: 14px; }

/* ── подсказки ── */
.hints button {
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(190, 170, 255, .22);
  font-weight: 700;
  color: #e3dcff;
  transition: background .2s, border-color .2s, transform .15s;
}
.hints button:hover { background: rgba(255, 106, 213, .16); border-color: rgba(255, 106, 213, .55); color: #fff; }
.hints button:active { transform: scale(.95); }

/* ── поле ввода ── */
.compose { background: linear-gradient(180deg, rgba(10, 6, 30, .4), rgba(10, 6, 30, .8)); }
.compose input {
  background: rgba(6, 4, 22, .85);
  border: 1px solid rgba(190, 170, 255, .2);
  border-radius: 16px;
  font-weight: 600;
  transition: border-color .2s, box-shadow .2s;
}
.compose input::placeholder { color: rgba(177, 168, 216, .7); }
.compose input:focus, .teach input:focus, .addbox input:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255, 106, 213, .2), 0 0 18px rgba(255, 106, 213, .25);
}
.compose .btn { border-radius: 16px; }
.compose .btn.go { animation: runoSend 3.5s ease-in-out infinite; }
@keyframes runoSend { 0%, 85%, 100% { transform: none; } 92% { transform: translateX(3px); } }

/* ── 🎓 учить, 🧠 мозг, 🗺️ шаги — карточки ── */
.addbox, .know, .stat, .step, .netrow { border-radius: 16px; transition: transform .2s, border-color .2s, box-shadow .2s; }
.know:hover, .stat:hover, .step:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 0, 0, .3); border-color: rgba(190, 170, 255, .35); }
.stat b { font-family: Unbounded, Nunito, sans-serif; font-size: 1.25rem; background: linear-gradient(90deg, var(--cyan), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.chip { font-weight: 700; }
.brainc, .lossc { box-shadow: inset 0 0 0 1px var(--line), 0 6px 20px rgba(0, 0, 0, .35); }
.step.next { box-shadow: 0 0 22px rgba(255, 209, 102, .18); }
.step.done .ic { filter: drop-shadow(0 0 8px rgba(93, 255, 155, .5)); }
h3 { font-weight: 900; letter-spacing: .3px; }
.prog i { box-shadow: 0 0 10px rgba(255, 106, 213, .6); }

/* ── окна и всплывашка ── */
.modal { background: rgba(4, 2, 14, .78); }
.box {
  border: 1px solid transparent;
  border-radius: 22px;
  background:
    linear-gradient(160deg, #2a0f5c, #140b3e 60%, #062640) padding-box,
    linear-gradient(140deg, rgba(255, 106, 213, .6), rgba(56, 216, 255, .5)) border-box;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}
.modal.show .box { animation: runoPop .3s cubic-bezier(.2, .9, .3, 1.2); }
.box h2 { font-family: Unbounded, Nunito, sans-serif; font-size: 1.2rem; }
.toast {
  border: 1px solid transparent;
  border-radius: 14px;
  font-weight: 700;
  background:
    linear-gradient(rgba(22, 13, 56, .97), rgba(22, 13, 56, .97)) padding-box,
    linear-gradient(90deg, var(--pink), var(--cyan)) border-box;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}

/* ── табличка talk.js (слушаю / думаю / говорю) — только цвет и тень ── */
#app .tstate { font-weight: 800; box-shadow: 0 4px 16px rgba(0, 0, 0, .45); }

/* ═════ v2 (2026-11-22, Кевин: «чуть-чуть ещё подизайнируй») ═════ */
/* окно разговора: еле заметный узор из точек, едет вместе с сообщениями */
#chat {
  background-image: radial-gradient(rgba(190, 170, 255, .08) 1px, transparent 1.4px);
  background-size: 22px 22px;
  background-attachment: local;
}
/* аватар Runo у сообщений — маленькое лицо вместо 🤖 (глаза + рот, моргает) */
.msg.runo .av { position: relative; font-size: 0; color: transparent;
  background: radial-gradient(ellipse 37% 29% at 50% 57%, #0f0833 0 89%, rgba(200, 230, 255, .5) 93%, transparent 100%), var(--shell); }
.msg.runo .av::before {               /* левый глаз; правый — тенью */
  content: ""; position: absolute; left: 32%; top: 32%; width: 13%; height: 24%; border-radius: 4px;
  background: #eafcff; box-shadow: 7px 0 0 #eafcff, 0 0 6px #7ff, 7px 0 6px #7ff;
  animation: runoAvBlink 4.6s infinite; transform-origin: 50% 50%;
}
.msg.runo .av::after {                /* рот */
  content: ""; position: absolute; left: 50%; bottom: 24%; width: 34%; height: 2px; margin-left: -17%;
  border-radius: 2px; background: #eafcff; opacity: .85;
}
@keyframes runoAvBlink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.15); } }
.msg.runo.typing .av::after { animation: runoAvTalk .35s ease-in-out infinite alternate; }
@keyframes runoAvTalk { to { height: 5px; } }
/* «Runo думает…» + три прыгающие точки */
.typing .bub::after {
  content: ""; display: inline-block; vertical-align: middle; width: 26px; height: 8px; margin-left: 8px;
  background:
    radial-gradient(circle, var(--pink) 3px, transparent 3.5px) 0 50% / 8px 8px no-repeat,
    radial-gradient(circle, #b38bff 3px, transparent 3.5px) 9px 50% / 8px 8px no-repeat,
    radial-gradient(circle, var(--cyan) 3px, transparent 3.5px) 18px 50% / 8px 8px no-repeat;
  animation: runoDots 1s ease-in-out infinite;
}
@keyframes runoDots { 50% { transform: translateY(-3px); } }
/* подсказки: края плавно тают — видно, что ряд листается */
.hints {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 28px), transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 28px), transparent 100%);
}
/* кнопки под ответом — «таблетки» */
.msg .tools { gap: 6px; }
.msg .tools button { border-radius: 999px; padding: 4px 11px; background: rgba(255, 255, 255, .08); border-color: rgba(190, 170, 255, .25); }
.msg .tools button:hover { border-color: rgba(56, 216, 255, .55); }
/* ответ из интернета — карточка с картинкой */
.web { padding: 8px; border-radius: 14px; background: rgba(6, 4, 22, .45); border: 1px solid rgba(56, 216, 255, .2); }
.web img { width: 96px; height: 96px; }
.web a { padding: 3px 0; }
.web a:hover { text-decoration: underline; }
/* «Научи меня» — золотая рамка */
.teach { border: 1px solid transparent; border-radius: 16px;
  background: linear-gradient(rgba(40, 30, 20, .55), rgba(40, 30, 20, .55)) padding-box,
              linear-gradient(120deg, rgba(255, 209, 102, .8), rgba(255, 106, 213, .5)) border-box; }
/* картинки в окнах и «Мозг» — мягкие рамки */
.addbox { border: 1px solid transparent;
  background: linear-gradient(rgba(14, 30, 30, .7), rgba(14, 30, 30, .7)) padding-box,
              linear-gradient(120deg, rgba(93, 255, 155, .55), rgba(56, 216, 255, .35)) border-box; }
/* выделение текста — в цветах Runo */
::selection { background: rgba(255, 106, 213, .45); color: #fff; }

/* ═════ v3: 😊😠😢😱😮 эмоции (emotion.js ставит data-emo) ═════ */
/* брови у маленьких аватарок (<i class="eb"> добавляет emotion.js) */
.msg.runo .av .eb { display: none; position: absolute; left: 22%; top: 17%; width: 56%; height: 3px; pointer-events: none; }
.msg.runo .av .eb::before, .msg.runo .av .eb::after { content: ""; position: absolute; top: 0; width: 40%; height: 2px; border-radius: 2px; background: #eafcff; }
.msg.runo .av .eb::before { left: 0; } .msg.runo .av .eb::after { right: 0; }
.msg.runo[data-emo] .av .eb { display: block; }
.msg.runo .av, .msg.runo .av::after { transition: background .3s, box-shadow .3s; }
/* злой: красный, брови «\ /», рот «⌒» */
.msg.runo[data-emo="angry"] .av { --shell: radial-gradient(circle at 35% 30%, #ffc0cc, #e0306a 48%, #5a0f2e 100%); --glow: rgba(255, 60, 100, .8); --ear: #8a1840; --tip: #ff3d5a; }
.msg.runo[data-emo="angry"] .av .eb::before { transform: rotate(22deg); }
.msg.runo[data-emo="angry"] .av .eb::after { transform: rotate(-22deg); }
.msg.runo[data-emo="angry"] .av::after, .msg.runo[data-emo="sad"] .av::after {
  height: 5px; background: none; border-top: 2px solid #eafcff; border-radius: 50% 50% 0 0; bottom: 18%; }
/* грустный: синий, брови «/ \», слезинка */
.msg.runo[data-emo="sad"] .av { --shell: radial-gradient(circle at 35% 30%, #c4dcff, #3c6cff 48%, #10245a 100%); --glow: rgba(70, 130, 255, .8); --ear: #1c3a8f; --tip: #7fb2ff; }
.msg.runo[data-emo="sad"] .av .an { transform: rotate(38deg); }
.msg.runo[data-emo="sad"] .av .eb::before { transform: rotate(-20deg); }
.msg.runo[data-emo="sad"] .av .eb::after { transform: rotate(20deg); }
.msg.runo[data-emo="sad"] .av::before { box-shadow: 7px 0 0 #eafcff, -1px 8px 0 -1px #7fd4ff; }
/* радость: зелёное свечение, улыбка «‿» */
.msg.runo[data-emo="happy"] .av { --glow: rgba(93, 255, 155, .85); --tip: #5dff9b; }
.msg.runo[data-emo="happy"] .av .eb { top: 14%; }
.msg.runo[data-emo="happy"] .av::after { height: 5px; background: none; border-bottom: 2px solid #eafcff; border-radius: 0 0 50% 50%; bottom: 18%; }
/* испуг: бледный, брови вверх, рот «o», дрожит */
.msg.runo[data-emo="scared"] .av { --shell: radial-gradient(circle at 35% 30%, #f2eeff, #9a8cff 48%, #3a2f7a 100%); --glow: rgba(200, 190, 255, .8); --ear: #4d3f9a; --tip: #ffffff; animation: runoShake .25s linear 6; }
.msg.runo[data-emo="scared"] .av .eb { top: 10%; }
.msg.runo[data-emo="scared"] .av .eb::before { transform: rotate(-10deg); }
.msg.runo[data-emo="scared"] .av .eb::after { transform: rotate(10deg); }
.msg.runo[data-emo="scared"] .av::after, .msg.runo[data-emo="wow"] .av::after {
  width: 7px; height: 8px; margin-left: -3.5px; background: none; border: 2px solid #eafcff; border-radius: 50%; bottom: 14%; }
/* удивление: голубое свечение, брови вверх, рот «o» */
.msg.runo[data-emo="wow"] .av { --glow: rgba(56, 216, 255, .9); --tip: #38d8ff; }
.msg.runo[data-emo="wow"] .av .an { height: 10px; top: -8px; }
.msg.runo[data-emo="wow"] .av .eb { top: 8%; }
@keyframes runoShake { 25% { transform: translateX(-1.5px); } 75% { transform: translateX(1.5px); } }

/* лицо в шапке (#face): глаза меняют форму, рот, цвет */
#face .eye, #face .mouth { transition: clip-path .25s, transform .25s, background .25s; }
#face[data-emo="angry"] { --shell: radial-gradient(circle at 35% 30%, #ffc0cc, #e0306a 45%, #5a0f2e 100%); --fglow: rgba(255, 60, 100, .85); --ear: #8a1840; --tip: #ff3d5a; }
#face[data-emo="angry"] .eye.l { clip-path: polygon(0 0, 100% 45%, 100% 100%, 0 100%); }
#face[data-emo="angry"] .eye.r { clip-path: polygon(0 45%, 100% 0, 100% 100%, 0 100%); }
#face[data-emo="sad"] { --shell: radial-gradient(circle at 35% 30%, #c4dcff, #3c6cff 45%, #10245a 100%); --fglow: rgba(70, 130, 255, .85); --ear: #1c3a8f; --tip: #7fb2ff; }
#app #face[data-emo="sad"]::before { transform: rotate(35deg); }
#face[data-emo="sad"] .eye { transform: translateY(2px); }
#face[data-emo="sad"] .eye.l { clip-path: polygon(0 45%, 100% 0, 100% 100%, 0 100%); }
#face[data-emo="sad"] .eye.r { clip-path: polygon(0 0, 100% 45%, 100% 100%, 0 100%); }
#face[data-emo="angry"] .mouth, #face[data-emo="sad"] .mouth { height: 7px; background: none; border-top: 3px solid #eafcff; border-radius: 50% 50% 0 0; }
#face[data-emo="happy"] { --fglow: rgba(93, 255, 155, .85); --tip: #5dff9b; }
#face[data-emo="happy"] .mouth { height: 7px; background: none; border-bottom: 3px solid #eafcff; border-radius: 0 0 50% 50%; }
#face[data-emo="scared"] { --shell: radial-gradient(circle at 35% 30%, #f2eeff, #9a8cff 45%, #3a2f7a 100%); --fglow: rgba(200, 190, 255, .8); --ear: #4d3f9a; --tip: #ffffff; animation: runoShake .2s linear 10; }
#face[data-emo="scared"] .eye, #face[data-emo="wow"] .eye { transform: scale(1.25); }
#face[data-emo="scared"] .mouth, #face[data-emo="wow"] .mouth { width: 9px; height: 10px; margin-left: -4.5px; background: none; border: 3px solid #eafcff; border-radius: 50%; }
#face[data-emo="wow"] { --fglow: rgba(56, 216, 255, .9); --tip: #38d8ff; }
#app #face[data-emo="wow"]::before { transform: scaleY(1.25); }

/* 🎭 выбор эмоции при обучении (emotion.js вставляет .emo-pick в «Научи меня» и «🎓 Учить») */
.emo-pick { display: flex; flex-direction: column; gap: 6px; }
.emo-pick small { color: var(--dim); font-size: .8rem; font-weight: 700; }
.addbox .emo-pick small { color: var(--dim); }
.emo-row { display: flex; gap: 6px; flex-wrap: wrap; }
.emo-b {
  display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 4px 10px 4px 7px; border-radius: 999px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(190, 170, 255, .25); color: var(--txt); font-weight: 700; font-size: .82rem;
  transition: background .2s, border-color .2s, transform .15s, box-shadow .2s;
}
.emo-b span { font-size: 1.15rem; line-height: 1; }
.emo-b:hover { background: rgba(255, 255, 255, .12); }
.emo-b:active { transform: scale(.94); }
.emo-b.on { border-color: transparent; background: var(--grad); box-shadow: var(--glow-v); }
.emo-b[data-e="angry"].on { background: linear-gradient(135deg, #ff4d6d, #c81d5a); box-shadow: 0 4px 16px rgba(255, 60, 100, .5); }
.emo-b[data-e="sad"].on { background: linear-gradient(135deg, #4d8bff, #2a4fc8); box-shadow: 0 4px 16px rgba(70, 130, 255, .5); }
.emo-b[data-e="happy"].on { background: linear-gradient(135deg, #19c37d, #5dd65d); box-shadow: 0 4px 16px rgba(93, 255, 155, .45); }
.emo-b[data-e="scared"].on { background: linear-gradient(135deg, #a99cff, #6a5cd8); box-shadow: 0 4px 16px rgba(200, 190, 255, .5); }
.emo-b[data-e="wow"].on { background: linear-gradient(135deg, #38d8ff, #1a8fe0); box-shadow: 0 4px 16px rgba(56, 216, 255, .5); }
@media (max-width: 640px) { .emo-b i { display: none; } .emo-b { padding: 4px 9px; } }
/* знание с эмоцией — рамка своего цвета */
.know[data-emo="angry"] { border-color: rgba(255, 60, 100, .55); }
.know[data-emo="sad"] { border-color: rgba(70, 130, 255, .55); }
.know[data-emo="happy"] { border-color: rgba(93, 255, 155, .5); }
.know[data-emo="scared"] { border-color: rgba(200, 190, 255, .55); }
.know[data-emo="wow"] { border-color: rgba(56, 216, 255, .55); }

/* сцена с большим лицом чуть окрашивается под настроение */
#app .stage { transition: background .5s; }
html[data-emo="angry"] #app .stage { background: radial-gradient(260px 150px at 95px 50%, rgba(255, 60, 100, .35), transparent 70%), linear-gradient(180deg, rgba(255, 60, 100, .06), transparent); }
html[data-emo="sad"] #app .stage { background: radial-gradient(260px 150px at 95px 50%, rgba(70, 130, 255, .35), transparent 70%), linear-gradient(180deg, rgba(70, 130, 255, .06), transparent); }
html[data-emo="happy"] #app .stage { background: radial-gradient(260px 150px at 95px 50%, rgba(93, 255, 155, .28), transparent 70%), linear-gradient(180deg, rgba(93, 255, 155, .05), transparent); }
html[data-emo="scared"] #app .stage { background: radial-gradient(260px 150px at 95px 50%, rgba(200, 190, 255, .3), transparent 70%), linear-gradient(180deg, rgba(200, 190, 255, .05), transparent); }
html[data-emo="wow"] #app .stage { background: radial-gradient(260px 150px at 95px 50%, rgba(56, 216, 255, .32), transparent 70%), linear-gradient(180deg, rgba(56, 216, 255, .06), transparent); }

/* ── телефон ── */
@media (max-width: 640px) {
  .face { --ex: 20px; --es: -15px; }
  #app #face::before { top: -9px; transform: scale(.85); }
  .ttl h1 { letter-spacing: 3px; }
  .tabs { padding: 3px; border-radius: 15px; }
  .panel { border-radius: 18px; }
  body::after { background-size: 420px 420px; }
}
@media (max-height: 500px) {
  .tabs { padding: 2px; }
  .face { --ex: 17px; --es: -13px; }
  #app #face::before { top: -8px; transform: scale(.75); }
}
/* 🎨📷 v1.4 (чат 84): рисунки и фото в пузыре — в стиле Runo, кнопки в одну строку даже на телефоне 360 px */
#chat .rdraw { max-width: 460px; }
#chat .rdraw canvas { border: 1px solid rgba(200, 170, 255, .25); }
#chat .rdraw > div:last-child { display: flex; gap: 6px; margin-top: 7px; }
#chat .rdraw > div:last-child > button, #chat .rph .bt button {
  flex: 1 1 0; min-width: 0; min-height: 38px; margin: 0 !important; padding: 6px 8px !important;
  border-radius: 12px !important; font-family: inherit !important; font-weight: 700 !important; font-size: .86rem !important; line-height: 1.15 !important; color: #fff !important; cursor: pointer;
  background: linear-gradient(180deg, rgba(64, 48, 140, .95), rgba(40, 30, 100, .95)) !important;
  border: 1px solid rgba(200, 170, 255, .3) !important; transition: transform .15s, filter .2s;
}
#chat .rdraw > div:last-child > button:active, #chat .rph .bt button:active { transform: scale(.96); }
#chat .rdraw > div:last-child > button:hover, #chat .rph .bt button:hover { filter: brightness(1.15); }
#chat .rph .ba { border: 1px solid rgba(200, 170, 255, .25); box-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
#chat .rph .lb { background: rgba(20, 10, 50, .7); border: 1px solid rgba(200, 170, 255, .35); }
/* ползунок «было / стало»: неоновая дорожка, большой круглый бегунок — удобно пальцем */
#chat .rph input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 4px 0 2px; background: transparent; cursor: ew-resize; touch-action: pan-y; }
#chat .rph input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, #8a5cff, #ff6ad5 50%, #38d8ff); }
#chat .rph input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%;
  background: #fff; border: 3px solid #ff6ad5; box-shadow: 0 0 0 4px rgba(255, 106, 213, .25), 0 2px 6px rgba(0, 0, 0, .45);
}
#chat .rph input[type=range]::-moz-range-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, #8a5cff, #ff6ad5 50%, #38d8ff); }
#chat .rph input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid #ff6ad5; box-shadow: 0 0 0 4px rgba(255, 106, 213, .25); }
#chat .rph input[type=range]:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 8px; }
/* 📎 кнопка и 🔒 заметка о приватности */
.compose #bAttach { font-size: 1.15rem; }
#chat .att-note { font-size: .8rem; opacity: .85; margin-top: 4px; }

/* кто не любит движение — всё спокойно */
@media (prefers-reduced-motion: reduce) {
  body::before, body::after, .ttl h1, .compose .btn.go, .typing .bub, .typing .bub::after, .msg.runo .av::before, .msg.runo .av::after,
  .msg.runo .av .an::after, #app #face::before,
  .scroll > .msg:last-child, .modal.show .box { animation: none !important; }
}
