/* 企业级前台视觉 — 冷灰蓝工作台，无外链字体 */
:root {
  --ink: #0b1c2c;
  --ink-2: #1a3348;
  --muted: #5a6b7a;
  --faint: #8a9aab;
  --paper: #e8eef4;
  --surface: #ffffff;
  --surface-2: #f4f7fa;
  --line: #d3dde7;
  --line-soft: rgba(11, 28, 44, 0.08);
  --accent: #0e7490;
  --accent-2: #155e75;
  --accent-soft: #e0f2f7;
  --navy: #0b1c2c;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #0f766e;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 1px 2px rgba(11, 28, 44, 0.04), 0 12px 32px -20px rgba(11, 28, 44, 0.28);
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: Consolas, "Courier New", ui-monospace, monospace;
  --header-h: 60px;
  --max: 980px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(180deg, #dfe8f1 0%, var(--paper) 42%, #f3f6f9 100%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 11px,
      rgba(11, 28, 44, 0.015) 11px,
      rgba(11, 28, 44, 0.015) 12px
    );
  background-attachment: fixed;
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; }

.shell {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
}

.container {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
  flex: 1;
}

/* ========== Header ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255,255,255,.8);
  backdrop-filter: blur(12px);
}
.site-header::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--accent) 55%, #67e8f9 100%);
}
.site-header nav {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-header ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: .15rem .2rem;
  margin: 0;
  padding: 0;
}
.site-brand {
  display: flex;
  align-items: center;
  gap: .7rem;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--navy), var(--accent));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: .02em;
  flex-shrink: 0;
}
.brand-text {
  display: flex;
  flex-direction: column;
  gap: .05rem;
  line-height: 1.15;
}
.brand-text strong,
.brand-text a {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .01em;
  text-decoration: none;
}
.brand-text small {
  color: var(--faint);
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.site-header .nav-right a {
  color: var(--muted);
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  padding: .45rem .75rem;
  border-radius: 6px;
  border-bottom: none;
}
.site-header .nav-right a:hover,
.site-header .nav-right a.nav-active {
  color: var(--navy);
  background: var(--surface-2);
  text-decoration: none;
}
.site-header .nav-right a.nav-active {
  color: var(--accent-2);
  background: var(--accent-soft);
}
#announcement-btn,
#search-icon {
  width: 2.1rem;
  height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  border-radius: 6px;
}
#announcement-btn:hover,
#search-icon:hover {
  background: var(--surface-2);
}

/* ========== Hero ========== */
.hero-section {
  margin-bottom: 1.25rem;
  padding: 1.35rem 1.4rem 1.25rem;
  background: linear-gradient(135deg, #0b1c2c 0%, #14344d 48%, #0e5c6e 100%);
  color: #e8eef4;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero-section::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -50px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(103, 232, 249, 0.18), transparent 70%);
  pointer-events: none;
}
.hero-kicker {
  display: inline-block;
  margin: 0 0 .55rem;
  padding: .2rem .55rem;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #a5f3fc;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(165, 243, 252, .25);
  border-radius: 4px;
}
.hero-section h1 {
  margin: 0 0 .4rem;
  font-size: clamp(1.35rem, 2.8vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -.01em;
  color: #fff;
  position: relative;
  z-index: 1;
}
.hero-subtitle {
  margin: 0;
  color: rgba(232, 238, 244, .82);
  font-size: .95rem;
  position: relative;
  z-index: 1;
}
.hero-hint {
  margin: .55rem 0 0;
  color: rgba(165, 243, 252, .75);
  font-size: .8rem;
  position: relative;
  z-index: 1;
}
.hero-section.compact {
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

/* ========== Workspace panels ========== */
.workspace {
  display: grid;
  gap: 1rem;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem 1.1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.panel-head h2 {
  margin: 0;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.panel-head .meta {
  font-size: .78rem;
  color: var(--faint);
}
.panel-body {
  padding: 1.1rem;
}

/* Upload */
.upload-area {
  position: relative;
  border: 1.5px dashed #9eb0c0;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, #fbfdff, #f3f7fb);
  min-height: 168px;
  display: grid;
  place-items: center;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
  outline: none;
}
.upload-area:hover,
.upload-area:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(14, 116, 144, .15);
}
.upload-area.dragover {
  border-color: var(--accent-2);
  background: #cffafe;
}
.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .7rem;
  padding: 1.75rem 1rem;
  cursor: pointer;
  color: var(--muted);
  text-align: center;
  width: 100%;
}
.upload-label small {
  display: block;
  margin-top: .25rem;
  color: var(--faint);
  font-size: .8rem;
}
.upload-icon {
  color: var(--accent);
  opacity: .9;
}
.upload-card-stack {
  position: absolute;
  inset: .6rem;
  pointer-events: none;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-content: flex-start;
}
.upload-card {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}
.upload-card img { width: 100%; height: 100%; object-fit: cover; }

.url-upload-btn,
.url-action-btn,
.btn-text,
button {
  font-family: inherit;
}

.url-upload-section { margin-top: .85rem; }

.url-upload-bar {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.url-upload-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 116, 144, .12);
}

.url-input-wrap {
  flex: 1;
  min-width: 0;
}
.url-upload-input {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 42px;
  border: none;
  border-radius: 0;
  padding: .65rem .85rem;
  font: inherit;
  line-height: 1.45;
  background: transparent;
  color: var(--ink);
}
.url-upload-input:focus {
  outline: none;
}
.url-upload-input::placeholder {
  color: var(--faint);
}

.url-upload-actions {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  border-left: 1px solid var(--line);
  background: var(--surface-2);
}

.url-action-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0 1.05rem;
  min-height: 42px;
  cursor: pointer;
  font-size: .84rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.url-action-btn + .url-action-btn {
  border-left: 1px solid var(--line);
}
.url-action-btn:hover {
  background: var(--accent-soft);
  color: var(--accent-2);
}
.url-action-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}
.url-action-btn--primary {
  background: var(--accent);
  color: #fff;
  min-width: 4.5rem;
}
.url-action-btn--primary:hover {
  background: var(--accent-2);
  color: #fff;
}

.url-batch-hint {
  display: block;
  margin-top: .45rem;
  padding-left: .1rem;
  font-size: .75rem;
  color: var(--faint);
}

/* legacy class kept for any stray refs */
.url-upload-btn {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  padding: 0 1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: .88rem;
  white-space: nowrap;
}
.url-upload-btn--secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 500;
}

