/* ============================================================
   CronVibe — "The Control Room" 控制室 / 浅色宽幅
   设计隐喻：cron 是机器的心跳。调度机房、主时钟、指示灯、
   打孔纸带（表达式即纸带）、刻度表盘。
   字体：IBM Plex Mono（等宽机读）+ Fraunces（铭牌衬线）+ Archivo（正文）。
   ============================================================ */

:root {
  --paper: #f2efe7;
  --paper-2: #e9e4d8;
  --panel: #faf8f2;
  --panel-2: #f0ece0;

  --ink: #232a31;            /* 机身墨 */
  --ink-soft: #56616d;
  --ink-faint: #939da8;

  --signal: #b3541e;         /* 琥珀信号橙 */
  --signal-deep: #8a3f14;
  --signal-soft: rgba(179, 84, 30, .09);
  --signal-line: rgba(179, 84, 30, .28);

  --run: #2e6e4e;            /* 运转绿 */
  --run-soft: rgba(46, 110, 78, .10);
  --run-line: rgba(46, 110, 78, .25);

  --warn: #a06415;
  --warn-soft: rgba(160, 100, 21, .10);

  --err: #ab3b2e;

  --line: #d8d1c0;
  --line-2: #c4bba6;

  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 1520px;
  --mono: "IBM Plex Mono", "JetBrains Mono", Consolas, monospace;
  --sans: "Archivo", "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;

  --shadow-sm: 0 1px 2px rgba(35, 42, 49, .05), 0 4px 14px rgba(35, 42, 49, .05);
  --shadow-md: 0 2px 6px rgba(35, 42, 49, .06), 0 20px 48px rgba(35, 42, 49, .10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 85% -5%, rgba(179, 84, 30, .05), transparent 60%),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(35, 42, 49, .025) 39px 40px),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(35, 42, 49, .025) 39px 40px),
    var(--paper);
  font-size: 15px;
  line-height: 1.6;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 28px; }
.hidden { display: none !important; }
a { color: var(--signal-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ 头部 ============ */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 248, 242, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1.5px solid var(--line);
}
.head-inner {
  display: flex; align-items: center; gap: 18px;
  padding: 12px 0; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand img { width: 38px; height: 38px; display: block; }
.brand-name {
  font-family: var(--display);
  font-size: 21px; font-weight: 600; letter-spacing: .01em;
  color: var(--ink);
}
.brand-name b { color: var(--signal); font-weight: 700; }
.head-tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em;
  color: var(--ink-faint); text-transform: uppercase;
  padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 99px;
  background: var(--panel-2);
}
.head-nav { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.head-nav a { font-size: 13.5px; color: var(--ink-soft); font-weight: 500; }
.head-nav a:hover { color: var(--signal-deep); text-decoration: none; }

/* 控制室时钟 */
.control-clock {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono);
  padding: 6px 12px;
  background: var(--ink); color: #f4ead8;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), var(--shadow-sm);
}
.clock-lamp {
  width: 7px; height: 7px; border-radius: 50%;
  background: #7ddca3; box-shadow: 0 0 6px rgba(125, 220, 163, .8);
}
.clock-lamp.blink { background: #4e9a6d; box-shadow: none; }
.clock-time { font-size: 15px; font-weight: 600; letter-spacing: .06em; }
.clock-date { font-size: 10px; opacity: .65; letter-spacing: .04em; }

/* ============ 主区 ============ */
.hero-strip {
  padding: 26px 0 10px;
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
}
.hero-strip h1 {
  font-family: var(--display); font-size: 30px; font-weight: 600;
  letter-spacing: -.01em;
}
.hero-strip p { color: var(--ink-soft); font-size: 14px; }

/* 模式切换 */
.mode-switch {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--paper-2); border: 1.5px solid var(--line);
  border-radius: 10px; margin: 14px 0 18px;
}
.mode-tab {
  border: none; background: transparent; cursor: pointer;
  font-family: var(--sans); font-size: 13.5px; font-weight: 600;
  color: var(--ink-soft); padding: 8px 22px; border-radius: 7px;
  transition: all .18s;
  display: inline-flex; align-items: center; gap: 8px;
}
.mode-tab.active {
  background: var(--ink); color: #f4ead8;
  box-shadow: var(--shadow-sm);
}
.mode-tab .tab-idx {
  font-family: var(--mono); font-size: 10px; opacity: .6;
}

/* ============ 正向：选择器面板 ============ */
.field-panels {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px;
  margin-bottom: 18px;
}
.fpanel {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: panelIn .5s both;
  animation-delay: calc(var(--i) * 70ms);
  display: flex; flex-direction: column;
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.fpanel-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 13px 9px;
  border-bottom: 1px dashed var(--line-2);
  background: linear-gradient(180deg, var(--panel-2), transparent);
}
.fpanel-idx {
  font-family: var(--mono); font-size: 10px; color: var(--signal);
  border: 1px solid var(--signal-line); border-radius: 4px;
  padding: 1px 5px; background: var(--signal-soft);
}
.fpanel-head h3 {
  font-size: 13px; font-weight: 700; letter-spacing: .02em;
  text-transform: uppercase;
}
.fpanel-range {
  margin-left: auto; font-family: var(--mono); font-size: 10px;
  color: var(--ink-faint);
}
.fpanel-range em { font-style: normal; display: block; text-align: right; }

.fpanel-modes {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
  padding: 7px 7px 0;
}
.mode-btn {
  border: 1px solid transparent; background: var(--paper-2);
  font-size: 10.5px; font-weight: 600; font-family: var(--sans);
  color: var(--ink-soft); padding: 5px 2px; border-radius: 5px;
  cursor: pointer; transition: all .15s;
  text-transform: uppercase; letter-spacing: .03em;
}
.mode-btn:hover { color: var(--signal-deep); border-color: var(--signal-line); }
.mode-btn.active {
  background: var(--ink); color: #f4ead8; border-color: var(--ink);
}

.fpanel-body { padding: 12px 13px 14px; flex: 1; }
.fbody { display: none; }
.fbody.show { display: block; animation: fadeSlide .25s; }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(4px); } }
.fbody-every {
  font-family: var(--mono); font-size: 13px; color: var(--ink-faint);
  text-align: center; padding: 14px 0;
  border: 1.5px dashed var(--line-2); border-radius: var(--radius-sm);
}

