/* =========================================================
   IMAGE → ASCII · Cyberpunk / Terminal teardown
   Replicating the imagetoascii.app aesthetic
   ========================================================= */

:root {
  --bg:        #0d0e15;   /* 极深底色 */
  --bg-2:      #12131d;
  --panel:     #0f1119;
  --line:      #1f2430;
  --accent:    #00ff66;   /* 经典黑客绿 */
  --accent-2:  #00e5ff;   /* 霓虹蓝 */
  --accent-3:  #ff7a1a;   /* 亮橙 */
  --text:      #c8f7d8;
  --text-dim:  #6f7d78;
  --white:     #eafff2;
  --mono: 'Fira Code', 'JetBrains Mono', 'Courier New', monospace;
  --glow: 0 0 6px rgba(0,255,102,.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--mono);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
  position: relative;
  /* 细密科技网格背景 */
  background-image:
    linear-gradient(rgba(0,255,102,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,102,.035) 1px, transparent 1px);
  background-size: 34px 34px;
}

::selection { background: var(--accent); color: #000; }

/* ---------- 全局 CRT / 扫描线覆盖层 ---------- */
.crt-overlay {
  position: fixed; inset: 0; z-index: 900; pointer-events: none;
  background:
    linear-gradient(rgba(18,16,16,0) 50%, rgba(0,0,0,.18) 50%),
    linear-gradient(90deg, rgba(255,0,0,.04), rgba(0,255,0,.015), rgba(0,0,255,.04));
  background-size: 100% 3px, 6px 100%;
  mix-blend-mode: overlay;
  opacity: .55;
}
.scanline-sweep {
  position: fixed; inset: 0; z-index: 901; pointer-events: none;
  background: linear-gradient(to bottom,
    rgba(0,255,102,0) 0%, rgba(0,255,102,.06) 45%,
    rgba(0,255,102,.10) 50%, rgba(0,255,102,.06) 55%, rgba(0,255,102,0) 100%);
  height: 45vh;
  animation: sweep 8s linear infinite;
  mix-blend-mode: screen;
}
@keyframes sweep {
  0%   { transform: translateY(-60vh); }
  100% { transform: translateY(160vh); }
}
.vignette {
  position: fixed; inset: 0; z-index: 899; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%);
}

@media (prefers-reduced-motion: reduce) {
  .scanline-sweep, .neon-text, .blink, .hero__title { animation: none !important; }
}

/* ---------- 顶部状态栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 800;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .7rem 1.4rem;
  background: rgba(13,14,21,.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  font-size: .8rem;
}
.topbar__left { display: flex; align-items: center; gap: .5rem; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot--r { background: #ff5f56; } .dot--y { background: #ffbd2e; } .dot--g { background: #27c93f; }
.topbar__path { color: var(--text-dim); margin-left: .5rem; }
.topbar__nav { display: flex; gap: 1.1rem; }
.topbar__nav a { color: var(--text-dim); text-decoration: none; transition: color .2s, text-shadow .2s; }
.topbar__nav a:hover { color: var(--accent); text-shadow: var(--glow); }
.topbar__right { color: var(--accent); font-size: .75rem; letter-spacing: 1px; white-space: nowrap; }
.blink { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- 通用 ---------- */
main { max-width: 1100px; margin: 0 auto; padding: 0 1.4rem; }
.section { padding: 4.5rem 0; border-top: 1px dashed var(--line); }
.section:first-of-type { border-top: none; }
.dim { color: var(--text-dim); font-weight: 400; }
.hl { color: var(--accent); text-shadow: var(--glow); }
code {
  font-family: var(--mono);
  background: rgba(0,255,102,.08);
  color: var(--accent);
  padding: .1em .4em; border-radius: 3px; font-size: .9em;
}
strong, b { color: var(--white); }

/* ---------- 霓虹发光文本 ---------- */
.neon-text {
  color: var(--white);
  text-shadow:
    0 0 5px  #fff,
    0 0 10px var(--accent),
    0 0 20px var(--accent),
    0 0 42px var(--accent);
  animation: flux 2.4s infinite alternate;
}
@keyframes flux {
  0%   { opacity: .92; }
  100% { opacity: 1; text-shadow: 0 0 5px #fff, 0 0 16px var(--accent), 0 0 34px var(--accent); }
}

/* ---------- 霓虹容器 ---------- */
.neon-box {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid rgba(0,255,102,.35);
  border-radius: 6px;
  box-shadow: 0 0 12px rgba(0,255,102,.12), inset 0 0 14px rgba(0,255,102,.06);
  transition: box-shadow .3s, border-color .3s, transform .3s;
}
.neon-box:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(0,255,102,.28), inset 0 0 18px rgba(0,255,102,.1);
}

