/* ============================================================
   我的世界渐变颜色生成器 — 设计系统
   ============================================================ */

:root{
  --mc-font: 'Minecraft', 'Minecraftia', 'Monocraft', 'Unifont', ui-monospace,
             'Cascadia Mono', 'DejaVu Sans Mono', Consolas, monospace;
  --ui-font: system-ui, -apple-system, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, 'DejaVu Sans Mono', monospace;

  --r-s: 6px;
  --r-m: 10px;
  --r-l: 14px;
  --t: .15s ease;
}

html[data-theme="dark"]{
  --bg:        #0e1116;
  --bg-2:      #151a21;
  --panel:     #171d25;
  --panel-2:   #1e242e;
  --line:      #2a3341;
  --line-soft: #212934;
  --fg:        #e6edf5;
  --fg-dim:    #93a1b3;
  --fg-faint:  #67748a;
  --accent:    #55dd77;
  --accent-2:  #3fb85f;
  --accent-fg: #06210e;
  --danger:    #ff6b6b;
  --warn:      #ffb454;
  --shadow:    0 8px 28px rgba(0,0,0,.45);
}

html[data-theme="light"]{
  --bg:        #f2f5f9;
  --bg-2:      #e8edf4;
  --panel:     #ffffff;
  --panel-2:   #f4f7fb;
  --line:      #d6dfea;
  --line-soft: #e6ecf3;
  --fg:        #16202c;
  --fg-dim:    #56657a;
  --fg-faint:  #8494a8;
  --accent:    #1f9d47;
  --accent-2:  #17803a;
  --accent-fg: #ffffff;
  --danger:    #d13b3b;
  --warn:      #b8730d;
  --shadow:    0 6px 22px rgba(20,35,60,.12);
}

*{ box-sizing: border-box; }

/* hidden 属性必须压过组件自己的 display（.modal 是 grid、.btn 是 inline-flex） */
[hidden]{ display: none !important; }

html,body{ margin:0; padding:0; }