.batch-progress {
  margin-top: .85rem;
  padding: .75rem .85rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.batch-progress-text {
  font-size: .84rem;
  color: var(--muted);
  margin-bottom: .4rem;
}
.batch-progress-bar {
  height: 5px;
  background: #dbe4ee;
  border-radius: 99px;
  overflow: hidden;
}
.batch-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--navy), var(--accent));
  transition: width .2s ease;
}

/* Options */
.options-panel {
  display: grid;
  gap: 0;
}
.opt-row {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .65rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.opt-row:last-child { border-bottom: none; padding-bottom: 0; }
.opt-row:first-child { padding-top: 0; }
.opt-row label { color: var(--muted); font-size: .86rem; font-weight: 500; }
.opt-row select,
.opt-row input[type="text"],
.opt-row input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .45rem .6rem;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
.opt-row select:focus,
.opt-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 116, 144, .12);
}
.tip {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: #d9e3ec;
  color: #3d5568;
  font-size: .7rem;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
  cursor: help;
  user-select: none;
}
.check-label {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  grid-column: 1 / -1;
  color: var(--ink) !important;
  cursor: pointer;
  font-weight: 500;
}
.password-fields {
  margin-top: .35rem;
  padding: .75rem .85rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: .15rem;
}

/* Results */
.result-area {
  margin-top: .25rem;
  display: grid;
  gap: .65rem;
}
.result-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: .85rem;
  align-items: center;
  padding: .75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ok);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: rise .25s ease;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.result-item img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
  background: #e8eef4;
  border: 1px solid var(--line);
}
.result-item .links {
  display: grid;
  gap: .28rem;
  font-size: .82rem;
  word-break: break-all;
}
.result-item .links code {
  font-family: var(--mono);
  font-size: .76rem;
  background: var(--surface-2);
  padding: .12rem .35rem;
  border-radius: 3px;
  border: 1px solid var(--line-soft);
}
.copy-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: .45rem .7rem;
  cursor: pointer;
  color: var(--accent-2);
  font-weight: 600;
  font-size: .82rem;
}
.copy-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.copy-btn.copied {
  color: #fff;
  background: var(--ok);
  border-color: var(--ok);
}

/* History */
.history-section { margin-top: .25rem; }
.history-header {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}
.history-header h2 {
  margin: 0;
  font-size: .95rem;
  font-weight: 700;
  color: var(--ink);
}
.history-note {
  font-size: .75rem;
  color: var(--faint);
  margin-right: auto;
}
.btn-text {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: .84rem;
  font-weight: 500;
}
.btn-text:hover { color: var(--danger); }
#history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: .7rem;
}
.history-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.history-card:hover {
  transform: translateY(-2px);
  border-color: #b7c7d6;
}
.history-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #e8eef4;
}
.history-card .cap {
  padding: .45rem .55rem .55rem;
  font-size: .72rem;
  color: var(--muted);
  background: var(--surface-2);
  border-top: 1px solid var(--line-soft);
}
.history-card .cap button {
  border: none;
  background: none;
  color: var(--accent-2);
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-weight: 600;
}

/* Explore */
.explore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: .75rem;
}
.explore-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.explore-card:hover {
  transform: translateY(-2px);
  text-decoration: none;
}
.explore-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #e8eef4;
}
.explore-card .meta {
  display: flex;
  justify-content: space-between;
  padding: .45rem .55rem;
  font-size: .72rem;
  color: var(--muted);
  background: var(--surface-2);
}
.empty-hint {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem 0;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
}
.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
}

