/* Lemon Shell —— 视觉变量与 lemon-mirror.pages.dev 保持一致 */
:root {
  color-scheme: light;
  --bg1: #f7f8fa; --bg2: #e9eef6;
  --panel: #ffffff;
  --line: #e3e7ec; --line-2: #ccd4dd;
  --text: #1f2328; --muted: #5b6572;
  --accent: #4f46e5; --accent-2: #4338ca;
  --green: #15803d;
  --warn: #a16207;
  --code: #f2f4f7;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg1: #0f172a; --bg2: #1e293b;
  --panel: rgba(255,255,255,.05);
  --line: rgba(148,163,184,.18);
  --line-2: rgba(148,163,184,.32);
  --text: #e2e8f0; --muted: #94a3b8;
  --accent: #818cf8; --accent-2: #6366f1;
  --green: #4ade80;
  --warn: #fbbf24;
  --code: rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg1) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.65 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI",
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 2.2rem 1.25rem 4rem; }

/* ---------- 头部 ---------- */
header { position: relative; text-align: center; margin-bottom: 1.5rem; }
.logo { height: 74px; width: auto; display: block; margin: 0 auto .35rem; }
h1 { font-size: 1.5rem; margin: 0 0 .3rem; letter-spacing: -.01em; }
.page-tag { margin: 0; color: var(--muted); font-size: .9rem; }
/* 顶部胶囊：分段式导航，当前页高亮 */
.top-actions {
  position: absolute; top: 0; right: 0;
  display: flex; align-items: center; gap: .1rem;
  padding: .24rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}
.toplink {
  display: inline-flex; align-items: center; justify-content: center;
  height: 1.72rem; padding: 0 .56rem 1px;
  border-radius: 999px;
  color: var(--muted); font-size: .82rem; font-weight: 500; line-height: 1;
  letter-spacing: .01em; text-decoration: none; white-space: nowrap;
  transition: color .15s, background .15s;
}
.toplink:hover { color: var(--accent); background: rgba(99, 102, 241, .08); }
.toplink[aria-current="page"] {
  color: var(--accent); font-weight: 600;
  background: rgba(99, 102, 241, .13);
}
#theme {
  width: 1.72rem; height: 1.72rem;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: 999px;
  color: var(--text); cursor: pointer; font-size: .92rem; line-height: 1;
  /* emoji 字形在行盒里略偏高，往下补 0.5px */
  transform: translateY(.5px);
  transition: background .15s;
}
#theme:hover { background: rgba(99, 102, 241, .13); }
.toplink:focus-visible, #theme:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
@media (max-width: 760px) {
  .top-actions { position: static; width: max-content; margin: 0 0 .8rem auto; }
  .logo { height: 64px; }
}
@media (max-width: 430px) {
  .top-actions { gap: .06rem; padding: .2rem; }
  .toplink { height: 1.5rem; padding: 0 .38rem 1px; font-size: .74rem; }
  #theme { width: 1.5rem; height: 1.5rem; font-size: .84rem; }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .45rem .95rem; border-radius: 8px; font-size: .84rem;
  font-family: inherit; text-decoration: none; cursor: pointer;
  color: var(--accent);
  background: rgba(99,102,241,.13); border: 1px solid rgba(99,102,241,.38);
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: rgba(99,102,241,.22); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent-2), #4f46e5);
  color: #fff; border-color: transparent;
}
.btn.primary:hover { filter: brightness(1.08); }

/* ---------- 布局 ---------- */
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 384px; gap: 1.1rem; align-items: start; }
.col-side { position: sticky; top: 1rem; }
@media (max-width: 980px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .col-side { position: static; }
  body { padding-bottom: 3.6rem; }
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.card:last-child { margin-bottom: 0; }
.card > h3 {
  margin: 0 0 .75rem; font-size: .93rem; font-weight: 700;
  display: flex; align-items: center; gap: .4rem;
}
.card.accent { background: rgba(34,197,94,.06); border-color: rgba(34,197,94,.28); }
.card.accent > h3 { color: var(--green); }

.hint { margin: .5rem 0 0; font-size: .76rem; color: var(--muted); line-height: 1.5; }
.hint code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .94em; }

.mt { margin-top: .7rem; }
.mt-s { margin-top: .6rem; }
.mt-xs { margin-top: .45rem; }
.last { margin-bottom: 0 !important; }
.grow { flex: 1 1 auto; }

/* ---------- 表单 ---------- */
.field { margin-bottom: .7rem; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; font-size: .72rem; color: var(--muted); margin-bottom: .25rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .8rem; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

select, input[type="text"], input[type="number"] {
  width: 100%; padding: .42rem .6rem;
  background-color: var(--code);
  border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); font-size: .84rem; font-family: inherit;
  outline: none; transition: border-color .15s, opacity .15s;
  -moz-appearance: textfield;
}
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%238b95a3' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .58rem center; background-size: .58rem;
  padding-right: 1.6rem; cursor: pointer;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
select:focus, input[type="text"]:focus, input[type="number"]:focus { border-color: var(--accent); }
select:disabled, input:disabled { opacity: .45; cursor: not-allowed; }

