:root {
  color-scheme: light;
  --bg: #f7f6f2;
  --paper: #ffffff;
  --paper-soft: #fbfaf7;
  --ink: #121212;
  --muted: #6f6f68;
  --faint: #ece9e2;
  --line: #dedbd2;
  --shadow: 0 22px 70px rgba(18, 18, 18, 0.08);
  --shadow-soft: 0 10px 30px rgba(18, 18, 18, 0.06);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #fff 0, var(--bg) 42%, #fff 100%);
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1120px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
}

.view {
  min-height: 100vh;
}

.home-view {
  display: grid;
  place-items: center;
  padding: 56px 0;
}

.home-inner {
  width: min(760px, 100%);
  display: grid;
  justify-items: center;
  text-align: center;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin: 0 0 18px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 18px;
  font-size: clamp(42px, 8vw, 76px);
  line-height: 0.98;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.subtitle {
  width: min(620px, 100%);
  margin: 0 auto 34px;
  color: var(--muted);
  font-size: clamp(17px, 4.6vw, 22px);
  line-height: 1.65;
}

.upload-search {
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: min(680px, 100%);
  min-height: 78px;
  padding: 10px 14px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  text-align: left;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.upload-search:hover,
.upload-search:focus-within {
  transform: translateY(-1px);
  border-color: #c8c4ba;
  box-shadow: 0 28px 80px rgba(18, 18, 18, 0.11);
}

.upload-search input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--ink);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
}

.search-copy {
  min-width: 0;
}

.search-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 760;
}

.search-copy small,
.counter,
.status-text {
  color: var(--muted);
}

.search-copy small {
  display: block;
  margin-top: 5px;
  font-size: 13px;
}

.counter {
  padding-right: 8px;
  font-size: 14px;
  font-weight: 800;
}

.home-preview {
  display: none;
  justify-content: center;
  width: min(680px, 100%);
  min-height: 0;
  margin-top: 18px;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.home-preview::-webkit-scrollbar,
.thumb-strip::-webkit-scrollbar {
  display: none;
}

.home-preview:empty {
  margin-top: 0;
}

.home-preview.has-files {
  display: flex;
}

.mini-thumb,
.result-cover-thumb {
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 18px;
  background: var(--faint);
}

.mini-thumb {
  width: 64px;
  height: 78px;
  box-shadow: var(--shadow-soft);
}

.mini-thumb img,
.thumb-item img,
.result-cover-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.thumb-badge {
  position: absolute;
  left: 7px;
  top: 7px;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, 0.68);
  font-size: 12px;
  font-weight: 900;
}

.primary-button,
.ghost-button {
  min-height: 56px;
  border-radius: 999px;
  font-weight: 850;
  cursor: pointer;
}

.primary-button {
  min-width: min(260px, 100%);
  margin-top: 26px;
  padding: 0 30px;
  border: 0;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow-soft);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.34;
}

.ghost-button {
  padding: 0 18px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
}

.status-text {
  min-height: 24px;
  margin: 14px 0 0;
  font-size: 14px;
  line-height: 1.6;
}

.analysis-view,
.result-view {
  padding: 22px 0 52px;
}

.result-view {
  width: min(900px, 100%);
  margin: 0 auto;
}

.top-bar,
.result-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top-bar {
  min-height: 60px;
}

.top-bar span {
  color: var(--muted);
  font-weight: 800;
}

.thumb-strip {
  display: flex;
  gap: 12px;
  margin: 18px calc((100vw - min(1120px, calc(100vw - 28px))) / -2) 0;
  padding: 0 calc((100vw - min(1120px, calc(100vw - 28px))) / 2);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.thumb-item {
  position: relative;
  flex: 0 0 92px;
  width: 92px;
  height: 116px;
  overflow: hidden;
  border-radius: 22px;
  background: var(--faint);
  box-shadow: var(--shadow-soft);
  scroll-snap-align: start;
}

.analysis-card {
  display: grid;
  justify-items: center;
  width: min(760px, 100%);
  margin: 12vh auto 0;
  padding: 44px 22px;
  text-align: center;
}

.pulse-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin-bottom: 24px;
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--shadow);
}