.fselect {
  width: 100%; padding: 8px 10px;
  font-family: var(--mono); font-size: 14px;
  border: 1.5px solid var(--line-2); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink);
  cursor: pointer; transition: border-color .15s;
}
.fselect:hover, .fselect:focus { border-color: var(--signal); outline: none; }
.fbody-range, .fbody-step {
  display: none; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--ink-soft); font-family: var(--mono);
}
.fbody-range.show, .fbody-step.show { display: flex; flex-wrap: wrap; }
.fbody-range .fselect, .fbody-step .fselect { flex: 1; min-width: 0; }

.chip-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 3px;
}
.chip {
  border: 1px solid var(--line-2); background: var(--panel-2);
  font-family: var(--mono); font-size: 10.5px; padding: 5px 0;
  border-radius: 5px; cursor: pointer; color: var(--ink-soft);
  transition: all .12s;
}
.chip:hover { border-color: var(--signal); color: var(--signal-deep); }
.chip.on {
  background: var(--ink); color: #f4ead8; border-color: var(--ink);
}

/* ============ 表达式纸带 ============ */
.tape-section {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 14px;
  margin-bottom: 18px;
}
.tape-card, .runs-card {
  background: var(--panel); border: 1.5px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 18px 20px;
}
.card-kicker {
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint);
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.card-kicker::after { content: ''; flex: 1; border-top: 1px dashed var(--line-2); }

.expr-tape {
  display: flex; gap: 8px; align-items: stretch;
  background:
    repeating-linear-gradient(0deg, transparent 0 11px, rgba(35, 42, 49, .04) 11px 12px),
    var(--panel-2);
  border: 1.5px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 14px 16px;
  position: relative;
  overflow-x: auto;
}
.tape-cell {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  animation: panelIn .4s both; animation-delay: calc(var(--i) * 90ms);
  cursor: pointer; padding: 2px 10px; border-radius: 6px;
  transition: background .15s;
  background: transparent; border: none;
}
.tape-cell:hover { background: rgba(179, 84, 30, .07); }
.tape-cell b {
  font-family: var(--mono); font-size: 24px; font-weight: 600;
  color: var(--ink); letter-spacing: .02em;
  position: relative; padding: 2px 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: inset 0 -2px 0 rgba(35, 42, 49, .06);
}
.tape-cell em {
  font-style: normal; font-family: var(--mono); font-size: 9px;
  color: var(--ink-faint); text-transform: uppercase; letter-spacing: .1em;
}
.tape-cell[data-copy] { cursor: copy; }

