:root {
  --bg: #f6f7fb;
  --bg-elev: #ffffff;
  --bg-soft: #eef1f8;
  --text: #1a2130;
  --text-muted: #55607a;
  --border: #dfe4ef;
  --border-strong: #c7cfe0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #e3ecff;
  --danger: #dc2626;
  --ok: #047857;
  --code-bg: #f2f4fa;
  --shadow: 0 1px 2px rgba(24, 36, 64, 0.06), 0 8px 24px rgba(24, 36, 64, 0.06);
  --shadow-sm: 0 1px 2px rgba(24, 36, 64, 0.08);
  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", "Courier New", monospace;
}

html[data-theme="dark"] {
  --bg: #0e1117;
  --bg-elev: #161b25;
  --bg-soft: #1c2330;
  --text: #e7ecf5;
  --text-muted: #a3aec4;
  --border: #28303f;
  --border-strong: #3a4457;
  --accent: #5b8cff;
  --accent-hover: #7aa2ff;
  --accent-soft: #1c2947;
  --danger: #f87171;
  --ok: #34d399;
  --code-bg: #10151e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #0e1117;
    --bg-elev: #161b25;
    --bg-soft: #1c2330;
    --text: #e7ecf5;
    --text-muted: #a3aec4;
    --border: #28303f;
    --border-strong: #3a4457;
    --accent: #5b8cff;
    --accent-hover: #7aa2ff;
    --accent-soft: #1c2947;
    --danger: #f87171;
    --ok: #34d399;
    --code-bg: #10151e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  line-height: 1.3;
  margin: 0 0 0.5em;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

.mono {
  font-family: var(--mono);
  font-size: 13.5px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
}

.skip-link:focus {
  left: 0;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  flex: none;
}

.brand-icon {
  width: 21px;
  height: 21px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 16px;
}

.brand-text small {
  color: var(--text-muted);
  font-size: 11.5px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.site-nav a {
  color: var(--text-muted);
  padding: 7px 11px;
  border-radius: 8px;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--bg-soft);
  text-decoration: none;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  margin-left: 4px;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
}

.theme-icon-sun {
  display: none;
}

html[data-theme="dark"] .theme-icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-icon-sun {
  display: inline;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .theme-icon-moon {
    display: none;
  }
  html:not([data-theme="light"]) .theme-icon-sun {
    display: inline;
  }
}

/* ---------- hero ---------- */
.hero {
  padding: 56px 0 30px;
  background: radial-gradient(1000px 320px at 50% -40%, var(--accent-soft), transparent 70%);
}

.hero-inner {
  max-width: 760px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(28px, 5vw, 42px);
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.hero-sub {
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 8px;
}

.hero-desc {
  color: var(--text-muted);
  margin: 0 auto 22px;
  max-width: 620px;
}

.search-box input {
  width: 100%;
  max-width: 520px;
  padding: 14px 18px;
  font-size: 15px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.search-box input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

/* ---------- sections ---------- */
.tools-section,
.seo-section {
  padding: 26px 20px 10px;
}

.changelog-section {
  padding: 26px 20px 10px;
}

.changelog-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.changelog-list li {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.7;
  box-shadow: var(--shadow-sm);
}

.changelog-list li + li {
  margin-top: 10px;
}

.changelog-issue {
  font-weight: 600;
  color: var(--text);
}

.changelog-status {
  color: var(--text-muted);
  font-size: 12.5px;
}

.section-title {
  font-size: 20px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 20px;
}

.chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-muted);
  font-size: 13.5px;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.tool-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.tool-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.tool-card[hidden] {
  display: none;
}

.tool-card-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}

.tool-card-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tool-card-title {
  font-weight: 600;
  font-size: 15px;
}

.tool-card-desc {
  color: var(--text-muted);
  font-size: 12.5px;
}

.tool-card-arrow {
  margin-left: auto;
  color: var(--text-muted);
  flex: none;
}

.no-results {
  color: var(--text-muted);
  padding: 20px 0;
}

.seo-section {
  padding-bottom: 60px;
  color: var(--text-muted);
}

.seo-section h2 {
  color: var(--text);
  font-size: 19px;
  margin-top: 1.6em;
}

.tool-list li {
  margin-bottom: 10px;
}

.icon {
  width: 20px;
  height: 20px;
}

.icon-lg {
  width: 26px;
  height: 26px;
}

/* ---------- tool page ---------- */
.tool-main {
  padding: 24px 0 60px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.breadcrumb .sep {
  color: var(--border-strong);
}

.tool-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.tool-head-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
}

.tool-head h1 {
  font-size: clamp(22px, 3.4vw, 30px);
  margin-bottom: 6px;
}

.lead {
  color: var(--text-muted);
  margin: 0;
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.tool-panel {
  margin-bottom: 20px;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.field-stack,
.output-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.field-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

textarea.field-input {
  resize: vertical;
  line-height: 1.6;
}

textarea.field-input.mono {
  font-family: var(--mono);
}

.field-input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-default {
  background: var(--bg-elev);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-default:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 12.5px;
}

.checkbox-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.divider {
  height: 1px;
  background: var(--border);
}

/* ---------- output ---------- */
.output {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  overflow: hidden;
  min-width: 0;
}

.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}

.output-actions {
  display: flex;
  gap: 6px;
}

.output-pre {
  margin: 0;
  padding: 12px;
  min-height: 80px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  max-height: 460px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.6;
}

textarea.output-pre {
  display: block;
}

.output-html {
  padding: 12px;
  min-height: 80px;
  max-height: 520px;
  overflow: auto;
  word-break: break-word;
}

.output-inline {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13.5px;
  line-height: 1.6;
}

.output .is-error,
.output-meta.is-error {
  color: var(--danger);
}

.output-meta {
  padding: 0 12px 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.output-meta.is-error {
  color: var(--danger);
}

.output-meta.is-ok {
  color: var(--ok);
}

.kv {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
}

.kv:last-child {
  border-bottom: 0;
}

.kv-key {
  flex: none;
  min-width: 110px;
  color: var(--text-muted);
  font-size: 13px;
}

.kv-val {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 13px;
  word-break: break-all;
  white-space: pre-wrap;
}

mark,
.hl {
  background: #fde68a;
  color: #422006;
  border-radius: 3px;
  padding: 0 1px;
}

html[data-theme="dark"] mark,
html[data-theme="dark"] .hl {
  background: #a16207;
  color: #fff7ed;
}

.match-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.match-item {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}

.match-item:last-child {
  border-bottom: 0;
}

.match-index {
  color: var(--text-muted);
  margin-right: 8px;
}

.match-groups {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 3px;
  word-break: break-all;
}

.status-item {
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
}

.status-item:last-child {
  border-bottom: 0;
}

.status-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.status-code {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 17px;
  color: var(--accent);
}

.status-name {
  font-weight: 600;
}

.status-zh {
  color: var(--text-muted);
}

.status-desc {
  margin: 6px 0 2px;
}

.status-tip {
  color: var(--text-muted);
  font-size: 13px;
  margin: 2px 0 0;
}

.status-rfc {
  font-size: 12px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 9px;
}

.qr-preview {
  display: flex;
  justify-content: center;
  padding: 10px;
}

.qr-preview svg {
  width: min(100%, 320px);
  height: auto;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

/* ---------- content ---------- */
.content-panel {
  color: var(--text-muted);
}

.content-panel h2 {
  color: var(--text);
  font-size: 18px;
  margin-top: 1.5em;
}

.content-panel h2:first-child {
  margin-top: 0;
}

.steps {
  padding-left: 22px;
}

.steps li {
  margin-bottom: 6px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 8px;
  background: var(--bg);
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.faq-answer {
  margin-top: 8px;
  color: var(--text-muted);
}

.related-list {
  padding-left: 20px;
}

.related-list li {
  margin-bottom: 5px;
}

.related-tools-note {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.notfound {
  text-align: center;
  padding: 80px 20px;
}

.notfound h1 {
  font-size: 64px;
  margin-bottom: 8px;
}

/* ---------- LLM 工具（三栏 / 双栏 / 单列） ---------- */
.llm-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.llm-layout-2 {
  grid-template-columns: 340px minmax(0, 1fr);
}

.llm-col {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.llm-col .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.llm-col .btn {
  align-self: flex-start;
}

.llm-key-hint {
  font-size: 12.5px;
  color: var(--danger);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.llm-models {
  font-size: 13px;
  color: var(--text-muted);
}

.llm-model-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow: auto;
  margin-top: 6px;
}

.llm-model-item {
  text-align: left;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 7px 10px;
  min-height: 44px;
}

.llm-model-item:hover,
.llm-model-item:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.llm-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.llm-reply {
  min-height: 120px;
  max-height: 420px;
  overflow: auto;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.col-title {
  margin: 8px 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.metric-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 820px) {
  .metric-cards {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x proximity;
  }
}

.metric-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 108px;
  scroll-snap-align: start;
}

.metric-label {
  font-size: 11.5px;
  color: var(--text-muted);
}

.metric-value {
  font-size: 17px;
  font-weight: 650;
  font-family: var(--mono);
}

.est-note {
  font-size: 12px;
  color: var(--text-muted);
}

.run-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.run-stats-table th,
.run-stats-table td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: right;
}

.run-stats-table th:first-child,
.run-stats-table td:first-child {
  text-align: left;
}

.cost-box,
.cost-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cost-line {
  font-size: 13.5px;
  color: var(--text);
}

.cost-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cost-card-label {
  font-size: 12px;
  color: var(--text-muted);
}

.cost-card-value {
  font-size: 18px;
  font-weight: 650;
  font-family: var(--mono);
}

.cost-card-note {
  font-size: 12px;
  color: var(--text-muted);
}

.cors-card {
  font-size: 12.5px;
  color: var(--text-muted);
}

.cors-list {
  padding-left: 18px;
  margin: 0 0 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cors-checklist summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.cors-checklist ol {
  padding-left: 18px;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 费用计算器价格表 */
.price-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 320px;
  overflow: auto;
}

.price-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}

.price-row-idx {
  color: var(--text-muted);
  font-family: var(--mono);
  width: 20px;
}

.price-row-name {
  font-family: var(--mono);
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.price-row-nums {
  font-family: var(--mono);
  color: var(--text);
  white-space: nowrap;
}

.price-row-date {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.price-row-note {
  color: var(--text-muted);
}

.cost-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Prompt 模板（T3） ---------- */
.tpl-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.tpl-form,
.tpl-list {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tpl-form-actions,
.tpl-item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tpl-list-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.tpl-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tpl-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tpl-item-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tpl-item-name {
  font-weight: 650;
}

.tpl-item-vars {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
}

.tpl-item-actions .btn {
  min-height: 44px;
}

/* ---------- LLM 响应式（手机竖屏） ---------- */
@media (max-width: 1080px) {
  .llm-layout,
  .llm-layout-2,
  .tpl-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .llm-col {
    padding: 12px;
  }

  .llm-col-settings {
    order: 0;
  }

  .llm-col-edit {
    order: 1;
    position: relative;
  }

  .llm-col-metrics {
    order: 2;
  }

  .llm-actions {
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: var(--bg-elev);
    padding: 10px 0;
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
    border-top: 1px solid var(--border);
  }

  .llm-actions .btn {
    flex: 1;
    min-height: 44px;
  }
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  padding: 40px 0 24px;
  margin-top: 20px;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 28px;
}

.footer-brand {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  margin-bottom: 8px;
}

.footer-col p,
.footer-col ul {
  color: var(--text-muted);
  font-size: 13px;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 4px 12px;
}

.footer-title {
  font-weight: 600;
  color: var(--text);
  font-size: 13.5px;
  margin-bottom: 8px;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12.5px;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.toast[data-type="error"] {
  background: #b91c1c;
}

@media (max-width: 820px) {
  .panel-grid,
  .footer-inner,
  .control-row {
    grid-template-columns: 1fr;
  }
  .hero {
    padding-top: 36px;
  }
  .site-nav a {
    padding: 6px 8px;
  }
  .brand-text small {
    display: none;
  }
}

@media (max-width: 520px) {
  .brand-text strong {
    font-size: 14.5px;
  }
  .site-nav a {
    font-size: 13px;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
