/* ClueArk app UI preview — mirrors frontend/src design tokens & layout */

.appPreview {
  --ark-bg: 5 10 15;
  --ark-sidebar: 8 12 18;
  --ark-content: 2 6 23;
  --ark-surface: 14 20 30;
  --ark-border: 48 55 66;
  --ark-text: 248 250 252;
  --ark-accent: 0 242 255;
  --ark-green-tint: 22 34 28;
  --ark-green-text: 63 185 80;
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid rgba(0, 242, 255, 0.22);
  border-radius: 16px;
  background: rgb(var(--ark-bg));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 40px rgba(0, 242, 255, 0.12),
    0 28px 70px rgba(0, 0, 0, 0.55);
  font-size: 12px;
  line-height: 1.5;
  color: rgb(var(--ark-text));
  -webkit-font-smoothing: antialiased;
}

.appPreview__chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid rgb(var(--ark-border));
  background: rgb(var(--ark-sidebar));
  color: rgba(148, 163, 184, 0.9);
  font-size: 10px;
}

.appPreview__dots {
  display: inline-flex;
  gap: 5px;
}

.appPreview__dots i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.appPreview__dots i:nth-child(1) {
  background: #ff5f57;
}
.appPreview__dots i:nth-child(2) {
  background: #febc2e;
}
.appPreview__dots i:nth-child(3) {
  background: #28c840;
}

.appPreview__frame {
  display: flex;
  min-height: 0;
}

.appPreview__sidebar {
  display: none;
  width: 168px;
  flex-shrink: 0;
  flex-direction: column;
  border-right: 1px solid rgb(var(--ark-border));
  background: rgb(var(--ark-sidebar));
}

@media (min-width: 540px) {
  .heroVisual .appPreview__sidebar,
  .proofVisual__stage .appPreview__sidebar {
    display: flex;
  }
}

@media (min-width: 720px) {
  .appPreview__sidebar {
    display: flex;
  }
}

.appPreview__sidebarInner {
  padding: 18px 14px;
}

.appPreview__mark {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: #fff;
  text-decoration: none;
}

.appPreview__mark img {
  width: 18px;
  height: 18px;
  border-radius: 6px;
}

.appPreview__mark em {
  font-style: normal;
  color: rgb(var(--ark-accent));
}

.appPreview__tagline {
  margin: 0 0 20px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgb(71, 85, 105);
}

.appPreview__nav {
  display: grid;
  gap: 4px;
}

.appPreview__navItem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: rgb(100, 116, 139);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}

.appPreview__navItem.is-active {
  border-color: rgba(0, 242, 255, 0.3);
  background: rgba(0, 242, 255, 0.1);
  color: rgb(var(--ark-accent));
  box-shadow:
    0 0 20px rgba(0, 242, 255, 0.14),
    0 0 0 1px rgba(0, 242, 255, 0.15) inset;
}

.appPreview__navItem.is-active .ap-icon {
  color: rgb(var(--ark-accent));
}

.appPreview__badge {
  margin-left: auto;
  min-width: 18px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgb(var(--ark-accent));
  color: rgb(var(--ark-bg));
  font-size: 9px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

.appPreview__main {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.appPreview__content {
  flex: 1;
  padding: 14px 14px 10px;
  background-color: rgb(var(--ark-content));
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 242, 255, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(0, 242, 255, 0.04), transparent);
}

.appPreview__welcome {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.appPreview__welcome h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #fff;
}

.appPreview__welcome p {
  margin: 4px 0 0;
  max-width: 28em;
  font-size: 11px;
  line-height: 1.55;
  color: rgb(100, 116, 139);
}

.appPreview__manageBtn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: rgb(203, 213, 225);
  font-size: 10px;
  font-weight: 500;
  text-decoration: none;
}

.ap-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.ap-metric {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 12px 13px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  background: linear-gradient(
    to bottom right,
    rgba(0, 242, 255, 0.04),
    rgba(14, 20, 30, 0.3) 45%,
    rgba(2, 6, 23, 0.85)
  );
}