.expr-desc {
  margin-top: 14px;
  font-family: var(--display); font-size: 18px; line-height: 1.45;
  color: var(--ink);
  border-left: 3px solid var(--signal);
  padding: 4px 0 4px 14px;
}
.copy-row { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--ink); background: var(--ink); color: #f4ead8;
  padding: 9px 18px; border-radius: var(--radius-sm); cursor: pointer;
  transition: all .15s;
  display: inline-flex; align-items: center; gap: 7px;
}
.btn:hover { background: var(--signal-deep); border-color: var(--signal-deep); }
.btn.ghost {
  background: transparent; color: var(--ink); border-color: var(--line-2);
}
.btn.ghost:hover { border-color: var(--signal); color: var(--signal-deep); background: var(--signal-soft); }
.btn.copied { background: var(--run); border-color: var(--run); }

/* 预设 */
.preset-row { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 16px; }
.preset-btn {
  font-family: var(--mono); font-size: 11px;
  border: 1px solid var(--line-2); background: var(--panel-2);
  color: var(--ink-soft); padding: 5px 11px; border-radius: 99px;
  cursor: pointer; transition: all .15s;
}
.preset-btn:hover { border-color: var(--signal); color: var(--signal-deep); background: var(--signal-soft); }

/* ============ 执行时刻 ============ */
.runs-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.run-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 13px;
  animation: panelIn .4s both; animation-delay: calc(var(--i) * 90ms);
  cursor: pointer; transition: all .15s;
}
.run-item:hover { border-color: var(--signal); background: var(--signal-soft); }
.run-idx {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: #f4ead8; font-size: 10px;
  flex: none;
}
.run-item time { font-weight: 600; letter-spacing: .01em; }
.run-rel { margin-left: auto; font-size: 11px; color: var(--run); opacity: .85; }

/* ============ 逆向面板 ============ */
.rev-input-row { display: flex; gap: 8px; }
.expr-input {
  flex: 1; font-family: var(--mono); font-size: 17px;
  padding: 11px 14px;
  border: 1.5px solid var(--line-2); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); letter-spacing: .04em;
  transition: border-color .15s;
}
.expr-input:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-soft); }
.expr-input::placeholder { color: var(--ink-faint); }

.rev-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 14px;
  margin-top: 14px;
}
.rev-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rev-table th, .rev-table td { text-align: left; padding: 8px 10px; border-bottom: 1px dashed var(--line); vertical-align: top; }
.rev-table th { font-weight: 600; color: var(--ink-soft); white-space: nowrap; width: 1%; }
.rev-table td code {
  font-family: var(--mono); font-size: 13px; background: var(--panel-2);
  padding: 2px 8px; border-radius: 4px; border: 1px solid var(--line);
}
.alias-note {
  margin-top: 10px; font-family: var(--mono); font-size: 12px;
  color: var(--ink-soft); background: var(--run-soft);
  border: 1px dashed var(--run-line); border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.alias-note code { color: var(--ink); }

/* ============ 警告 ============ */
.warn-box { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.warn-item {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--warn-soft); border: 1px solid rgba(160, 100, 21, .25);
  border-radius: var(--radius-sm); padding: 10px 13px;
  animation: fadeSlide .3s;
}
.warn-item.err { background: rgba(171, 59, 46, .08); border-color: rgba(171, 59, 46, .3); }
.warn-tag {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--warn); white-space: nowrap;
  padding: 2px 7px; border: 1px solid rgba(160, 100, 21, .35); border-radius: 4px;
  background: rgba(160, 100, 21, .08);
}
.warn-item.err .warn-tag { color: var(--err); border-color: rgba(171, 59, 46, .4); background: rgba(171, 59, 46, .08); }
.warn-item p { font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; }

/* ============ 说明区（SEO） ============ */
.doc-section {
  margin: 40px 0 26px;
  background: var(--panel); border: 1.5px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.doc-head {
  padding: 16px 26px; border-bottom: 1px solid var(--line);
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  background: linear-gradient(180deg, var(--panel-2), transparent);
}
.doc-head h2 { font-family: var(--display); font-size: 22px; font-weight: 600; }
.doc-head span { font-size: 12.5px; color: var(--ink-faint); font-family: var(--mono); }
.doc-body { padding: 22px 26px 26px; display: grid; gap: 18px; }
.doc-body h3 { font-size: 15.5px; font-weight: 700; margin-bottom: 6px; display: flex; gap: 8px; align-items: baseline; }
.doc-body h3 .no { font-family: var(--mono); font-size: 11px; color: var(--signal); }
.doc-body p { color: var(--ink-soft); font-size: 14px; max-width: 72ch; }
.doc-body code, .inline-code {
  font-family: var(--mono); font-size: .92em;
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 4px; color: var(--ink);
}
.doc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 28px; }