/* ---------- HERO ---------- */
.hero {
  position: relative; text-align: center;
  padding: 7rem 0 5rem; overflow: hidden;
}
.hero__grid {
  position: absolute; inset: -50% 0; z-index: -1;
  background-image:
    linear-gradient(rgba(0,229,255,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,255,.06) 1px, transparent 1px);
  background-size: 46px 46px;
  transform: perspective(400px) rotateX(60deg);
  mask-image: linear-gradient(to bottom, transparent, #000 40%, transparent 90%);
}
.hero__kicker { color: var(--accent-2); letter-spacing: 3px; font-size: .8rem; margin-bottom: 1.2rem; }
.hero__title {
  font-size: clamp(2.2rem, 7vw, 5rem);
  font-weight: 700; letter-spacing: 2px; line-height: 1.05;
  margin-bottom: 1.4rem;
}
.hero__sub { max-width: 640px; margin: 0 auto 2rem; color: var(--text); font-size: 1.02rem; }
.hero__cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 2.4rem; }
.hero__tags { display: flex; gap: .55rem; justify-content: center; flex-wrap: wrap; }
.tag {
  font-size: .72rem; padding: .28rem .7rem; border: 1px solid var(--line);
  border-radius: 999px; color: var(--text-dim); background: rgba(255,255,255,.02);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block; cursor: pointer; text-decoration: none;
  font-family: var(--mono); font-size: .88rem; font-weight: 500;
  color: var(--accent); background: transparent;
  border: 1px solid var(--accent); border-radius: 4px;
  padding: .6rem 1.3rem;
  transition: all .2s ease;
  position: relative;
}
.btn:hover {
  background: rgba(0,255,102,.12);
  box-shadow: 0 0 14px rgba(0,255,102,.4);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0) scale(.98); }
.btn--primary { background: var(--accent); color: #041207; font-weight: 700; box-shadow: 0 0 16px rgba(0,255,102,.5); }
.btn--primary:hover { background: #4dff99; }
.btn--sm { padding: .38rem .8rem; font-size: .78rem; }

/* ---------- 段落标题 ---------- */
.section__head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.2rem; }
.section__idx {
  font-size: 1rem; color: var(--accent); font-weight: 700;
  border: 1px solid var(--accent); border-radius: 4px; padding: .1rem .5rem;
  box-shadow: var(--glow);
}
.section__title { font-size: clamp(1.4rem, 3.4vw, 2.1rem); font-weight: 700; color: var(--white); letter-spacing: 1px; }
.section__lead { max-width: 760px; color: var(--text); margin-bottom: 2rem; }
.tip { border-left: 3px solid var(--accent-3); padding-left: 1rem; }

/* ---------- DEMO ---------- */
.demo {
  display: grid; grid-template-columns: 320px 1fr; gap: 0;
  overflow: hidden; margin-bottom: .8rem;
}
.demo__controls { padding: 1.4rem; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 1.2rem; }
.drop {
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
  padding: 1.6rem 1rem; text-align: center; cursor: pointer;
  border: 1.5px dashed rgba(0,255,102,.4); border-radius: 6px;
  transition: all .2s; color: var(--text-dim);
}
.drop:hover, .drop.drag { border-color: var(--accent); background: rgba(0,255,102,.07); color: var(--accent); box-shadow: inset 0 0 18px rgba(0,255,102,.12); }
.drop__icon { font-size: 1.8rem; color: var(--accent); }
.drop__text { color: var(--white); font-size: .9rem; }
.drop__hint { font-size: .72rem; }

.ctrl { display: flex; flex-direction: column; gap: 1rem; }
.ctrl__row { display: flex; flex-direction: column; gap: .4rem; }
.ctrl__row label { font-size: .8rem; color: var(--text-dim); display: flex; justify-content: space-between; }
.ctrl__row label b { color: var(--accent); }
.ctrl__row--inline { flex-direction: row; gap: 1.2rem; }
.switch { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--text); cursor: pointer; }
.switch input { accent-color: var(--accent); }
select {
  font-family: var(--mono); background: var(--bg); color: var(--accent);
  border: 1px solid var(--line); border-radius: 4px; padding: .4rem; font-size: .82rem;
}
select:focus { outline: none; border-color: var(--accent); }
.ctrl__actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .2rem; }

/* 定制化 range 滑块 */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--line));
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); border: 2px solid #041207;
  box-shadow: 0 0 10px var(--accent); transition: transform .12s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.25); }
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid #041207;
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
}

