/* ============================================================
   KEYFORGE · 秘钥生成器
   暖纸色 / 橙铜强调 / 仪表盘式布局
   ============================================================ */

:root {
  --paper: #eeeae2;
  --paper-deep: #e6e1d6;
  --surface: #f8f6f2;
  --surface-hi: #fdfcf9;
  --ink: #2c2621;
  --ink-soft: #6d6155;
  --ink-faint: #837769;
  --line: #dfd8ca;
  --line-soft: #e8e2d7;
  --line-strong: #cfc6b5;
  --accent: #d45d35;
  --accent-deep: #b94a26;
  --accent-ink: #8f3a1c;
  --accent-wash: #f3ded3;
  --good: #4b7a50;
  --warn: #b67a22;
  --bad: #b0453a;
  --good-wash: #dce7d5;
  --warn-wash: #f6e9d5;
  --bad-wash: #f5e1dd;

  --r-lg: 26px;
  --r-md: 16px;
  --r-sm: 10px;

  --font-ui: "Microsoft YaHei", "微软雅黑", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  --font-display: "Microsoft YaHei", "微软雅黑", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-mono: "Microsoft YaHei", "微软雅黑", "PingFang SC", "Hiragino Sans GB", sans-serif;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  --shadow-forge: 0 40px 90px -55px rgba(70, 46, 22, 0.6), 0 2px 0 rgba(255, 255, 255, 0.7) inset;
  --shadow-pop: 0 18px 40px -24px rgba(44, 38, 33, 0.4);
}

/* ── Reset ────────────────────────────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background-color: var(--paper);
  /* 纸面颗粒：直接铺在根背景上，不再使用 fixed 覆盖层 */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E");
  background-attachment: fixed;
}

body {
  margin: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 注意：不要在这里写 overflow-x: hidden。
     它会把 body 变成滚动容器，部分浏览器会导致整页无法滚动。 */
}

h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea, button, kbd, code { font-family: inherit; }
code { font-family: var(--font-mono); }
svg { display: block; }
img { max-width: 100%; display: block; }

::selection { background: var(--accent-wash); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--paper);
  font-size: 13px; transition: top 0.2s var(--ease);
}
.skip:focus { top: 12px; }

.wrap { width: min(1160px, calc(100% - 48px)); margin-inline: auto; }

.ico { width: 16px; height: 16px; flex: none; }
.ico--xs { width: 13px; height: 13px; }

/* ── Topbar ───────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(238, 234, 226, 0.55);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease);
}
.topbar.is-stuck {
  background: rgba(238, 234, 226, 0.88);
  border-bottom-color: var(--line);
}
.topbar__inner { display: flex; align-items: center; gap: 30px; height: 64px; }

.brand { display: flex; align-items: center; gap: 9px; }
.brand__mark { width: 21px; height: 21px; color: var(--accent); }
.brand__name {
  font-size: 13.5px; font-weight: 700; letter-spacing: 0.14em;
}
.brand__cn {
  font-size: 11.5px; font-weight: 400; color: var(--ink-soft); letter-spacing: 0.04em;
  padding-left: 12px; margin-left: 3px; border-left: 1px solid var(--line-strong);
}

.nav { display: flex; gap: 24px; margin-left: auto; font-size: 13.5px; color: var(--ink-soft); }
.nav a { position: relative; padding: 4px 0; transition: color 0.16s; }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px;
  background: var(--accent); transition: right 0.28s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after { right: 0; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 99px;
  border: 1px solid var(--line); background: rgba(248, 246, 242, 0.75);
  font-size: 11.5px; color: var(--ink-soft); white-space: nowrap;
}
.pill i { width: 6px; height: 6px; border-radius: 50%; background: #5e8c5a; box-shadow: 0 0 0 3px rgba(94, 140, 90, 0.16); }

/* ── Hero ─────────────────────────────────────────────── */
.hero { position: relative; padding: 76px 0 54px; text-align: center; }
.hero::before {
  content: "";
  position: absolute; left: 50%; top: -220px; transform: translateX(-50%);
  width: min(980px, 100%); height: 620px; pointer-events: none;
  background: radial-gradient(50% 50% at 50% 50%, rgba(212, 93, 53, 0.15), rgba(212, 93, 53, 0) 72%);
}
.hero__inner { position: relative; display: flex; flex-direction: column; align-items: center; }