.ap-metric__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.ap-metric__label {
  font-size: 11px;
  font-weight: 500;
  color: rgb(148, 163, 184);
}

.ap-metric__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: rgba(0, 242, 255, 0.5);
  filter: drop-shadow(0 0 6px rgba(0, 242, 255, 0.15));
}

.ap-metric__valueRow {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px;
  margin-top: 8px;
}

.ap-metric__value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.ap-metric__delta {
  margin-bottom: 2px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgb(var(--ark-green-tint));
  color: rgb(var(--ark-green-text));
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ap-metric__hint {
  margin: 4px 0 0;
  font-size: 10px;
  color: rgb(100, 116, 139);
}

.ap-metric__spark {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.ap-spark {
  color: rgba(0, 242, 255, 0.7);
  filter: drop-shadow(0 0 6px rgba(0, 242, 255, 0.28));
}

.ap-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

@media (min-width: 640px) {
  .ap-columns {
    grid-template-columns: minmax(0, 1fr) 236px;
  }

  .heroVisual .appPreview--home .ap-columns {
    grid-template-columns: minmax(0, 1fr) 210px;
  }
}

.ap-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  background: rgba(14, 20, 30, 0.25);
}

.ap-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ap-panel__headLeft {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.ap-panel__title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.ap-panel__sub {
  font-size: 10px;
  color: rgb(100, 116, 139);
}

.ap-panel__link {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 500;
  color: rgb(148, 163, 184);
  text-decoration: none;
}

.ap-liveDot {
  position: relative;
  display: inline-flex;
  width: 8px;
  height: 8px;
  flex-shrink: 0;
}

.ap-liveDot::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(0, 242, 255, 0.25);
  animation: apPing 1.8s ease-out infinite;
}

.ap-liveDot::after {
  content: "";
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 242, 255, 0.8);
}

