/* ARI FV — WebP device frame + AI chat UI */

.ari-fv-animation {
  --ari-fv-shell-w: 285px;
  --ari-fv-shell-h: 530px;
  --ari-fv-native-w: 393;
  --ari-fv-native-h: 800;
  --ari-fv-native-screen-x: 10;
  --ari-fv-native-screen-y: 6;
  --ari-fv-native-screen-w: 373;
  --ari-fv-native-screen-h: 786;
  --ari-fv-screen-inset: 1px;
  --ari-fv-fit-w: calc(var(--ari-fv-shell-h) * var(--ari-fv-native-w) / var(--ari-fv-native-h));
  --ari-fv-fit-h: var(--ari-fv-shell-h);
  --ari-fv-fit-x: calc((var(--ari-fv-shell-w) - var(--ari-fv-fit-w)) / 2);
  --ari-fv-screen-x: calc(var(--ari-fv-fit-x) + var(--ari-fv-fit-w) * var(--ari-fv-native-screen-x) / var(--ari-fv-native-w));
  --ari-fv-screen-y: calc(var(--ari-fv-fit-h) * var(--ari-fv-native-screen-y) / var(--ari-fv-native-h));
  --ari-fv-screen-w: calc(var(--ari-fv-fit-w) * var(--ari-fv-native-screen-w) / var(--ari-fv-native-w));
  --ari-fv-screen-h: calc(var(--ari-fv-fit-h) * var(--ari-fv-native-screen-h) / var(--ari-fv-native-h));
  --ari-fv-screen-outer-radius: calc(var(--ari-fv-screen-w) * 0.115);
  --ari-fv-screen-inner-radius: calc(var(--ari-fv-screen-outer-radius) - var(--ari-fv-screen-inset));
  --ari-fv-glass-peak: 0.18;
  --ari-fv-flow-h: 26px;
  width: 100%;
  max-width: calc(var(--ari-fv-shell-w) + 8px);
  min-height: calc(var(--ari-fv-flow-h) + 10px + var(--ari-fv-shell-h));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  contain: layout style;
}

/* Flow label */
.ari-fv-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 0;
  width: 100%;
  max-width: var(--ari-fv-shell-w);
  height: var(--ari-fv-flow-h);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
  user-select: none;
}

.ari-fv-flow__item {
  color: var(--text-muted, #71717A);
  transition: color 0.25s ease;
  white-space: nowrap;
}

.ari-fv-flow__item.is-active {
  color: var(--accent, #1B56B0);
  font-weight: 600;
}

.ari-fv-flow__arrow {
  color: rgba(113, 113, 122, 0.45);
  padding: 0 5px;
  font-size: 11px;
}

/* Device — WebP frame asset (393×800 native) */
.ari-fv-device {
  position: relative;
  width: var(--ari-fv-shell-w);
  height: var(--ari-fv-shell-h);
  flex-shrink: 0;
}

.ari-fv-device__shadow {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.ari-fv-device__shadow-contact {
  position: absolute;
  left: calc(var(--ari-fv-fit-x) + var(--ari-fv-fit-w) * 0.08);
  right: calc(var(--ari-fv-shell-w) - var(--ari-fv-fit-x) - var(--ari-fv-fit-w) * 0.92);
  bottom: -4px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.28) 0%, transparent 72%);
  filter: blur(3px);
}

.ari-fv-device__shadow-ambient {
  position: absolute;
  left: calc(var(--ari-fv-fit-x) - 6%);
  right: calc(var(--ari-fv-shell-w) - var(--ari-fv-fit-x) - var(--ari-fv-fit-w) + 6%);
  bottom: -20px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.12) 0%, transparent 70%);
  filter: blur(16px);
}

