:root{
  --red:#b71c1c;
  --red-dark:#8e1414;
  --red-soft:#fdecec;
  --ink:#1a1a1a;
  --muted:#6b6b6b;
  --line:#ececec;
}
* { box-sizing: border-box; }
body { margin:0; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
       color:var(--ink); background:#fafafa; line-height:1.55; }
a { color:var(--red); }
.hdr { display:flex; justify-content:space-between; align-items:center; padding:16px 32px;
       background:#fff; border-bottom:1px solid var(--line); position:sticky; top:0; z-index:10; }
.brand { display:flex; align-items:center; gap:12px; text-decoration:none; color:var(--ink); }
.brand svg { display:block; }
.brand-name { font-weight:700; font-size:19px; letter-spacing:.2px; }
.brand-name span { color:var(--red); }
.adm-link { color:var(--muted); text-decoration:none; font-size:13px; }
.adm-link:hover { color:var(--red); }
.wrap { max-width:820px; margin:56px auto; padding:0 20px; }
h1 { font-size:32px; margin:0 0 8px; font-weight:700; }
h1 .accent { color:var(--red); }
.sub { color:var(--muted); margin:0 0 32px; }
.dialog { margin-bottom:24px; }
.msg { padding:18px 22px; border-radius:12px; margin-bottom:14px; white-space:pre-wrap;
       word-wrap:break-word; font-size:15px; }
.msg.user { background:var(--red-soft); border-left:3px solid var(--red); }
.msg.ai { background:#fff; border:1px solid var(--line); border-left:3px solid #ddd; }
.msg .role { font-size:11px; text-transform:uppercase; letter-spacing:1px; color:var(--muted); margin-bottom:6px; }
.msg.user .role { color:var(--red); }
.msg .btn-review { display:inline-block; margin-top:14px; padding:10px 18px; background:var(--red);
                   color:#fff; text-decoration:none; border-radius:8px; font-size:13px; cursor:pointer;
                   border:none; font-weight:600; }
.msg .btn-review:hover { background:var(--red-dark); }
.msg .offer { margin-top:10px; font-size:13px; color:var(--muted); }
.msg .offer a { color:var(--red); font-weight:600; text-decoration:none; }
.msg .offer a:hover { text-decoration:underline; }
.ask-form textarea { width:100%; min-height:110px; padding:16px; border:1px solid #ddd;
                     border-radius:12px; font-size:15px; font-family:inherit; resize:vertical;
                     background:#fff; transition:border-color .15s; }
.ask-form textarea:focus { outline:none; border-color:var(--red); box-shadow:0 0 0 3px rgba(183,28,28,.08); }
.row { display:flex; align-items:center; gap:16px; margin-top:12px; }
.attach { cursor:pointer; font-size:14px; color:var(--muted); }
.attach:hover { color:var(--red); }
.attach input { display:none; }
.file-name { font-size:12px; color:var(--muted); }
#send-btn { margin-left:auto; padding:12px 28px; background:var(--red); color:#fff; border:none;
            border-radius:10px; font-size:15px; cursor:pointer; font-weight:600; }
#send-btn:hover { background:var(--red-dark); }
#send-btn:disabled { opacity:.5; cursor:wait; }
.ftr { text-align:center; padding:40px 20px; color:#999; font-size:13px;
       border-top:1px solid var(--line); margin-top:80px; }
.ftr .owner { color:var(--ink); font-weight:600; }
.disclaimer { margin-top:6px; font-size:12px; }

/* ====== АПЛОШКА ====== */
.aposhka {
  position: fixed;
  right: 28px;
  bottom: 28px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  z-index: 999;
}

.aposhka-bubble {
  position: relative;
  width: 260px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 34px 14px 18px;
  box-shadow: 0 10px 34px rgba(0,0,0,.10);
  margin-bottom: 22px;
  font-size: 14px;
  line-height: 1.5;
  animation: bubble-in .35s ease-out;
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.aposhka-bubble::after {
  content: '';
  position: absolute;
  right: -9px;
  bottom: 24px;
  width: 0; height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 9px solid #ffffff;
}

.aposhka-close {
  position: absolute;
  top: 6px; right: 10px;
  background: none;
  border: none;
  color: #c7c7c7;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.aposhka-close:hover { color: var(--red); background: var(--red-soft); }

.aposhka-text { color: var(--ink); }

.aposhka-actions { margin-top: 10px; }
.aposhka-actions button {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}
.aposhka-actions button:hover { background: var(--red-dark); }

/* Персонаж — весы */
.aposhka-char {
  width: 84px;
  height: 84px;
  cursor: pointer;
  flex-shrink: 0;
  animation: scales-float 5s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(183,28,28,.30));
  transition: transform .2s ease;
  transform-origin: 50% 90%;
}
.aposhka-char svg { width: 100%; height: 100%; display: block; }
.aposhka-char:hover { animation-play-state: paused; transform: scale(1.08); }
.aposhka-char:active { transform: scale(.95); }

@keyframes scales-float {
  0%, 100% { transform: translateY(0)     rotate(-2deg); }
  50%      { transform: translateY(-8px)  rotate(2deg); }
}

/* Коромысло качается */
.ap-beam {
  transform-box: fill-box;
  transform-origin: center;
  animation: beam-tilt 3.2s ease-in-out infinite;
}
@keyframes beam-tilt {
  0%, 100% { transform: rotate(-4deg); }
  50%      { transform: rotate(4deg); }
}

/* Чаши покачиваются в противофазе */
.ap-pan {
  transform-box: fill-box;
  transform-origin: center top;
}
.ap-pan-left  { animation: pan-left  3.2s ease-in-out infinite; }
.ap-pan-right { animation: pan-right 3.2s ease-in-out infinite; }

@keyframes pan-left {
  0%, 100% { transform: rotate(3deg); }
  50%      { transform: rotate(-3deg); }
}
@keyframes pan-right {
  0%, 100% { transform: rotate(-3deg); }
  50%      { transform: rotate(3deg); }
}

/* Глаза моргают */
.ap-eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: blink 4s infinite;
}
@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95%           { transform: scaleY(0.1); }
}

@media (max-width: 640px) {
  .aposhka-bubble { display: none; }
  .aposhka-char { width: 66px; height: 66px; }
}

/* ====== МОДАЛЬНОЕ ОКНО ====== */
.modal { position:fixed; inset:0; background:rgba(0,0,0,.4); display:flex;
         align-items:center; justify-content:center; z-index:1000; }
.modal-box { background:#fff; border-radius:14px; padding:28px; max-width:420px; width:90%; }
.modal-box h3 { margin:0 0 8px; color:var(--red); }
.modal-box p { font-size:14px; color:var(--muted); margin:0 0 18px; }
.tabs { display:flex; gap:8px; margin-bottom:14px; }
.tab { flex:1; padding:10px; border:1px solid var(--line); background:#fff; border-radius:8px;
       cursor:pointer; font-size:14px; }
.tab.active { background:var(--red); color:#fff; border-color:var(--red); }
#contact-value { width:100%; padding:12px; border:1px solid #ddd; border-radius:8px;
                 font-size:15px; margin-bottom:14px; font-family:inherit; }
#contact-value:focus { outline:none; border-color:var(--red); }
#contact-send { width:100%; padding:12px; background:var(--red); color:#fff; border:none;
                border-radius:8px; font-size:15px; cursor:pointer; font-weight:600; }
#contact-result { margin-top:12px; font-size:13px; }

/* ====== АДМИНКА ====== */
.admin-wrap { max-width:900px; margin:40px auto; padding:0 20px; }
.card { background:#fff; border:1px solid var(--line); border-radius:12px; padding:22px; margin-bottom:18px; }
.card h3 { margin:14px 0 8px; font-size:15px; color:var(--red); }
.card .meta { font-size:12px; color:var(--muted); margin-bottom:10px; }
.card .q, .card .a { white-space:pre-wrap; margin:8px 0; padding:12px; background:#f7f7f7;
                     border-radius:8px; font-size:14px; }
.card textarea { width:100%; min-height:180px; padding:14px; border:1px solid #ddd;
                 border-radius:10px; font-family:inherit; font-size:14px; }
.card button { margin-top:12px; padding:10px 22px; background:var(--red); color:#fff; border:none;
               border-radius:8px; cursor:pointer; font-size:14px; font-weight:600; }
.card button:hover { background:var(--red-dark); }
.login-form { max-width:340px; margin:120px auto; padding:32px; background:#fff;
              border:1px solid var(--line); border-radius:14px; }
.login-form input { width:100%; padding:12px; border:1px solid #ddd; border-radius:8px;
                    margin-bottom:14px; font-size:15px; }
.login-form button { width:100%; padding:12px; background:var(--red); color:#fff; border:none;
                     border-radius:8px; cursor:pointer; font-size:15px; font-weight:600; }