:root {
  --ic-word: #3b82c4;
  --ic-word-bg: #e8f1fa;
  --ic-merge: #1e7a4a;
  --ic-merge-bg: #e7f4ec;
  --ic-split: #e8832a;
  --ic-split-bg: #fcf0e2;
  --ic-doc-image: #7a5fe8;
  --ic-doc-image-bg: #efebfc;
  --ic-translate: #b254d1;
  --ic-translate-bg: #f6eafb;
  --ic-upgrade: #159e9a;
  --ic-upgrade-bg: #e2f4f3;
  --ic-text: #5c6dc9;
  --ic-text-bg: #ebeef9;
  --ic-pdf-ocr: #d6527c;
  --ic-pdf-ocr-bg: #fbe9f0;
  --ic-image-ocr: #b254d1;
  --ic-image-ocr-bg: #f6eafb;
  --ic-soon: #6f8175;
  --ic-soon-bg: #f0f3f1;
}

.home-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.home-topbar-inner {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr);
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 10px 40px;
}

.home-topbar .p-account {
  justify-self: end;
}

.home-topbar .p-mini-program-button {
  width: 36px;
  min-width: 36px;
  padding: 0;
}

.home-topbar .p-mini-program-button svg {
  width: 18px;
  height: 18px;
}

.home-topbar .p-mini-program-label {
  display: none;
}

.home-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 66px 24px 54px;
  overflow: hidden;
  text-align: center;
}

/* 「移动线条」动效层：品牌绿径向光晕托底 + 粒子星座场（向下渐隐，不干扰正文阅读） */
.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(760px 380px at 50% 24%, rgba(43, 164, 106, 0.14), transparent 68%),
    radial-gradient(520px 320px at 12% 76%, rgba(60, 179, 113, 0.1), transparent 70%),
    radial-gradient(520px 320px at 88% 72%, rgba(30, 122, 74, 0.09), transparent 70%);
}

.home-hero-field {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 58%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 58%, transparent 100%);
}

.home-hero > *:not(.home-hero-field) {
  position: relative;
  z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
  .home-hero-field {
    opacity: 0.5;
  }
}

.home-hero-copy {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 760px;
}

.home-hero h1 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.34;
}

.home-hero h1 em,
.home-hero-slogan em {
  font-style: normal;
  color: var(--brand-deep);
  white-space: normal;
}

.home-hero-description {
  margin: 0;
  font-size: var(--font-md);
  color: var(--text);
  line-height: 1.7;
}

.home-hero-tagline,
.home-hero-slogan,
.home-hero-follow {
  margin: 0;
  font-size: 14.5px;
  color: var(--sub);
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.home-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(100%, 640px);
  padding: 7px 7px 7px 18px;
  border-radius: var(--r-pill);
  background: var(--card);
  box-shadow: var(--shadow-search);
}

.home-search:focus-within {
  outline: 2px solid var(--brand-deep);
  outline-offset: 3px;
}

.home-search svg {
  flex: none;
}

.home-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: var(--font-md);
}

.home-search input::placeholder {
  color: var(--placeholder);
}

.home-search button {
  flex: none;
  padding: 10px 22px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--action);
  color: var(--card);
  font-size: var(--font-base);
  font-weight: 500;
  cursor: pointer;
}

.home-search button:hover {
  background: var(--action-hover);
}

.home-hot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  color: var(--sub);
  font-size: var(--font-xs);
}

.home-hot button {
  padding: 6px 12px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--tint);
  color: var(--brand-deep);
  font-size: var(--font-xs);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.home-hot button:hover {
  transform: translateY(-1px);
}

.home-search-status {
  min-height: 20px;
  margin: -8px 0 0;
  color: var(--brand-deep);
  font-size: var(--font-xs);
}

.home-notice {
  width: min(100%, 1128px);
  margin: 0 auto 28px;
  padding-inline: 24px;
}

.home-notice-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.home-notice-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--tint);
  color: var(--brand-deep);
  font-size: var(--font-xs);
  font-weight: 500;
}

.home-notice-text {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: var(--font-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-notice-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  color: var(--brand-deep);
  font-size: var(--font-xs);
  text-decoration: none;
}

.home-notice-dialog {
  width: min(calc(100% - 32px), 640px);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-lift);
}

.home-notice-dialog::backdrop {
  background: var(--overlay);
}

.home-notice-dialog-card {
  display: flex;
  flex-direction: column;
  max-height: inherit;
}

.home-notice-dialog-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.home-notice-dialog-heading {
  flex: 1;
  min-width: 0;
}

.home-notice-dialog-heading h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: var(--font-xl);
  line-height: 1.45;
}

.home-notice-dialog-heading p {
  margin: 6px 0 0;
  color: var(--sub);
  font-size: var(--font-xs);
}

