

.os-phone {
  position: relative;
  width: 100%;
  aspect-ratio: 1350 / 2760;
}
.os-phone__screen {
  position: absolute;
  left: 5.1111%;
  top: 2.3913%;
  width: 89.7778%;
  height: 95.2174%;
  border-radius: 15.759% / 7.268%;
  overflow: hidden;
  background: #0A1420;
}
.os-phone::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("img/phone-frame.svg") center / 100% 100% no-repeat;
  pointer-events: none;
}

.os-chat {
  --os-bg: #0A1420;
  --os-surface: #10233A;
  --os-surface-2: #1A3150;
  --os-ink: #E6ECF2;
  --os-muted: #9AABBD;
  --os-rule: rgba(255, 255, 255, .10);
  --os-rule-2: rgba(255, 255, 255, .18);
  --os-you: rgb(29, 89, 142);
  --os-you-edge: rgba(53, 159, 245, .73);
  --os-accent: #2C9BF5;
  --os-accent-ink: #06101B;
  --os-link: #8ED8FA;
  --os-ok: #6FBF8B;
  --os-rec: #FF6B6B;
  --os-ease: cubic-bezier(.2, .8, .2, 1);

  container-type: inline-size;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--os-bg);
  color: var(--os-ink);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  text-align: left;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
}
.os-chat *, .os-chat *::before, .os-chat *::after { box-sizing: border-box; }
.os-chat svg { display: block; flex: none; }

.os-chat__stage {
  --os-fallback: .8103;
  position: absolute;
  top: 0;
  left: 0;
  width: 390px;
  height: calc(100% / var(--os-scale, var(--os-fallback)));
  transform: scale(var(--os-scale, var(--os-fallback)));
  transform-origin: 0 0;
  display: flex;
  flex-direction: column;
}
@container (min-width: 330px) { .os-chat__stage { --os-fallback: .8718; } }
@container (max-width: 315px) { .os-chat__stage { --os-fallback: .7077; } }
@container (max-width: 275px) { .os-chat__stage { --os-fallback: .6; } }

.os-chat.is-fading .os-chat__log { opacity: 0; }
.os-chat.is-resetting *, .os-chat.is-resetting .os-chat__stage { transition: none !important; }

.os-home {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 134px;
  height: 5px;
  margin-left: -67px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .85);
  pointer-events: none;
}

.os-status {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 30px 0 44px;
  color: #fff;
  pointer-events: none;
}
.os-status__time { font-size: 17px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.os-status__icons { display: flex; align-items: center; gap: 6px; }
.os-status svg { fill: currentColor; }
.os-status__signal { width: 18px; height: 12px; }
.os-status__wifi { width: 16px; height: 12px; }
.os-status__battery { width: 27px; height: 13px; }

.os-chat__top {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 62px 14px 10px;
}
.os-chat__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  min-width: 36px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--os-surface);
  border: 1px solid var(--os-rule-2);
  color: var(--os-ink);
  font-size: 14px;
  line-height: 1;
}
.os-chat__btn svg { width: 17px; height: 17px; }

.os-chat__logo { margin-left: auto; display: flex; align-items: center; padding-right: 2px; }
.os-chat__logo svg { height: 26px; width: auto; }

.os-chat__log {
  transition: opacity .45s ease;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 12px 16px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 44px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 44px);
}
.os-row { display: grid; grid-template-rows: 1fr; }
.os-row__in { min-height: 0; overflow: hidden; display: flex; flex-direction: column; padding: 14px 2px 3px; }
.os-row--cont .os-row__in { padding-top: 6px; }

.os-chat.is-live .os-row { grid-template-rows: 0fr; transition: grid-template-rows .42s var(--os-ease); }
.os-chat.is-live .os-row.is-in { grid-template-rows: 1fr; }
.os-chat.is-live .os-turn { opacity: 0; transform: translateY(8px); transition: opacity .3s ease, transform .38s var(--os-ease); }
.os-chat.is-live .os-row.is-in .os-turn { opacity: 1; transform: none; }
.os-chat.is-live .os-row--thinking:not(.is-in) .os-turn { transition-duration: .2s; }

.os-chat:not(.is-live) .os-row--thinking { display: none; }

.os-turn { display: flex; flex-direction: column; max-width: 86%; }
.os-turn--you { align-self: flex-end; align-items: flex-end; }
.os-turn--bot { align-self: flex-start; align-items: flex-start; }

