/* fourier.css —— 傅里叶变换动画页。配色变量与 style.css / rnn-base.css 同源 */
:root{
  color-scheme:dark;
  --bg:#0a0d13; --panel:#0f141e; --line:#1f2a3c; --line-soft:#182334;
  --txt:#e2eaf6; --dim:#8d9bb1; --txt2:#9fb2cb;
  --accent:#5aa7ff; --gold:#ffb547; --violet:#b98cff; --green:#5fd6a5; --red:#ff6b6b;
  --btn-bg:#121a26; --btn-bd:#2c3d55; --chip-on-bg:rgba(90,167,255,.16); --chip-on-txt:#cfe4ff;
  --math:"Cambria Math","Latin Modern Math",Georgia,"Times New Roman",serif;
}
[data-theme="light"]{
  color-scheme:light;
  --bg:#eef1f6; --panel:#fff; --line:#dde3ec; --line-soft:#e6ebf2;
  --txt:#16203a; --dim:#5c6b87; --txt2:#4a5b78;
  --accent:#1157d8; --gold:#b45309; --violet:#7c3aed; --green:#0c8a5b; --red:#d92d20;
  --btn-bg:#fff; --btn-bd:#c9d4e6; --chip-on-bg:rgba(17,87,216,.10); --chip-on-txt:#1157d8;
}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{
  background:var(--bg); color:var(--txt); overflow:hidden;
  display:flex; flex-direction:column;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  -webkit-font-smoothing:antialiased;
}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
.hidden{display:none !important}

/* ---------------- 顶栏 ---------------- */
#bar{
  flex:none; display:flex; align-items:center; gap:9px; flex-wrap:wrap;
  padding:8px 14px; border-bottom:1px solid var(--line); background:var(--panel);
  min-height:50px;
}
.brand{
  font-weight:800; font-size:15px; letter-spacing:.02em; color:var(--txt); text-decoration:none;
  display:flex; align-items:baseline; gap:7px; white-space:nowrap;
}
.brand .dim{font-weight:500; font-size:12px; color:var(--dim); letter-spacing:0}
.spacer{flex:1}
.stat{font-size:12px; color:var(--txt2); font-variant-numeric:tabular-nums; white-space:nowrap}
.stat b{color:var(--txt); font-weight:650}

#bar select{
  height:32px; padding:0 8px; background:var(--btn-bg); color:var(--txt2);
  border:1px solid var(--line); border-radius:8px; font:inherit; font-size:12.5px;
  font-weight:600; cursor:pointer;
}
#bar select:hover{border-color:var(--btn-bd); color:var(--txt)}
.up{
  height:32px; padding:0 11px; display:inline-flex; align-items:center; gap:6px;
  background:var(--btn-bg); border:1px solid var(--line); border-radius:8px;
  color:var(--txt2); font-size:12.5px; font-weight:600; cursor:pointer; white-space:nowrap;
}
.up:hover{border-color:var(--btn-bd); color:var(--txt)}
.up svg{width:15px; height:15px}

button.icon{
  width:32px; height:32px; display:grid; place-items:center; padding:0; flex:none;
  background:var(--btn-bg); border:1px solid var(--line); border-radius:8px; cursor:pointer;
}
button.icon svg{width:16px; height:16px; fill:none; stroke:var(--txt2); stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round}
button.icon:hover{border-color:var(--btn-bd)}
button.icon:hover svg{stroke:var(--txt)}
.i-moon{display:none}
[data-theme="dark"] .i-sun{display:none}
[data-theme="dark"] .i-moon{display:block}

/* ---------------- 三栏 ---------------- */
#wrap{
  flex:1; min-height:0;
  display:grid; grid-template-columns:272px minmax(0,1fr) 336px;
}
#left,#right{overflow-y:auto; overflow-x:hidden; background:var(--panel)}
#left{border-right:1px solid var(--line)}
#right{border-left:1px solid var(--line)}

.panel{padding:12px 14px; border-bottom:1px solid var(--line-soft)}
.panel:last-child{border-bottom:0}
.phead{
  margin:0 0 10px; font-size:12px; font-weight:700; letter-spacing:.06em;
  color:var(--dim); text-transform:uppercase;
  display:flex; align-items:center; gap:8px; flex-wrap:wrap;
}

/* ---------------- 分段按钮 ---------------- */
.seg{display:inline-flex; background:var(--btn-bg); border:1px solid var(--line); border-radius:9px;
  padding:2px; gap:2px; margin-left:auto}
