/* Interactive Zapiskg.com demo — Telegram UI (dark theme) */

.demo-section {
  padding: 2.5rem 0 3.5rem;
  overflow-x: clip;
}

.demo-section.section-bg {
  /* фон задаётся в index.html через section-bg--demo */
}

.demo-section:not(.section-bg) {
  background:
    linear-gradient(180deg, rgba(48, 186, 255, 0.07) 0%, rgba(0, 210, 168, 0.06) 40%, var(--bg) 100%);
}

.demo-section--priority {
  padding-top: 1.75rem;
  border-top: none;
  box-shadow: inset 0 1px 0 var(--border);
}

.demo-intro {
  text-align: left;
  max-width: none;
  margin: 0 0 1.25rem;
}

.demo-intro .section-sub {
  margin-top: 0.35rem;
}

.demo-intro__sub {
  margin-bottom: 1.25rem !important;
}

.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--support-soft);
  color: var(--support);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}

.demo-badge--live {
  background: rgba(34, 158, 217, 0.12);
  color: #1a6fa0;
  border: 1px solid rgba(34, 158, 217, 0.35);
}

.demo-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
  animation: demo-live-pulse 1.8s ease-out infinite;
}

@keyframes demo-live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.demo-live-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  max-width: min(100%, 340px);
  padding: 0.55rem 0.85rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(34, 158, 217, 0.14) 0%, rgba(196, 92, 62, 0.1) 100%);
  border: 1px solid rgba(34, 158, 217, 0.35);
  font-size: 0.82rem;
  color: var(--text);
  text-align: center;
  line-height: 1.35;
}

.demo-live-banner__icon {
  font-size: 1.15rem;
  animation: demo-tap-bounce 1.4s ease-in-out infinite;
}

