:root {
  color-scheme: light;
  --bg: #f6faf8;
  --panel: #ffffff;
  --panel-soft: #edf5f2;
  --ink: #17211f;
  --muted: #66736e;
  --line: #d7e5df;
  --teal: #0f8f83;
  --teal-dark: #0a5f59;
  --coral: #e96d54;
  --yellow: #e2aa2f;
  --charcoal: #263331;
  --shadow: 0 18px 55px rgba(29, 51, 47, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(210px, 280px) minmax(280px, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 72px;
  padding: 12px clamp(16px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgba(246, 250, 248, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 10px;
  background: var(--charcoal);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  line-height: 1.1;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.global-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 13px;
}

.global-search svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.global-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.top-links,
.footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.top-links a,
.footer-links a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.top-links a:hover,
.footer-links a:hover {
  color: var(--teal-dark);
}

.app-layout {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: start;
  padding: 18px clamp(16px, 3vw, 34px) 30px;
}

.tool-sidebar,
.right-rail {
  position: sticky;
  top: 90px;
  display: grid;
  gap: 14px;
  max-height: calc(100svh - 108px);
  overflow: auto;
}

.sidebar-section,
.rail-card,
.workspace,
.tool-panel,
.ad-slot {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.sidebar-section,
.rail-card {
  padding: 14px;
}

.sidebar-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.category-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.category-tab,
.tool-tab,
.primary-button,
.ghost-button {
  border: 0;
  border-radius: 8px;
}

.category-tab {
  min-height: 38px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.category-tab.active {
  background: var(--charcoal);
  color: #fff;
}

.tool-list {
  display: grid;
  gap: 8px;
}

.tool-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.tool-tab:hover {
  background: var(--panel-soft);
}

.tool-tab.active {
  background: var(--charcoal);
  color: #fff;
}

.tool-tab svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.tool-tab span,
.tool-tab strong,
.tool-tab small {
  display: block;
  min-width: 0;
}

.tool-tab strong {
  color: inherit;
  font-size: 14px;
}

.tool-tab small {
  margin-top: 3px;
  color: currentColor;
  opacity: 0.72;
  font-size: 12px;
}

.workspace {
  padding: clamp(18px, 3vw, 28px);
  box-shadow: var(--shadow);
}

.workspace-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: 0;
}

.workspace-top p:last-child {
  max-width: 760px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.ad-slot {
  display: grid;
  min-height: 88px;
  place-items: center;
  margin-bottom: 16px;
  border-style: dashed;
  background: repeating-linear-gradient(
    135deg,
    rgba(237, 245, 242, 0.95),
    rgba(237, 245, 242, 0.95) 12px,
    rgba(255, 255, 255, 0.95) 12px,
    rgba(255, 255, 255, 0.95) 24px
  );
  color: var(--muted);
  text-align: center;
}

.ad-slot span,
.ad-slot small {
  display: block;
}

.ad-slot span {
  font-weight: 900;
}

.ad-slot small {
  margin-top: 4px;
  font-size: 12px;
}

.ad-slot.vertical {
  min-height: 250px;
  margin: 0;
}

.tool-panel {
  display: none;
  padding: clamp(16px, 3vw, 24px);
  background: #fff;
}

.tool-panel.active {
  display: block;
}

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

label {
  display: grid;
  gap: 8px;
}

label span,
.stat-card span,
.hero-result span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  outline: none;
}

textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 143, 131, 0.14);
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  font-weight: 900;
}

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

.primary-button:hover {
  background: var(--teal-dark);
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost-button:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.primary-button svg,
.ghost-button svg {
  width: 18px;
  height: 18px;
}

button[data-copied="true"]::after {
  content: "已复制";
  margin-left: 6px;
  color: var(--teal-dark);
  font-size: 12px;
}

.stat-card,
.result-card,
.hero-result {
  min-height: 118px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.stat-card strong,
.hero-result strong {
  display: block;
  margin-top: 10px;
  color: var(--charcoal);
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1;
}

.stat-card small,
.result-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.result-card {
  min-height: 92px;
  background: #fff;
}

.result-card.pass strong {
  color: var(--teal-dark);
}

.result-card.warn strong {
  color: #9a6710;
}

.progress {
  width: 100%;
  height: 12px;
  margin: 18px 0 10px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--panel-soft);
}

.progress::-webkit-progress-bar {
  background: var(--panel-soft);
}

.progress::-webkit-progress-value {
  background: var(--teal);
}

.progress::-moz-progress-bar {
  background: var(--teal);
}

.status {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.file-drop {
  min-height: 150px;
  align-content: center;
  justify-items: center;
  border: 1px dashed #aebdb7;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}

.file-drop.dragging {
  border-color: var(--teal);
  background: #e4f3ef;
}

.file-drop svg {
  width: 28px;
  height: 28px;
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.preview-box {
  display: grid;
  min-height: 220px;
  margin: 14px 0;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  font-weight: 800;
}

.preview-box img {
  display: block;
  width: 100%;
  max-height: 380px;
  object-fit: contain;
}

.code-output {
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  margin: 14px 0 0;
  padding: 16px;
  border: 1px solid #152321;
  border-radius: 8px;
  background: #101817;
  color: #e8f4ef;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.code-output.error {
  border-color: var(--coral);
}

.download-link {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--charcoal);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.title-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding-left: 22px;
}

.copy-line {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
  color: var(--ink);
  text-align: left;
  line-height: 1.55;
}

.copy-line:hover {
  border-color: var(--teal);
}

.hero-result {
  margin: 14px 0;
  background: var(--charcoal);
  color: #fff;
}

.hero-result span {
  color: rgba(255, 255, 255, 0.72);
}

.hero-result strong {
  color: #fff;
}

.mini-bars {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 90px;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-soft);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.search-preview {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.search-preview span {
  color: #2f7d32;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.search-preview strong {
  color: #1a0dab;
  font-size: 20px;
  line-height: 1.3;
}

.search-preview p {
  margin: 0;
  color: #4d5156;
  line-height: 1.55;
}

.metric-list {
  display: grid;
  gap: 10px;
}

.metric-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.metric-list strong {
  font-size: 22px;
}

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

.rail-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(16px, 3vw, 34px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.page-main {
  display: grid;
  gap: 28px;
  padding: clamp(30px, 5vw, 64px) clamp(18px, 5vw, 64px);
}

.content-hero,
.content-panel,
.note-box {
  max-width: 920px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.content-hero h1,
.content-panel h2,
.note-box h2 {
  margin-top: 0;
}

.content-hero p,
.content-panel p,
.content-panel li,
.note-box p,
.note-box li {
  color: var(--muted);
  line-height: 1.8;
}

.content-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.content-grid,
.planner-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
  align-items: start;
}

@media (max-width: 1180px) {
  .app-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .right-rail {
    position: static;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 860px) {
  .app-header {
    grid-template-columns: 1fr;
  }

  .top-links {
    justify-content: space-between;
  }

  .app-layout {
    grid-template-columns: 1fr;
  }

  .tool-sidebar,
  .right-rail {
    position: static;
    max-height: none;
    overflow: visible;
  }

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

  .tool-tab {
    justify-content: flex-start;
    min-height: 64px;
  }

  .workspace-top,
  .site-footer {
    flex-direction: column;
  }

  .form-grid,
  .stat-grid,
  .result-grid,
  .right-rail,
  .content-grid,
  .planner-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .app-layout {
    padding-inline: 10px;
  }

  .workspace,
  .tool-panel {
    padding: 14px;
  }

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

  .category-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .category-tab {
    min-width: 0;
    padding-inline: 4px;
    font-size: 12px;
  }

  .bar-row {
    grid-template-columns: 64px minmax(0, 1fr) 72px;
  }
}