.input-group { display: flex; gap: .4rem; }
.input-group input { flex: 1 1 auto; min-width: 0; }
.mini {
  flex: 0 0 auto; padding: .3rem .55rem; border-radius: 7px;
  border: 1px solid var(--line-2); background: var(--panel);
  color: var(--muted); font-size: .72rem; font-family: inherit; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.mini:hover { color: var(--accent); border-color: var(--accent); }

/* 开关 */
.sw { display: flex; align-items: center; gap: .55rem; cursor: pointer; user-select: none; }
.sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw i {
  flex: 0 0 34px; height: 19px; border-radius: 999px; position: relative;
  background: var(--line-2); transition: background .16s;
}
.sw i::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 15px; height: 15px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .16s;
}
.sw input:checked + i { background: var(--accent); }
.sw input:checked + i::after { transform: translateX(15px); }
.sw input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw em { font-style: normal; font-size: .86rem; font-weight: 600; }
.sw em small { font-weight: 400; color: var(--muted); font-size: .74rem; margin-left: .1rem; }
.sws { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem .8rem; margin-top: .2rem; }
@media (max-width: 560px) { .sws { grid-template-columns: 1fr; } }

/* 预设卡片：桌面 3 列 2 行，窄屏 2 列 */
.presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; }
@media (max-width: 620px) { .presets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.preset {
  text-align: left; padding: .5rem .62rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--code);
  color: var(--text); font-family: inherit; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.preset b { display: block; font-size: .86rem; letter-spacing: .01em; }
.preset span { display: block; font-size: .68rem; color: var(--muted); line-height: 1.35; margin-top: .1rem; }
.preset:hover { border-color: var(--line-2); }
.preset.on { background: rgba(99,102,241,.1); border-color: rgba(99,102,241,.45); }
.preset.on b { color: var(--accent); }
.preset.on span { color: var(--accent); opacity: .8; }

/* chip */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: .02rem;
  padding: .32rem .6rem; border-radius: 8px; font-size: .8rem; line-height: 1.25;
  background: var(--code); border: 1px solid var(--line);
  color: var(--text); font-family: inherit; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.chip small {
  font-size: .65rem; color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.chip:hover:not(:disabled) { border-color: var(--line-2); }
.chip[aria-pressed="true"] {
  background: rgba(99,102,241,.13); border-color: rgba(99,102,241,.45); color: var(--accent);
}
.chip[aria-pressed="true"] small { color: var(--accent); opacity: .85; }
.chip:disabled { opacity: .38; cursor: not-allowed; }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 分段控件 */
.seg { display: inline-flex; background: var(--code); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: .72rem; padding: .16rem .5rem; border-radius: 6px; cursor: pointer;
}
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---------- 命令块 ---------- */
.cmd-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
pre.cmd {
  margin: 0; padding: .7rem .8rem; overflow-x: auto;
  background: var(--code); border: 1px solid var(--line); border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .735rem; line-height: 1.6; white-space: pre-wrap;
  overflow-wrap: anywhere; tab-size: 2;
  color: var(--text);
}
.row-btns { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .7rem; }
.row-btns .btn { flex: 1 1 auto; }

.copy {
  flex: 0 0 auto; background: var(--panel); border: 1px solid var(--line-2);
  color: var(--muted); border-radius: 6px; padding: .24rem .55rem;
  font-size: .7rem; font-family: inherit; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.copy:hover { color: var(--text); border-color: var(--accent); }

/* ---------- 摘要 ---------- */
.kv {
  display: flex; justify-content: space-between; gap: .6rem; align-items: baseline;
  padding: .3rem 0; border-bottom: 1px dashed var(--line); font-size: .78rem;
}
.kv:last-child { border-bottom: 0; }
.kv b { font-weight: 600; color: var(--muted); flex: 0 0 auto; font-size: .74rem; }
.kv span { text-align: right; min-width: 0; word-break: break-word; }
.kv span.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .74rem; }

.note {
  display: flex; gap: .4rem; font-size: .75rem; line-height: 1.5;
  padding: .42rem .58rem; border-radius: 8px; margin-top: .45rem;
}
.note.warn { background: rgba(234,179,8,.1); border: 1px solid rgba(234,179,8,.32); color: var(--warn); }
.note.info { background: rgba(99,102,241,.07); border: 1px solid rgba(99,102,241,.22); color: var(--muted); }
.note b { font-weight: 700; }

/* ---------- 移动端底栏 ---------- */
.mbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: none; gap: .5rem; padding: .55rem .8rem;
  background: var(--panel); border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.mbar .btn { flex: 1 1 0; }
@media (max-width: 980px) { .mbar { display: flex; } }

/* ---------- 页脚 ---------- */
footer {
  margin-top: 2.5rem; padding-top: 1.1rem; border-top: 1px solid var(--line);
  text-align: center; color: var(--muted); font-size: .74rem;
}
footer a { color: inherit; }
noscript p { color: var(--warn); font-size: .85rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  html { scroll-behavior: auto; }
}
