:root {
  --bg: #eef2f6;
  --ink: #152033;
  --muted: #5b6b7c;
  --accent: #1f6feb;
  --accent-dark: #1554b8;
  --line: #d5dee8;
  --card: #ffffff;
  --soft: #f7f9fc;
  --danger: #c62828;
  --ok: #0f7b5a;
  --shadow: 0 14px 36px rgba(21, 32, 51, 0.08);
  --font-display: "Outfit", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-body: "Source Sans 3", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(ellipse at 0% 0%, #c9dbff66, transparent 42%),
    radial-gradient(ellipse at 100% 8%, #b8e8d855, transparent 36%),
    linear-gradient(180deg, #f5f8fc 0%, var(--bg) 48%, #e8eef5 100%);
}

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

.home-body {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-shell {
  width: 80vw;
  height: 80dvh;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.home-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 0 0 auto;
}

.home-footer {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}

.home-title-block {
  min-width: 0;
}

.home-title-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.home-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 2.8vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.home-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.4;
}

/* 一屏：分类横排，每行一类工具 */
.home-board {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  gap: 4px;
  padding: 22px 28px;
  border: 1px solid rgba(213, 222, 232, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
  box-shadow: 0 14px 32px rgba(21, 32, 51, 0.07);
  overflow: hidden;
}

.category-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  gap: 8px 16px;
  padding: 10px 0;
  border-bottom: 1px dashed #e2e8f0;
}

.category-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.category-label {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.25;
}

.tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 4px;
  align-items: flex-start;
}

.tool-item {
  width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  border-radius: 10px;
  transition: background 0.2s, transform 0.2s;
}

.tool-item:hover {
  background: var(--soft);
  transform: translateY(-1px);
}

.tool-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--accent-dark);
  background: linear-gradient(160deg, #ffffff 0%, #edf4ff 100%);
  border: 1px solid #d7e4f7;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(31, 111, 235, 0.08);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.tool-icon svg {
  width: 20px;
  height: 20px;
}

.tool-item:hover .tool-icon {
  border-color: #9dbcf5;
  box-shadow: 0 3px 8px rgba(31, 111, 235, 0.14);
}

.tool-name {
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}

.tool-empty {
  text-align: center;
  color: var(--muted);
}

.field-tip {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.convert-notice {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #c9d8ef;
  border-radius: 10px;
  background: #f3f7fd;
  color: #3d5168;
  font-size: 0.88rem;
  line-height: 1.45;
}

.convert-notice.compact {
  padding: 8px 10px;
  font-size: 0.84rem;
}

@media (max-width: 640px) {
  .home-body {
    overflow: auto;
    align-items: flex-start;
    padding: 16px 0;
  }

  .home-shell {
    width: 92vw;
    height: auto;
    min-height: 80dvh;
    gap: 16px;
  }

  .home-header {
    align-items: flex-start;
  }

  .home-board {
    flex: none;
    justify-content: flex-start;
    padding: 16px 18px;
  }

  .category-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .category-label {
    font-size: 0.95rem;
  }
}

.page {
  width: min(920px, 92vw);
  margin: 0 auto;
  padding: 36px 0 64px;
}

.page.narrow {
  width: min(640px, 92vw);
}

.top-nav {
  margin-bottom: 16px;
}

.top-nav a {
  color: var(--accent-dark);
  font-size: 0.92rem;
  font-weight: 550;
}

.header h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
}

.header p {
  margin: 0 0 22px;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
}

.field span,
.field-label {
  color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 220px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.5;
}

.upload-zone {
  border: 1.5px dashed #aebccd;
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--soft);
  transition: border-color 0.2s, background 0.2s;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: #edf4ff;
}

.upload-title {
  margin: 0;
  font-weight: 600;
}

.upload-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 0.9rem;
  color: var(--muted);
}

.range-row,
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 文本格式转换：快捷场景 + 勾选项 */
.preset-block {
  display: grid;
  gap: 8px;
}

.preset-label {
  font-size: 0.9rem;
  color: var(--muted);
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset {
  background: #eef3fa;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.88rem;
  line-height: 1.2;
}

.preset:hover {
  background: #e3ecf8;
  border-color: #c5d6ef;
}

.preset.is-active {
  background: #e8f1ff;
  color: var(--accent-dark);
  border-color: #9dbcf5;
  font-weight: 600;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}

.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.note kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82em;
  line-height: 1.3;
}

button,
.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

.secondary {
  background: #e8eef6;
  color: var(--ink);
}

.ghost {
  background: transparent;
  color: var(--muted);
}