.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 12px; border-radius: 99px;
  border: 1px solid var(--line); background: rgba(248, 246, 242, 0.7);
  font-size: 12px; color: var(--ink-soft); letter-spacing: 0.01em;
  backdrop-filter: blur(6px);
}
.badge__dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 93, 53, 0.16);
}

.hero h1 {
  margin-top: 24px;
  font-size: clamp(38px, 5.3vw, 66px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 700;
}
.hero h1 em {
  font-style: normal;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
  padding: 0 0.02em;
}

.hero__lede {
  max-width: 660px; margin-top: 22px;
  font-size: 16px; line-height: 1.78; color: var(--ink-soft);
}
.hero__lede code {
  font-size: 0.86em; padding: 2px 6px; border-radius: 5px;
  background: rgba(44, 38, 33, 0.055); color: var(--ink);
}

.hero__meta {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px;
  list-style: none; margin-top: 26px; font-size: 12.5px; color: var(--ink-soft);
}
.hero__meta li { display: inline-flex; align-items: center; gap: 7px; }
.hero__meta li::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent); opacity: 0.55;
}

/* 被内嵌时（iframe 预览）改用 body 作为唯一滚动容器 */
html.is-embedded { height: 100%; overflow: hidden; }
html.is-embedded body {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* ── Section basics ───────────────────────────────────── */
.section { position: relative; padding: 92px 0; scroll-margin-top: 80px; }
.section--forge { padding-top: 26px; padding-bottom: 96px; }

.sec-head { display: flex; flex-direction: column; gap: 18px; max-width: 660px; margin-bottom: 46px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  font-weight: 500; color: var(--ink-faint);
}
.eyebrow i { width: 18px; height: 1px; background: var(--accent); }
.sec-title {
  font-size: clamp(28px, 3.4vw, 42px); line-height: 1.18;
  letter-spacing: -0.022em; font-weight: 700;
}

/* ── Forge card ───────────────────────────────────────── */
.forge-wrap { position: relative; }
.forge-wrap::before {
  content: "";
  position: absolute; inset: -50px 0 -70px; z-index: -1;
  background: radial-gradient(46% 54% at 50% 46%, rgba(212, 93, 53, 0.12), rgba(212, 93, 53, 0) 72%);
}
.forge {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, #fbf9f5 0%, #f6f3ed 100%);
  box-shadow: var(--shadow-forge);
  overflow: hidden;
}
.forge__bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(238, 234, 226, 0.5);
  font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing: 0.055em; color: var(--ink-faint);
  text-transform: uppercase;
}
.forge__bar b { font-weight: 600; color: var(--ink-soft); }
.forge__sep { opacity: 0.45; margin: 0 3px; }
.forge__status { display: inline-flex; align-items: center; gap: 7px; letter-spacing: 0.03em; text-transform: none; }
.forge__status i { width: 5px; height: 5px; border-radius: 50%; background: #5e8c5a; box-shadow: 0 0 0 3px rgba(94, 140, 90, 0.14); }

.forge__body { display: grid; grid-template-columns: 388px minmax(0, 1fr); }
.panel { padding: 26px 26px 24px; min-width: 0; }
.controls {
  display: flex; flex-direction: column; gap: 24px;
  border-right: 1px solid var(--line-soft);
  background: rgba(238, 234, 226, 0.22);
}

/* ── Field ────────────────────────────────────────────── */
.field__label {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px; font-size: 12px; color: var(--ink-soft); font-weight: 500;
}
.field__label .idx {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--accent);
}
.field__label::after {
  content: ""; flex: 1; height: 1px; background: var(--line-soft); margin-left: 4px;
}
.field__hint { font-size: 10.5px; color: var(--ink-faint); font-family: var(--font-mono); letter-spacing: 0; }