body{
  background: var(--bg);
  color: var(--fg);
  font-family: var(--ui-font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3{ margin:0; font-weight:650; }

button, input, select, textarea{ font-family: inherit; font-size: inherit; color: inherit; }

.mono{ font-family: var(--mono); }
.ico{ font-style: normal; line-height:1; }
.hint{ color: var(--fg-faint); font-size: 12px; }
.sep{ color: var(--fg-faint); margin: 0 .4em; }

/* ---------- 顶栏 ---------- */
.topbar{
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top:0; z-index: 50;
  flex-wrap: wrap;
}
.brand{ display:flex; align-items:center; gap:12px; }
.brand h1{ font-size: 17px; letter-spacing:.2px; }
.brand-sub{ margin:0; font-size:11.5px; color: var(--fg-faint); }
.brand-cube{
  width:30px; height:30px; border-radius:5px; flex:none;
  background:
    linear-gradient(135deg,#ff5555 0 25%,#ffaa00 25% 45%,#55ff55 45% 65%,#55ffff 65% 82%,#5555ff 82% 100%);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.14);
}
.topbar-actions{ display:flex; gap:6px; flex-wrap:wrap; }

/* ---------- 按钮 ---------- */
.btn{
  display:inline-flex; align-items:center; gap:6px;
  padding: 7px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  cursor: pointer;
  transition: background var(--t), border-color var(--t), transform var(--t);
  white-space: nowrap;
  user-select: none;
}
.btn:hover{ background: var(--line-soft); border-color: var(--fg-faint); }
.btn:active{ transform: translateY(1px); }
.btn:disabled{ opacity:.4; cursor:not-allowed; }
.btn-ghost{ background: transparent; }
.btn-mini{ padding: 5px 9px; font-size: 12.5px; }
.btn-accent{ background: var(--accent); color: var(--accent-fg); border-color: var(--accent-2); font-weight:600; }
.btn-accent:hover{ background: var(--accent-2); }

/* ---------- 布局 ---------- */
.layout{
  display:grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 16px;
  padding: 16px 20px 40px;
  max-width: 1720px;
  margin: 0 auto;
  align-items: start;
}
.col{ display:flex; flex-direction:column; gap:16px; min-width:0; }
.col-right{ position: sticky; top: 74px; }

@media (max-width: 1100px){
  .layout{ grid-template-columns: minmax(0,1fr); }
  .col-right{ position: static; }
}

/* ---------- 面板 ---------- */
.panel{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.panel-title{
  display:flex; align-items:center; gap:8px;
  font-size: 13.5px; letter-spacing:.3px;
  padding: 11px 16px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  color: var(--fg-dim);
  text-transform: none;
}
.panel-body{ padding: 14px 16px 16px; display:flex; flex-direction:column; gap:12px; }

.row{ display:flex; align-items:center; }
.row-wrap{ flex-wrap: wrap; }
.gap-s{ gap:8px; }

.grid2{
  display:grid; grid-template-columns: repeat(auto-fit, minmax(215px,1fr));
  gap: 10px 14px;
}

.field{ display:flex; flex-direction:column; gap:4px; font-size:12.5px; color: var(--fg-dim); min-width:0; }
.field-inline{ flex-direction: row; align-items:center; gap:7px; }
.field > span b{ color: var(--fg); font-weight:600; }

select, .text-input, input[type="number"], input[type="text"], .out-box{
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: 7px 9px;
  color: var(--fg);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  max-width:100%;
}
select:focus, .text-input:focus, input:focus, .out-box:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.mini-input{ padding: 4px 7px; }

.text-input{ width:100%; resize: vertical; font-family: var(--mono); font-size: 14px; line-height:1.6; }

.check{ display:inline-flex; align-items:center; gap:7px; font-size:12.5px; color: var(--fg-dim); cursor:pointer; user-select:none; }
.check input{ accent-color: var(--accent); width:15px; height:15px; cursor:pointer; }

input[type="range"]{ accent-color: var(--accent); width:100%; cursor:pointer; }

details.sub{ border:1px solid var(--line-soft); border-radius: var(--r-m); background: var(--panel-2); }
details.sub > summary{
  cursor:pointer; padding: 9px 12px; font-size:12.5px; font-weight:600;
  color: var(--fg-dim); user-select:none; list-style:none;
  display:flex; align-items:center; gap:7px;
}
details.sub > summary::before{ content:'▸'; transition: transform var(--t); }
details.sub[open] > summary::before{ transform: rotate(90deg); }
details.sub > summary::-webkit-details-marker{ display:none; }
details.sub > .grid2{ padding: 4px 12px 13px; }

/* ---------- 样式工具条 ---------- */
.style-toolbar{ display:flex; gap:4px; }
.sbtn{
  width:32px; height:30px; display:grid; place-items:center;
  background: var(--panel-2); border:1px solid var(--line); border-radius: var(--r-s);
  cursor:pointer; transition: all var(--t); font-size:14px;
}
.sbtn:hover{ border-color: var(--fg-faint); }
.sbtn.on{ background: var(--accent); color: var(--accent-fg); border-color: var(--accent-2); }
.sbtn.mixed{ background: color-mix(in srgb, var(--accent) 35%, var(--panel-2)); border-color: var(--accent-2); }
.obf-ico{ animation: obfblink .6s steps(1) infinite; }
@keyframes obfblink{ 0%{content:'K'} 50%{opacity:.35} 100%{opacity:1} }

/* ---------- 逐字编辑器 ---------- */
.char-grid{
  display:flex; flex-wrap:wrap; gap:4px;
  max-height: 190px; overflow-y:auto;
  padding: 8px; border-radius: var(--r-s);
  background: #0b0d11; border:1px solid var(--line);
}
html[data-theme="light"] .char-grid{ background:#1b2028; }
.char-tile{
  min-width: 28px; height: 32px; padding: 0 5px;
  display:grid; place-items:center;
  font-family: var(--mc-font); font-size: 16px; line-height:1;
  border-radius: 5px; cursor:pointer; user-select:none;
  border: 2px solid transparent;
  background: rgba(255,255,255,.05);
  transition: border-color var(--t), background var(--t);
}
.char-tile:hover{ background: rgba(255,255,255,.14); }
.char-tile.sel{ border-color: var(--accent); background: rgba(255,255,255,.16); }
.char-tile.ov{ box-shadow: inset 0 -3px 0 var(--warn); }
.char-tile.nl{ width:100%; height: 3px; min-width:0; padding:0; background: var(--line); border:none; cursor:default; border-radius:99px; }
.char-tile.nl:hover{ background: var(--line); }
.char-tile .b{ font-weight:700; }
.char-tile .i{ font-style: italic; }

.char-bar{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.char-bar .sel-info{ font-size:12px; color: var(--fg-dim); min-width: 74px; }

/* ---------- 命令参数 ---------- */
.out-params{
  display:flex; flex-wrap:wrap; align-items:center; gap:10px;
  padding: 9px 11px; border-radius: var(--r-s);
  background: var(--panel-2); border:1px solid var(--line-soft);
  font-size: 12.5px;
}
.out-params .lead{ color: var(--fg-faint); font-size:11.5px; }
.out-params:empty{ display:none; }

/* ---------- 统计 / 警告 ---------- */
.stats{ display:flex; flex-wrap:wrap; gap:6px; }
.chip{
  display:inline-flex; align-items:center; gap:5px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--panel-2); border:1px solid var(--line);
  font-size: 11.5px; color: var(--fg-dim);
}
.chip b{ color: var(--fg); font-family: var(--mono); font-weight:600; }
.chip.ok{ border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.chip.bad{ border-color: var(--danger); color: var(--danger); }
.chip.bad b{ color: var(--danger); }

.warnbox{
  border:1px solid var(--warn); border-radius: var(--r-s);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  color: var(--warn); padding: 8px 11px; font-size: 12.5px;
}
.warnbox ul{ margin:4px 0 0; padding-left:18px; }

/* ---------- 渐变条 ---------- */
.gbar-wrap{ display:flex; flex-direction:column; gap:6px; }
.gbar{
  position:relative; height: 52px; border-radius: var(--r-m);
  border:1px solid var(--line);
  background-image:
    linear-gradient(45deg,#8883 25%,transparent 25%,transparent 75%,#8883 75%),
    linear-gradient(45deg,#8883 25%,transparent 25%,transparent 75%,#8883 75%);
  background-size: 14px 14px; background-position: 0 0, 7px 7px;
  outline:none; cursor: copy;
}
.gbar:focus-visible{ box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.gbar-fill{ position:absolute; inset:0; border-radius: inherit; }
.gbar-stops{ position:absolute; inset:0; }
/* 整个 .gstop 都是鼠标热区，做得比可见的旗标宽很多，才好点中 */
.gstop{
  position:absolute; top:-10px; width:30px; height:74px; margin-left:-15px;
  cursor: grab; touch-action:none;
}
.gstop::before{
  content:''; position:absolute; left:5px; top:0; width:20px; height:22px;
  background: var(--bg); border-radius:5px 5px 0 0;
  clip-path: polygon(0 0,100% 0,100% 62%,50% 100%,0 62%);
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.gstop-dot{
  position:absolute; left:7px; top:2px; width:16px; height:18px;
  border-radius:3px 3px 0 0;
  clip-path: polygon(0 0,100% 0,100% 60%,50% 100%,0 60%);
}
.gstop-line{ position:absolute; left:14px; top:21px; width:2px; height:42px; background: var(--bg); opacity:.6; }
.gstop:hover::before{ background: var(--fg-dim); }
.gstop.sel::before{ background: var(--accent); }
.gstop.sel{ z-index:3; }
.gstop:active{ cursor:grabbing; }

/* ---------- 色标列表 ---------- */
.stop-list{ display:flex; flex-direction:column; gap:6px; }
.stop-row{
  display:grid; grid-template-columns: 26px 34px 1fr 92px 62px 26px;
  align-items:center; gap:8px;
  padding: 5px 7px; border-radius: var(--r-s);
  border:1px solid var(--line-soft); background: var(--panel-2);
  transition: border-color var(--t);
}
.stop-row.sel{ border-color: var(--accent); }
.stop-idx{ font-family: var(--mono); font-size:11px; color: var(--fg-faint); text-align:center; }
input[type="color"]{
  width:34px; height:28px; padding:0; border:1px solid var(--line);
  border-radius: var(--r-s); background:none; cursor:pointer;
}
.color-mini{ width:32px; height:26px; }
.stop-hex{ width:100%; font-family: var(--mono); text-transform: uppercase; }
.stop-pos-wrap{ display:flex; align-items:center; gap:5px; }
.stop-pos{ width:100%; }
.stop-pos-num{ font-family: var(--mono); font-size:11.5px; color: var(--fg-dim); width:38px; text-align:right; }
.stop-del{
  width:24px; height:24px; display:grid; place-items:center;
  border:none; background:transparent; color: var(--fg-faint);
  border-radius:4px; cursor:pointer; font-size:16px;
}
.stop-del:hover{ background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }

@media (max-width: 560px){
  .stop-row{ grid-template-columns: 22px 32px 1fr 26px; }
  .stop-row .stop-pos-wrap, .stop-row .stop-pos-num{ display:none; }
}

/* ---------- 预设 ---------- */
.tabs{ display:flex; gap:4px; flex-wrap:wrap; border-bottom:1px solid var(--line); padding-bottom:8px; }
.tab{
  padding: 5px 11px; border-radius: 999px; cursor:pointer;
  border:1px solid transparent; background: transparent;
  font-size:12.5px; color: var(--fg-dim); transition: all var(--t);
}
.tab:hover{ background: var(--panel-2); }
.tab.on{ background: var(--accent); color: var(--accent-fg); font-weight:600; }

.preset-grid{
  display:grid; grid-template-columns: repeat(auto-fill, minmax(132px,1fr));
  gap: 8px; max-height: 260px; overflow-y:auto; padding-right:4px;
}
.preset{
  border:1px solid var(--line); border-radius: var(--r-s); overflow:hidden;
  cursor:pointer; background: var(--panel-2); transition: all var(--t);
  position:relative;
}
.preset:hover{ border-color: var(--accent); transform: translateY(-1px); }
.preset-sw{ height: 26px; }
.preset-name{ padding: 4px 7px; font-size: 11.5px; color: var(--fg-dim); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.preset-x{
  position:absolute; top:2px; right:2px; width:17px; height:17px; line-height:15px;
  border:none; border-radius:4px; background: rgba(0,0,0,.55); color:#fff;
  cursor:pointer; font-size:13px; display:none; padding:0;
}
.preset:hover .preset-x{ display:block; }

/* ---------- 预览 ---------- */
.preview-ctl .field-inline input[type="range"]{ width: 96px; }
.preview{
  border-radius: var(--r-m); border:1px solid var(--line);
  padding: 20px 18px; min-height: 108px;
  display:flex; align-items:center; justify-content:center;
  overflow-x:auto; overflow-y:hidden;
  background-size: cover; background-position:center;
  image-rendering: pixelated;
}
.preview[data-bg="chat"]{ background: rgba(0,0,0,.72); }
.preview[data-bg="white"]{ background:#f8f8f8; }
.preview[data-bg="grass"]{
  background:
    repeating-linear-gradient(90deg,#5b8f3a 0 8px,#67a043 8px 16px),
    #5b8f3a;
  background-size: 16px 16px;
}
.preview[data-bg="stone"]{
  background:
    repeating-linear-gradient(45deg,#7a7a7a 0 6px,#888 6px 12px);
}
.preview[data-bg="obsidian"]{
  background: repeating-linear-gradient(135deg,#170f24 0 7px,#1d1430 7px 14px);
}
.preview[data-bg="sand"]{
  background: repeating-linear-gradient(90deg,#dbcb8f 0 8px,#e6d79c 8px 16px);
}
.preview[data-bg="nether"]{
  background: repeating-linear-gradient(45deg,#601f1f 0 7px,#722727 7px 14px);
}
.preview[data-bg="image"]{ image-rendering: auto; }
.preview-inner{
  font-family: var(--mc-font);
  white-space: pre-wrap;
  word-break: break-word;
  text-align:center;
  line-height: 1.35;
  max-width: 100%;
}
.preview-inner .mc-b{ font-weight: 700; }
.preview-inner .mc-i{ font-style: italic; }
.preview-inner .mc-u{ text-decoration: underline; }
.preview-inner .mc-s{ text-decoration: line-through; }
.preview-inner .mc-u.mc-s{ text-decoration: underline line-through; }
.preview.shadow .preview-inner span{ text-shadow: .12em .12em 0 var(--sh); }

.contrast{ display:flex; flex-wrap:wrap; gap:6px; }

/* ---------- 输出 ---------- */
.out-opts{ font-size:12.5px; }
.out-list{ display:flex; flex-direction:column; gap:10px; max-height: 720px; overflow-y:auto; padding-right:4px; }
/* flex:none 必须有，否则 max-height 会把所有卡片压扁、内容被 overflow:hidden 裁掉 */
.out-item{ flex: none; border:1px solid var(--line-soft); border-radius: var(--r-m); background: var(--panel-2); overflow:hidden; }
.out-head{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding: 7px 10px; border-bottom:1px solid var(--line-soft); flex-wrap:wrap;
}
.out-name{ font-size:12.5px; font-weight:600; }
.out-desc{ font-size:11px; color: var(--fg-faint); font-weight:400; margin-left:6px; }
.out-meta{ display:flex; align-items:center; gap:6px; }
.out-len{ font-family: var(--mono); font-size:11px; color: var(--fg-faint); }
.out-len.bad{ color: var(--danger); }
.out-box{
  width:100%; border:none; border-radius:0; background: transparent;
  font-family: var(--mono); font-size: 12px; line-height:1.55;
  resize: vertical; min-height: 42px; padding: 9px 10px;
  white-space: pre; overflow-x:auto;
}
.out-box:focus{ box-shadow:none; }

/* ---------- Toast / Modal ---------- */
.toast{
  position: fixed; left:50%; bottom: 28px; transform: translateX(-50%);
  background: var(--accent); color: var(--accent-fg);
  padding: 9px 18px; border-radius: 999px; font-weight:600; font-size:13px;
  box-shadow: var(--shadow); z-index: 200;
  animation: toastin .2s ease;
}
@keyframes toastin{ from{ opacity:0; transform: translate(-50%, 12px);} }

.modal{ position:fixed; inset:0; background: rgba(0,0,0,.6); z-index:150; display:grid; place-items:center; padding:20px; }
.modal-box{
  background: var(--panel); border:1px solid var(--line); border-radius: var(--r-l);
  padding: 22px 24px; max-width: 620px; width:100%; max-height: 82vh; overflow-y:auto;
  position:relative; box-shadow: var(--shadow);
}
.modal-close{
  position:absolute; top:10px; right:12px; width:28px; height:28px;
  border:none; background:transparent; color: var(--fg-dim); font-size:22px; cursor:pointer; border-radius:6px;
}
.modal-close:hover{ background: var(--panel-2); }
.modal-box h3{ margin-bottom: 12px; }
.modal-box h4{ margin: 16px 0 6px; font-size:13px; color: var(--accent); }
.modal-box ul{ margin:0; padding-left: 20px; color: var(--fg-dim); font-size:13px; }
.modal-box li{ margin: 3px 0; }
kbd{
  font-family: var(--mono); font-size:11px; padding:1px 5px;
  border:1px solid var(--line); border-bottom-width:2px; border-radius:4px;
  background: var(--panel-2); color: var(--fg);
}

/* ---------- 取色器 ---------- */
.sw-btn{
  width: 34px; height: 28px; padding: 0;
  border: 1px solid var(--line); border-radius: var(--r-s);
  cursor: pointer; position: relative;
  transition: border-color var(--t), transform var(--t);
}
.sw-btn:hover{ border-color: var(--accent); }
.sw-btn.on{ border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.sw-btn.sw-mini{ width: 32px; height: 26px; }

.cp-pop{
  position: fixed; z-index: 300; width: 268px;
  background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-m);
  box-shadow: 0 12px 36px rgba(0,0,0,.35);
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
  user-select: none;
  /* 极矮窗口（横屏手机）下弹层内部自己滚，不撑出屏幕 */
  max-height: calc(100vh - 16px);
  overflow-y: auto;
}

.cp-sv{
  position: relative; height: 132px; border-radius: var(--r-s);
  cursor: crosshair; outline: none; touch-action: none;
  border: 1px solid var(--line);
}
.cp-sv:focus-visible{ box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.cp-sv-dot{
  position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; border: 2px solid #fff; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 1px 4px rgba(0,0,0,.4);
}

.cp-mid{ display: flex; align-items: center; gap: 9px; }
.cp-chip{
  width: 30px; height: 30px; flex: none; border-radius: var(--r-s);
  border: 1px solid var(--line);
}
.cp-hue{
  position: relative; flex: 1; height: 14px; border-radius: 99px;
  cursor: pointer; touch-action: none;
  background: linear-gradient(to right,
    #f00 0%, #ff0 16.66%, #0f0 33.33%, #0ff 50%, #00f 66.66%, #f0f 83.33%, #f00 100%);
}
.cp-hue-dot{
  position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border-radius: 50%; background: #fff; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 1px 4px rgba(0,0,0,.35);
}

.cp-icon{
  width: 28px; height: 28px; flex: none; display: grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--r-s); cursor: pointer; font-size: 14px; padding: 0;
  color: var(--fg-dim);
}
.cp-icon:hover{ border-color: var(--accent); color: var(--fg); }

.cp-fields{ display: flex; align-items: flex-end; gap: 5px; }
.cp-f{ display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.cp-f-hex{ flex: 1.9; }
.cp-f > span{ font-size: 10px; color: var(--fg-faint); letter-spacing: .3px; }
.cp-f input{
  width: 100%; min-width: 0; padding: 5px 6px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-s); color: var(--fg); font-size: 12px;
  font-family: var(--mono); outline: none;
}
.cp-f input:focus{ border-color: var(--accent); }
.cp-hex{ text-transform: uppercase; }
.cp-fields .cp-n::-webkit-outer-spin-button,
.cp-fields .cp-n::-webkit-inner-spin-button{ -webkit-appearance: none; margin: 0; }
.cp-fields .cp-n{ -moz-appearance: textfield; }

.cp-lbl{ font-size: 10.5px; color: var(--fg-faint); margin-top: 1px; }
.cp-sw{ display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.cp-s{
  height: 20px; padding: 0; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--line);
  transition: transform var(--t), border-color var(--t);
}
.cp-s:hover{ transform: scale(1.14); border-color: var(--fg); z-index: 1; }
.cp-empty{ grid-column: 1/-1; font-size: 11px; color: var(--fg-faint); }

/* ---------- 正文内容 ---------- */
.article{
  max-width: 860px;
  margin: 8px auto 0;
  padding: 26px 22px 34px;
  color: var(--fg-dim);
  font-size: 14.5px;
  line-height: 1.85;
}
.article h2{
  font-size: 20px; color: var(--fg);
  margin: 34px 0 12px; padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
  letter-spacing: .2px;
}
.article h2:first-child{ margin-top: 0; }
.article h3{
  font-size: 15.5px; color: var(--fg);
  margin: 26px 0 7px;
  padding-left: 11px; border-left: 3px solid var(--accent);
}
.article p{ margin: 0 0 13px; }
.article strong{ color: var(--fg); font-weight: 650; }
.article ul{ margin: 0 0 13px; padding-left: 22px; }
.article li{ margin: 5px 0; }
.article code{
  font-family: var(--mono); font-size: 12.5px;
  padding: 1.5px 6px; border-radius: 4px;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  color: var(--fg); white-space: nowrap;
}

.table-wrap{ overflow-x: auto; margin: 0 0 16px; -webkit-overflow-scrolling: touch; }
.article table{
  width: 100%; border-collapse: collapse;
  font-size: 13.5px; min-width: 520px;
  background: var(--panel); border-radius: var(--r-m); overflow: hidden;
}
.article th, .article td{
  padding: 9px 12px; text-align: left;
  border-bottom: 1px solid var(--line-soft);
}
.article th{
  background: var(--panel-2); color: var(--fg);
  font-weight: 600; white-space: nowrap;
}
.article tr:last-child td{ border-bottom: none; }
.article tbody tr:hover{ background: var(--panel-2); }
.color-table{ min-width: 640px; }
.color-table td{ white-space: nowrap; }
.sw{
  display: inline-block; width: 34px; height: 15px;
  border-radius: 3px; vertical-align: -2px;
  border: 1px solid var(--line);
}

@media (max-width: 700px){
  .article{ padding: 20px 16px 28px; font-size: 14px; }
  .article h2{ font-size: 18px; }
}

/* ---------- 页脚 ---------- */
.foot{
  text-align:center; padding: 14px 20px 26px;
  color: var(--fg-faint); font-size: 12px;
  border-top: 1px solid var(--line-soft);
}

/* 滚动条 */
*::-webkit-scrollbar{ width:9px; height:9px; }
*::-webkit-scrollbar-track{ background: transparent; }
*::-webkit-scrollbar-thumb{ background: var(--line); border-radius:99px; }
*::-webkit-scrollbar-thumb:hover{ background: var(--fg-faint); }