.ari-fv-device__body {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  transform: rotateY(-2deg) rotateX(0.5deg);
  transform-style: preserve-3d;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Screen slot — opening bounds; white UI inset to reveal asset black bezel */
.ari-fv-device__screen-slot {
  position: absolute;
  left: var(--ari-fv-screen-x);
  top: var(--ari-fv-screen-y);
  width: var(--ari-fv-screen-w);
  height: var(--ari-fv-screen-h);
  border-radius: var(--ari-fv-screen-outer-radius);
  overflow: hidden;
  z-index: 2;
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.ari-fv-device__frame-img {
  position: absolute;
  left: var(--ari-fv-fit-x);
  top: 0;
  width: var(--ari-fv-fit-w);
  height: var(--ari-fv-fit-h);
  object-fit: fill;
  z-index: 3;
  pointer-events: none;
  user-select: none;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Glass — screen-only overlay above chat UI */
.ari-fv-device__glass {
  position: absolute;
  inset: var(--ari-fv-screen-inset);
  border-radius: var(--ari-fv-screen-inner-radius);
  pointer-events: none;
  z-index: 4;
  overflow: hidden;
  border: none;
  outline: none;
  box-shadow: none;
  filter: blur(0.3px);
  will-change: transform, opacity;
}

.ari-fv-device__glass-falloff {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.06), transparent 52%);
}

.ari-fv-device__glass-reflection-dark {
  position: absolute;
  inset: -8% -6%;
  pointer-events: none;
  background: linear-gradient(
    120deg,
    transparent 0%,
    transparent 38%,
    rgba(40, 55, 70, 0.025) 52%,
    rgba(30, 45, 60, 0.055) 70%,
    rgba(20, 35, 50, 0.025) 88%,
    transparent 100%
  );
}

.ari-fv-device__glass-edge-falloff {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(20, 30, 40, 0.025),
    transparent 8%,
    transparent 92%,
    rgba(20, 30, 40, 0.03)
  );
}

.ari-fv-device__glass-reflection-primary {
  position: absolute;
  inset: -10% -8%;
  pointer-events: none;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, var(--ari-fv-glass-peak)) 0%,
    rgba(255, 255, 255, 0.12) 14%,
    rgba(255, 255, 255, 0.055) 28%,
    rgba(255, 255, 255, 0.02) 42%,
    rgba(255, 255, 255, 0) 56%
  );
}

.ari-fv-device__glass-reflection-secondary {
  position: absolute;
  inset: -6% -5%;
  pointer-events: none;
  background: linear-gradient(
    120deg,
    transparent 18%,
    rgba(255, 255, 255, 0.08) 24%,
    rgba(255, 255, 255, 0.028) 31%,
    transparent 38%
  );
}

.ari-fv-device__glass-edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.30);
}

/* AI Chat UI — white layer inset to reveal uniform asset black bezel */
.ari-fv-chat {
  position: absolute;
  inset: var(--ari-fv-screen-inset);
  z-index: 1;
  display: flex;
  flex-direction: column;
  border-radius: var(--ari-fv-screen-inner-radius);
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #fdfdfd 100%);
  border: none;
  outline: none;
  box-shadow: none;
}

.ari-fv-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 46px 14px 8px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.ari-fv-chat__title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text, #09090B);
  letter-spacing: -0.01em;
}

.ari-fv-chat__status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 500;
  color: var(--text-muted, #71717A);
}

.ari-fv-chat__status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent, #1B56B0);
}

.ari-fv-chat__thread-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.ari-fv-chat__thread {
  padding: 10px 12px 8px;
  will-change: transform;
}

.ari-fv-chat__composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
  background: #fdfdfd;
}