@keyframes apPing {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

.ap-panel__body {
  padding: 10px;
}

.ap-feedList {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ap-feedCard {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  background: rgba(14, 20, 30, 0.3);
}

.ap-feedCard__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 10px;
}

.ap-tag {
  padding: 2px 7px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: rgb(148, 163, 184);
  font-weight: 500;
}

.ap-feedCard__time {
  color: rgb(100, 116, 139);
}

.ap-score {
  margin-left: auto;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: rgb(203, 213, 225);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  font-weight: 600;
}

.ap-feedCard__title {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: #fff;
}

.ap-feedCard__summary {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.55;
  color: rgb(148, 163, 184);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ap-feedCard__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.ap-feedCard__source {
  font-size: 10px;
  color: rgb(100, 116, 139);
}

.ap-feedCard__source em {
  font-style: normal;
  color: rgb(71, 85, 105);
}

.ap-aiBtn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid rgba(0, 242, 255, 0.25);
  border-radius: 6px;
  background: rgba(0, 242, 255, 0.1);
  color: rgb(var(--ark-accent));
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
}

.ap-alertList {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ap-alertItem {
  display: flex;
  gap: 10px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.ap-alertItem__rank {
  width: 22px;
  flex-shrink: 0;
  padding-top: 2px;
  text-align: center;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  font-weight: 600;
  color: rgb(100, 116, 139);
}

.ap-alertItem__topic {
  display: inline-block;
  max-width: 100%;
  margin-bottom: 4px;
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  color: rgb(148, 163, 184);
  font-size: 9px;
}

.ap-alertItem__title {
  display: block;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  color: rgb(226, 232, 240);
}

.ap-alertItem__time {
  display: block;
  margin-top: 4px;
  font-size: 9px;
  color: rgb(71, 85, 105);
}

.ap-statusBar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-family: ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgb(71, 85, 105);
}

@media (min-width: 640px) {
  .ap-statusBar {
    display: flex;
  }
}

.ap-statusBar em {
  font-style: normal;
  color: rgba(0, 242, 255, 0.7);
}

.ap-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: rgb(71, 85, 105);
}

.ap-icon--amber {
  color: rgba(251, 191, 36, 0.9);
}

.ap-icon--sm {
  width: 12px;
  height: 12px;
}

/* Timeline preview (MonitorTimelineItem + TimelineItem) */

.appPreview--timeline .appPreview__content {
  padding: 14px 16px;
}

.ap-tlHead {
  margin-bottom: 14px;
}

.ap-tlHead h2 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

.ap-tlHead p {
  margin: 0;
  font-size: 11px;
  color: rgb(100, 116, 139);
}

.ap-timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ap-tlRow {
  display: flex;
  gap: 10px;
}

.ap-tlRow:not(:last-child) .ap-tlBody {
  padding-bottom: 18px;
}

.ap-tlStamp {
  flex-shrink: 0;
  width: 52px;
  padding-top: 4px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  line-height: 1.35;
  color: rgb(148, 163, 184);
}

.ap-tlStamp span {
  display: block;
  color: rgb(100, 116, 139);
  font-size: 10px;
}

.ap-tlRail {
  display: flex;
  width: 12px;
  flex-shrink: 0;
  flex-direction: column;
  align-items: center;
  padding-top: 4px;
}

.ap-tlRail__dot {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border: 2px solid rgba(0, 242, 255, 0.85);
  border-radius: 999px;
  background: rgb(var(--ark-surface));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.ap-tlRail__line {
  width: 1px;
  flex: 1;
  min-height: 8px;
  margin-top: 6px;
  background: rgb(var(--ark-border));
}

.ap-tlBody {
  min-width: 0;
  flex: 1;
}

.ap-tlMeta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 10px;
  color: rgb(100, 116, 139);
}

.ap-tlMeta strong {
  font-weight: 500;
  color: rgb(148, 163, 184);
}

.ap-tlMeta em {
  font-style: normal;
  color: rgb(51, 65, 85);
}

.ap-tlTitle {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: rgb(241, 245, 249);
}

.ap-tlSummary {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: rgb(148, 163, 184);
}

.ap-reason {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 8px;
  background: rgba(6, 78, 59, 0.2);
}

.ap-reason small {
  display: block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(16, 185, 129, 0.9);
}

.ap-reason p {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(209, 250, 229, 0.9);
}

.ap-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.ap-tags span {
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: rgb(100, 116, 139);
  font-size: 9px;
}

.ap-cluster {
  margin-top: 6px;
  font-size: 11px;
  color: rgb(100, 116, 139);
}

.ap-cluster a {
  margin-left: 4px;
  color: rgb(var(--ark-accent));
  text-decoration: underline;
  text-decoration-color: rgba(0, 242, 255, 0.4);
  text-underline-offset: 2px;
}

.heroVisual {
  position: relative;
  z-index: 1;
  width: 100%;
  margin-right: 0;
  perspective: 1400px;
  perspective-origin: 62% 50%;
}

.heroVisual__stage {
  transform: rotateY(-11deg) rotateX(3deg) rotateZ(-1.5deg);
  transform-origin: 72% 48%;
  transform-style: preserve-3d;
  transition: transform 0.45s ease;
}

.heroVisual__stage .appPreview {
  width: 100%;
  max-width: 920px;
  margin-left: auto;
  aspect-ratio: 4 / 3;
  max-height: min(520px, 54vh);
  height: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-color: rgba(0, 242, 255, 0.34);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 0 36px rgba(0, 242, 255, 0.26),
    0 38px 88px rgba(0, 0, 0, 0.58);
  backface-visibility: hidden;
}

@supports (height: 1lh) {
  .heroVisual__stage .appPreview {
    width: min(100%, calc(min(520px, 54vh) * 4 / 3));
  }
}

.heroVisual .appPreview--home .appPreview__frame {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.heroVisual .appPreview--home .appPreview__main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.heroVisual .appPreview--home .appPreview__content {
  height: 100%;
  overflow: hidden;
}

.heroVisual .appPreview--home .appPreview__sidebar {
  width: 152px;
}

.heroVisual .shotGlow {
  position: absolute;
  inset: auto 4% -20px 12%;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 242, 255, 0.42), transparent 72%);
  filter: blur(14px);
  pointer-events: none;
  transform: rotate(-2deg);
}