/* Docs */
.docs-wrap { width: min(860px, calc(100% - 2rem)); }
.docs-hero {
  text-align: left;
  margin-bottom: 1.1rem;
  padding: 1.2rem 1.3rem;
  background: linear-gradient(135deg, #0b1c2c, #155e75);
  color: #fff;
  border-radius: var(--radius-lg);
}
.docs-hero h1 { margin: 0 0 .35rem; font-size: 1.35rem; color: #fff; }
.docs-hero p { color: rgba(232,238,244,.8); margin: 0; }
.docs-hero a { color: #a5f3fc; }
.docs-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1rem 1.15rem;
  margin-bottom: .85rem;
  box-shadow: var(--shadow);
}
.docs-card.warn {
  border-color: #f0c7a0;
  background: #fffaf3;
}
.docs-card h3 {
  margin: 0 0 .55rem;
  font-size: .95rem;
  color: var(--ink);
}
.docs-card pre {
  margin: 0;
  padding: .8rem .9rem;
  background: #0b1c2c;
  color: #d7ebe8;
  border-radius: 6px;
  overflow: auto;
  font-size: .8rem;
  line-height: 1.45;
}
.endpoint {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-2);
  padding: .2rem .45rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: .84rem;
}
.badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  padding: .12rem .4rem;
  border-radius: 3px;
  margin-right: .35rem;
  color: #fff;
}
.badge.ok { background: var(--ok); }
.badge.info { background: #1d4ed8; }
.table-wrap { overflow: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
th, td {
  text-align: left;
  padding: .5rem .55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; background: var(--surface-2); }

/* Footer */
.site-footer {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto 1.75rem;
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  color: var(--muted);
  font-size: .82rem;
  box-shadow: var(--shadow);
}
.footer-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.1rem;
  margin-bottom: .4rem;
}
.footer-stats span {
  font-variant-numeric: tabular-nums;
}
.site-footer small {
  display: block;
  margin-top: .55rem;
  padding-top: .55rem;
  border-top: 1px solid var(--line-soft);
  color: var(--faint);
}

/* Popups */
.search-popup,
.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(11, 28, 44, .52);
  display: grid;
  place-items: center;
  padding: 1rem;
}
.search-popup[hidden],
.popup-overlay[hidden] { display: none !important; }
.search-popup-content,
.popup-content {
  width: min(480px, 100%);
  background: #fff;
  border-radius: 10px;
  padding: 1.1rem 1.2rem 1.2rem;
  box-shadow: 0 24px 60px rgba(11, 28, 44, .28);
  max-height: min(80vh, 640px);
  overflow: auto;
  border: 1px solid var(--line);
}
.popup-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .55rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--line);
}
.popup-dialog-header h2 {
  margin: 0;
  font-size: 1.05rem;
}
.popup-close {
  border: none;
  background: transparent;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}
#image-search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .45rem;
  margin: .75rem 0;
}
#image-search-form input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .55rem .65rem;
  font: inherit;
}
#image-search-form button {
  border: none;
  background: var(--navy);
  color: #fff;
  border-radius: 6px;
  padding: 0 .95rem;
  cursor: pointer;
  font-weight: 600;
}
.muted { color: var(--muted); font-size: .85rem; }
.search-result {
  border-top: 1px solid var(--line);
  padding-top: .75rem;
  font-size: .86rem;
}
.search-result img {
  max-width: 160px;
  border-radius: 6px;
  margin-bottom: .5rem;
  border: 1px solid var(--line);
}

/* Locked */
.page-locked {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: var(--paper);
}
.locked-box {
  width: min(380px, calc(100% - 2rem));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.35rem;
  box-shadow: var(--shadow);
}
.locked-box h1 { margin: 0 0 .75rem; font-size: 1.15rem; }
.locked-box form { display: grid; gap: .55rem; }
.locked-box input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .55rem .65rem;
  font: inherit;
}
.locked-box button {
  border: none;
  background: var(--navy);
  color: #fff;
  border-radius: 6px;
  padding: .55rem;
  font-weight: 600;
  cursor: pointer;
}
.locked-box .err { color: var(--danger); margin: 0 0 .4rem; }
.locked-box .q { color: var(--muted); margin: 0 0 .5rem; }

@media (max-width: 720px) {
  .url-upload-bar { flex-direction: column; }
  .url-upload-actions {
    border-left: none;
    border-top: 1px solid var(--line);
  }
  .url-upload-actions .url-action-btn {
    flex: 1;
    justify-content: center;
  }
  .url-action-btn + .url-action-btn { border-left: 1px solid var(--line); }
  .opt-row { grid-template-columns: 1fr; gap: .35rem; }
  .result-item { grid-template-columns: 56px 1fr; }
  .result-item .copy-btn { grid-column: 1 / -1; }
  .brand-text small { display: none; }
  .hero-section { padding: 1.1rem 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
