:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #050505;
  --text: #171717;
  --muted: #777777;
  --subtle: #999999;
  --soft: #f6f6f6;
  --soft-2: #fafafa;
  --line: rgba(0, 0, 0, 0.1);
  --line-strong: rgba(0, 0, 0, 0.18);
  --black: #080808;
  --white: #ffffff;
  --code: #202123;
  --radius: 18px;
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  font-family: var(--font);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.025), transparent 120px),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.026) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(180deg, transparent 0, black 120px, black 72%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, black 120px, black 72%, transparent 100%);
  animation: grid-drift 18s linear infinite;
}

[hidden],
.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  color: inherit;
  font: inherit;
}

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

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 9px 13px;
  border-radius: 8px;
  background: var(--black);
  color: var(--white);
  font-size: 13px;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.nav {
  width: min(620px, calc(100% - 32px));
  height: calc(58px + env(safe-area-inset-top));
  margin: 0 auto;
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0;
}

.brand img {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: block;
}

.language-toggle {
  position: relative;
  width: 88px;
  height: 32px;
  margin-left: auto;
  padding: 3px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  background: rgba(255, 255, 255, 0.74);
}

.language-toggle::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  border-radius: 999px;
  background: var(--black);
  transition: transform 360ms var(--ease);
}

html[data-lang="en"] .language-toggle::before {
  transform: translateX(100%);
}

.language-toggle button {
  position: relative;
  z-index: 1;
  height: 100%;
  border: 0;
  border-radius: 999px;
  appearance: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  transition: color 220ms ease;
}

html[data-lang="zh"] .language-toggle [data-lang="zh"],
html[data-lang="en"] .language-toggle [data-lang="en"] {
  color: var(--white);
}

.page-shell {
  width: min(620px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 max(18px, env(safe-area-inset-bottom));
  display: grid;
  align-content: start;
  gap: 12px;
}

.hero {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 9px;
  text-align: center;
}

.eyebrow,
.project-kicker,
.modal-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 520;
  letter-spacing: 0;
}