.seg button{
  border:0; background:transparent; color:var(--txt2); font:inherit; font-size:12px; font-weight:650;
  padding:4px 10px; border-radius:7px; cursor:pointer; letter-spacing:.02em; white-space:nowrap;
}
.seg button:hover{color:var(--txt)}
.seg button.on{background:var(--chip-on-bg); color:var(--chip-on-txt)}
.seg.mini button{padding:3px 8px; font-size:11.5px}

/* ---------------- 左栏：预览与滑块 ---------------- */
.pvbox{
  height:186px; display:grid; place-items:center; border-radius:10px;
  background:var(--bg); border:1px solid var(--line-soft); overflow:hidden;
}
#pv{display:block; width:100%; height:100%}
.pn{margin:8px 0 0; font-size:11px; color:var(--dim); line-height:1.5}
.hint{margin:9px 0 0; font-size:11px; color:var(--dim); line-height:1.55}

.row{display:grid; grid-template-columns:46px 1fr 42px; align-items:center; gap:8px; margin-bottom:9px}
.row label{font-size:12px; color:var(--txt2); cursor:help}
.row b{font-size:11.5px; color:var(--txt); text-align:right; font-variant-numeric:tabular-nums; font-weight:650}
.row b.over{color:var(--gold)}

/* 显示圆：点这一行选中，之后 A/D 或 ←/→ 逐个调 */
#rowWheel{border-radius:7px; cursor:pointer; transition:background .15s}
#rowWheel:hover{background:var(--chip-on-bg)}
#rowWheel.sel{background:var(--chip-on-bg); box-shadow:inset 0 0 0 1.5px var(--accent)}
#rowWheel.sel label{color:var(--txt)}
#rowWheel.sel b{color:var(--accent)}
#rowWheel .khint{display:none; grid-column:1/-1; font-style:normal; font-size:10px;
  line-height:1.5; color:var(--accent); opacity:.9; letter-spacing:.2px}
#rowWheel.sel .khint{display:block}
input[type=range]{
  -webkit-appearance:none; appearance:none; width:100%; height:18px; background:transparent; cursor:pointer;
}
input[type=range]::-webkit-slider-runnable-track{height:4px; border-radius:2px; background:var(--line)}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none; width:13px; height:13px; margin-top:-4.5px; border-radius:50%;
  background:var(--accent); border:0;
}
input[type=range]::-moz-range-track{height:4px; border-radius:2px; background:var(--line)}
input[type=range]::-moz-range-thumb{width:13px; height:13px; border:0; border-radius:50%; background:var(--accent)}

.wide{
  width:100%; height:32px; margin-top:2px;
  background:var(--btn-bg); border:1px solid var(--line); border-radius:8px;
  color:var(--txt2); font:inherit; font-size:12.5px; font-weight:650; cursor:pointer;
}
.wide:hover{border-color:var(--btn-bd); color:var(--txt)}
.wide:active{background:var(--chip-on-bg)}

/* ---------------- 中栏：画布 ---------------- */
#center{display:flex; flex-direction:column; min-width:0; min-height:0}
#stage{flex:1; min-height:0; position:relative; overflow:hidden}
#cv{display:block; width:100%; height:100%}
#drop{
  position:absolute; inset:10px; display:grid; place-items:center;
  border:2px dashed var(--accent); border-radius:14px;
  background:rgba(90,167,255,.08); color:var(--accent);
  font-size:15px; font-weight:700; pointer-events:none;
}

#playbar{
  flex:none; display:flex; align-items:center; gap:10px;
  padding:8px 12px; border-top:1px solid var(--line); background:var(--panel);
}
#play .i-pause{display:none}
body.playing #play .i-play{display:none}
body.playing #play .i-pause{display:block}
.spd{display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--txt2); white-space:nowrap; flex:1; min-width:140px}
.spd input{flex:1; width:auto; min-width:100px}
.spd b{font-weight:650; color:var(--txt); font-variant-numeric:tabular-nums; min-width:34px; text-align:right}
#prog{
  flex:0 0 92px; min-width:0; height:18px; position:relative; cursor:pointer; display:flex; align-items:center;
}
#prog::before{content:''; position:absolute; left:0; right:0; height:4px; border-radius:2px; background:var(--line)}
#progFill{position:relative; height:4px; border-radius:2px; background:var(--accent); width:0}
#pstat{font-size:11.5px; color:var(--txt2); min-width:118px; text-align:right; font-variant-numeric:tabular-nums}