/* ── Modes ────────────────────────────────────────────── */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.mode {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 9px; min-width: 0;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface-hi);
  text-align: left;
  transition: transform 0.18s var(--ease), border-color 0.18s, background 0.18s, color 0.18s, box-shadow 0.18s;
}
.mode:hover { transform: translateY(-1px); border-color: var(--line-strong); box-shadow: var(--shadow-pop); }
.mode__ico {
  flex: none; width: 27px; height: 27px; display: grid; place-items: center;
  border-radius: 7px; background: var(--paper-deep);
  font-family: var(--font-mono); font-size: 9px; letter-spacing: -0.02em;
  color: var(--ink-soft); transition: background 0.18s, color 0.18s;
}
.mode__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; line-height: 1.2; }
.mode__text b { font-size: 12.5px; font-weight: 600; letter-spacing: 0.01em; }
.mode__text small {
  font-size: 10px; color: var(--ink-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mode.is-on {
  background: var(--ink); border-color: var(--ink); color: var(--paper);
  box-shadow: 0 10px 22px -14px rgba(44, 38, 33, 0.9);
}
.mode.is-on .mode__ico { background: rgba(248, 246, 242, 0.15); color: var(--paper); }
.mode.is-on .mode__text small { color: rgba(248, 246, 242, 0.62); }

/* ── Param panes ──────────────────────────────────────── */
.params { display: block; }
.pane { display: none; }
.pane.is-active { display: block; animation: paneIn 0.28s var(--ease); }
@keyframes paneIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.pane__row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 14px 0 6px; }
.pane__row:first-child { margin-top: 0; }
.pane__label { font-size: 12px; color: var(--ink-soft); }
.pane__value {
  font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-variant-numeric: tabular-nums;
}

/* range */
.range {
  -webkit-appearance: none; appearance: none;
  display: block; width: 100%; height: 20px; margin: 0 0 6px;
  background: transparent; cursor: pointer;
}
.range::-webkit-slider-runnable-track {
  height: 5px; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent) 0 var(--fill, 50%), var(--line-strong) var(--fill, 50%) 100%);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; margin-top: -5px;
  border-radius: 50%; background: #fffdfa; border: 2px solid var(--accent-deep);
  box-shadow: 0 1px 4px rgba(44, 38, 33, 0.28);
  transition: transform 0.14s var(--ease);
}
.range:hover::-webkit-slider-thumb { transform: scale(1.12); }
.range:active::-webkit-slider-thumb { transform: scale(1.04); }
.range::-moz-range-track { height: 5px; border-radius: 99px; background: var(--line-strong); }
.range::-moz-range-progress { height: 5px; border-radius: 99px; background: var(--accent); }
.range::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: #fffdfa; border: 2px solid var(--accent-deep);
  box-shadow: 0 1px 4px rgba(44, 38, 33, 0.28);
}

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  padding: 6px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-hi);
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-soft);
  transition: 0.16s var(--ease);
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); transform: translateY(-1px); }
.chip.is-on {
  background: var(--accent-wash); border-color: rgba(212, 93, 53, 0.42); color: var(--accent-ink);
}
.chip.is-off { opacity: 0.55; }
.chip.is-off:hover { opacity: 0.8; }

/* checks */
.checks { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.checks--inline { flex-direction: row; flex-wrap: wrap; gap: 8px 18px; }
.check {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 12px; line-height: 1.55; color: var(--ink-soft); cursor: pointer;
}
.check input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.check__box {
  position: relative; flex: none; width: 15px; height: 15px; margin-top: 2px;
  border: 1.5px solid var(--line-strong); border-radius: 4px;
  background: var(--surface-hi);
  transition: background 0.16s, border-color 0.16s;
}
.check__box::after {
  content: ""; position: absolute; left: 4.5px; top: 1.5px;
  width: 4px; height: 8px; border: 1.7px solid #fff; border-top: 0; border-left: 0;
  transform: rotate(42deg) scale(0.4); opacity: 0;
  transition: opacity 0.16s, transform 0.16s var(--ease);
}
.check input:checked + .check__box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .check__box::after { opacity: 1; transform: rotate(42deg) scale(1); }
.check input:focus-visible + .check__box { outline: 2px solid var(--accent); outline-offset: 2px; }
.check:hover .check__box { border-color: var(--accent); }
.check code {
  font-size: 10.5px; padding: 1px 4px; border-radius: 4px;
  background: var(--paper-deep); color: var(--ink-soft);
}

/* select */
.select { position: relative; }
.select select {
  -webkit-appearance: none; appearance: none;
  width: 100%; padding: 10px 34px 10px 12px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface-hi); color: var(--ink);
  font-family: var(--font-mono); font-size: 12.5px;
  cursor: pointer; transition: border-color 0.16s;
}
.select select:hover { border-color: var(--line-strong); }
.select__ico {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--ink-faint); pointer-events: none;
}

