* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f8fafc;
  color: #1e293b;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

a { text-decoration: none; color: inherit; }
button, input, select, textarea { font: inherit; }

.hidden { display: none !important; }

.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 240px;
  height: 100vh;
  background: linear-gradient(180deg, #1e293b 0%, #334155 100%);
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.28);
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo a {
  display: flex;
  align-items: center;
  color: #fff;
}

.sidebar-logo__mark {
  width: 32px;
  height: 32px;
  margin-right: 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, #10b981, #059669);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.sidebar-logo__text {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}

.sidebar-nav {
  padding: 8px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: rgba(255, 255, 255, 0.8);
  transition: all 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: rgba(16, 185, 129, 0.2);
}

.nav-item.active {
  border-right: 3px solid #10b981;
}

.nav-icon {
  width: 20px;
  margin-right: 12px;
  text-align: center;
  font-size: 14px;
}

.main-wrap {
  margin-left: 240px;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 12px 24px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.top-link,
.top-tool,
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: #475569;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.top-link:hover,
.top-tool:hover,
.back-link:hover,
.top-link.is-current {
  color: #059669;
  background: #f8fafc;
}

.top-link--ad {
  color: #ea580c;
  font-weight: 600;
}

.top-link--ad.blue {
  color: #2563eb;
}

.search-form {
  position: relative;
  width: 240px;
}

.search-form input {
  width: 100%;
  padding: 10px 38px 10px 16px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  outline: none;
  transition: all 0.2s ease;
}

.search-form input:focus,
.mobile-search-form input:focus,
.feedback-form input:focus,
.feedback-form select:focus,
.feedback-form textarea:focus,
.tool-form input:focus,
.tool-form select:focus {
  border-color: #10b981;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.08);
}

.search-form button {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
}

.page-shell {
  padding: 16px 16px 40px;
}

.section-card,
.tool-panel,
.soft-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.section-card {
  padding: 24px;
  margin-bottom: 24px;
}

.section-card__head {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
}

.section-card__head.between {
  justify-content: space-between;
}

.section-card__head h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 600;
  color: #1e293b;
}

.section-icon {
  color: #059669;
  font-size: 18px;
}

.section-count {
  font-size: 14px;
  color: #64748b;
}

.tool-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.tool-card-simple,
.tool-card-rich,
.related-item {
  display: flex;
  align-items: flex-start;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
}

.tool-card-simple:hover,
.tool-card-rich:hover,
.related-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.tool-card-simple:hover {
  border-color: #10b981;
}

.tool-card-rich:hover {
  border-color: #10b981;
}

.tool-card-rich.hot:hover {
  border-color: #ef4444;
}

.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
  font-size: 20px;
  color: #fff;
}

.tool-icon.small {
  width: 42px;
  height: 42px;
  font-size: 18px;
}