.proofImage {
  position: relative;
  overflow: visible;
  border: none;
  border-radius: 0;
  box-shadow: none;
  perspective: 1300px;
  perspective-origin: 22% 50%;
}

.proofVisual__stage {
  transform: rotateY(9deg) rotateX(2deg) rotateZ(1deg);
  transform-origin: 18% 50%;
  transform-style: preserve-3d;
}

.proofVisual__stage .appPreview {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-color: rgba(0, 242, 255, 0.28);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 30px rgba(0, 242, 255, 0.16),
    0 28px 72px rgba(0, 0, 0, 0.5);
  backface-visibility: hidden;
}

.appPreview--timeline .appPreview__frame {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.appPreview--timeline .appPreview__main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.appPreview--timeline .appPreview__content {
  height: 100%;
  overflow: hidden;
}

@media (max-width: 960px) {
  .heroVisual {
    perspective-origin: 50% 46%;
  }

  .heroVisual__stage {
    transform: rotateY(-6deg) rotateX(2deg) rotateZ(-0.5deg);
    transform-origin: 50% 48%;
  }

  .heroVisual__stage .appPreview {
    width: 100%;
    max-width: none;
    max-height: none;
    margin-left: 0;
  }

  .proofVisual__stage {
    transform: rotateY(5deg) rotateX(1.5deg);
  }
}

@media (max-width: 900px) {
  .heroVisual__stage {
    transform: rotateY(-5deg) rotateX(2deg) rotateZ(-0.5deg);
  }

  .proofVisual__stage {
    transform: rotateY(4deg) rotateX(1.2deg);
  }

  .heroVisual .appPreview--home .ap-panel__sub,
  .appPreview--timeline .ap-tlHead p {
    display: none;
  }
}

@media (max-width: 768px) {
  .heroVisual .appPreview--home .appPreview__sidebar,
  .proofVisual__stage .appPreview__sidebar {
    display: none;
  }

  .heroVisual .appPreview--home .ap-columns {
    grid-template-columns: minmax(0, 1fr) 168px;
  }
}

@media (max-width: 640px) {
  .heroVisual .appPreview--home .ap-feedList li:last-child,
  .heroVisual .appPreview--home .ap-alertItem:last-child,
  .appPreview--timeline .ap-tlRow:last-child {
    display: none;
  }

  .ap-metric__hint {
    display: none;
  }
}

@media (max-width: 600px) {
  .heroVisual {
    width: 100%;
    margin-right: 0;
    perspective: none;
  }

  .heroVisual__stage,
  .proofVisual__stage {
    transform: none;
  }

  .heroVisual__stage .appPreview,
  .proofVisual__stage .appPreview {
    width: 100%;
    max-width: none;
    aspect-ratio: 4 / 3;
  }

  .heroVisual .appPreview--home .ap-columns {
    grid-template-columns: 1fr;
  }

  .heroVisual .appPreview--home .ap-panel:last-child {
    display: none;
  }

  .heroVisual .appPreview--home .appPreview__manageBtn {
    display: none;
  }

  .heroVisual .appPreview--home .ap-statusBar {
    display: none;
  }

  .appPreview__chrome span:nth-child(2) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ap-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .ap-metric {
    padding: 8px 9px;
  }

  .ap-metric__value {
    font-size: 17px;
  }

  .ap-metric__spark {
    display: none;
  }

  .appPreview__welcome h2 {
    font-size: 13px;
  }

  .appPreview {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .ap-metrics {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .heroVisual__stage,
  .proofVisual__stage {
    transform: none !important;
    transition: none;
  }

  .ap-liveDot::before {
    animation: none;
  }

  html {
    scroll-behavior: auto;
  }
}
