:root {
  color-scheme: light dark;
  --bg: #f5f7f8;
  --page-top: #ffffff;
  --surface: #ffffff;
  --surface-strong: #eef3f5;
  --panel-bg: rgba(255, 255, 255, 0.92);
  --header-bg: rgba(255, 255, 255, 0.88);
  --text: #18242b;
  --muted: #63717a;
  --line: #d9e1e5;
  --accent: #0f766e;
  --accent-strong: #0b5f58;
  --accent-contrast: #ffffff;
  --blue: #2563eb;
  --danger: #b4233a;
  --amber: #a15c07;
  --metric-bg: linear-gradient(180deg, #f8fbfb 0%, #eef5f4 100%);
  --upload-bg: linear-gradient(135deg, #ffffff 0%, #edf6f4 100%);
  --upload-active-bg: #e3f4f0;
  --code-bg: #102128;
  --code-text: #dff7f2;
  --notice-bg: #fff7d8;
  --notice-border: #e0cb8b;
  --shadow: 0 18px 50px rgba(18, 36, 43, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1418;
    --page-top: #101b20;
    --surface: #142126;
    --surface-strong: #1b2b31;
    --panel-bg: rgba(20, 33, 38, 0.94);
    --header-bg: rgba(14, 23, 27, 0.9);
    --text: #e6eef1;
    --muted: #9aaab1;
    --line: #2b3d44;
    --accent: #2dd4bf;
    --accent-strong: #14b8a6;
    --accent-contrast: #062520;
    --blue: #60a5fa;
    --danger: #fb7185;
    --amber: #fbbf24;
    --metric-bg: linear-gradient(180deg, #19282e 0%, #132126 100%);
    --upload-bg: linear-gradient(135deg, #16252a 0%, #102026 100%);
    --upload-active-bg: #173b36;
    --code-bg: #071216;
    --code-text: #d8fff8;
    --notice-bg: #332812;
    --notice-border: #8a6a22;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 0%, rgba(15, 118, 110, 0.16), transparent 32rem),
    linear-gradient(180deg, var(--page-top) 0%, var(--bg) 42%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button,
input,
dialog {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.nav-shell,
.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
}

.nav-shell {
  min-height: 72px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 850;
  white-space: nowrap;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-size: 14px;
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.main-nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 750;
}

.main-nav a:hover,
.main-nav a.is-active {
  background: var(--surface-strong);
  color: var(--text);
}

.account {
  min-width: 160px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.shell {
  padding: 36px 0 64px;
}

.view,
.auth-panel,
.feature-strip article {
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hero-view {
  position: relative;
  min-height: 590px;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr);
  gap: clamp(36px, 5vw, 72px);
  align-items: center;
  padding: clamp(38px, 5vw, 68px);
  border-radius: 12px;
  background:
    linear-gradient(color-mix(in srgb, var(--line) 32%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--line) 32%, transparent) 1px, transparent 1px),
    radial-gradient(circle at 12% 14%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 27rem),
    var(--panel-bg);
  background-size: 32px 32px, 32px 32px, auto, auto;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.error-shell {
  min-height: calc(100vh - 72px);
  display: grid;
  place-items: center;
}

.error-view {
  width: min(720px, 100%);
  padding: clamp(36px, 7vw, 72px);
  text-align: center;
}

.error-code {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: clamp(72px, 16vw, 144px);
  font-weight: 900;
  letter-spacing: -0.08em;
  line-height: 0.85;
}

.error-view h1 {
  margin: 10px 0 14px;
  font-size: clamp(32px, 6vw, 56px);
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.error-text {
  margin: 0 auto 28px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.hero-kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-kicker span {
  color: var(--accent);
  font-weight: 850;
}

.hero-kicker small {
  padding-left: 12px;
  border-left: 1px solid var(--line);
  font: inherit;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 620px;
  font-family: ui-rounded, "SF Pro Rounded", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(42px, 5.2vw, 66px);
  font-weight: 760;
  line-height: 1.04;
  letter-spacing: -0.045em;
}

h1 span {
  color: var(--accent);
}

h2 {
  font-size: 24px;
  line-height: 1.2;
}

.hero-text {
  max-width: 590px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.hero-actions {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions .button {
  min-height: 48px;
  padding-inline: 19px;
  border-radius: 999px;
}

.hero-primary {
  gap: 12px;
  box-shadow: 0 12px 28px color-mix(in srgb, var(--accent) 26%, transparent);
}

.hero-primary span {
  font-size: 17px;
}

.hero-secondary {
  background: color-mix(in srgb, var(--surface) 76%, transparent);
}

.hero-footnote {
  margin: 25px 0 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-showcase {
  position: relative;
  min-width: 0;
  margin: 0;
  padding: 0 0 32px 44px;
}

.hero-index-rail {
  position: absolute;
  inset: 0 auto 32px 0;
  width: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  writing-mode: vertical-rl;
}

.hero-photo-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-strong);
  box-shadow:
    0 28px 58px rgba(18, 36, 43, 0.2),
    0 1px 0 rgba(255, 255, 255, 0.6) inset;
  animation: home-photo-enter 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-photo-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.11), transparent 45%, rgba(7, 33, 30, 0.08));
  pointer-events: none;
}

.hero-photo-frame img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 1px;
  object-fit: cover;
}

.hero-upload-card {
  position: absolute;
  z-index: 2;
  left: -8px;
  bottom: 3px;
  width: min(340px, 76%);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface) 91%, transparent);
  box-shadow: 0 18px 34px rgba(18, 36, 43, 0.18);
  backdrop-filter: blur(16px);
  animation: home-status-enter 520ms 150ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-upload-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--upload-active-bg);
  color: var(--accent);
  font-size: 20px;
  font-weight: 900;
}

.hero-upload-card > span:nth-child(2) {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 4px;
}

.hero-upload-card strong,
.hero-upload-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-upload-card strong {
  font-size: 13px;
}

.hero-upload-card small {
  color: var(--muted);
  font-size: 11px;
}

.hero-upload-check {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 12px;
  font-weight: 900;
}

.feature-strip {
  margin-top: 24px;
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel-bg) 86%, transparent);
}

.feature-intro {
  margin-bottom: 28px;
}

.feature-intro h2 {
  max-width: 600px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.feature-grid article {
  min-height: 250px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  transition: background 160ms ease;
}

.feature-grid article:last-child {
  border-right: 0;
}

.feature-grid article:hover {
  background: color-mix(in srgb, var(--upload-active-bg) 45%, transparent);
}

.feature-icon {
  width: fit-content;
  margin-bottom: 36px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.07em;
}

.feature-grid h3 {
  margin: 0;
  font-size: 20px;
}

.feature-grid p {
  margin: 12px 0 24px;
  color: var(--muted);
  line-height: 1.7;
}

.feature-grid a {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}

.feature-grid a:hover span {
  transform: translateX(3px);
}

.feature-grid a span {
  transition: transform 160ms ease;
}

.auth-panel {
  margin-top: 18px;
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.section-head {
  margin-bottom: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.button,
.icon-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  font-weight: 780;
  white-space: nowrap;
}

.button:hover,
.icon-button:hover {
  border-color: var(--accent);
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.button.danger:hover {
  border-color: var(--danger);
  filter: brightness(0.92);
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.upload-zone {
  position: relative;
  min-height: 230px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  margin: 0 20px 20px;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--upload-bg);
}

.upload-zone.is-dragging {
  border-color: var(--accent);
  background: var(--upload-active-bg);
}

.upload-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.upload-copy {
  display: grid;
  gap: 8px;
}

.upload-copy strong {
  font-size: 32px;
  line-height: 1.1;
}

.upload-copy span,
.image-detail,
.token-detail {
  color: var(--muted);
  font-size: 13px;
}

.status {
  min-height: 24px;
  margin: 0 22px 16px;
  color: var(--amber);
  font-size: 14px;
}

.upload-progress {
  margin: 0 20px 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent) 0%, var(--blue) 100%);
  transition: width 220ms ease;
}

.upload-progress.is-active .progress-bar {
  background-size: 180% 100%;
  animation: progress-sheen 1.2s linear infinite;
}

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

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

.upload-results {
  margin: 0 20px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.section-subhead {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.section-subhead h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.upload-result-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.upload-result-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.upload-result-row .icon-button {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.upload-result-actions {
  display: flex;
  gap: 8px;
}

.upload-result-thumb {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 7px;
  background: var(--surface);
}

.upload-result-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-result-detail {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.gallery-controls {
  margin: 0 20px 16px;
  display: grid;
  gap: 12px;
}

.gallery-head-actions,
.selection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.selection-toolbar {
  margin: 0 20px 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 8px;
  background: var(--upload-active-bg);
}

.selection-toolbar > strong {
  white-space: nowrap;
}

.segmented {
  width: fit-content;
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.segment,
.filter-tag {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  min-height: 34px;
  padding: 0 12px;
  font-weight: 780;
}

.segment.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(18, 36, 43, 0.08);
}

.filter-block {
  display: grid;
  gap: 8px;
}

.filter-block span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-tag {
  border: 1px solid var(--line);
  background: var(--surface);
}

.filter-tag.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 24%, transparent);
}

.filter-tag:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.filter-block.is-disabled > span {
  opacity: 0.48;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 0 20px 20px;
}

.image-grid.is-list {
  grid-template-columns: 1fr;
}

.image-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.image-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 34%, transparent);
}

.thumb-shell {
  position: relative;
  min-width: 0;
  background: var(--surface-strong);
}

.image-select {
  position: absolute;
  z-index: 4;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.favorite-image {
  position: absolute;
  z-index: 4;
  top: 10px;
  left: 10px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  background: rgba(14, 23, 27, 0.72);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  font-size: 21px;
  line-height: 1;
}

.favorite-image:hover,
.favorite-image:focus-visible,
.favorite-image.is-favorite {
  border-color: #f8c94e;
  background: #6f4d00;
  color: #ffd968;
}

.favorite-image:focus-visible {
  outline: 3px solid rgba(248, 201, 78, 0.38);
  outline-offset: 2px;
}

.favorite-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.favorite-filter span {
  color: #c48600;
  font-size: 17px;
}

.image-select-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.image-select-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  background: rgba(14, 23, 27, 0.72);
  color: transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  font-weight: 900;
}

.image-select-input:focus-visible + .image-select-mark {
  outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 2px;
}

.image-select-input:checked + .image-select-mark {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
}

.image-grid.is-list .image-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 320px;
  align-items: stretch;
}

.image-grid.is-list .thumb-shell {
  min-height: 76px;
}

.image-grid.is-list .favorite-image {
  top: 6px;
  left: 6px;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: 16px;
}

.image-grid.is-list .image-select {
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
}

.image-grid.is-list .image-select-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 12px;
}

.thumb-link {
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--surface-strong);
}

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

.image-grid.is-list .thumb-link {
  aspect-ratio: auto;
  height: 100%;
  min-height: 76px;
}

.image-meta {
  min-height: 74px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.image-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-actions {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: column;
  border-top: 1px solid var(--line);
}

.image-actions .icon-button {
  width: 100%;
  min-width: 0;
  padding-inline: 6px;
}

.image-grid.is-list .image-actions {
  border-top: 0;
  border-left: 1px solid var(--line);
}

.icon-button {
  border: 0;
  border-radius: 0;
  border-right: 1px solid var(--line);
}

.icon-button:last-child {
  border-right: 0;
}

.delete-image,
.revoke-token {
  color: var(--danger);
}

.process-image {
  color: var(--accent);
}

.process-image:hover {
  background: var(--upload-active-bg);
}

.confirm-dialog {
  width: min(480px, calc(100vw - 24px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.confirm-dialog::backdrop {
  background: rgba(4, 12, 15, 0.72);
  backdrop-filter: blur(4px);
}

.confirm-dialog.is-dialog-fallback {
  position: fixed;
  inset: 12px;
  z-index: 110;
  margin: auto;
}

.confirm-dialog-shell {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  padding: 22px;
}

.confirm-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
  font-size: 22px;
  font-weight: 900;
}

.confirm-message {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.confirm-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.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;
}

.process-dialog {
  width: min(920px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.process-dialog.is-dialog-fallback {
  position: fixed;
  inset: 12px;
  z-index: 100;
  margin: auto;
}

.process-dialog::backdrop {
  background: rgba(4, 12, 15, 0.72);
  backdrop-filter: blur(4px);
}

.process-dialog-shell {
  padding: 20px;
}

.process-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.dialog-close {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.crop-viewport {
  min-height: 280px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, var(--surface-strong) 25%, transparent 25%),
    linear-gradient(-45deg, var(--surface-strong) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--surface-strong) 75%),
    linear-gradient(-45deg, transparent 75%, var(--surface-strong) 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.crop-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.crop-stage img {
  display: block;
  max-width: 100%;
  max-height: 52vh;
  pointer-events: none;
}

.crop-selection {
  position: absolute;
  cursor: move;
  border: 2px solid #ffffff;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.72),
    0 0 0 9999px rgba(4, 12, 15, 0.56);
  touch-action: none;
}

.crop-selection::before,
.crop-selection::after {
  content: "";
  position: absolute;
  pointer-events: none;
  opacity: 0.58;
}

.crop-selection::before {
  inset: 33.333% 0;
  border-top: 1px solid #ffffff;
  border-bottom: 1px solid #ffffff;
}

.crop-selection::after {
  inset: 0 33.333%;
  border-left: 1px solid #ffffff;
  border-right: 1px solid #ffffff;
}

.crop-handle {
  position: absolute;
  z-index: 1;
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.crop-handle.nw {
  top: -9px;
  left: -9px;
  cursor: nwse-resize;
}

.crop-handle.ne {
  top: -9px;
  right: -9px;
  cursor: nesw-resize;
}

.crop-handle.sw {
  bottom: -9px;
  left: -9px;
  cursor: nesw-resize;
}

.crop-handle.se {
  right: -9px;
  bottom: -9px;
  cursor: nwse-resize;
}

.crop-help {
  margin: 10px 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.process-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.process-actions .button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.process-status {
  min-height: 24px;
  margin-top: 10px;
  color: var(--amber);
  font-size: 14px;
}

.process-result {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.process-result > img {
  width: 72px;
  height: 56px;
  object-fit: contain;
  border-radius: 7px;
  background: var(--surface);
}

.process-result-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.process-result-copy strong,
.process-result-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.process-result-copy span {
  color: var(--muted);
  font-size: 12px;
}

.process-result-actions {
  display: flex;
  gap: 8px;
}

.empty {
  margin: 0 20px 20px;
  padding: 36px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.token-form {
  display: flex;
  gap: 8px;
}

.token-form input {
  width: min(260px, 42vw);
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.api-example {
  margin: 0 20px 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-text);
  overflow-x: auto;
}

.api-example code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  white-space: nowrap;
}

.token-secret {
  margin: 0 20px 14px;
  padding: 12px;
  border: 1px solid var(--notice-border);
  border-radius: 8px;
  background: var(--notice-bg);
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.token-list {
  padding: 0 20px 20px;
  display: grid;
  gap: 8px;
}

.token-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

[hidden] {
  display: none !important;
}

@keyframes home-photo-enter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes home-status-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-photo-frame,
  .hero-upload-card {
    animation: none;
  }

  .feature-grid article,
  .feature-grid a span {
    transition: none;
  }
}

@media (max-width: 860px) {
  .nav-shell {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px 0;
  }

  .main-nav {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .account {
    min-width: 0;
    justify-content: flex-start;
  }

  .hero-view {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .hero-copy {
    max-width: 680px;
  }

  .hero-showcase {
    width: min(680px, 100%);
    margin: 0 auto;
  }

}

@media (max-width: 720px) {
  .nav-shell,
  .shell {
    width: min(100vw - 20px, 1180px);
  }

  .shell {
    padding-top: 18px;
  }

  .hero-view,
  .section-head,
  .auth-panel,
  .upload-zone {
    align-items: stretch;
  }

  .hero-view {
    padding: 22px;
    border-radius: 18px;
  }

  .upload-zone {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(40px, 12vw, 54px);
  }

  .hero-text {
    font-size: 16px;
  }

  .hero-showcase {
    padding: 0 0 28px 30px;
  }

  .hero-index-rail {
    bottom: 28px;
    width: 20px;
    font-size: 8px;
  }

  .hero-photo-frame {
    padding: 5px;
    border-radius: 3px;
  }

  .hero-upload-card {
    left: 8px;
    width: calc(100% - 30px);
  }

  .feature-strip {
    padding: 24px 16px;
    border-radius: 18px;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .feature-grid article {
    min-height: 220px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .feature-grid article:last-child {
    border-bottom: 0;
  }

  .image-grid.is-list .image-card {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .image-grid.is-list .image-actions {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .section-head,
  .auth-panel {
    flex-direction: column;
  }

  .gallery-head-actions,
  .selection-actions {
    width: 100%;
  }

  .gallery-head-actions .button,
  .selection-actions .button {
    flex: 1;
  }

  .selection-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .upload-copy strong {
    font-size: 24px;
  }

  .token-form {
    width: 100%;
    display: grid;
  }

  .token-form input {
    width: 100%;
  }

  .upload-result-row {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .upload-result-actions {
    grid-column: 1 / -1;
  }

  .upload-result-actions .icon-button {
    flex: 1;
  }

  .process-dialog-shell {
    padding: 14px;
  }

  .crop-viewport {
    min-height: 220px;
    padding: 10px;
  }

  .process-actions {
    display: grid;
  }

  .process-result {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .process-result > img {
    width: 56px;
    height: 48px;
  }

  .process-result-actions {
    grid-column: 1 / -1;
  }

  .process-result-actions .button {
    flex: 1;
  }
}
