.ora-ai {
  --ora-pink: #ff0055;
  --ora-ink: #17151b;
  --ora-paper: #fffdf5;
  --ora-line: #eadfca;
  position: fixed;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 2147482000;
  color: var(--ora-ink);
  font-family: Outfit, Arial, sans-serif;
}

.ora-ai *, .ora-ai *::before, .ora-ai *::after { box-sizing: border-box; }
.ora-ai button, .ora-ai textarea { font: inherit; }
.ora-ai button { color: inherit; }

.ora-ai__launcher {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  position: relative;
  margin-left: auto;
  border: 1px solid rgba(255, 0, 85, .42);
  border-radius: 25px;
  background: rgba(255, 253, 245, .96);
  box-shadow: 0 14px 42px rgba(21, 16, 23, .25), 0 0 0 5px rgba(255, 0, 85, .07);
  cursor: pointer;
  overflow: hidden;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}

.ora-ai__launcher:hover {
  transform: translateY(-4px);
  border-color: var(--ora-pink);
  box-shadow: 0 18px 46px rgba(21, 16, 23, .3), 0 0 0 7px rgba(255, 0, 85, .1);
}

.ora-ai__launcher:focus-visible, .ora-ai button:focus-visible, .ora-ai textarea:focus-visible {
  outline: 3px solid rgba(255, 0, 85, .32);
  outline-offset: 3px;
}

.ora-ai__launcher-glow {
  position: absolute;
  inset: 16px;
  border-radius: 50%;
  background: rgba(255, 0, 85, .18);
  filter: blur(10px);
}

.ora-ai__launcher-dot {
  width: 12px;
  height: 12px;
  position: absolute;
  top: 7px;
  right: 7px;
  border: 2px solid var(--ora-paper);
  border-radius: 50%;
  background: #33d68b;
}

.ora-ai__launcher-mascot {
  width: 68px;
  height: 68px;
  display: block;
  position: relative;
  top: 5px;
  object-fit: contain;
  filter: drop-shadow(0 7px 8px rgba(20, 16, 22, .13));
  animation: ora-ai-idle-float 3.2s ease-in-out infinite;
}

.ora-ai--thinking .ora-ai__launcher-mascot {
  animation-duration: 1.35s;
}

@keyframes ora-ai-idle-float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-4px) rotate(1deg); }
}

.ora-ai__panel {
  width: min(400px, calc(100vw - 28px));
  height: min(650px, calc(100vh - 125px));
  min-height: 470px;
  position: absolute;
  right: 0;
  bottom: 92px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  border: 1px solid rgba(20, 20, 20, .14);
  border-radius: 26px;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 0, 85, .12), transparent 32%),
    var(--ora-paper);
  box-shadow: 0 28px 80px rgba(19, 15, 21, .34);
  overflow: hidden;
  transform-origin: bottom right;
  animation: ora-ai-open .28s cubic-bezier(.2, .9, .2, 1) both;
}

.ora-ai__panel[hidden] { display: none; }

@keyframes ora-ai-open {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ora-ai__header {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ora-line);
  background: rgba(255, 253, 245, .78);
  backdrop-filter: blur(14px);
}

.ora-ai__avatar {
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--ora-ink);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}

.ora-ai__avatar img { width: 27px; height: 27px; object-fit: contain; filter: brightness(0) invert(16%) sepia(96%) saturate(7482%) hue-rotate(337deg) brightness(100%) contrast(105%); }

