/* ACE 全乔氏 · 小红书内容生成器（v2 视觉）
   依赖 ../styles.css 的 tokens / header / footer / btn / card 基础样式 */

.tool-page {
  background:
    radial-gradient(1100px 520px at 8% -8%, rgba(223, 242, 255, 0.9), transparent 60%),
    radial-gradient(900px 480px at 100% 0%, rgba(226, 246, 239, 0.92), transparent 55%),
    linear-gradient(180deg, #f8fcff 0%, #f4fbf7 46%, #ffffff 100%);
}

.tool-main {
  padding: calc(var(--header-h) + 48px) 0 clamp(48px, 6vw, 80px);
}

.tool-head {
  display: grid;
  gap: 14px;
  max-width: 780px;
  margin-bottom: clamp(24px, 3vw, 36px);
}

.tool-head h1 { font-size: clamp(32px, 4.4vw, 52px); }
.tool-head .lead { max-width: 42em; }

.tool-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-badge {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--green-deep);
  font-size: 12px;
  font-weight: 700;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
  gap: 22px;
  align-items: start;
}

.tool-panel,
.tool-result,
.tool-history {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-sm);
}

.tool-panel {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  padding: clamp(18px, 2.2vw, 26px);
}

.tool-panel-title {
  font-size: 18px;
  margin-bottom: 16px;
}

.tool-field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.tool-field label,
.tool-field legend {
  color: #31443f;
  font-size: 13px;
  font-weight: 700;
}

.tool-field--fieldset {
  padding: 0;
  border: 0;
  margin-inline: 0;
}

.tool-field--fieldset legend {
  margin-bottom: 8px;
}

.tool-field input,
.tool-field select,
.tool-field textarea {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

.tool-field textarea {
  min-height: 64px;
  resize: vertical;
  line-height: 1.65;
}

.tool-field input:hover,
.tool-field select:hover,
.tool-field textarea:hover { border-color: rgba(18, 95, 79, 0.38); }

.tool-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

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

.seg-btn {
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease);
}

.seg-btn:hover { background: var(--soft); }
.seg-btn.is-active {
  border-color: rgba(20, 160, 120, 0.55);
  background: var(--green-soft);
  color: var(--green-deep);
}

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

.tool-actions .btn { flex: 1; min-height: 46px; }

.tool-output {
  display: grid;
  gap: 16px;
}

.tool-preview {
  position: relative;
  display: grid;
  gap: 10px;
  min-height: 168px;
  padding: clamp(20px, 2.6vw, 28px);
  overflow: hidden;
  border-radius: var(--radius);
  background:
    radial-gradient(420px 220px at 85% 0%, rgba(45, 114, 255, 0.34), transparent 60%),
    radial-gradient(360px 220px at 0% 100%, rgba(20, 160, 120, 0.42), transparent 60%),
    linear-gradient(135deg, #08241e 0%, #0b5d4b 58%, #0e6f8a 100%);
  color: var(--white);
  box-shadow: var(--shadow);
}

.tool-preview::after {
  content: "";
  position: absolute;
  right: -46px;
  bottom: -60px;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  box-shadow: 0 0 0 26px rgba(255, 255, 255, 0.05), 0 0 0 54px rgba(255, 255, 255, 0.03);
  pointer-events: none;
}

.tool-preview-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 600;
}

.tool-preview-title {
  position: relative;
  z-index: 1;
  max-width: 20em;
  margin: 0;
  color: var(--white);
  font-size: clamp(22px, 2.6vw, 32px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.tool-preview-meta {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.tool-result {
  padding: clamp(18px, 2.2vw, 26px);
}

.tool-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.tool-result-head h2 { font-size: 18px; }

.tool-save {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.tool-count {
  float: right;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.tool-count.is-warn { color: #c0552f; }

.title-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.title-option {
  max-width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--white);
  color: #31443f;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.title-option:hover { background: var(--soft); }
.title-option[aria-pressed="true"] {
  border-color: rgba(20, 160, 120, 0.55);
  background: var(--green-soft);
  color: var(--green-deep);
}

.tool-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.tool-result-actions .btn { min-height: 44px; }
.tool-result-actions .btn--primary { flex: 1; }

.tool-toast {
  min-height: 20px;
  margin-top: 10px;
  color: var(--green-deep);
  font-size: 13px;
  font-weight: 600;
}

.tool-history {
  margin-top: 22px;
  padding: clamp(18px, 2.2vw, 26px);
}

.tool-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.tool-history-head h2 { font-size: 18px; }

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

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
}

.history-load {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.history-load strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta {
  color: var(--muted);
  font-size: 12px;
}

.history-del {
  flex: none;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.history-del:hover { border-color: var(--coral); color: #c0552f; }

.history-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

@media (max-width: 960px) {
  .tool-main { padding-top: calc(var(--header-h) + 34px); }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-panel { position: static; }
  .tool-preview { min-height: 150px; }
}

@media (max-width: 960px) {
  /* 工具页在移动端保留“返回官网”按钮 */
  .tool-page .site-header .header-actions .btn--primary { display: inline-flex; }
}

@media (max-width: 640px) {
  .tool-page .site-header .header-actions .btn { min-height: 40px; padding: 0 12px; }
  .tool-page .header-actions .btn--ghost { display: none; }
  .tool-actions { flex-direction: column; }
  .tool-actions .btn { width: 100%; }
  .tool-result-actions .btn { flex: 1 1 calc(50% - 5px); }
  .tool-result-actions .btn--primary { flex-basis: 100%; }
  .tool-preview-title { font-size: 24px; }
  .history-item { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .seg-btn, .tool-panel { transition: none; }
}