.ari-fv-chat__composer-field {
  flex: 1;
  font-size: 10px;
  color: var(--text-muted, #71717A);
  background: var(--bg-card, #F4F4F5);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 18px;
  padding: 7px 12px;
}

.ari-fv-chat__composer-send {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent, #1B56B0);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Messages */
.ari-fv-msg {
  margin-bottom: 10px;
}

.ari-fv-msg--user {
  display: flex;
  justify-content: flex-end;
}

.ari-fv-msg__bubble {
  max-width: 88%;
  background: var(--bg-card, #F4F4F5);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 14px 14px 4px 14px;
  padding: 8px 11px;
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--text, #09090B);
}

.ari-fv-msg--ai {
  display: flex;
  gap: 7px;
  align-items: flex-start;
}

.ari-fv-msg__avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-soft, rgba(27, 86, 176, 0.12)), #e8ecf2);
  border: 1px solid rgba(27, 86, 176, 0.15);
  margin-top: 2px;
}

.ari-fv-msg__body {
  flex: 1;
  min-width: 0;
}

.ari-fv-ai-text {
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--text, #09090B);
  margin: 0 0 6px;
}

.ari-fv-ai-sub {
  font-size: 9px;
  color: var(--text-muted, #71717A);
  margin: 0 0 5px;
}

.ari-fv-thinking {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.ari-fv-thinking span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent, #1B56B0);
  opacity: 0.25;
}

/* Discover results */
.ari-fv-results {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 4px;
}

.ari-fv-result {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  font-size: 9.5px;
  line-height: 1.45;
}

.ari-fv-result__dot {
  color: var(--accent, #1B56B0);
  font-size: 6px;
  margin-top: 4px;
  flex-shrink: 0;
}

.ari-fv-result__text strong {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text, #09090B);
}

.ari-fv-result__text span {
  display: block;
  color: var(--text-muted, #71717A);
  font-size: 9px;
}

/* Understand */
.ari-fv-struct {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  margin-top: 4px;
}

.ari-fv-struct__row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  font-size: 9.5px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.ari-fv-struct__row:last-child {
  border-bottom: none;
}

.ari-fv-struct__row span {
  color: var(--text-muted, #71717A);
}

.ari-fv-struct__row strong {
  color: var(--text, #09090B);
  font-weight: 600;
  text-align: right;
}

/* Compare */
.ari-fv-compare-lite {
  margin-top: 4px;
  font-size: 9.5px;
}

.ari-fv-compare-lite__row {
  display: grid;
  grid-template-columns: 1.1fr repeat(3, 1fr);
  gap: 2px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  color: var(--text, #09090B);
  text-align: center;
}

.ari-fv-compare-lite__row span:first-child {
  text-align: left;
  color: var(--text-muted, #71717A);
  font-weight: 500;
}

.ari-fv-compare-lite__row--head {
  font-size: 8.5px;
  font-weight: 600;
  color: var(--accent, #1B56B0);
  border-bottom: 1px solid rgba(27, 86, 176, 0.12);
}

.ari-fv-compare-lite__row:last-child {
  border-bottom: none;
}

/* Recommend */
.ari-fv-msg--highlight .ari-fv-msg__body {
  border-left: 2px solid var(--accent, #1B56B0);
  padding-left: 8px;
}

.ari-fv-rec {
  margin-top: 4px;
}

.ari-fv-rec__name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text, #09090B);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.ari-fv-rec__reason {
  font-size: 9.5px;
  line-height: 1.5;
  color: var(--text-secondary, #52525B);
  margin-bottom: 3px;
}

.ari-fv-rec__badge {
  margin-top: 8px;
  font-size: 9px;
  font-weight: 600;
  color: var(--accent, #1B56B0);
  padding-top: 6px;
  border-top: 1px solid rgba(27, 86, 176, 0.15);
}

/* Responsive — scale shell only; screen math follows */
@media (max-width: 900px) {
  .ari-fv-animation {
    --ari-fv-shell-w: 255px;
    --ari-fv-shell-h: 474px;
  }
}

@media (max-width: 768px) {
  .ari-fv-animation {
    --ari-fv-shell-w: 230px;
    --ari-fv-shell-h: 428px;
  }

  .ari-fv-flow { font-size: 12px; }
  .ari-fv-msg__bubble { font-size: 10px; }
  .ari-fv-ai-text { font-size: 10px; }
  .ari-fv-chat__header { padding-top: 40px; }
}

/* OISUMMIT scenario extensions */
.ari-fv-rec__badge--critical {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-top: none;
  padding-top: 0;
  margin-bottom: 8px;
}

.ari-fv-rec__badge--danger { color: #DC2626; }

.ari-fv-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.ari-fv-tag {
  font-size: 8.5px;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(27, 86, 176, 0.1);
  color: var(--accent, #1B56B0);
}

.ari-fv-program-list { margin-top: 6px; }

.ari-fv-program {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 9.5px;
  line-height: 1.45;
  color: var(--text-secondary, #52525B);
  margin-bottom: 5px;
}

.ari-fv-program__num {
  font-weight: 700;
  color: var(--accent, #1B56B0);
  flex-shrink: 0;
}

.ari-fv-req-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 6px;
}

.ari-fv-req {
  text-align: center;
  padding: 6px 4px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.04);
}

.ari-fv-req span {
  display: block;
  font-size: 7.5px;
  letter-spacing: 0.05em;
  color: var(--text-muted, #71717A);
}

.ari-fv-req strong {
  display: block;
  font-size: 10px;
  margin-top: 2px;
}

.ari-fv-req--warn strong { color: #CA8A04; }

.ari-fv-api-result {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(22, 163, 74, 0.08);
}

.ari-fv-api-result__label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted, #71717A);
}

.ari-fv-api-result__status {
  font-size: 10px;
  font-weight: 700;
  color: #16A34A;
}

.ari-fv-outcome { margin-top: 4px; }

.ari-fv-outcome__row {
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted, #71717A);
  margin-bottom: 4px;
}

.ari-fv-outcome__times {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.ari-fv-outcome__neq { color: #DC2626; font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  .ari-fv-flow__item { transition: none; }
  .ari-fv-device__body { transform: none; }
  .ari-fv-device__glass {
    transform: none !important;
    opacity: 1 !important;
    filter: blur(0.3px);
  }
}
