:root {
  --ak-ink: #171c24;
  --ak-surface: #f6f8fb;
  --ak-keyboard-top: #e4f0f5;
  --ak-keyboard-bottom: rgba(223, 227, 228, 0.45);
  --ak-key: #ffffff;
  --ak-utility-key: #b6bec9;
  --ak-accent: #1e63e9;
  --ak-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

.ak-hybrid-demo {
  position: relative;
  width: 100%;
  max-width: 360px;
  height: 326px;
  overflow: hidden;
  border-radius: 20px;
  background: var(--ak-surface);
  border: 1px solid rgba(65, 82, 104, 0.08);
  color: var(--ak-ink);
  font-family: var(--ak-font);
}

.ak-product-ui,
.ak-fx-layer,
.ak-action-layer {
  position: absolute;
  inset: 0;
}

.ak-product-ui {
  z-index: 1;
}

.ak-fx-layer {
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: normal;
}

.ak-action-layer {
  z-index: 3;
  pointer-events: none;
}

.ak-action-guide {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  transition: opacity 150ms ease;
}

.ak-action-guide.is-visible {
  opacity: 1;
}

.ak-action-label {
  position: absolute;
  left: 0;
  top: -31px;
  transform: translateX(-50%);
  padding: 3px 7px;
  border: 1px solid rgba(30, 99, 233, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 12px rgba(30, 99, 233, 0.12);
  color: #1654c5;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.ak-action-dot {
  position: absolute;
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: var(--ak-accent);
  box-shadow: 0 2px 7px rgba(30, 99, 233, 0.42);
}

.ak-action-ring {
  position: absolute;
  inset: -9px;
  border: 1.5px solid rgba(30, 99, 233, 0.54);
  border-radius: 50%;
}

.ak-action-guide.is-visible .ak-action-ring {
  animation: ak-action-ring 900ms ease-out infinite;
}

.ak-action-guide.is-label-only .ak-action-label {
  top: -9px;
  animation: ak-auto-paste-label 900ms ease-in-out both;
}

.ak-action-guide.is-label-only .ak-action-dot {
  display: none;
}

.ak-effect-slot {
  position: absolute;
  pointer-events: none;
  overflow: visible;
}

.ak-effect-slot.is-clipped {
  overflow: hidden;
  border-radius: 15px;
}

.ak-effect-slot > svg {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.ak-chat-strip {
  position: absolute;
  inset: 0 0 auto;
  height: 68px;
  overflow: hidden;
  background: linear-gradient(180deg, #f7faff 0%, #eef5ff 100%);
}

.ak-incoming {
  position: absolute;
  left: 14px;
  top: 50%;
  height: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(calc(-50% + 8px));
  transition: opacity 360ms ease, transform 420ms cubic-bezier(.2, .82, .2, 1);
}

.ak-incoming.is-visible {
  opacity: 1;
  transform: translateY(-50%);
}

.ak-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e63e9, #ddebff);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.72);
}

.ak-incoming-bubble {
  min-width: 0;
  max-width: 230px;
  min-height: 36px;
  height: auto;
  display: flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.35;
  box-shadow: 0 8px 18px rgba(47, 59, 76, 0.08);
}

.ak-host-row {
  position: absolute;
  left: 0;
  top: 68px;
  width: 100%;
  height: 58px;
  display: grid;
  grid-template-columns: 39px 1fr 26px 58px;
  gap: 5px;
  align-items: center;
  padding: 7px 9px;
  background: #fff;
  border-top: 1px solid rgba(65, 82, 104, 0.08);
}

.ak-host-icon,
.ak-emoji-icon {
  display: grid;
  place-items: center;
  color: #0f172a;
  font-size: 16px;
  font-weight: 400;
}

.ak-emoji-icon {
  font-size: 17px;
}

.ak-reply-field {
  min-width: 0;
  height: 42px;
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 13px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(65, 82, 104, 0.08);
  color: #111827;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.22;
  overflow: hidden;
}

.ak-reply-field.is-overflowing {
  align-items: flex-end;
}

.ak-reply-field.is-overflowing [data-ak-reply],
.ak-reply-field.is-overflowing .ak-cursor {
  transform: translateY(-1px);
}

.ak-cursor {
  display: inline-block;
  width: 2px;
  height: 16px;
  margin-left: 2px;
  background: var(--ak-accent);
  vertical-align: -4px;
  opacity: 0.22;
}

.ak-cursor.is-typing {
  animation: ak-cursor-breathe 1150ms ease-in-out infinite;
}

.ak-host-send {
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ak-utility-key);
  color: var(--ak-ink);
  font-size: 13px;
  font-weight: 400;
  transition: background 360ms ease, color 360ms ease, transform 260ms cubic-bezier(.2, .82, .2, 1);
}

.ak-host-send.is-ready {
  background: var(--ak-accent);
  color: #fff;
  transform: scale(1.02);
}

.ak-keyboard {
  position: absolute;
  left: 0;
  top: 126px;
  width: 100%;
  height: 200px;
  padding: 0 7px 7px;
  background: linear-gradient(180deg, var(--ak-keyboard-top), var(--ak-keyboard-bottom));
  border-top: 1px solid rgba(82, 169, 255, 0.15);
}

.ak-keyboard-head {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ak-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
}

.ak-brand img {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 0.75px solid rgba(191, 211, 229, 0.6);
}

.ak-close {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.68);
  color: rgba(23, 28, 36, 0.76);
  font-size: 15px;
}

.ak-source-field {
  height: 46px;
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  padding: 0 16px;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  font-size: 14px;
  font-weight: 400;
  box-shadow: inset 0 0 0 1.2px rgba(75, 147, 255, 0.88);
}

.ak-source-text {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 330ms ease, transform 380ms cubic-bezier(.2, .82, .2, 1);
}

.ak-source-text.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.ak-keyboard-main {
  display: grid;
  grid-template-columns: 1fr 50px;
  gap: 8px;
}

.ak-templates {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px 5px;
}

.ak-template {
  appearance: none;
  height: 39px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  padding: 0 5px;
  border-radius: 8px;
  background: var(--ak-key);
  border: 0.5px solid rgba(191, 211, 229, 0.52);
  box-shadow: 0 1px 0.6px rgba(173, 173, 173, 0.9);
  color: inherit;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  overflow: hidden;
  white-space: nowrap;
  transition: background-color 220ms ease, color 220ms ease, transform 260ms ease, box-shadow 260ms ease, border-color 260ms ease;
}

.ak-template.is-interactive {
  cursor: pointer;
}

.ak-template.is-interactive:focus-visible {
  outline: 2px solid rgba(30, 99, 233, 0.42);
  outline-offset: 1px;
}

.ak-template.is-selected {
  background: #dae6f1;
}

.ak-template.is-selected.is-breathing {
  color: #0d3f9f;
  transform: translateY(-1px);
  border-color: rgba(30, 99, 233, 0.42);
  animation: ak-template-breath 1200ms ease-in-out infinite;
}

.ak-template-emoji {
  width: 16px;
  flex: 0 0 16px;
  text-align: center;
}

.ak-template-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ak-utility-column {
  display: grid;
  grid-template-rows: 39px 39px;
  gap: 7px;
  width: 50px;
}

.ak-utility {
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ak-utility-key);
  color: var(--ak-ink);
  font-size: 13px;
  font-weight: 400;
  box-shadow: 0 1px 0.6px rgba(173, 173, 173, 0.9);
}