.os-bubble {
  padding: 11px 15px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 24px;
  overflow-wrap: anywhere;
}
.os-bubble p { margin: 0; }
.os-bubble p + p, .os-bubble p + .os-card, .os-bubble .os-card + p { margin-top: 10px; }
.os-turn--you .os-bubble { background: var(--os-you); border: 1px solid var(--os-you-edge); border-bottom-right-radius: 2px; }
.os-turn--bot .os-bubble {
  background: var(--os-surface);
  border: 1px solid var(--os-rule-2);
  border-bottom-left-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

.os-chat.is-live .os-w { display: none; }
.os-chat.is-live .os-w.is-on { display: inline; animation: os-in .24s ease both; }
.os-chat.is-live [data-stream]:not(:has(.os-w.is-on)) { display: none; }
@keyframes os-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes os-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes os-grow { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }

.os-bubble--voice { padding: 9px 12px 11px; min-width: 262px; }
.os-voice { display: flex; align-items: center; gap: 10px; }
.os-voice__play {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--os-accent);
  color: var(--os-accent-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.os-voice__play svg { width: 15px; height: 15px; }
.os-voice__wave { flex: 1 1 auto; display: flex; align-items: center; gap: 2px; height: 26px; }
.os-voice__bar { flex: 1 1 auto; min-width: 2px; border-radius: 1px; background: rgba(255, 255, 255, .30); transition: background .12s linear; }
.os-voice__bar.is-played { background: var(--os-link); }
.os-voice__time { flex: none; font-size: 12px; font-variant-numeric: tabular-nums; color: rgba(230, 236, 242, .82); }
.os-voice__said { margin: 8px 2px 0; font-size: 13.5px; line-height: 20px; color: rgba(230, 236, 242, .88); }

.os-bubble--photos { padding: 8px; }
.os-photos { display: grid; grid-template-columns: repeat(3, 92px); gap: 4px; }
.os-photo { width: 92px; height: 92px; border-radius: 10px; position: relative; overflow: hidden; }

.os-photo--old { background: #3a4048 url("img/stairs-old.webp") center / cover no-repeat; }
.os-photo--out { background: #3a4048 url("img/stairs-out.webp") center / cover no-repeat; }
.os-photo--new { background: #3a4048 url("img/stairs-new.webp") center / cover no-repeat; }

.os-thinking {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 15px;
  border: 1px solid var(--os-rule);
  border-radius: 14px;
  border-bottom-left-radius: 2px;
  background: var(--os-surface);
  color: var(--os-muted);
  font-size: 13px;
  line-height: 18px;
}
.os-dots { display: inline-flex; gap: 4px; }
.os-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--os-muted); animation: os-dot 1.2s ease-in-out infinite; }
.os-dots i:nth-child(2) { animation-delay: .15s; }
.os-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes os-dot {
  0%, 80%, 100% { opacity: .3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
.os-thinking__time { opacity: .75; font-variant-numeric: tabular-nums; }

.os-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  background: var(--os-surface-2);
  border: 1px solid var(--os-rule-2);
}
.os-card__thumb { flex: none; width: 54px; height: 54px; border-radius: 8px; position: relative; overflow: hidden; }
.os-card__t { display: block; font-size: 14px; font-weight: 600; line-height: 19px; }
.os-card__u { display: block; margin-top: 3px; font-size: 12.5px; line-height: 16px; color: var(--os-link); text-decoration: underline; text-underline-offset: 2px; }
.os-chat.is-live .os-card { display: none; }
.os-chat.is-live .os-card.is-on { display: flex; animation: os-rise .38s var(--os-ease) both; }

.os-done { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.os-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 16px;
  color: var(--os-ok);
  background: rgba(111, 191, 139, .14);
  border: 1px solid rgba(111, 191, 139, .38);
}
.os-chip svg { width: 13px; height: 13px; }
.os-chip--blue { color: var(--os-link); background: rgba(44, 155, 245, .14); border-color: rgba(44, 155, 245, .42); }
.os-chat.is-live .os-chip { display: none; }
.os-chat.is-live .os-chip.is-on { display: inline-flex; animation: os-grow .35s var(--os-ease) both; }
.os-chat.is-live .os-done:not(:has(.os-chip.is-on)) { display: none; }

.os-chat__bar {
  flex: none;
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 14px 0 40px;
  border-top: 1px solid var(--os-rule);
  background: var(--os-bg);
}
.os-key {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--os-accent);
  color: var(--os-accent-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .16s var(--os-ease), filter .16s ease;
}
.os-key svg { width: 22px; height: 22px; }
.os-key.is-press { transform: scale(.88); filter: brightness(1.15); }
.os-key.is-rec { background: var(--os-rec); }
.os-key.is-rec::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid var(--os-rec);
  animation: os-rec 1s ease-out infinite;
}
@keyframes os-rec {
  from { transform: scale(.92); opacity: 1; }
  to { transform: scale(1.3); opacity: 0; }
}

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