.home-notice-dialog-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--card);
  color: var(--sub);
  cursor: pointer;
}

.home-notice-dialog-close:hover,
.home-notice-dialog-close:focus-visible {
  border-color: var(--brand-border);
  color: var(--brand-deep);
  outline: 2px solid var(--brand-border);
  outline-offset: 2px;
}

.home-notice-dialog-body {
  min-height: 0;
  padding: 20px 22px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.home-notice-dialog-status {
  margin: 0;
  color: var(--sub);
  font-size: var(--font-sm);
}

.home-notice-dialog-status:empty {
  display: none;
}

.home-notice-dialog-content {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: var(--font-base);
  line-height: 1.8;
  white-space: pre-wrap;
}

.home-main {
  width: min(100%, 1128px);
  margin: 0 auto;
  padding: 0 24px 40px;
}

.home-section {
  margin-bottom: 28px;
  scroll-margin-top: 84px;
}

.home-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.home-section-head::before {
  content: "";
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brand), var(--brand-deep));
}

.home-section-head h2 {
  margin: 0;
  font-size: var(--font-lg);
  font-weight: 600;
}

.home-section-meta {
  flex: 1;
  color: var(--sub);
  font-size: var(--font-xs);
}

.home-section-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--brand-deep);
  font-size: var(--font-xs);
  text-decoration: none;
}

.quick-grid,
.tool-grid {
  display: grid;
  gap: 14px;
}

.quick-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.quick-item {
  position: relative;
  min-width: 0;
}

.quick-item .quick-card {
  height: 100%;
  padding-right: 42px;
}

.quick-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--sub);
  line-height: 1;
  cursor: pointer;
}

.quick-remove svg {
  display: block;
}

@media (hover: hover) and (pointer: fine) {
  .quick-remove {
    opacity: 0;
    pointer-events: none;
  }

  .quick-item:hover .quick-remove,
  .quick-item:focus-within .quick-remove {
    opacity: 1;
    pointer-events: auto;
  }
}

.quick-remove:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.quick-remove:focus-visible {
  outline: 2px solid var(--brand-deep);
  outline-offset: 2px;
}

#quick-tools.is-dragging {
  outline: 2px dashed var(--brand);
  outline-offset: 8px;
  border-radius: var(--r-card);
}

#quick-tools.is-search-drop {
  position: fixed;
  z-index: 50;
  top: 80px;
  left: 5%;
  width: 90%;
  max-height: 55vh;
  overflow: auto;
  padding: 16px;
  background: var(--card);
  box-shadow: var(--shadow-lift);
}

.tool-card.is-dragging,
.quick-card.is-dragging {
  opacity: 0.55;
}

.tool-card[draggable="true"] {
  position: relative;
}

.drop-before::before,
.drop-after::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--brand);
  border-radius: var(--r-pill);
  pointer-events: none;
}

.drop-before::before { left: -7px; }
.drop-after::after { right: -7px; }

.quick-empty {
  padding: 28px 16px;
  border: 1px dashed var(--brand-border);
  border-radius: var(--r-card);
  background: var(--surface-soft);
  color: var(--sub);
  text-align: center;
  font-size: var(--font-base);
}

.quick-status {
  margin: 8px 0 0;
  color: var(--sub);
  font-size: var(--font-xs);
}

.quick-status:empty {
  margin: 0;
}

.tool-grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tool-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tool-grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quick-card,
.tool-card {
  color: var(--ink);
  text-decoration: none;
}

.quick-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.quick-card:hover {
  border-color: rgba(43, 164, 106, 0.45);
  box-shadow: var(--shadow-lift);
  transform: translateY(-3px);
}

.quick-card h3,
.quick-card p,
.tool-card h3,
.tool-card p {
  margin: 0;
}

.quick-card h3 {
  font-size: var(--font-md);
  font-weight: 600;
}

.quick-card p {
  color: var(--sub);
  font-size: var(--font-xs);
}

.tool-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 70px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.tool-card[href]:hover {
  border-color: rgba(43, 164, 106, 0.45);
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}

.tool-card-copy {
  flex: 1;
  min-width: 0;
}

.tool-card h3 {
  font-size: var(--font-base);
  font-weight: 600;
}

.tool-card p {
  overflow: hidden;
  color: var(--sub);
  font-size: 0.6875rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-arrow {
  flex: none;
  color: var(--chevron);
}

.tool-badge {
  flex: none;
  color: var(--warning);
  font-size: 0.6875rem;
  white-space: nowrap;
}

.tool-card.soon {
  cursor: default;
}

.tool-card.soon h3,
.tool-card.soon p {
  color: var(--soon-ink);
}

.tool-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--tint);
  color: var(--brand-deep);
}