.card-green { background: linear-gradient(135deg, #86efac, #4ade80); }
.card-blue { background: linear-gradient(135deg, #93c5fd, #60a5fa); }
.card-purple { background: linear-gradient(135deg, #c4b5fd, #a78bfa); }
.card-orange { background: linear-gradient(135deg, #fdba74, #fb923c); }
.card-red { background: linear-gradient(135deg, #fca5a5, #f87171); }
.card-pink { background: linear-gradient(135deg, #f9a8d4, #f472b6); }
.card-indigo { background: linear-gradient(135deg, #a5b4fc, #818cf8); }
.card-teal { background: linear-gradient(135deg, #99f6e4, #5eead4); }

.tool-content {
  flex: 1;
  min-width: 0;
}

.tool-title {
  display: block;
  color: #1e293b;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 40px;
  height: 40px;
}

.tool-title.rich {
  line-height: 1.4;
  height: auto;
  margin-bottom: 6px;
}

.tool-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: #94a3b8;
  font-size: 12px;
}

.tool-meta em {
  font-style: normal;
}

.hot-text {
  color: #ef4444;
  font-weight: 600;
}

.tool-list-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.rank-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(239, 68, 68, 0.3);
}

.rank-badge.top {
  background: linear-gradient(135deg, #fbbf24, #f97316);
}

.tool-layout,
.feedback-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
}

.tool-panel {
  overflow: hidden;
}

.tool-panel__head {
  position: relative;
  padding: 20px;
  border-bottom: 1px solid #e2e8f0;
}

.tool-actions {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
}

.tool-action-button,
.action-button,
.coupon-mini,
.icon-button {
  border: 0;
  cursor: pointer;
}

.tool-action-button {
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.tool-action-button:hover,
.tool-action-button.active {
  color: #fff;
  background: #ef4444;
  border-color: #ef4444;
}

.tool-headline {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-right: 120px;
}

.tool-panel__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
}

.tool-headline h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.tool-panel__body {
  padding: 24px;
}

.tool-panel__foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.tool-panel__foot-title {
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

.tool-panel__foot p {
  margin: 0;
  color: #64748b;
  line-height: 1.7;
  font-size: 14px;
}

.tool-panel__foot a {
  color: #94a3b8;
  font-size: 12px;
}

.workbench-wrap {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  margin-bottom: 24px;
}

.workbench-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
}

.workbench-tab {
  padding: 6px 12px;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
  border: 1px solid #e2e8f0;
}

.workbench-tab.active {
  background: #d1fae5;
  color: #047857;
  border-color: #86efac;
}

.tool-alert {
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.7;
}

.tool-alert.info {
  background: #dbeafe;
  border: 1px solid #93c5fd;
  color: #1d4ed8;
}

.tool-alert.warning {
  margin-top: 16px;
  margin-bottom: 0;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.tool-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

.tool-field {
  display: block;
}

.tool-field span,
.feedback-form label span {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: #475569;
  font-weight: 500;
}

.tool-form input,
.tool-form select,
.feedback-form input,
.feedback-form select,
.feedback-form textarea,
.mobile-search-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
}

.action-button {
  padding: 10px 18px;
  background: #10b981;
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.action-button:hover {
  background: #059669;
}

.action-button.gray {
  background: #64748b;
}

.action-button.gray:hover {
  background: #475569;
}

.action-button.tiny {
  padding: 8px 12px;
  font-size: 12px;
}

.tool-result,
.tool-history {
  margin-top: 24px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  padding: 16px;
}

.tool-result__head,
.tool-history__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.result-line,
.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
  margin-bottom: 8px;
}

.result-line span,
.history-row strong {
  font-weight: 700;
}

.result-line button,
.history-row button {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
}

.history-row span,
.related-item small,
.soft-card p,
.modal-list__item span,
.modal-list__item p,
.tip-item {
  color: #64748b;
  font-size: 13px;
  line-height: 1.7;
}

.tips-list,
.related-list,
.modal-list {
  display: grid;
  gap: 12px;
}

.tip-item,
.modal-list__item,
.soft-card {
  padding: 14px 16px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.related-item strong,
.modal-list__item strong {
  display: block;
  margin-bottom: 4px;
}

.soft-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.soft-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.soft-card p {
  margin: 0;
}

.feedback-form {
  display: grid;
  gap: 16px;
}

.site-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.site-modal__dialog {
  width: min(720px, 100%);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.22);
}

.site-modal__dialog.small {
  max-width: 420px;
}

.site-modal__head,
.site-modal__foot {
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.site-modal__foot {
  border-top: 1px solid #e2e8f0;
  border-bottom: 0;
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
}

.site-modal__head strong {
  display: block;
  font-size: 18px;
}

.site-modal__head span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: #64748b;
}

.site-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.site-modal__body {
  padding: 24px;
  overflow: auto;
}

.modal-close,
.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: transparent;
  color: #64748b;
  border: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-button:hover,
.modal-close:hover {
  background: #f8fafc;
  color: #334155;
}

.coupon-mini {
  padding: 8px 10px;
  background: #f97316;
  color: #fff;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}

.coupon-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #c2410c;
  margin-bottom: 12px;
}

.coupon-card span {
  color: #ea580c;
  font-size: 13px;
}

.coupon-card.blue {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.coupon-card.blue span {
  color: #2563eb;
}

.setting-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.setting-card strong {
  display: block;
  margin-bottom: 4px;
}

.setting-card span {
  display: block;
  color: #64748b;
  font-size: 13px;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: all 0.2s ease;
}

.switch-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #fff;
  transition: all 0.2s ease;
}

.switch input:checked + .switch-slider {
  background: #10b981;
}

.switch input:checked + .switch-slider::after {
  transform: translateX(20px);
}

.mobile-search-form {
  display: grid;
  gap: 12px;
}

.empty-state,
.empty-inline {
  padding: 18px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: #64748b;
  text-align: center;
}

.site-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(16px);
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  opacity: 0;
  transition: all 0.2s ease;
  z-index: 10000;
}

.site-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.desktop-only { display: inline-flex; }
.mobile-only { display: none; }

@media (max-width: 1279px) {
  .tool-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .tool-list-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1023px) {
  .tool-layout,
  .feedback-layout {
    grid-template-columns: 1fr;
  }

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

  .tool-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-wrap {
    margin-left: 0;
  }

  .desktop-only { display: none; }
  .mobile-only { display: inline-flex; }

  .topbar {
    padding: 12px 16px;
  }

  .page-shell {
    padding: 16px;
  }

  .tool-cards,
  .tool-list-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 639px) {
  .tool-cards,
  .tool-list-grid {
    grid-template-columns: 1fr;
  }

  .section-card,
  .tool-panel {
    padding: 18px;
  }

  .section-card__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .tool-actions {
    position: static;
    margin-bottom: 16px;
  }

  .tool-headline {
    padding-right: 0;
  }

  .tool-panel__body,
  .site-modal__body,
  .site-modal__head,
  .site-modal__foot {
    padding-left: 16px;
    padding-right: 16px;
  }
}