.status {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.status.error {
  color: var(--danger);
}

.status.ok {
  color: var(--ok);
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(21, 32, 51, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}

.modal-panel {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 14px;
  padding: 22px;
  display: grid;
  gap: 12px;
}

.modal-panel h2 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-panel p {
  margin: 0;
  color: var(--muted);
}

.modal-actions {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.preview-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  padding: 12px;
  display: grid;
  place-items: center;
  min-height: 160px;
  overflow: auto;
}

.preview-box img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.split-panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.result-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 72px;
}

@media (max-width: 760px) {
  .split-panes,
  .form-row,
  .form-row-3,
  .range-row {
    grid-template-columns: 1fr;
  }

  .category {
    padding: 18px 14px;
  }
}

/* 时间戳转换：紧凑横排 */
.ts-card {
  gap: 18px;
}

.ts-now {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.98rem;
}

.ts-toggle {
  padding: 4px 8px;
  color: var(--danger);
}

.ts-toggle:not(.is-stop) {
  color: var(--ok);
}

.ts-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.ts-label {
  width: 3.2rem;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.95rem;
}

.ts-input,
.ts-output {
  flex: 1 1 180px;
  min-width: 160px;
  max-width: 280px;
}

.ts-unit {
  width: 110px;
  flex: 0 0 auto;
  padding: 10px 8px;
}

.ts-btn {
  flex: 0 0 auto;
  padding: 10px 16px;
}

.ts-suffix {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.feedback-entry {
  flex: 0 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 22px;
  white-space: nowrap;
}

.feedback-entry:hover {
  border-color: #9dbcf5;
  background: #edf4ff;
}

.feedback-panel {
  width: min(520px, 100%);
}

.feedback-guide {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.95rem;
}

.feedback-editor {
  width: 100%;
  min-height: 150px;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.5;
  color: var(--ink);
  background: #fff;
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
}

.feedback-editor:focus {
  border-color: #9dbcf5;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

.feedback-editor.is-empty::before {
  content: attr(data-placeholder);
  color: #98a6b8;
  pointer-events: none;
}

.feedback-inline-image {
  display: block;
  max-width: min(100%, 320px);
  max-height: 180px;
  width: auto;
  height: auto;
  margin: 8px 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: contain;
  background: var(--soft);
}

.diff-result {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  max-height: 420px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.45;
}

.diff-line {
  display: flex;
  gap: 8px;
  padding: 2px 10px;
  white-space: pre-wrap;
  word-break: break-all;
}

.diff-mark {
  flex: 0 0 1ch;
  opacity: 0.8;
}

.diff-line.same {
  color: #64748b;
}

.diff-line.add {
  background: #dcfce7;
  color: #166534;
}

.diff-line.del {
  background: #fee2e2;
  color: #991b1b;
}

.feedback-contact-row {
  display: flex;
  gap: 8px;
}

.feedback-contact-row input {
  flex: 1;
}

.feedback-panel textarea {
  min-height: 84px;
  font-family: inherit;
  font-size: 1rem;
}

.scan-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.scan-thumb {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--soft);
}

.scan-thumb img {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: cover;
  background: #fff;
}

.scan-thumb-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.scan-thumb-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scan-thumb-remove {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: #991b1b;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

/* 图片文字提取 */
.ocr-panes {
  align-items: stretch;
}

.ocr-col {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.ocr-preview {
  position: relative;
  min-height: 280px;
  height: 100%;
  border: 1.5px dashed #aebccd;
  border-radius: 12px;
  background: var(--soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.ocr-preview:hover,
.ocr-preview.dragover {
  border-color: var(--accent);
  background: #edf4ff;
}

.ocr-preview.has-image {
  border-style: solid;
  border-color: var(--line);
  background: #fff;
  cursor: default;
}

.ocr-preview.has-image:hover {
  background: #fff;
}

.ocr-preview img {
  display: block;
  max-width: 100%;
  max-height: 360px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.ocr-placeholder {
  text-align: center;
  padding: 24px 16px;
  pointer-events: none;
}

.ocr-placeholder-title {
  margin: 0 0 10px;
  font-weight: 600;
  color: var(--ink);
}

.ocr-placeholder-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.ocr-output {
  min-height: 280px;
  height: 100%;
  resize: vertical;
}

.ocr-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.ocr-lang {
  width: min(220px, 100%);
}

@media (max-width: 760px) {
  .ocr-preview,
  .ocr-output {
    min-height: 220px;
  }

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

  .ocr-lang {
    width: 100%;
  }
}

/* 首页爬虫可读工具索引：不占视觉版面，保留可抓取链接 */
.seo-tool-index {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.related-tools {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.related-tools-title {
  margin: 0 0 10px;
  font-size: 0.92rem;
  font-weight: 650;
  color: var(--muted);
}

.related-tools-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.related-tools-list a {
  color: var(--accent-dark);
  font-size: 0.92rem;
  font-weight: 550;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.related-tools-list a:hover {
  color: var(--accent);
}