/* 速查表 */
.cheat-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cheat-table th, .cheat-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.cheat-table th {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--ink-faint);
}
.cheat-table td:first-child code {
  font-family: var(--mono); font-size: 13px; background: var(--signal-soft);
  border: 1px solid var(--signal-line); color: var(--signal-deep);
  padding: 2px 8px; border-radius: 4px; white-space: nowrap;
}

/* ============ FAQ ============ */
.faq-list { display: flex; flex-direction: column; }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item:last-child { border-bottom: none; }
.faq-item summary {
  cursor: pointer; list-style: none;
  padding: 13px 4px; font-weight: 600; font-size: 14.5px;
  display: flex; align-items: center; gap: 10px;
  transition: color .15s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: '+'; font-family: var(--mono); color: var(--signal);
  font-size: 16px; width: 18px; flex: none;
  transition: transform .2s;
}
.faq-item[open] summary::before { transform: rotate(45deg); }
.faq-item summary:hover { color: var(--signal-deep); }
.faq-item .faq-a { padding: 0 4px 14px 32px; color: var(--ink-soft); font-size: 14px; max-width: 75ch; }

/* ============ 页脚 ============ */
.site-foot {
  margin-top: 44px; border-top: 1.5px solid var(--line);
  background: linear-gradient(180deg, transparent, rgba(35, 42, 49, .025));
}
.foot-inner {
  padding: 26px 0 30px;
  display: flex; gap: 26px; flex-wrap: wrap; align-items: flex-start;
}
.foot-brand { display: flex; align-items: center; gap: 10px; }
.foot-brand img { width: 30px; height: 30px; }
.foot-brand span { font-family: var(--display); font-size: 16px; font-weight: 600; }
.foot-note { color: var(--ink-faint); font-size: 12px; max-width: 46ch; }
.foot-links { margin-left: auto; display: flex; gap: 18px; flex-wrap: wrap; }
.foot-links a { font-size: 12.5px; color: var(--ink-soft); }
.foot-copy { width: 100%; padding-top: 14px; border-top: 1px dashed var(--line); color: var(--ink-faint); font-size: 11.5px; font-family: var(--mono); }

/* ============ 移动端 ============ */
.menu-btn { display: none; }
@media (max-width: 1080px) {
  .field-panels { grid-template-columns: repeat(3, 1fr); }
  .tape-section { grid-template-columns: 1fr; }
  .rev-grid { grid-template-columns: 1fr; }
  .doc-cols { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .container { padding: 0 16px; }
  .head-inner { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 10px; }
  .brand img { width: 32px; height: 32px; }
  .brand-name { font-size: 18px; }
  .head-tag { display: none; }
  .head-nav { display: none; }
  .menu-btn {
    display: grid; place-items: center;
    width: 42px; height: 42px;
    border: 1.5px solid var(--line-2); background: var(--panel);
    border-radius: 9px; cursor: pointer;
    margin-left: auto;
  }
  .menu-btn span {
    display: block; width: 18px; height: 2px; background: var(--ink);
    position: relative;
  }
  .menu-btn span::before, .menu-btn span::after {
    content: ''; position: absolute; left: 0; width: 18px; height: 2px; background: var(--ink);
  }
  .menu-btn span::before { top: -6px; }
  .menu-btn span::after { top: 6px; }
  .head-nav.open {
    display: flex; flex-direction: column; align-items: flex-start;
    gap: 12px; width: 100%; padding: 12px 0 4px;
    border-top: 1px dashed var(--line); margin-left: 0;
  }
  .control-clock { order: 5; }
  .hero-strip h1 { font-size: 24px; }
  .hero-strip { padding-top: 18px; }
  .field-panels { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .fpanel-modes { grid-template-columns: repeat(3, 1fr); }
  .fpanel-body { padding: 10px; }
  .tape-card, .runs-card { padding: 14px; }
  .tape-cell b { font-size: 18px; }
  .expr-desc { font-size: 15.5px; }
  .expr-input { font-size: 16px; }
  .doc-head, .doc-body { padding-left: 16px; padding-right: 16px; }
  .btn { padding: 10px 16px; font-size: 13px; min-height: 44px; }
  .mode-tab { padding: 9px 16px; }
}
@media (max-width: 400px) {
  .field-panels { grid-template-columns: 1fr; }
}
@media (hover: none) {
  .tape-cell:hover, .run-item:hover, .chip:hover, .mode-btn:hover { background: revert; }
  .btn:hover { background: var(--ink); border-color: var(--ink); }
}