.pulse-mark::before,
.pulse-mark::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(18, 18, 18, 0.16);
  border-radius: 22px;
  animation: pulse 1.8s ease-out infinite;
}

.pulse-mark::after {
  animation-delay: 0.65s;
}

.pulse-mark span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
}

.analysis-card h2 {
  margin-bottom: 12px;
  font-size: clamp(30px, 8vw, 54px);
  line-height: 1.08;
}

.analysis-card p {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 760;
}

.progress-track {
  position: relative;
  width: min(520px, 100%);
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9e5dc;
}

.progress-bar {
  width: 10%;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, #111 0%, #7c5cff 38%, #39c6b8 70%, #ffd166 100%);
  background-size: 180% 100%;
  transition: width 0.45s ease;
  animation: progressFlow 1.7s linear infinite;
}

.progress-track::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(18, 18, 18, 0.05);
  pointer-events: none;
}

.result-hero {
  align-items: flex-end;
  padding: 28px 0 8px;
}

.result-hero h2 {
  margin: 0 0 10px;
  font-size: clamp(38px, 10vw, 74px);
  line-height: 1;
}

.result-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.cover-card,
.photo-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
}

.cover-card {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
  margin-top: 0;
  padding: 0;
  background: #fff;
  box-shadow: var(--shadow);
}

.result-cover-thumb {
  width: 100%;
  min-height: 260px;
  border-radius: 0;
}

.cover-content {
  min-width: 0;
  align-self: center;
  padding: 26px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.cover-content h3 {
  margin: 0 0 12px;
  font-size: 24px;
}

.cover-content pre,
.photo-card pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  line-height: 1.75;
}

.cover-content pre {
  color: #333;
  font-size: 15px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 36px 0 16px;
}

.section-title h3 {
  margin: 0;
  font-size: 24px;
}

.section-title span {
  color: var(--muted);
  font-weight: 850;
}

.photo-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.photo-card {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}

.photo-card-media {
  position: relative;
  min-height: 360px;
  background: var(--faint);
}

.photo-card-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.photo-card-body {
  padding: 26px;
}

.photo-card h3 {
  margin: 0 0 14px;
  font-size: 23px;
}

.photo-card pre {
  color: #2e2e2a;
  font-size: 15px;
}

.cover-section {
  margin-top: 4px;
}

.result-view .thumb-strip {
  margin: 22px 0 0;
  padding: 0;
}

.error-card {
  grid-column: 1 / -1;
  padding: 22px;
  border: 1px solid #efd1c8;
  border-radius: var(--radius-lg);
  background: #fff7f4;
  color: #8d2d1f;
  line-height: 1.7;
}

@keyframes pulse {
  0% {
    opacity: 0.85;
    transform: scale(0.82);
  }

  100% {
    opacity: 0;
    transform: scale(1.45);
  }
}

@keyframes progressFlow {
  0% {
    background-position: 0% 50%;
  }

  100% {
    background-position: 180% 50%;
  }
}

@media (min-width: 720px) {
  .app-shell {
    width: min(1120px, calc(100% - 56px));
  }

  .home-view {
    padding: 76px 0;
  }

  .photo-card-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1040px) {
  .photo-card-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 22px, 1120px);
  }

  .upload-search {
    grid-template-columns: 50px minmax(0, 1fr);
    min-height: 76px;
    border-radius: 24px;
    align-items: center;
  }

  .counter {
    grid-column: 1 / -1;
    padding-right: 0;
    padding-left: 62px;
  }

  .icon-button {
    width: 50px;
    height: 50px;
  }

  .primary-button {
    width: 100%;
  }

  .result-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .result-view .thumb-strip {
    margin-top: 18px;
  }

  .photo-card {
    grid-template-columns: 1fr;
  }

  .photo-card-media {
    aspect-ratio: 4 / 3;
    min-height: 0;
  }

  .cover-card {
    grid-template-columns: 1fr;
    border-radius: 24px;
  }

  .result-cover-thumb {
    width: 100%;
    min-height: 0;
    height: auto;
    aspect-ratio: 16 / 10;
  }

  .photo-card-body {
    padding: 18px;
  }
}