.quick-card .tool-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
}

.tool-icon.word { background: var(--ic-word-bg); color: var(--ic-word); }
.tool-icon.merge { background: var(--ic-merge-bg); color: var(--ic-merge); }
.tool-icon.split { background: var(--ic-split-bg); color: var(--ic-split); }
.tool-icon.doc-image { background: var(--ic-doc-image-bg); color: var(--ic-doc-image); }
.tool-icon.translate { background: var(--ic-translate-bg); color: var(--ic-translate); }
.tool-icon.upgrade { background: var(--ic-upgrade-bg); color: var(--ic-upgrade); }
.tool-icon.text { background: var(--ic-text-bg); color: var(--ic-text); }
.tool-icon.pdf-ocr { background: var(--ic-pdf-ocr-bg); color: var(--ic-pdf-ocr); }
.tool-icon.image-ocr { background: var(--ic-image-ocr-bg); color: var(--ic-image-ocr); }
.tool-icon.soon { background: var(--ic-soon-bg); color: var(--ic-soon); }

.home-footer {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 8px 0;
  color: var(--sub);
  font-size: var(--font-xs);
  text-align: center;
}

.home-footer a {
  color: inherit;
  text-decoration: none;
}

.home-footer a:hover,
.home-footer a:focus-visible {
  color: var(--brand-deep);
  text-decoration: underline;
}

.mobile-tabbar {
  display: none;
}

@media (max-width: 1023px) {
  .home-topbar-inner {
    grid-template-columns: 1fr auto;
    padding-inline: 24px;
  }

  .home-nav {
    display: none;
  }

  .quick-grid,
  .tool-grid.cols-4,
  .tool-grid.cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body.home-page {
    padding-bottom: 76px;
  }

  .home-topbar-inner {
    min-height: 52px;
    padding: 8px 16px;
  }

  .home-hero {
    align-items: flex-start;
    gap: 14px;
    padding: 26px 16px;
    text-align: left;
  }

  /* 移动端 Hero 更紧凑：保留动效但收窄影响范围，避免抢搜索框 */
  .home-hero-field {
    opacity: 0.92;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 72%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, #000 72%, transparent 100%);
  }

  .home-hero-copy {
    gap: 7px;
    max-width: 100%;
  }

  .home-hero h1 {
    font-size: 21px;
    line-height: 1.42;
  }

  .home-hero-tagline,
  .home-hero-slogan,
  .home-hero-follow {
    font-size: 12.5px;
    letter-spacing: 0.02em;
  }

  .home-search {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--line);
    box-shadow: none;
  }

  .home-search input {
    font-size: var(--font-sm);
  }

  .home-search button {
    display: none;
  }

  .home-hot {
    justify-content: flex-start;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .home-hot::-webkit-scrollbar {
    display: none;
  }

  .home-notice {
    margin-bottom: 18px;
    padding-inline: 16px;
  }

  .home-notice-inner {
    border-radius: var(--r-lg);
  }

  .home-notice-action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .home-main {
    padding: 0 16px 24px;
  }

  .home-section {
    margin-bottom: 18px;
  }

  .quick-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .quick-item .quick-card {
    padding: 10px 2px;
  }

  .quick-remove {
    top: 0;
    right: 0;
  }

  .quick-card {
    align-items: center;
    flex: 1;
    gap: 6px;
    padding: 10px 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    text-align: center;
  }

  .quick-card:hover {
    border-color: transparent;
    box-shadow: none;
    transform: none;
  }

  .quick-card .tool-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--r-lg);
  }

  .quick-card h3 {
    font-size: 0.6875rem;
    font-weight: 400;
  }

  .quick-card p {
    display: none;
  }

  .tool-grid.cols-4,
  .tool-grid.cols-3,
  .tool-grid.cols-2 {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .home-section-head h2 {
    font-size: var(--font-md);
  }

  .mobile-tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 55;
    display: flex;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--card);
  }

  .mobile-tabbar a {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
    color: var(--sub);
    font-size: 0.625rem;
    text-decoration: none;
  }

  .mobile-tabbar a[aria-current="page"] {
    color: var(--brand-deep);
    font-weight: 500;
  }
}

@media (max-width: 430px) {
  .home-notice-dialog {
    width: calc(100% - 24px);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }

  .home-notice-dialog-header {
    padding: 16px 16px 14px;
  }

  .home-notice-dialog-body {
    padding: 16px 16px 20px;
  }

  .home-topbar .p-account .p-btn {
    padding-inline: 10px;
  }

  .home-topbar .p-account .p-mini-program-button {
    padding: 2px;
  }

  .home-section-meta {
    max-width: 150px;
  }
}