/* ---------------- 右栏：公式 ---------------- */
.eqs{display:flex; flex-direction:column; gap:9px}
.eqc{
  position:relative; padding:9px 10px 9px 26px; border-radius:9px;
  background:var(--bg); border:1px solid var(--line-soft);
  transition:border-color .2s, background .2s;
}
.eqc.on{border-color:var(--accent); background:var(--chip-on-bg)}
.eqn{
  position:absolute; left:8px; top:9px; width:14px; height:14px; border-radius:50%;
  display:grid; place-items:center; font-size:9.5px; font-weight:800;
  background:var(--line); color:var(--txt2);
}
.eqc.on .eqn{background:var(--accent); color:#fff}
.eq{
  font-family:var(--math); font-size:15px; line-height:1.9; color:var(--txt);
  overflow-x:auto; white-space:nowrap; padding-bottom:1px;
}
.eq i{font-family:var(--math); font-style:italic}
.eq sub,.eq sup{font-size:.66em; font-style:normal}
.eq sub{vertical-align:-.28em}
.eq sup{vertical-align:.5em}
.eqd{margin:5px 0 0; font-size:11.5px; line-height:1.6; color:var(--dim)}

/* 求和号：Σ + 右上/右下两个小标注 */
.sum{display:inline-flex; align-items:center; vertical-align:middle; margin:0 4px}
.sum .op{font-family:var(--math); font-size:1.55em; line-height:.9}
.sum .lim{
  display:inline-flex; flex-direction:column; align-items:flex-start;
  font-size:.58em; line-height:1.25; margin-left:2px; font-style:normal;
}
.sum .lim em{display:block; font-style:normal}

/* 分数：上下两行 + 中间一根线 */
.frac{
  display:inline-flex; flex-direction:column; align-items:center; vertical-align:middle;
  margin:0 3px; font-size:.85em; line-height:1.2;
}
.frac>span:first-child{border-bottom:1px solid currentColor; padding:0 .4em}
.frac>span:last-child{padding:0 .4em}

/* ---------------- 右栏：频谱与读数 ---------------- */
.spbox{height:112px; border-radius:9px; background:var(--bg); border:1px solid var(--line-soft); overflow:hidden}
#sp{display:block; width:100%; height:100%; cursor:ew-resize; touch-action:none}

.kv{display:grid; grid-template-columns:1fr auto; gap:6px 10px; margin:0; font-size:12px}
.kv dt{color:var(--dim)}
.kv dd{margin:0; text-align:right; color:var(--txt); font-variant-numeric:tabular-nums; font-weight:650}

/* ---------------- 窄屏 ---------------- */
@media (max-width:1180px){
  #wrap{grid-template-columns:250px minmax(0,1fr)}
  #right{
    grid-column:1 / -1; border-left:0; border-top:1px solid var(--line);
    display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr));
    max-height:34vh;
  }
  .panel{border-bottom:0; border-right:1px solid var(--line-soft)}
}
@media (max-width:820px){
  body{overflow:auto}
  #wrap{display:flex; flex-direction:column}
  #left,#right,#center{border:0; max-height:none}
  /* 竖排时侧栏不要被 flex 压扁（否则预览框只剩 130px 还要内部滚动），整页一起滚 */
  #left,#right{flex:none}
  #left{border-bottom:1px solid var(--line); order:2}
  #right{order:3; border-top:1px solid var(--line)}
  #center{order:1; height:62vh; min-height:340px}
  #playbar{flex-wrap:wrap}
  #pstat{min-width:0; flex:1}
}

/* ---------------- 几何模式：不适用的控件置灰 ---------------- */
.row.off{opacity:.38; pointer-events:none}
.seg button:disabled{opacity:.32; cursor:not-allowed}
.seg button:disabled:hover{color:var(--txt2)}

/* ================= 返回首页（全站统一 · 2026-10-26） =================
   用户口径：所有网页的返回首页都放左上角第一个、位置不许随页面变；
   能点的链接鼠标上去必须有高亮，否则用户不知道那个东西能点。
   · 位置：各页顶栏的第一个子元素（JS 不生成、不浮动、不 sticky）
   · 悬停：淡金底 + 金色内描边 + 箭头左移；:focus-visible 给键盘用户 */
.bh-link{
  flex:none; display:inline-flex; align-items:center; gap:4px;
  padding:5px 10px 5px 8px; border-radius:8px; text-decoration:none;
  font-size:13px; font-weight:600; letter-spacing:.01em; white-space:nowrap;
  color:inherit; opacity:.78;
  transition:opacity .16s ease, background .16s ease, box-shadow .16s ease;
}
.bh-link .ar{display:inline-block; transition:transform .16s ease}
.bh-link:hover{
  opacity:1; background:rgba(203,165,94,.16);
  box-shadow:inset 0 0 0 1px rgba(203,165,94,.52);
}
.bh-link:hover .ar{transform:translateX(-2px)}
.bh-link:active{background:rgba(203,165,94,.26)}
.bh-link:focus-visible{outline:2px solid rgba(203,165,94,.75); outline-offset:2px}