.hint {
  margin-top: 12px; font-size: 11px; line-height: 1.6; color: var(--ink-faint);
}
.hint code { font-size: 10.5px; padding: 1px 4px; border-radius: 4px; background: var(--paper-deep); }

/* seg */
.seg {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  padding: 4px; border-radius: 11px; background: var(--paper-deep);
}
.seg__btn {
  padding: 7px 0; border-radius: 8px;
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 500;
  color: var(--ink-soft); transition: 0.16s var(--ease);
}
.seg__btn:hover { color: var(--ink); }
.seg__btn.is-on {
  background: var(--surface-hi); color: var(--ink); font-weight: 700;
  box-shadow: 0 1px 3px rgba(44, 38, 33, 0.14);
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 20px; border-radius: 12px; border: 1px solid transparent;
  font-size: 14px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s, border-color 0.18s, color 0.18s;
}
.btn--primary {
  background: linear-gradient(180deg, #cc5930 0%, #b0451f 100%);
  color: #fff7f2;
  box-shadow: 0 12px 22px -14px rgba(176, 69, 31, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 18px 28px -16px rgba(176, 69, 31, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.16); }
.btn--primary:active { transform: translateY(0); }
.btn--block { width: 100%; margin-top: auto; padding-block: 14px; }
.btn kbd {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  padding: 2px 6px; border-radius: 5px;
  background: rgba(255, 255, 255, 0.16); color: rgba(255, 255, 255, 0.86);
}
.btn--ghost {
  padding: 9px 13px; border-radius: 9px; font-size: 12px; font-weight: 500;
  background: var(--surface-hi); border-color: var(--line); color: var(--ink-soft);
}
.btn--ghost:hover { border-color: var(--line-strong); color: var(--ink); background: #fff; }
.btn--light {
  background: #fff7f2; color: var(--accent-ink);
  box-shadow: 0 14px 26px -18px rgba(90, 35, 12, 0.9);
}
.btn--light:hover { transform: translateY(-1px); background: #fff; }

.iconbtn {
  display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface-hi); color: var(--ink-soft);
  transition: 0.16s var(--ease);
}
.iconbtn:hover { border-color: var(--line-strong); color: var(--ink); }
.iconbtn.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ── Output ───────────────────────────────────────────── */
.output { display: flex; flex-direction: column; gap: 15px; }
.output__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.output__title { display: flex; align-items: center; gap: 10px; }
.output__title h2 { font-size: 13.5px; font-weight: 600; letter-spacing: 0.02em; }
.output__actions { display: flex; gap: 6px; }

.strength {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 500;
  background: var(--paper-deep); color: var(--ink-soft);
  transition: 0.2s;
}
.strength__dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.strength[data-level="weak"] { background: var(--bad-wash); color: var(--bad); }
.strength[data-level="fair"] { background: var(--warn-wash); color: var(--warn); }
.strength[data-level="good"] { background: var(--good-wash); color: var(--good); }
.strength[data-level="strong"] { background: #d8e3cf; color: #3f6b44; }

.output__stats { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.stat { display: flex; align-items: baseline; gap: 5px; }
.stat__num {
  font-size: 25px; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat__num--sm { font-size: 14.5px; letter-spacing: -0.01em; }
.stat__unit { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
.stat__label { font-size: 11px; color: var(--ink-faint); margin-left: 2px; }
.stat__div { width: 1px; height: 20px; background: var(--line); }

.meter { height: 4px; border-radius: 99px; background: var(--paper-deep); overflow: hidden; }
.meter__fill {
  display: block; height: 100%; width: 55%; border-radius: 99px;
  background: var(--accent);
  transition: width 0.55s var(--ease), background 0.3s;
}
.meter[data-level="weak"] .meter__fill { background: var(--bad); }
.meter[data-level="fair"] .meter__fill { background: var(--warn); }
.meter[data-level="good"] .meter__fill { background: #6f9455; }
.meter[data-level="strong"] .meter__fill { background: linear-gradient(90deg, #6f9455, #4b7a50); }

.keys {
  list-style: none;
  display: flex; flex-direction: column; gap: 6px;
  max-height: 344px; overflow-y: auto; padding-right: 5px;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.keys::-webkit-scrollbar { width: 8px; }
.keys::-webkit-scrollbar-track { background: transparent; }
.keys::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }

.key {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px 9px 12px;
  border: 1px solid var(--line-soft); border-radius: 10px;
  background: var(--surface-hi);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.key:hover { border-color: var(--line-strong); background: #fff; box-shadow: 0 6px 14px -10px rgba(44, 38, 33, 0.4); }
.keys.is-anim .key { animation: rowIn 0.34s var(--ease) both; animation-delay: calc(var(--d, 0) * 1ms); }
.keys.is-scroll { mask-image: linear-gradient(180deg, #000 calc(100% - 26px), transparent 100%); -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 26px), transparent 100%); }
@keyframes rowIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.key__idx {
  flex: none; width: 16px; font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-faint); font-variant-numeric: tabular-nums;
}
.key__val {
  flex: 1; min-width: 0;
  font-size: 13px; line-height: 1.45; font-weight: 400;
  letter-spacing: 0.035em; color: #241f1a;
  overflow-wrap: anywhere;
  transition: filter 0.2s var(--ease);
  cursor: copy;
  user-select: all;
  -webkit-user-select: all;
}
.keys.is-masked .key__val { filter: blur(5px); user-select: none; }
.keys.is-masked .key:hover .key__val { filter: none; }
.key__copy {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px;
  border-radius: 7px; color: var(--ink-faint); opacity: 0.6;
  transition: 0.15s var(--ease);
}
.key:hover .key__copy, .key__copy:focus-visible { opacity: 1; }
.key__copy:hover { background: var(--accent-wash); color: var(--accent-ink); }
.key__copy.is-done { opacity: 1; color: var(--good); }

.output__foot {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-top: auto;
  padding-top: 14px; border-top: 1px solid var(--line-soft);
}
.output__note {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; color: var(--ink-faint);
}

/* ── Cards ────────────────────────────────────────────── */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.card {
  position: relative; padding: 26px 24px 28px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 18px;
  background: linear-gradient(180deg, rgba(248, 246, 242, 0.92), rgba(243, 240, 233, 0.68));
  transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s;
}
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
}
.card:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: 0 24px 44px -34px rgba(44, 38, 33, 0.6); }
.card__no {
  display: inline-flex; align-items: center; gap: 10px;
  margin-bottom: 18px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.16em;
  color: var(--accent);
}
.card__no::after {
  content: ""; width: 22px; height: 1px; background: currentColor; opacity: 0.45;
}
.card h3 { font-size: 16px; font-weight: 600; margin-bottom: 9px; letter-spacing: 0.005em; }
.card p { font-size: 13.5px; line-height: 1.72; color: var(--ink-soft); }
.card code {
  font-size: 11.5px; padding: 1px 5px; border-radius: 4px;
  background: rgba(44, 38, 33, 0.06); color: var(--ink);
}

/* ── Notes ────────────────────────────────────────────── */
.section--notes { border-top: 1px solid var(--line-soft); }
.notes { display: grid; grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr); gap: 72px; align-items: start; }
.notes__intro { position: sticky; top: 96px; }
.notes__intro .eyebrow { margin-bottom: 18px; }
.notes__lede { margin-top: 22px; font-size: 14px; line-height: 1.8; color: var(--ink-soft); max-width: 40ch; }
.formula {
  display: inline-block; margin: 26px 0 10px; padding: 14px 20px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-hi);
  font-size: 15px; font-weight: 700; color: var(--ink);
  letter-spacing: 0.08em;
}
.notes__caption { font-size: 11.5px; color: var(--ink-faint); line-height: 1.6; }

.rules { list-style: none; display: flex; flex-direction: column; }
.rules li {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px;
  padding: 24px 0; border-top: 1px solid var(--line);
}
.rules li:last-child { border-bottom: 1px solid var(--line); }
.rules__no { font-family: var(--font-mono); font-size: 11px; color: var(--accent); padding-top: 4px; letter-spacing: 0.05em; }
.rules h4 { font-size: 14.5px; font-weight: 600; margin-bottom: 6px; }
.rules p { font-size: 13px; line-height: 1.7; color: var(--ink-soft); }

/* ── Band ─────────────────────────────────────────────── */
.band-wrap { padding: 8px 0 26px; }
.band {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 36px;
  padding: 52px 52px;
  border-radius: 26px;
  background: linear-gradient(135deg, #d9603a 0%, #b94a26 65%, #a63f1f 100%);
  color: #fff6f1;
  box-shadow: 0 34px 60px -44px rgba(150, 60, 25, 0.95);
}
.band::after {
  content: "";
  position: absolute; right: -70px; top: -90px; width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 66%);
  pointer-events: none;
}
.band__copy { position: relative; z-index: 1; max-width: 620px; }
.band h2 {
  font-weight: 700;
  font-size: clamp(26px, 3.1vw, 38px); line-height: 1.2; letter-spacing: -0.01em;
}
.band p { margin-top: 12px; font-size: 13.5px; line-height: 1.7; color: rgba(255, 246, 241, 0.78); max-width: 44ch; }
.band .btn { position: relative; z-index: 1; flex: none; }

/* ── Footer ───────────────────────────────────────────── */
.footer { padding: 44px 0 56px; border-top: 1px solid var(--line); margin-top: 74px; }
.footer__inner { display: flex; align-items: center; justify-content: space-between; gap: 22px; flex-wrap: wrap; }
.footer__brand { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.footer__brand b { letter-spacing: 0.14em; font-weight: 700; }
.footer__brand .brand__mark { width: 18px; height: 18px; }
.footer__sub { margin-left: 10px; color: var(--ink-faint); font-weight: 400; letter-spacing: 0.02em; }
.footer__nav { display: flex; gap: 20px; font-size: 12.5px; color: var(--ink-soft); }
.footer__nav a { transition: color 0.15s; }
.footer__nav a:hover { color: var(--accent-ink); }
.footer__meta { font-size: 11.5px; color: var(--ink-faint); font-family: var(--font-mono); letter-spacing: 0.01em; }

/* ── Toast ────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 30px; z-index: 60;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 99px;
  background: var(--ink); color: var(--paper);
  font-size: 12.5px; letter-spacing: 0.01em;
  box-shadow: 0 18px 34px -16px rgba(44, 38, 33, 0.75);
  opacity: 0; transform: translate(-50%, 16px); pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.noscript {
  padding: 16px 20px; margin-bottom: 24px; border-radius: 12px;
  background: var(--bad-wash); color: var(--bad); font-size: 13px;
}

/* ── Motion ───────────────────────────────────────────── */
@keyframes riseIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.hero .badge,
.hero h1,
.hero__lede,
.hero__meta { animation: riseIn 0.75s var(--ease) both; }
.hero h1 { animation-delay: 0.07s; }
.hero__lede { animation-delay: 0.14s; }
.hero__meta { animation-delay: 0.2s; }
.forge { animation: riseIn 0.9s var(--ease) 0.24s both; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 1000px) {
  .forge__body { grid-template-columns: 1fr; }
  .controls { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .notes { grid-template-columns: 1fr; gap: 44px; }
  .notes__intro { position: static; }
  .notes__lede, .band p { max-width: none; }
  .cards { grid-template-columns: 1fr 1fr; }
  .modes { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 780px) {
  .wrap { width: calc(100% - 32px); }
  .nav { display: none; }
  .topbar__inner { height: 58px; gap: 12px; justify-content: space-between; }
  .hero { padding: 52px 0 34px; }
  .hero__lede { font-size: 15px; margin-top: 20px; }
  .section { padding: 64px 0; }
  .section--forge { padding-top: 14px; padding-bottom: 64px; }
  .panel { padding: 20px 18px; }
  .controls { gap: 20px; }
  .mode__text small { display: none; }
  .mode { padding: 10px 8px; }
  .cards { grid-template-columns: 1fr; }
  .band { flex-direction: column; align-items: flex-start; padding: 36px 26px; gap: 24px; }
  .band .btn { width: 100%; }
  .footer__inner { flex-direction: column; align-items: flex-start; gap: 16px; }
  .output__note { margin-left: 0; width: 100%; padding-top: 4px; }
  .keys { max-height: 300px; }
  .stat__num { font-size: 22px; }
}

@media (max-width: 560px) {
  .forge__sub, .forge__sep, .forge__status, .btn kbd { display: none; }
  .forge__bar { justify-content: center; }
}

@media (max-width: 460px) {
  .modes { grid-template-columns: 1fr 1fr; gap: 6px; }
  .mode__ico { display: none; }
  .mode { justify-content: center; }
  .mode__text b { font-size: 12px; }
  .hero h1 { font-size: 34px; }
  .hero__meta { gap: 4px 14px; font-size: 11.5px; }
  .forge__bar { font-size: 9px; padding: 10px 14px; }
  .brand__cn { display: none; }
  .output__stats { gap: 10px; }
  .stat__div { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