h1 {
  max-width: 600px;
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  color: var(--ink);
  font-size: clamp(33px, 8.8vw, 48px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.08;
  text-align: center;
  text-wrap: balance;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.loading-label {
  color: transparent;
  font-size: 1px;
}

.author-row {
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.avatar {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.author-copy {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.author-name {
  max-width: min(48vw, 270px);
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.author-detail {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.author-detail::before {
  content: "·";
  margin-right: 6px;
}

.work-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.065);
  transition: transform 400ms var(--ease), box-shadow 400ms ease;
}

.work-card:hover {
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.075);
}

.work-typebar {
  height: 46px;
  padding: 0 13px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(255, 255, 255, 0.96);
}

.work-type {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.type-symbol {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.type-symbol svg,
.poster-symbol svg {
  width: 58%;
  height: 58%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.work-type strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-kind {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 520;
  white-space: nowrap;
}

.preview-viewport {
  position: relative;
  height: clamp(170px, 24svh, 202px);
  overflow: hidden;
  background: var(--code);
}

.preview-skeleton {
  position: absolute;
  inset: 0;
  padding: 34px 30px;
  display: grid;
  align-content: center;
  gap: 12px;
  background: var(--code);
}

.preview-skeleton span {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  animation: pulse 1.35s ease-in-out infinite alternate;
}

.preview-skeleton span:nth-child(1) { width: 44%; }
.preview-skeleton span:nth-child(2) { width: 76%; animation-delay: 100ms; }
.preview-skeleton span:nth-child(3) { width: 61%; animation-delay: 200ms; }
.preview-skeleton span:nth-child(4) { width: 83%; animation-delay: 300ms; }

.code-preview,
.cover-preview,
.poster-preview {
  width: 100%;
  height: 100%;
}

.code-preview {
  position: relative;
  overflow: hidden;
  background: var(--code);
  color: #ececec;
}

.code-preview pre {
  height: 100%;
  margin: 0;
  padding: 18px 0 38px;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.55;
  tab-size: 4;
}

.code-line {
  min-height: 16px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
}

.code-number {
  padding-right: 10px;
  color: #616164;
  text-align: right;
  user-select: none;
}

.code-text {
  padding-right: 18px;
  overflow: hidden;
  color: #e8e8e8;
  text-overflow: clip;
  white-space: pre;
}

.preview-fade {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 48px;
  background: linear-gradient(transparent, var(--code) 88%);
  pointer-events: none;
}

.cover-preview {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: var(--soft);
}

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

.poster-preview {
  position: relative;
  padding: 24px;
  overflow: hidden;
  background: var(--code);
}

.poster-grid {
  position: absolute;
  inset: 0;
  opacity: 0.46;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(90deg, black, transparent 76%);
  -webkit-mask-image: linear-gradient(90deg, black, transparent 76%);
}

.poster-lines {
  position: absolute;
  top: 50%;
  left: 34px;
  width: min(58%, 360px);
  display: grid;
  gap: 12px;
  transform: translateY(-50%);
}

.poster-lines span {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
}

.poster-lines span:nth-child(1) { width: 78%; }
.poster-lines span:nth-child(2) { width: 100%; background: rgba(255, 255, 255, 0.47); }
.poster-lines span:nth-child(3) { width: 62%; }

.poster-symbol {
  position: absolute;
  top: 50%;
  right: clamp(30px, 8vw, 70px);
  width: clamp(88px, 20vw, 126px);
  height: clamp(88px, 20vw, 126px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 32px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(255, 255, 255, 0.93);
  font-family: var(--mono);
  font-size: clamp(19px, 4vw, 27px);
  font-weight: 650;
  transform: translateY(-50%) rotate(-2deg);
}

.project-facts {
  position: absolute;
  right: 20px;
  bottom: 16px;
  left: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.project-fact {
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 6px;
  color: #b7b7b9;
  font-family: var(--mono);
  font-size: 9px;
}

.stats {
  height: 42px;
  padding: 0 7px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: rgba(255, 255, 255, 0.92);
}

.stat {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted);
}

.stat strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
}

.stat span {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary {
  width: min(520px, 100%);
  min-height: 38px;
  margin: 0 auto;
  overflow: hidden;
  display: -webkit-box;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
  text-wrap: pretty;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.action-panel {
  position: relative;
  display: grid;
  gap: 7px;
}

.actions {
  width: min(360px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 10px;
}

.button {
  --ripple-x: 50%;
  --ripple-y: 50%;
  position: relative;
  min-height: 48px;
  padding: 0 16px;
  overflow: hidden;
  border: 1.25px solid var(--line-strong);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  appearance: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 650;
  transform: translateZ(0);
  transition: transform 220ms var(--ease), border-color 220ms ease, background 220ms ease, color 220ms ease;
}

.button::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at var(--ripple-x) var(--ripple-y), rgba(255, 255, 255, 0.22), transparent 34%);
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 360ms ease, transform 360ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button:active {
  transform: translateY(0) scale(0.99);
}

.button:active::after {
  opacity: 1;
  transform: scale(1.04);
  transition-duration: 120ms;
}

.button.primary {
  justify-content: center;
  border-color: var(--black);
  background: var(--black);
  color: var(--white);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.12);
}

.button.primary > [aria-hidden="true"] {
  position: absolute;
  right: 18px;
}

.button.secondary {
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.text-button {
  min-height: 22px;
  margin: 0 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11.5px;
}

.text-button:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.browser-note {
  margin: 0;
  overflow: hidden;
  color: var(--subtle);
  font-size: 10.5px;
  line-height: 1.4;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.launch-fallback {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 40;
  width: min(360px, calc(100% - 32px));
  padding: 12px 15px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.86);
  color: var(--white);
  text-align: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transform: translateX(-50%);
}

.launch-fallback strong {
  font-size: 12px;
  font-weight: 650;
}

.launch-fallback p {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 10.5px;
}

.status-card {
  position: absolute;
  top: 12px;
  right: 12px;
  left: 12px;
  z-index: 4;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--black);
}

.status-card strong,
.status-card p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-card strong {
  display: block;
  font-size: 11.5px;
  font-weight: 650;
}

.status-card p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.retry-button {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
}

.site-footer {
  width: min(620px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 max(20px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 18px;
  color: var(--muted);
  font-size: 10.5px;
}

.site-footer nav {
  display: flex;
  gap: 14px;
}

.browser-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-items: end;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal-sheet {
  position: relative;
  z-index: 1;
  width: min(500px, calc(100% - 24px));
  margin: 0 auto max(12px, env(safe-area-inset-bottom));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.25);
  animation: sheet-in 200ms var(--ease) both;
}

.modal-sheet h2 {
  max-width: 420px;
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 22px;
  font-weight: 680;
  letter-spacing: -0.025em;
}

.modal-sheet ol {
  margin: 20px 0;
  padding: 0;
  display: grid;
  gap: 10px;
  list-style: none;
}

.modal-sheet li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.modal-sheet li span {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--white);
  color: var(--ink);
  font-size: 10px;
  font-weight: 650;
}

.modal-sheet li b {
  font-weight: 520;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.modal-actions .button {
  width: 100%;
  min-width: 0;
  padding-right: 14px;
  padding-left: 14px;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 80;
  min-width: 120px;
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.86);
  color: var(--white);
  font-size: 12px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px) scale(0.98);
  transition: opacity 220ms ease, transform 300ms var(--ease);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.skeleton {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--soft), #dedede, var(--soft));
  background-size: 220% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}

.skeleton-title {
  width: min(430px, 82vw);
  height: clamp(36px, 8vw, 50px);
}

.skeleton-copy {
  width: min(420px, 86vw);
  height: 15px;
  margin: 3px auto 0;
}

body:not(.is-loading) .skeleton,
body:not(.is-loading) .loading-label {
  display: none;
}

.button:focus-visible,
.text-button:focus-visible,
.retry-button:focus-visible,
.brand:focus-visible,
.language-toggle button:focus-visible,
.site-footer a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

@keyframes grid-drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 64px 64px, 64px 64px; }
}

@keyframes shimmer {
  to { background-position: -220% 0; }
}

@keyframes pulse {
  to { opacity: 0.35; }
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(18px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (min-width: 681px) {
  .page-shell {
    padding-top: clamp(34px, 6svh, 64px);
    gap: 16px;
  }

  .preview-viewport {
    height: clamp(220px, 31svh, 270px);
  }
}

@media (max-width: 680px) {
  body {
    grid-template-rows: auto 1fr;
  }

  .page-shell {
    padding-top: 16px;
    gap: clamp(8px, 1.3svh, 11px);
  }

  .hero {
    gap: 7px;
  }

  .eyebrow {
    font-size: 12px;
  }

  h1 {
    font-size: clamp(31px, 9.3vw, 39px);
  }

  .avatar {
    width: 32px;
    height: 32px;
  }

  .author-name {
    max-width: 50vw;
  }

  .summary {
    min-height: 36px;
    font-size: 12.5px;
  }

  .actions {
    gap: 8px;
  }

  .button {
    min-height: 46px;
    font-size: 14px;
  }

  .browser-note {
    font-size: 10px;
  }

  .site-footer {
    display: none;
  }
}

@media (max-width: 360px) {
  .stat span {
    display: none;
  }

  .browser-note {
    white-space: normal;
  }

  .preview-viewport {
    height: clamp(150px, 25svh, 180px);
  }

  .status-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .retry-button {
    display: none;
  }
}

@media (max-height: 690px) and (max-width: 680px) {
  .page-shell {
    padding-top: 10px;
    gap: 7px;
  }

  .eyebrow,
  .browser-note {
    display: none;
  }

  h1 {
    font-size: 29px;
  }

  .preview-viewport {
    height: clamp(145px, 23svh, 164px);
  }

  .summary {
    min-height: 32px;
    font-size: 12px;
  }

  .button {
    min-height: 43px;
  }
}

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

  body::before {
    animation: none !important;
  }
}