@keyframes demo-tap-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.demo-post-cta {
  text-align: center;
  margin-top: 2rem;
  padding: 1.5rem 1.25rem;
  background: linear-gradient(135deg, var(--telegram-soft) 0%, #fff 50%, var(--accent-soft) 100%);
  border: 2px solid rgba(28, 156, 224, 0.25);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.demo-post-cta p {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}

.demo-roles-caption {
  display: none;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0;
}

.demo-layout {
  display: grid;
  gap: 1.25rem;
  align-items: start;
  width: 100%;
  min-width: 0;
}

@media (max-width: 959px) {
  .demo-layout {
    gap: 0.85rem;
  }

  .demo-sidebar {
    display: contents;
  }

  .demo-roles-caption {
    display: block;
    grid-row: 1;
    text-align: center;
  }

  .demo-roles-sticky {
    grid-row: 2;
    position: sticky;
    top: 52px;
    z-index: 90;
    margin: 0 calc(-1 * max(0px, (100vw - 100%) / 2));
    padding: 0.35rem 1rem 0.65rem;
    background: rgba(250, 248, 246, 0.94);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
  }

  .demo-roles {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.45rem;
    padding-bottom: 0.15rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .demo-roles::-webkit-scrollbar { display: none; }

  .demo-role-btn {
    flex: 0 0 auto;
    scroll-snap-align: center;
    min-width: auto;
    padding: 0.6rem 0.95rem;
    border-radius: 999px;
    font-size: 0.84rem;
  }

  .demo-role-btn__label {
    white-space: nowrap;
    overflow: visible;
    text-overflow: unset;
  }

  .demo-phone-wrap {
    grid-row: 3;
  }

  .demo-hints {
    grid-row: 4;
  }

  .demo-reset {
    grid-row: 5;
  }
}

@media (min-width: 960px) {
  .demo-layout {
    grid-template-columns: 220px 340px;
    gap: 1.5rem;
    align-items: start;
    justify-content: center;
  }

  .demo-sidebar {
    align-self: start;
    width: 100%;
  }

  .demo-phone-wrap {
    align-self: start;
    width: 340px;
    max-width: 340px;
  }

  .demo-roles-sticky {
    width: 100%;
    position: relative;
  }
}

/* —— Авто-подсказка «рука» —— */
.demo-tap-hand {
  position: absolute;
  z-index: 400;
  width: 40px;
  height: 40px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s, left 0.45s cubic-bezier(0.4, 0, 0.2, 1), top 0.45s cubic-bezier(0.4, 0, 0.2, 1), transform 0.15s ease;
  transform-origin: 50% 85%;
}

.demo-tap-hand--visible {
  opacity: 1;
}

.demo-tap-hand--press {
  transform: scale(0.82);
}

.demo-tap-hand__finger {
  display: block;
  font-size: 1.65rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.demo-tap-ripple {
  position: absolute;
  left: 50%;
  top: 55%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 2px solid rgba(28, 156, 224, 0.75);
  opacity: 0;
  pointer-events: none;
}

.demo-tap-hand--press .demo-tap-ripple {
  animation: demo-tap-ripple 0.45s ease-out forwards;
}

@keyframes demo-tap-ripple {
  0% { transform: scale(0.4); opacity: 0.9; }
  100% { transform: scale(2.2); opacity: 0; }
}

.demo-tap-hand--roles {
  z-index: 95;
}

.demo-roles-sticky {
  position: relative;
}

@media (min-width: 960px) {
  .demo-roles-sticky {
    position: relative;
    top: auto;
    margin: 0;
    padding: 0;
    background: transparent;
    border-bottom: none;
    backdrop-filter: none;
  }
}

.demo-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  min-width: 0;
}

.demo-roles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}

@media (min-width: 960px) {
  .demo-roles { grid-template-columns: 1fr; }
}

.demo-role-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.75rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.demo-role-btn__icon {
  font-size: 1.2rem;
  line-height: 1;
  flex-shrink: 0;
}

.demo-role-btn__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-role-btn:hover { border-color: rgba(34, 158, 217, 0.45); }

.demo-role-btn.active {
  border-color: var(--telegram);
  background: rgba(34, 158, 217, 0.08);
}

.demo-hints {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  font-size: 0.82rem;
  color: var(--muted);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}

.demo-hints h3 {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.demo-hints ul {
  list-style: none;
  display: grid;
  gap: 0.35rem;
}

.demo-hints li::before {
  content: "→ ";
  color: var(--accent);
  font-weight: 700;
}

.demo-reset {
  width: 100%;
  max-width: 100%;
  padding: 0.65rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: transparent;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.demo-reset:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.demo-phone-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
}

.demo-phone-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  max-width: 100%;
  padding-inline: 0.25rem;
}

.demo-phone--live {
  position: relative;
  animation: demo-phone-glow 3s ease-in-out infinite;
}

.demo-phone--live.demo-phone--engaged {
  animation: none;
}

@keyframes demo-phone-glow {
  0%, 100% {
    box-shadow:
      0 28px 70px rgba(0, 0, 0, 0.28),
      0 0 0 1px rgba(255, 255, 255, 0.08) inset,
      0 0 0 0 rgba(34, 158, 217, 0);
  }
  50% {
    box-shadow:
      0 28px 70px rgba(0, 0, 0, 0.28),
      0 0 0 1px rgba(255, 255, 255, 0.08) inset,
      0 0 0 3px rgba(34, 158, 217, 0.45);
  }
}

/* —— Device frame (same outer size as web-demo phone) —— */
.demo-phone {
  position: relative;
  width: 100%;
  max-width: 340px;
  min-width: min(100%, 340px);
  background: #1c1c1e;
  border-radius: 34px;
  padding: 0.5rem 0.5rem 0.65rem;
  box-sizing: border-box;
  box-shadow:
    0 28px 55px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

#demo-app {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.demo-tap-hand--phone {
  z-index: 500;
}

.demo-phone-notch {
  width: 110px;
  height: 26px;
  background: #000;
  border-radius: 0 0 18px 18px;
  margin: 2px auto 0;
  position: relative;
  z-index: 5;
}

.demo-phone-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 560px;
  min-height: 520px;
  max-height: 600px;
  background: #0e1621;
  border-radius: 16px;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  contain: layout style;
}

/* Status bar */
.demo-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px 4px;
  background: #17212b;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.demo-status-icons {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  opacity: 0.95;
}

.demo-status-signal::before { content: "▮▮▮"; letter-spacing: -2px; font-size: 9px; }
.demo-status-wifi::before { content: "⌁"; }
.demo-status-battery::before { content: "▭"; }