.ora-ai__identity { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 3px; }
.ora-ai__identity strong { letter-spacing: .08em; font-family: "Space Mono", monospace; font-size: 13px; }
.ora-ai__identity span { color: #787178; letter-spacing: .09em; font-family: "Space Mono", monospace; font-size: 9px; }
.ora-ai__identity i { width: 6px; height: 6px; display: inline-block; margin-right: 5px; border-radius: 50%; background: #33d68b; box-shadow: 0 0 8px rgba(51,214,139,.65); }

.ora-ai__close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #746d73;
  cursor: pointer;
  font-size: 27px;
  line-height: 1;
}
.ora-ai__close:hover { background: #f2ead9; color: var(--ora-ink); }

.ora-ai__messages {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 20px 16px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #dacdb5 transparent;
}

.ora-ai__message { max-width: 88%; display: flex; flex-direction: column; gap: 6px; }
.ora-ai__message--assistant { align-self: flex-start; }
.ora-ai__message--user { align-self: flex-end; }
.ora-ai__message-label { color: #817981; letter-spacing: .08em; font-family: "Space Mono", monospace; font-size: 8px; }
.ora-ai__message--user .ora-ai__message-label { align-self: flex-end; }
.ora-ai__message p {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--ora-line);
  border-radius: 5px 17px 17px 17px;
  background: #fff;
  color: #2b282c;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.55;
}
.ora-ai__message--user p { border-color: var(--ora-ink); border-radius: 17px 5px 17px 17px; background: var(--ora-ink); color: #fff; }

.ora-ai__suggestions { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 2px; }
.ora-ai__suggestions button {
  border: 1px solid #e7d9c0;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  padding: 8px 10px;
  color: #5b535a;
  cursor: pointer;
  font-family: "Space Mono", monospace;
  font-size: 9px;
  transition: border-color .2s ease, color .2s ease, transform .2s ease;
}
.ora-ai__suggestions button:hover { border-color: var(--ora-pink); color: var(--ora-pink); transform: translateY(-1px); }

.ora-ai__thinking {
  width: 100%;
  min-height: 142px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 8px;
  border: 1px solid rgba(255, 0, 85, .18);
  border-radius: 18px;
  background: linear-gradient(110deg, rgba(255,255,255,.82), rgba(255,232,241,.78));
  overflow: visible;
  box-shadow: inset 0 0 24px rgba(255, 0, 85, .035);
}
.ora-ai__mascot-stage {
  width: 132px;
  height: 120px;
  display: block;
  flex: 0 0 132px;
  position: relative;
  overflow: visible;
}
.ora-ai__mascot-stage img {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  object-fit: contain;
  opacity: 0;
  transform: translateY(5px) scale(.92);
  filter: drop-shadow(0 10px 12px rgba(25, 17, 22, .13));
  transition: opacity .35s ease, transform .45s cubic-bezier(.2,.8,.2,1);
  pointer-events: none;
}
.ora-ai__mascot-stage[data-state="idle"] [data-mascot="idle"],
.ora-ai__mascot-stage[data-state="happy"] [data-mascot="happy"],
.ora-ai__mascot-stage[data-state="thinking"] [data-mascot="thinking"],
.ora-ai__mascot-stage[data-state="coding"] [data-mascot="coding"],
.ora-ai__mascot-stage[data-state="sleeping"] [data-mascot="sleeping"] {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.ora-ai__mascot-stage[data-state="thinking"] [data-mascot="thinking"] { animation: ora-ai-think 1.5s ease-in-out infinite; }
.ora-ai__mascot-stage[data-state="coding"] [data-mascot="coding"] { animation: ora-ai-code .48s ease-in-out infinite alternate; }
.ora-ai__mascot-stage[data-state="idle"] [data-mascot="idle"] { animation: ora-ai-breathe 1.8s ease-in-out infinite; }
.ora-ai__mascot-stage[data-state="sleeping"] [data-mascot="sleeping"] { animation: ora-ai-sleep 2s ease-in-out infinite; }
.ora-ai__mascot-stage[data-state="happy"] [data-mascot="happy"] { animation: ora-ai-happy .55s ease-out both; }

@keyframes ora-ai-think { 0%,100% { transform: rotate(-1.5deg) translateY(0); } 50% { transform: rotate(1.5deg) translateY(-4px); } }
@keyframes ora-ai-code { from { transform: translateY(0) rotate(-.7deg); } to { transform: translateY(-3px) rotate(.7deg); } }
@keyframes ora-ai-breathe { 0%,100% { transform: translateY(1px) scale(.98); } 50% { transform: translateY(-3px) scale(1); } }
@keyframes ora-ai-sleep { 0%,100% { transform: translateY(2px) rotate(-1deg); } 50% { transform: translateY(-1px) rotate(1deg); } }
@keyframes ora-ai-happy { 0% { transform: scale(.86) translateY(8px); } 65% { transform: scale(1.06) translateY(-4px); } 100% { transform: scale(1) translateY(0); } }

.ora-ai__thinking-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 7px; }
.ora-ai__thinking-copy strong { color: var(--ora-pink); letter-spacing: .055em; font-family: "Space Mono", monospace; font-size: 8px; line-height: 1.45; }
.ora-ai__thinking-copy small { color: #6e676d; font-size: 12px; }
.ora-ai__dots { display: inline-block; width: 16px; overflow: hidden; vertical-align: bottom; animation: ora-ai-dots 1.2s steps(4, end) infinite; }
@keyframes ora-ai-dots { 0% { width: 0; } 100% { width: 16px; } }

.ora-ai__composer {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  padding: 12px 13px;
  border-top: 1px solid var(--ora-line);
  background: rgba(255,253,245,.94);
}
.ora-ai__composer textarea {
  width: 100%;
  min-height: 44px;
  max-height: 104px;
  resize: none;
  border: 1px solid #ded2bd;
  border-radius: 15px;
  background: #fff;
  padding: 11px 13px;
  color: var(--ora-ink);
  line-height: 1.45;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.ora-ai__composer textarea::placeholder { color: #9c949a; }
.ora-ai__send {
  width: 45px;
  height: 45px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 15px;
  background: var(--ora-pink);
  color: #fff;
  box-shadow: 0 8px 20px rgba(255,0,85,.25);
  cursor: pointer;
}
.ora-ai__send:hover { background: #e4004c; }
.ora-ai__send:disabled { cursor: wait; opacity: .5; }
.ora-ai__send svg { width: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }

.ora-ai__footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 15px 10px;
  color: #999097;
  letter-spacing: .05em;
  font-family: "Space Mono", monospace;
  font-size: 7px;
}
.ora-ai__sr-only { width: 1px; height: 1px; position: absolute; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

@media (max-width: 560px) {
  .ora-ai { right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); }
  .ora-ai__launcher { width: 68px; height: 68px; border-radius: 22px; }
  .ora-ai__launcher-mascot { width: 59px; height: 59px; }
  .ora-ai__panel { width: calc(100vw - 28px); height: min(680px, calc(100dvh - 100px)); bottom: 80px; border-radius: 22px; }
  .ora-ai__thinking { min-height: 130px; padding: 8px 10px 8px 5px; }
  .ora-ai__mascot-stage { width: 112px; height: 106px; flex-basis: 112px; }
}

@media (prefers-reduced-motion: reduce) {
  .ora-ai__panel, .ora-ai__launcher-mascot, .ora-ai__mascot-stage img, .ora-ai__dots { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .ora-ai__launcher { transition: none; }
}