.demo__output { overflow: auto; background: #06070c; }
.ascii {
  font-family: var(--mono); font-size: 6px; line-height: 6px;
  letter-spacing: 0; white-space: pre; color: var(--accent);
  text-shadow: 0 0 3px rgba(0,255,102,.5);
  padding: 1rem; min-height: 360px; margin: 0;
  transition: font-size .1s;
}
.footnote { font-size: .78rem; color: var(--text-dim); text-align: right; }

/* ---------- 卡片 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.2rem; }
.card { padding: 1.5rem; }
.card h3 { color: var(--accent); font-size: 1.05rem; margin-bottom: .7rem; text-shadow: var(--glow); }
.card p { font-size: .92rem; margin-bottom: .8rem; }
.swatches { display: flex; flex-wrap: wrap; gap: .5rem; }
.sw {
  font-size: .68rem; padding: .3rem .55rem; border-radius: 3px;
  border: 1px solid var(--line); color: var(--white);
}
.sw::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--c); margin-right: .4rem; vertical-align: middle; box-shadow: 0 0 8px var(--c); }
.demo-inline { font-size: 2rem; text-align: center; margin: .5rem 0; }
.range-demo { padding-top: .4rem; }

/* ---------- 原理拆解 deepdive ---------- */
.deepdive { margin-top: 2.6rem; }
.deepdive__title { font-size: 1.15rem; color: var(--accent-2); text-shadow: 0 0 8px rgba(0,229,255,.4); margin-bottom: .8rem; letter-spacing: .5px; }
.deepdive__intro { max-width: 820px; color: var(--text); margin-bottom: 1.6rem; }
.deepdive__intro em { color: var(--accent); font-style: normal; text-shadow: var(--glow); }

.principle { display: flex; gap: 1.2rem; padding: 1.5rem 1.7rem; margin-bottom: 1.1rem; align-items: flex-start; }
.principle__tag {
  flex: none; font-size: .85rem; font-weight: 700; color: var(--accent-2);
  border: 1px solid var(--accent-2); border-radius: 4px; padding: .15rem .5rem;
  box-shadow: 0 0 8px rgba(0,229,255,.35); margin-top: .2rem;
}
.principle__body { min-width: 0; }
.principle__body h4 { color: var(--white); font-size: 1.05rem; margin-bottom: .7rem; letter-spacing: .3px; }
.principle__body h4 code, .principle__body p code { font-size: .84em; }
.principle__body p { font-size: .93rem; margin-bottom: .8rem; }
.principle__body p:last-child { margin-bottom: 0; }
.center { text-align: center; }

/* 配色刻度条 */
.swatch-scale { display: flex; align-items: center; gap: 0; border-radius: 4px; overflow: hidden; margin-top: .4rem; flex-wrap: wrap; }
.swatch-scale span { width: 46px; height: 26px; background: var(--c); flex: none; }
.swatch-scale em { font-style: normal; color: var(--text-dim); font-size: .72rem; margin-left: .8rem; }

/* 发光层拆解 */
.glow-anatomy { display: flex; flex-direction: column; gap: .35rem; margin: .4rem 0 1rem; }
.glow-layer { display: flex; align-items: baseline; gap: .8rem; font-size: .82rem; padding: .3rem .6rem; border-left: 2px solid var(--accent); background: rgba(0,255,102,.04); }
.glow-layer b { color: var(--accent); font-family: var(--mono); min-width: 130px; }
.glow-layer span { color: var(--text-dim); }

/* mini list */
.mini-list { list-style: none; display: flex; flex-direction: column; gap: .6rem; margin: .2rem 0 1rem; }
.mini-list li { position: relative; padding-left: 1.2rem; font-size: .9rem; }
.mini-list li::before { content: "▸"; position: absolute; left: 0; color: var(--accent); }

/* blend 公式 */
.blend-formula {
  display: flex; flex-wrap: wrap; align-items: center; gap: .8rem;
  background: #07080d; border: 1px solid var(--line); border-radius: 5px;
  padding: .8rem 1rem; margin: .2rem 0 1rem;
}
.blend-formula code { font-size: .95rem; color: var(--accent-2); background: none; }
.blend-formula span { color: var(--text-dim); font-size: .8rem; }

/* z-index 层叠示意 */
.zstack { display: flex; flex-direction: column; gap: .4rem; margin: .8rem 0 .5rem; perspective: 600px; }
.zstack__layer {
  padding: .6rem 1rem; border-radius: 5px; font-size: .84rem; color: var(--white);
  border: 1px solid var(--line); transform: rotateX(32deg); transform-origin: center;
}
.zstack .z3 { background: rgba(0,229,255,.14); border-color: var(--accent-2); box-shadow: 0 0 14px rgba(0,229,255,.3); }
.zstack .z2 { background: rgba(0,255,102,.10); border-color: rgba(0,255,102,.5); }
.zstack .z1 { background: rgba(0,255,102,.18); border-color: var(--accent); box-shadow: 0 0 14px rgba(0,255,102,.3); }
.zstack__layer code { font-size: .82em; }

/* ---------- 学习指引 learn ---------- */
.principle__body a { color: var(--accent-2); text-decoration: none; border-bottom: 1px dashed rgba(0,229,255,.5); }
.principle__body a:hover { text-shadow: 0 0 8px rgba(0,229,255,.5); }
.tipline { border-left: 3px solid var(--accent-3); padding-left: .9rem; margin-top: .4rem; }

/* AI 四步流程 */
.ai-flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .7rem; margin: .3rem 0 1rem; }
.ai-step { padding: .8rem .9rem; border: 1px solid var(--line); border-radius: 5px; background: rgba(0,255,102,.03); }
.ai-step b { display: block; color: var(--accent); margin-bottom: .35rem; font-size: .92rem; }
.ai-step span { font-size: .82rem; color: var(--text-dim); line-height: 1.5; }
.ai-step strong { color: var(--white); }