/* Telegram chat header */
.demo-tg-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 8px 4px;
  background: #17212b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  color: #fff;
}

.demo-tg-back {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: #6ab3f3;
  font-size: 26px;
  line-height: 1;
  cursor: default;
  padding: 0;
  flex-shrink: 0;
}

.demo-tg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(145deg, #229ed9, #168acd);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.demo-tg-meta {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.demo-tg-meta b {
  display: block;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-tg-meta small {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: #8ba3b8;
}

.demo-tg-menu {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: #6ab3f3;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.demo-tg-menu svg {
  width: 22px;
  height: 22px;
  display: block;
}

.demo-tg-menu:hover { background: rgba(106, 179, 243, 0.12); }

/* Command popup & header menu */
.demo-phone-screen { position: relative; }

.demo-tg-header { position: relative; z-index: 12; }

.demo-header-backdrop {
  position: absolute;
  inset: 0;
  z-index: 11;
  background: transparent;
}

.demo-header-menu {
  position: absolute;
  top: 100%;
  right: 8px;
  z-index: 14;
  min-width: 190px;
  background: #242f3d;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.demo-header-menu button {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  color: #f5f5f5;
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.demo-header-menu button:last-child { border-bottom: none; }
.demo-header-menu button:hover { background: rgba(255, 255, 255, 0.06); }

.demo-chat-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.demo-chat-dim {
  position: absolute;
  inset: 0;
  z-index: 8;
  background: rgba(0, 0, 0, 0.2);
  cursor: default;
}

.demo-bottom {
  flex-shrink: 0;
  min-width: 0;
  background: #17212b;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  z-index: 20;
  overflow: visible;
}

.demo-cmd-popup {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% + 4px);
  z-index: 60;
  background: #242f3d;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
  max-height: min(280px, 42vh);
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  -webkit-overflow-scrolling: touch;
}

.demo-cmd-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  color: #f5f5f5;
  font-family: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.demo-cmd-item:last-child { border-bottom: none; }
.demo-cmd-item:hover { background: rgba(255, 255, 255, 0.06); }
.demo-cmd-item:active { background: rgba(255, 255, 255, 0.12); }

.demo-cmd-item code,
.demo-cmd-item span {
  pointer-events: none;
  user-select: none;
}

.demo-cmd-item code {
  color: #6ab3f3;
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
}

.demo-cmd-item span {
  color: #8ba3b8;
  font-size: 14px;
  line-height: 1.3;
}

.demo-reply-kb-wrap {
  overflow: hidden;
  max-height: 220px;
  transition: max-height 0.28s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.2s;
  flex-shrink: 0;
}

.demo-reply-kb-wrap.is-collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

/* Composer — как в Telegram */
.demo-input-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 10px;
  background: #17212b;
}

.demo-tg-menu-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px 0 10px;
  border: none;
  border-radius: 18px;
  background: #3390ec;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.demo-tg-menu-pill svg {
  width: 18px;
  height: 18px;
  display: block;
}

