:root {
  --brand: #05bebd;
  --ai: linear-gradient(90deg, #2bbdf2 0%, #7a82fb 100%);
  --ai-surface: linear-gradient(90deg, #eaf8fe 0%, #f0eeff 100%);
  --text-strong: #171717;
  --text-primary: #222;
  --text-secondary: #666;
  --text-tertiary: #8c8c8c;
  --border: #ededed;
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: #f2f3f7; color: var(--text-strong); font-family: var(--font); }
button { font: inherit; -webkit-tap-highlight-color: transparent; }
svg { display: block; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.demo-shell { min-height: 100dvh; display: grid; place-items: center; padding: 28px; }
.phone {
  position: relative;
  width: min(393px, 100vw);
  height: min(852px, 100dvh);
  overflow: hidden;
  background:
    linear-gradient(139deg, rgb(110 218 218 / 56%) 0%, rgb(255 255 255 / 56%) 38%),
    linear-gradient(228deg, #6582f6 0%, #fff 30%);
  box-shadow: 0 20px 60px rgb(26 36 75 / 22%);
}
.ambient { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .25; pointer-events: none; }
.ambient-a { width: 220px; height: 220px; background: #8ffffd; right: -90px; top: 260px; }
.ambient-b { width: 240px; height: 240px; background: #c2c3ff; left: -110px; bottom: 50px; }
.ambient-c { width: 170px; height: 170px; background: #ffccd2; right: -65px; bottom: -30px; }

.topbar {
  position: absolute;
  z-index: 20;
  inset: 0 0 auto;
  background: linear-gradient(180deg, rgb(255 255 255 / 10%), rgb(255 255 255 / 28%));
  backdrop-filter: blur(10px);
  box-shadow: 0 5px 12px rgb(255 255 255 / 45%);
}
.status { height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; font-size: 14px; font-weight: 700; }
.status strong { color: #12acae; font-size: 14px; }
.conversation-nav { height: 56px; display: flex; align-items: center; padding: 0 4px; gap: 4px; }
.conversation-nav > div { display: grid; gap: 1px; }
.conversation-nav b { font-size: 16px; line-height: 24px; }
.conversation-nav small { color: var(--text-secondary); font-size: 12px; line-height: 18px; }
.nav-spacer { flex: 1; }
.icon-btn { width: 44px; height: 44px; padding: 10px; border: 0; border-radius: 50%; background: transparent; color: #333; cursor: pointer; }
.icon-btn svg { width: 24px; height: 24px; fill: currentColor; }

.conversation {
  position: absolute;
  inset: 100px 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 14px 48px;
  scroll-behavior: auto;
  scrollbar-width: none;
}
.conversation::-webkit-scrollbar { display: none; width: 0; }
.empty-state { min-height: calc(100dvh - 132px); touch-action: manipulation; user-select: none; }

.hidden { display: none !important; }
[hidden] { display: none !important; }
.user-message {
  width: max-content;
  max-width: calc(100% - 28px);
  margin: 0 0 28px auto;
  padding: 8px 14px;
  border-radius: 12px 12px 0 12px;
  background: var(--brand);
  box-shadow: 0 4px 8px rgb(5 190 189 / 16%);
  color: #fff;
  font-size: 16px;
  line-height: 28px;
}

.ai-bubble {
  position: relative;
  width: 100%;
  margin: 0 0 28px;
  padding: 15px;
  overflow: hidden;
  border: 1px solid #fff;
  border-radius: 0 16px 16px 16px;
  background: linear-gradient(200deg, rgb(255 255 255 / 58%) 2%, rgb(255 255 255 / 12%) 42%);
  box-shadow: 0 0 12px rgb(147 163 163 / 25%), inset 5px 5px 12px #fff;
  backdrop-filter: blur(25px);
}
.reveal { opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity 250ms ease, transform 250ms ease; }
.reveal.shown { opacity: 1; transform: none; pointer-events: auto; }
.stream-gradient-tail {
  --stream-base-color: var(--text-primary);
  display: inline;
  background-image: linear-gradient(
    90deg,
    var(--stream-base-color) 0%,
    var(--stream-base-color) 52%,
    color-mix(in srgb, var(--stream-base-color) 78%, #2bbdf2) 68%,
    color-mix(in srgb, var(--stream-base-color) 62%, #638ff8) 84%,
    color-mix(in srgb, var(--stream-base-color) 48%, #7a82fb) 100%
  );
  background-position: 100% 0;
  background-size: 220% 100%;
  background-repeat: no-repeat;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: background-position 160ms ease-out;
  will-change: background-position;
}
.stream-gradient-tail.is-settling { background-position: 0 0; }
.stream-actions-locked .card-actions { visibility: hidden; pointer-events: none; }
.is-streaming .resume-preview { pointer-events: none; }
.ai-intro, .ai-title { display: block; font-size: 16px; font-weight: 700; line-height: 28px; }
.ai-intro i, .ai-title i, .analysis-result i { font-style: normal; background: var(--ai); color: transparent; background-clip: text; -webkit-background-clip: text; }

.thinking {
  max-height: 70px;
  margin: 12px 0;
  display: grid;
  gap: 10px;
  overflow: hidden;
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 16px;
  transition: max-height 300ms ease, margin 300ms ease, opacity 300ms ease;
}
.thinking p { margin: 0; opacity: .45; transition: opacity 200ms ease, color 200ms ease; }
.thinking p.active, .thinking p.done { opacity: 1; }
.thinking p.active { color: #5b6471; }
.thinking p.done { color: var(--text-tertiary); }
.thinking em { display: inline-block; width: 17px; font-style: normal; }
.thinking p.active em { color: #2bbdf2; animation: pulse 700ms infinite alternate; }
.thinking p.done em { color: #20af82; animation: none; }
.thinking.collapsed { max-height: 0; margin: 0; opacity: 0; }
.analysis-result { margin: 0 0 14px; font-size: 16px; font-weight: 700; line-height: 28px; }

.dimension-groups, .resume-groups { display: grid; gap: 20px; }
#bubble-1 > *,
#bubble-1 .dimension-groups,
#bubble-1 .dimension-group,
#bubble-1 .carousel {
  min-width: 0;
  max-width: 100%;
}
#bubble-1 .dimension-groups,
#bubble-1 .dimension-group,
#bubble-1 .carousel {
  width: 100%;
}
.carousel { width: 100%; overflow: hidden; touch-action: pan-y; cursor: grab; user-select: none; }
.carousel.dragging { cursor: grabbing; }
.track { display: flex; gap: 14px; will-change: transform; }
.dimension-card, .resume-card {
  width: 100%;
  flex: 0 0 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--ai-surface);
}
.dimension-card { height: 294px; padding: 16px 12px; display: flex; flex-direction: column; gap: 12px; }
.dimension-card h3, .resume-card h3 { margin: 0; color: var(--text-strong); font-size: 16px; font-weight: 700; line-height: 24px; }
.tag-row { display: flex; align-items: center; gap: 8px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 6px 8px; border-radius: 999px; background: #fff; color: var(--text-secondary); font-size: 11px; font-weight: 500; line-height: 16px; white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: #9bdcfa; }
.dimension-copy { flex: 1; min-height: 0; color: var(--text-primary); font-size: 16px; line-height: 28px; }
.dimension-copy p { margin: 0 0 8px; }
.dimension-copy b { color: var(--text-secondary); }
.dimension-copy .secondary-copy { color: var(--text-secondary); }

.pager { height: 3px; display: flex; justify-content: center; gap: 4px; flex: 0 0 3px; }
.pager span { width: 16px; height: 3px; border-radius: 4px; background: #e6e6e6; }
.pager span.active { background: linear-gradient(90deg, rgb(43 189 242 / 48%), rgb(122 130 251 / 48%)); }

.feedback { margin: 14px 0; display: grid; gap: 4px; }
#bubble-1 .feedback, #bubble-2 .feedback { margin-top: 0; }
.feedback-actions { display: flex; gap: 8px; }
.feedback-btn { width: 44px; height: 44px; padding: 10px; border: 0; border-radius: 50%; background: transparent; color: #999; cursor: pointer; }
.feedback-btn svg { width: 24px; height: 24px; }
.feedback-btn path { fill: currentColor; }
.feedback-btn.selected path { fill: url(#feedback-gradient); }
.feedback small { color: var(--text-secondary); font-size: 12px; line-height: 18px; }

.primary-btn {
  display: block;
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: var(--ai);
  box-shadow: 0 4px 8px rgb(85 139 249 / 18%);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 22px;
  cursor: pointer;
}

#bubble-2 .ai-title { margin-bottom: 14px; }
.resume-card {
  height: 380px;
  padding: 16px 12px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) 38px 3px;
  gap: 12px;
}
.resume-card { border: 0; }
.resume-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 8px;
  color: var(--text-primary);
  font-size: 16px;
  line-height: 28px;
  scrollbar-width: auto;
  scrollbar-color: #d6e3ff transparent;
}
.resume-scroll::-webkit-scrollbar { width: 8px; }
.resume-scroll::-webkit-scrollbar-track { background: transparent; }
.resume-scroll::-webkit-scrollbar-thumb { border-radius: 8px; background: #d6e3ff; }
.resume-scroll:focus { outline: none; }
.resume-scroll:focus-visible { outline: 2px solid rgb(43 189 242 / 45%); outline-offset: -2px; }
.resume-scroll section { margin: 0 0 8px; }
.resume-scroll b { display: block; color: var(--text-secondary); }
.resume-scroll p { margin: 0; }
.resume-scroll .secondary-copy p { color: var(--text-secondary); }
.ai-note { display: block; margin-top: 8px; background: var(--ai); color: transparent; background-clip: text; -webkit-background-clip: text; font-size: 12px; line-height: 18px; }
.card-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.card-actions button {
  height: 38px;
  min-width: 0;
  padding: 8px 4px;
  border: 1px solid #ccc;
  border-radius: 12px;
  background: #fff;
  color: #1a1a1a;
  font-size: 16px;
  line-height: 20px;
  cursor: pointer;
  white-space: nowrap;
}
.card-actions button.apply {
  border-color: transparent;
  background: linear-gradient(#fff, #fff) padding-box, var(--ai) border-box;
  font-weight: 700;
}
.card-actions button.apply > .apply-label {
  background: var(--ai);
  color: transparent;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.card-actions button.done, .card-actions button:disabled { border-color: #e6e6e6; background: #f3f3f3; color: #aaa; cursor: default; opacity: 1; }
.card-actions button.apply.done, .card-actions button.apply:disabled {
  background: #f3f3f3;
  color: #aaa;
}
.card-actions button.apply.done > .apply-label, .card-actions button.apply:disabled > .apply-label {
  background: none;
  color: #aaa;
  -webkit-text-fill-color: #aaa;
}

.version-scope { margin: 14px 0 20px; padding: 10px 12px 12px; display: grid; gap: 4px; border-radius: 10px; background: var(--ai-surface); color: var(--text-secondary); font-size: 12px; line-height: 18px; }
.version-scope b { color: var(--text-strong); font-size: 14px; font-weight: 500; line-height: 20px; }
.resume-preview { padding: 12px; display: grid; gap: 8px; border: 1px solid #2bbdf2; border-radius: 12px; background: rgb(255 255 255 / 52%); color: var(--text-primary); font-size: 14px; line-height: 22px; cursor: pointer; }
.resume-preview header { display: grid; gap: 0; }
.resume-preview header b { color: var(--text-strong); font-size: 17px; font-weight: 900; line-height: 28px; }
.resume-preview header span { color: var(--text-secondary); font-size: 12px; line-height: 18px; }
.resume-preview > div { display: grid; gap: 8px; }
.resume-preview h3 { margin: 0; color: var(--text-strong); font-size: 16px; line-height: 22px; }
.resume-preview p { margin: 0; }
.resume-preview b { color: var(--text-strong); font-size: 11px; line-height: 16px; }
.summary-strip { margin: 20px 0; padding: 8px 12px; display: grid; gap: 4px; overflow: hidden; border-radius: 10px; background: #fff; box-shadow: 0 0 20px -2px rgb(122 130 251 / 10%); color: var(--text-primary); font-size: 12px; line-height: 18px; }
.summary-strip b { font-weight: 500; }
.summary-strip span { color: var(--text-secondary); }
.summary-strip em { font-style: normal; }
.count-applied { color: #25b86b; }
.count-added { color: #ff4d4f; }
.count-skipped { color: #ffb020; }

.pressed:not(:disabled) { opacity: .8 !important; transform: scale(.98) !important; transition: opacity 150ms ease, transform 150ms ease !important; }
.card-actions button:active:not(:disabled), .icon-btn:active, .feedback-btn:active { opacity: .8; transform: scale(.97); }
@keyframes pulse { to { transform: scale(1.18); opacity: .55; } }

@media (max-width: 480px) {
  .demo-shell { padding: 0; }
  .phone { width: 100vw; height: 100dvh; box-shadow: none; }
  .topbar { padding-top: env(safe-area-inset-top); }
  .conversation { inset-block-start: calc(100px + env(safe-area-inset-top)); padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
  .empty-state { min-height: calc(100dvh - 116px - env(safe-area-inset-top)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