@keyframes ak-template-breath {
  0%, 100% {
    box-shadow: 0 1px 0.6px rgba(173, 173, 173, 0.9), 0 0 0 1px rgba(30, 99, 233, 0.12);
  }
  50% {
    box-shadow: 0 1px 0.6px rgba(173, 173, 173, 0.9), 0 0 0 2px rgba(30, 99, 233, 0.26);
  }
}

@keyframes ak-cursor-breathe {
  0%, 100% { opacity: 0.28; }
  50% { opacity: 0.82; }
}

@keyframes ak-action-ring {
  0% {
    opacity: 0.72;
    transform: scale(0.45);
  }
  78%, 100% {
    opacity: 0;
    transform: scale(1);
  }
}

@keyframes ak-auto-paste-label {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(2px);
  }
  18%, 70% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-2px);
  }
}

@media (max-width: 359px) {
  .ak-host-row {
    grid-template-columns: 32px minmax(0, 1fr) 24px 52px;
    gap: 4px;
    padding-inline: 6px;
  }

  .ak-reply-field,
  .ak-source-field {
    font-size: 13px;
  }

  .ak-keyboard-main {
    grid-template-columns: minmax(0, 1fr) 46px;
    gap: 5px;
  }

  .ak-templates {
    gap-inline: 3px;
  }

  .ak-template {
    gap: 2px;
    padding-inline: 3px;
    font-size: 12px;
  }

  .ak-utility-column {
    width: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ak-hybrid-demo *,
  .ak-hybrid-demo *::before,
  .ak-hybrid-demo *::after {
    animation: none !important;
    transition: none !important;
  }
}