.demo-tg-menu-pill:hover { background: #3b9aef; }
.demo-tg-menu-pill:active { transform: scale(0.97); }
.demo-tg-menu-pill.is-open { background: #2b84db; }

.demo-input-emoji {
  width: 32px;
  height: 36px;
  border: none;
  background: transparent;
  color: #8ba3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  cursor: default;
}

.demo-input-emoji svg { width: 26px; height: 26px; display: block; }

.demo-input-compose {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 10px 0 14px;
  border-radius: 18px;
  background: #242f3d;
}

.demo-input-field {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  line-height: 1.2;
  color: #8ba3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-input-clip {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8ba3b8;
  flex-shrink: 0;
}

.demo-input-clip svg { width: 22px; height: 22px; display: block; }

.demo-input-grid {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #8ba3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.demo-input-grid svg { width: 24px; height: 24px; display: block; }
.demo-input-grid:hover { background: rgba(255, 255, 255, 0.06); }
.demo-input-grid.is-collapsed { color: #6ab3f3; }

.demo-input-mic-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #3390ec;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  cursor: default;
}

.demo-input-mic-btn svg { width: 22px; height: 22px; display: block; }

/* Chat area — фон как в Telegram */
.demo-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px 12px;
  background-color: #0e1621;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260' viewBox='0 0 260 260'%3E%3Cg fill='%23ffffff' fill-opacity='0.025'%3E%3Ccircle cx='40' cy='40' r='3'/%3E%3Ccircle cx='120' cy='70' r='2'/%3E%3Ccircle cx='200' cy='45' r='2.5'/%3E%3Ccircle cx='80' cy='150' r='2'/%3E%3Ccircle cx='180' cy='130' r='3'/%3E%3Ccircle cx='220' cy='210' r='2'/%3E%3Ccircle cx='50' cy='220' r='2.5'/%3E%3C/g%3E%3C/svg%3E");
  scroll-behavior: smooth;
}

.demo-chat::-webkit-scrollbar { width: 3px; }
.demo-chat::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

/* Bot message bubble */
.demo-message {
  display: flex;
  margin-bottom: 6px;
  max-width: min(88%, calc(100% - 12px));
  min-width: 0;
}

.demo-message--in {
  align-self: flex-start;
}

.demo-message--out {
  align-self: flex-end;
  margin-left: auto;
}

.demo-message-bubble {
  position: relative;
  background: #182533;
  color: #f5f5f5;
  border-radius: 12px 12px 12px 4px;
  padding: 7px 10px 5px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  min-width: 60px;
  max-width: 100%;
  box-sizing: border-box;
}

.demo-message--out .demo-message-bubble {
  background: #d9fdd3;
  color: #111b21;
  border-radius: 12px 12px 4px 12px;
}

.demo-message-bubble--success { border-left: 2px solid #4fae4e; }
.demo-message-bubble--warn { border-left: 2px solid #e5a00d; }

.demo-message-text {
  font-size: 14px;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  padding-right: 4px;
}

.demo-message-text strong {
  font-weight: 600;
  color: #fff;
}

.demo-message-time {
  display: block;
  text-align: right;
  font-size: 11px;
  color: #6d8499;
  margin-top: 2px;
  line-height: 1;
}

/* Inline keyboard — attached to bubble above */
.demo-message:has(+ .demo-inline-kb) .demo-message-bubble {
  border-radius: 12px 12px 0 0;
  margin-bottom: 0;
}

.demo-inline-kb {
  max-width: 88%;
  min-width: 0;
  margin-bottom: 6px;
}

.demo-inline-kb-inner {
  background: #182533;
  border-radius: 0 0 12px 4px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  max-width: 100%;
}

.demo-inline-row {
  display: flex;
  min-width: 0;
  max-width: 100%;
  border-top: 1px solid rgba(0, 0, 0, 0.2);
}

.demo-inline-row:first-child { border-top: none; }

.demo-inline-btn {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: none;
  border-left: 1px solid rgba(0, 0, 0, 0.22);
  background: #3d5264;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
  cursor: pointer;
  line-height: 1.3;
  transition: background 0.1s;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-inline-row .demo-inline-btn:first-child { border-left: none; }

.demo-inline-btn--current {
  background: #354959;
  color: #b8c9d6;
  cursor: default;
}

.demo-inline-btn--current:hover { background: #354959; }

.demo-inline-row--cal .demo-inline-btn {
  font-size: 12px;
  padding: 9px 2px;
  line-height: 1.1;
  min-height: 34px;
}

.demo-inline-row--cal .demo-inline-btn--current {
  font-size: 11px;
  color: #8ba3b8;
  padding: 9px 1px;
}

.demo-inline-row--cal .demo-inline-btn:not(.demo-inline-btn--current) {
  background: #2b5278;
  color: #c5d4e0;
}

.demo-inline-row--cal .demo-inline-btn:not(.demo-inline-btn--current):hover {
  background: #336589;
}

.demo-inline-btn:hover { background: #455d72; }
.demo-inline-btn:active { background: #354959; }

.demo-inline-btn--muted {
  background: #354959;
  color: #c5d4e0;
}

.demo-inline-btn--danger {
  background: #4a3535;
  color: #ffab91;
}

.demo-inline-btn--success {
  background: #2e4a38;
  color: #a5d6a7;
}

.demo-reply-kb {
  padding: 4px 4px 2px;
  background: #0e1621;
}

.demo-reply-row {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
  min-width: 0;
}

.demo-reply-btn {
  flex: 1;
  min-width: 0;
  padding: 11px 6px;
  border: none;
  border-radius: 8px;
  background: #2b3949;
  color: #f5f5f5;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.1s;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-reply-btn:hover { background: #344556; }
.demo-reply-btn:active { background: #232e3c; }

/* Calendar & slots inside bubbles */
.demo-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin: 6px 0 2px;
}

.demo-cal-head {
  text-align: center;
  font-size: 11px;
  color: #6d8499;
  padding: 2px 0;
}

.demo-cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: 50%;
  background: transparent;
  color: #c5d4e0;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

.demo-cal-day:hover:not(:disabled) { background: rgba(106, 179, 243, 0.2); }
.demo-cal-day--past { opacity: 0.35; }
.demo-cal-day--today { box-shadow: 0 0 0 1.5px #6ab3f3; }

.demo-cal-day--selected {
  background: #6ab3f3;
  color: #0e1621;
  font-weight: 600;
}

.demo-inline-kb .demo-cal-day {
  background: #2b5278;
  border-radius: 6px;
  aspect-ratio: auto;
  min-height: 28px;
}

.demo-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 6px 0 2px;
}

.demo-slot-btn {
  padding: 8px 4px;
  border: none;
  border-radius: 6px;
  background: #2b5278;
  color: #6ab3f3;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}

.demo-slot-btn--busy {
  opacity: 0.35;
  cursor: not-allowed;
  text-decoration: line-through;
}

.demo-toast {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #17212b;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 200;
  max-width: calc(100% - 2rem);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.demo-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 639px) {
  .demo-section {
    padding: 3rem 0;
  }

  .demo-layout {
    gap: 1.25rem;
  }

  .demo-roles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .demo-role-btn {
    padding: 0.65rem 0.7rem;
    font-size: 0.8rem;
    gap: 0.4rem;
  }

  .demo-role-btn__icon {
    font-size: 1.05rem;
  }

  .demo-phone {
    width: 100%;
    max-width: 340px;
    min-width: min(100%, 340px);
    padding: 0.5rem 0.5rem 0.65rem;
    border-radius: 34px;
  }

  .demo-phone-notch {
    width: 96px;
    height: 22px;
  }

  .demo-phone-screen {
    height: 560px;
    min-height: 520px;
    max-height: 600px;
    border-radius: 16px;
  }

  .demo-toast { bottom: 6.5rem; }

  .demo-input-bar {
    gap: 4px;
    padding: 6px 6px 8px;
  }

  .demo-tg-menu-pill {
    height: 34px;
    padding: 0 9px 0 8px;
    font-size: 13px;
    gap: 4px;
  }

  .demo-tg-menu-pill svg {
    width: 16px;
    height: 16px;
  }

  .demo-input-compose {
    padding: 0 8px 0 10px;
    min-height: 34px;
  }

  .demo-input-field {
    font-size: 14px;
  }

  .demo-input-grid {
    width: 32px;
    height: 32px;
  }

  .demo-input-mic-btn {
    width: 36px;
    height: 36px;
  }

  .demo-inline-btn {
    font-size: 13px;
    padding: 10px 6px;
  }

  .demo-reply-btn {
    font-size: 13px;
    padding: 10px 4px;
  }

  .demo-status-bar {
    padding: 7px 14px 3px;
    font-size: 11px;
  }

  .demo-tg-header {
    padding: 6px 10px;
  }
}

@media (max-width: 380px) {
  .demo-roles {
    grid-template-columns: 1fr;
  }
}

.demo-screenshots-fallback {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .demo-chat { scroll-behavior: auto; }
  .demo-cmd-sheet-panel,
  .demo-reply-kb-wrap { transition: none; }
  .demo-live-dot,
  .demo-live-banner__icon,
  .demo-phone--live,
  .demo-tap-hand,
  .demo-tap-ripple { animation: none !important; }
  .demo-tap-hand { display: none !important; }
}

/* Fallback when :has() unsupported — still readable */
@supports not selector(:has(*)) {
  .demo-inline-kb-inner { border-radius: 12px 12px 12px 4px; margin-top: 4px; }
}