/* 学习顺序 */
.learn-order { margin: .2rem 0 1rem 1.2rem; display: flex; flex-direction: column; gap: .5rem; }
.learn-order li { font-size: .92rem; padding-left: .3rem; }
.learn-order li::marker { color: var(--accent); font-weight: 700; }

/* 别学的 */
.dontlearn { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin: .4rem 0 .8rem; font-size: .88rem; }
.dontlearn b { color: var(--accent-3); }
.strike {
  font-size: .78rem; padding: .22rem .6rem; border-radius: 3px;
  border: 1px solid var(--line); color: var(--text-dim); text-decoration: line-through;
  text-decoration-color: var(--accent-3);
}

/* 练习高亮 */
.hlcode { color: #fff; background: rgba(255,45,120,.25); padding: 0 .2em; border-radius: 2px; text-shadow: 0 0 8px #ff2d78; }
.exercise { margin: .6rem 0 1rem; }

/* 学习路径链 */
.learn-path { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin: .3rem 0 .6rem; }
.learn-path span {
  font-size: .8rem; padding: .35rem .75rem; border-radius: 999px;
  border: 1px solid var(--accent); color: var(--accent); background: rgba(0,255,102,.06);
}
.learn-path i { color: var(--text-dim); font-style: normal; }

/* ---------- split ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.split__item { padding: 1.5rem; }
.split__item h3 { color: var(--accent-2); margin-bottom: .6rem; text-shadow: 0 0 6px rgba(0,229,255,.4); }

/* ---------- steps ---------- */
.steps { list-style: none; display: flex; flex-direction: column; gap: 1rem; }
.step { display: flex; gap: 1.2rem; padding: 1.4rem 1.6rem; align-items: flex-start; }
.step__n {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 1.1rem;
  color: #041207; background: var(--accent); box-shadow: 0 0 14px var(--accent);
}
.step h3 { color: var(--white); font-size: 1.05rem; margin-bottom: .4rem; }
.formula { font-size: 1.05rem; margin-top: .6rem; }
.charmap { font-size: 1.4rem; letter-spacing: .5rem; color: var(--accent); text-shadow: var(--glow); margin: .6rem 0 .2rem; }

/* ---------- fonts ---------- */
.fonts { display: flex; gap: 1rem; flex-wrap: wrap; }
.fontcard {
  flex: 1; min-width: 180px; text-align: center; padding: 1.2rem;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel);
  color: var(--white); font-size: .95rem;
}
.fontcard code { display: inline-block; margin-top: .6rem; font-size: 1.3rem; }
.fonts .fontcard:nth-child(1) { font-family: 'Fira Code', monospace; }
.fonts .fontcard:nth-child(2) { font-family: 'JetBrains Mono', monospace; }
.fonts .fontcard:nth-child(3) { font-family: 'Courier New', monospace; }

/* ---------- code blocks ---------- */
.codeblock { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-bottom: 1.4rem; background: #07080d; }
.codeblock__bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: .5rem .9rem; background: var(--bg-2); border-bottom: 1px solid var(--line);
  font-size: .78rem; color: var(--text-dim);
}
.codeblock pre { padding: 1.1rem; overflow-x: auto; }
.codeblock code { background: none; color: #9defc0; padding: 0; font-size: .82rem; line-height: 1.6; }

/* ---------- summary / footer ---------- */
.summary { text-align: center; }
.summary .section__title { margin-bottom: 1.2rem; display: inline-block; }
.summary p { max-width: 720px; margin: 0 auto; }
.footer {
  text-align: center; padding: 2.4rem 1rem; border-top: 1px solid var(--line);
  color: var(--text-dim); font-size: .78rem;
  display: flex; gap: .4rem; justify-content: center; align-items: center;
}
.footer__blink { color: var(--accent); }

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
  .demo { grid-template-columns: 1fr; }
  .demo__controls { border-right: none; border-bottom: 1px solid var(--line); }
  .split { grid-template-columns: 1fr; }
  .topbar__nav { display: none; }
}
