/* ============================================================
   花钥 PetalKey — botanical, local-first password studio
   ============================================================ */

:root {
  --paper: #f6f1e7;
  --paper-deep: #efe7d8;
  --card: #fffdf7;
  --card-warm: #fbf6e9;
  --ink: #1b2a23;
  --ink-soft: #4a5a50;
  --muted: #687062;
  --line: #e4dac7;
  --line-strong: #d2c4ab;
  --emerald: #1e4d3d;
  --emerald-deep: #14382c;
  --petal: #b14e38;
  --petal-dark: #9a3f2d;
  --gold: #c99a4b;
  --sage: #a9bba6;
  --mint: #e4eee4;

  --font-display: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --font-ui: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 28px 60px -44px rgba(27, 42, 35, 0.5);
  --transition: 180ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(900px 620px at 8% -8%, rgba(199, 91, 69, 0.1), transparent 62%),
    radial-gradient(820px 560px at 102% 4%, rgba(30, 77, 61, 0.13), transparent 58%),
    linear-gradient(180deg, #f9f5ec 0%, #f4eee2 100%);
  background-attachment: fixed;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

body.modal-open {
  overflow: hidden;
}

::selection {
  background: rgba(199, 91, 69, 0.2);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--emerald);
}

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: rgba(30, 77, 61, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--petal);
  outline-offset: 3px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-small {
  width: 13px;
  height: 13px;
}

.icon-large {
  width: 24px;
  height: 24px;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--emerald);
  color: #f8f3e8;
  text-decoration: none;
  font-size: 13px;
  transition: top var(--transition);
}

.skip-link:focus {
  top: 16px;
}

/* ---------------- Header ---------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(249, 245, 236, 0.82);
  border-bottom: 1px solid rgba(210, 196, 171, 0.55);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 13px clamp(18px, 3vw, 36px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  justify-self: start;
  color: var(--ink);
  text-decoration: none;
  border-radius: 10px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  color: var(--emerald);
  transition: transform 700ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.brand:hover .brand-mark {
  transform: rotate(45deg);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.brand-en {
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.tab-list {
  display: inline-flex;
  gap: 3px;
  justify-self: center;
  padding: 3px;
  border: 1px solid rgba(210, 196, 171, 0.55);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.42);
}

.tab {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12.5px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.tab-index {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
}

.tab:hover {
  background: rgba(30, 77, 61, 0.06);
  color: var(--emerald);
}

.tab[aria-selected="true"] {
  background: var(--emerald);
  color: #f8f3e8;
  box-shadow: 0 8px 18px -12px rgba(20, 56, 44, 0.75);
}

.tab[aria-selected="true"] .tab-index {
  color: rgba(248, 243, 232, 0.58);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-self: end;
}

.local-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid rgba(30, 77, 61, 0.13);
  border-radius: 999px;
  background: rgba(30, 77, 61, 0.06);
  color: var(--emerald);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4c8b6a;
  animation: pulse 2.8s ease-out infinite;
}

.text-button {
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(124, 133, 119, 0.35);
  text-underline-offset: 4px;
  transition: color var(--transition), text-decoration-color var(--transition);
}

.text-button:hover {
  color: var(--emerald);
  text-decoration-color: var(--emerald);
}

/* ---------------- Layout / hero ---------------- */

main {
  position: relative;
  z-index: 1;
}

.panel {
  padding: clamp(20px, 3vw, 34px) 0 clamp(30px, 4vw, 48px);
}

.panel[hidden] {
  display: none;
}

.panel.is-entering {
  animation: panelIn 380ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.panel-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(18px, 3vw, 36px);
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: clamp(18px, 2.4vw, 26px);
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.eyebrow span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 27px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--petal);
  font-size: 8.5px;
  letter-spacing: 0.04em;
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(26px, 3.2vw, 36px);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.08;
  color: var(--ink);
}

.lede {
  max-width: 52ch;
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: clamp(12.5px, 1.25vw, 14px);
  line-height: 1.7;
}

/* ---------------- Cards ---------------- */

.derive-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.04fr);
  gap: clamp(18px, 2.4vw, 28px);
  align-items: start;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: clamp(18px, 2.4vw, 28px);
  align-items: start;
}

.card {
  position: relative;
  padding: clamp(22px, 2.8vw, 34px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--card) 0%, #fffbf2 100%);
  box-shadow: var(--shadow-card);
}

.seed-card {
  background: linear-gradient(180deg, #fffdf8 0%, #fbf6e9 100%);
}

.harvest-card {
  background: linear-gradient(180deg, #fffdf8 0%, #f8f2e4 100%);
}

.card-heading {
  margin-bottom: 22px;
}

.card-kicker {
  margin: 0 0 6px;
  color: var(--petal);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.card-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.algorithm-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid rgba(30, 77, 61, 0.14);
  border-radius: 999px;
  background: rgba(30, 77, 61, 0.06);
  color: var(--emerald);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* ---------------- Seed form ---------------- */

.mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  width: 100%;
  margin-bottom: 24px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-deep);
}

.mode-button {
  flex: 1 1 0;
  min-width: 82px;
  padding: 9px 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11.5px;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.mode-button:hover {
  color: var(--emerald);
}

.mode-button.is-active {
  border-color: rgba(210, 196, 171, 0.7);
  background: var(--card);
  color: var(--emerald);
  font-weight: 600;
  box-shadow: 0 3px 10px rgba(27, 42, 35, 0.08);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.field-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.field-label em {
  color: var(--muted);
  font-size: 10.5px;
  font-style: normal;
}

.input-wrap {
  position: relative;
  display: block;
}

.input-wrap input {
  width: 100%;
  height: 48px;
  padding: 0 48px 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  outline: none;
  background: rgba(255, 253, 247, 0.8);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.input-wrap input::placeholder {
  color: #7c7464;
}

.input-wrap input:hover {
  background: var(--card);
}

.input-wrap input:focus {
  border-color: var(--emerald);
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(30, 77, 61, 0.1);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.icon-button:hover {
  background: rgba(30, 77, 61, 0.07);
  color: var(--emerald);
}

.reveal-button {
  position: absolute;
  top: 50%;
  right: 5px;
  transform: translateY(-50%);
}

.length-block {
  margin: 22px 0 20px;
}

.length-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 12px;
}

#length-value,
#word-count-value {
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(30, 77, 61, 0.08);
  color: var(--emerald);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.range {
  width: 100%;
  height: 4px;
  margin: 15px 0 7px;
  border-radius: 999px;
  outline: none;
  background: linear-gradient(to right, var(--emerald) var(--fill, 50%), var(--line) var(--fill, 50%));
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.range::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid var(--emerald);
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 2px 7px rgba(27, 42, 35, 0.22);
  cursor: grab;
  appearance: none;
  -webkit-appearance: none;
}

.range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid var(--emerald);
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 2px 7px rgba(27, 42, 35, 0.22);
  cursor: grab;
}

.charset {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.charset legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  padding: 0;
  color: var(--ink-soft);
  font-size: 11.5px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 253, 247, 0.6);
  color: var(--ink-soft);
  font-size: 11.5px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.toggle:hover {
  border-color: var(--line-strong);
  background: var(--card);
}

.toggle:has(input:checked) {
  border-color: rgba(30, 77, 61, 0.32);
  background: rgba(30, 77, 61, 0.055);
}

.toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--emerald);
}

.toggle code {
  color: var(--muted);
  font-size: 10px;
  background: transparent;
  padding: 0;
}

.mode-note {
  margin: 0 0 20px;
  padding-left: 12px;
  border-left: 2px solid var(--sage);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.75;
}

.seed-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.privacy-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10.5px;
}

/* ---------------- Result ---------------- */

.result-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 246px;
  padding: clamp(22px, 2.8vw, 30px);
  overflow: hidden;
  border: 1px solid rgba(16, 46, 36, 0.55);
  border-radius: 16px;
  background: radial-gradient(140% 120% at 100% 0%, #2a6350 0%, #173e31 55%, #102e24 100%);
  color: #f8f3e8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 18px 40px -28px rgba(16, 46, 36, 0.8);
}

.result-bloom {
  position: absolute;
  top: -36px;
  right: -42px;
  width: 228px;
  color: #f8f3e8;
  opacity: 0.08;
  pointer-events: none;
}

.result-label {
  position: relative;
  z-index: 1;
  margin: 0 0 12px;
  color: rgba(248, 243, 232, 0.68);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.result-value {
  position: relative;
  z-index: 1;
  min-height: 1.45em;
  color: #fbf6ea;
  font-family: var(--font-mono);
  font-size: clamp(23px, 3.3vw, 34px);
  font-weight: 500;
  letter-spacing: 0.045em;
  line-height: 1.38;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
  word-break: break-all;
}

.result-value.is-empty {
  color: rgba(248, 243, 232, 0.66);
  font-family: var(--font-ui);
  font-size: clamp(16px, 1.9vw, 18px);
  font-weight: 400;
  letter-spacing: 0.04em;
}

.result-value.is-fresh {
  animation: revealIn 360ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.result-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.result-meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  color: rgba(248, 243, 232, 0.68);
  font-size: 10px;
}

.dot-sep {
  opacity: 0.55;
}

.on-dark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid rgba(248, 243, 232, 0.22);
  border-radius: var(--radius-sm);
  background: rgba(248, 243, 232, 0.07);
  color: #f8f3e8;
  font-size: 12px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.on-dark:hover {
  border-color: rgba(248, 243, 232, 0.4);
  background: rgba(248, 243, 232, 0.14);
}

.on-dark:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #c75b45, #b34a36);
  color: #fff9f0;
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 12px 24px -16px rgba(179, 74, 54, 0.9);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), opacity var(--transition);
}

.primary:hover {
  background: linear-gradient(135deg, #cf6650, #b84e39);
  box-shadow: 0 16px 28px -16px rgba(179, 74, 54, 0.95);
  transform: translateY(-1px);
}

.primary:active {
  transform: translateY(0);
}

.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.primary-small {
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.strength {
  margin-top: 22px;
}

.strength-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--ink-soft);
  font-size: 11.5px;
}

#strength-label {
  color: var(--meter-color, var(--muted));
  font-weight: 600;
}

.strength-meter {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.strength-meter span {
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  transition: background 280ms ease;
}

.strength-meter span.is-on {
  background: var(--meter-color, var(--sage));
}

.strength.score-0 {
  --meter-color: #b4533f;
}

.strength.score-1 {
  --meter-color: #c06b3e;
}

.strength.score-2 {
  --meter-color: #c99a4b;
}

.strength.score-3 {
  --meter-color: #6e8f6a;
}

.strength.score-4 {
  --meter-color: #2f6b4f;
}

.mode-tip {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px dashed rgba(122, 133, 119, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(169, 187, 166, 0.11);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.75;
}

.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 253, 247, 0.7);
  color: var(--emerald);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.secondary:hover {
  border-color: var(--emerald);
  background: var(--card);
}

.secondary[hidden] {
  display: none;
}

.full {
  width: 100%;
}

#randomize {
  margin-top: 14px;
}

.trust-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 30px;
  padding: 22px 8px 0;
  border-top: 1px solid var(--line);
}

.trust-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--muted);
}

.trust-item .icon {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  color: var(--sage);
}

.trust-item strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
}

.trust-item span {
  font-size: 11px;
  line-height: 1.65;
}

/* ---------------- Tool pages ---------------- */

.segmented {
  display: inline-flex;
  gap: 3px;
  margin-bottom: 24px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(239, 231, 216, 0.62);
}

.segment {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.segment:hover {
  color: var(--emerald);
}

.segment.is-active {
  border-color: var(--line);
  background: var(--card);
  color: var(--emerald);
  box-shadow: 0 3px 10px rgba(27, 42, 35, 0.08);
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 182px;
  padding: 24px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 16px;
  outline: none;
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(169, 187, 166, 0.13), transparent 65%),
    rgba(255, 253, 247, 0.45);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--emerald);
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(169, 187, 166, 0.2), transparent 65%),
    rgba(255, 253, 247, 0.7);
}

.dropzone.is-dragover {
  border-color: var(--petal);
  background: rgba(199, 91, 69, 0.06);
  transform: scale(1.004);
}

.dropzone-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 2px;
  border-radius: 50%;
  background: rgba(30, 77, 61, 0.08);
  color: var(--emerald);
}

.dropzone-title {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
}

.dropzone-hint {
  color: var(--muted);
  font-size: 10.5px;
}

.dropzone-small {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-auto-rows: min-content;
  align-items: center;
  justify-items: start;
  gap: 3px 12px;
  min-height: 0;
  padding: 15px 16px;
  text-align: left;
}

.dropzone-small .dropzone-mark {
  grid-row: 1 / 3;
  width: 42px;
  height: 42px;
  margin: 0;
}

.dropzone-small .dropzone-title {
  font-size: 12px;
}

.dropzone-small .dropzone-hint {
  font-size: 10px;
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid rgba(30, 77, 61, 0.18);
  border-radius: 12px;
  background: rgba(30, 77, 61, 0.055);
}

.file-chip + .field {
  margin-top: 16px;
}

.payload-block + .field {
  margin-top: 16px;
}

.file-chip-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--emerald);
}

.file-chip-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.file-chip-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip-copy small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.chip-remove {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.chip-remove:hover {
  background: rgba(199, 91, 69, 0.1);
  color: var(--petal);
}

.payload-block {
  margin-top: 16px;
}

.mini-label {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.format-note {
  margin: 14px 0 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(30, 77, 61, 0.05);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

.status {
  min-height: 1.4em;
  margin-top: 12px;
  font-size: 11.5px;
  line-height: 1.7;
}

.status:empty {
  display: none;
}

.status.is-success {
  color: #2f6b4f;
}

.status.is-error {
  color: #b3362b;
}

.status.is-busy {
  color: var(--ink-soft);
}

#crypto-download,
#stego-download {
  margin-top: 10px;
}

.note-card {
  background: linear-gradient(180deg, rgba(251, 246, 233, 0.92), rgba(246, 241, 231, 0.92));
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  gap: 14px;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  height: 22px;
  min-width: 30px;
  margin-top: 2px;
  border: 1px solid rgba(199, 91, 69, 0.3);
  border-radius: 999px;
  color: var(--petal);
  font-family: var(--font-mono);
  font-size: 9px;
}

.steps strong {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 12.5px;
}

.steps p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.75;
}

.warning {
  display: flex;
  gap: 11px;
  padding: 14px;
  border: 1px solid rgba(199, 91, 69, 0.18);
  border-radius: 12px;
  background: rgba(199, 91, 69, 0.07);
  color: var(--petal-dark);
}

.warning .icon {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: 0 0 auto;
}

.warning p {
  margin: 0;
  color: #7a4a3d;
  font-size: 11.5px;
  line-height: 1.75;
}

.warning strong {
  color: var(--petal-dark);
}

.aside-foot {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
}

/* ---------------- Footer ---------------- */

.site-footer {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  background: rgba(239, 231, 216, 0.38);
}

.footer-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 30px;
  align-items: start;
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px clamp(18px, 3vw, 36px) 44px;
}

.footer-brand {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.footer-mark {
  width: 34px;
  height: 34px;
  color: var(--emerald);
  opacity: 0.75;
}

.footer-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.06em;
}

.footer-brand span {
  color: var(--muted);
  font-size: 10.5px;
}

.footer-note {
  max-width: 42ch;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.8;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 10.5px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-links a:hover {
  color: var(--emerald);
}

.footer-version {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: 1px solid rgba(248, 243, 232, 0.13);
  border-radius: 999px;
  background: var(--emerald-deep);
  color: #f8f3e8;
  font-size: 12px;
  box-shadow: 0 18px 40px -18px rgba(16, 46, 36, 0.75);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(8px);
  transition: opacity 240ms ease, transform 240ms ease;
}

.toast[hidden] {
  display: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast .icon {
  width: 15px;
  height: 15px;
}

.toast.is-error {
  border-color: rgba(255, 214, 200, 0.25);
  background: #7a2e24;
}

button.is-busy {
  opacity: 0.86;
}

button.is-busy .icon {
  animation: spin 1.2s linear infinite;
}

/* ---------------- Modal ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background: rgba(22, 37, 30, 0.56);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 880px;
  max-height: 86vh;
  padding: clamp(28px, 4vw, 48px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: 0 40px 100px -30px rgba(16, 46, 36, 0.65);
  animation: modalIn 260ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.modal .eyebrow {
  margin-bottom: 12px;
}

.modal h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
}

.modal-lede {
  max-width: 66ch;
  margin: 0 0 28px;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.85;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.modal-close:hover {
  background: rgba(30, 77, 61, 0.06);
  color: var(--emerald);
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.about-grid article {
  padding-top: 14px;
  border-top: 2px solid var(--sage);
}

.about-grid h3 {
  margin: 0 0 8px;
  color: var(--emerald);
  font-size: 13px;
}

.about-grid p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.8;
}

.about-grid .muted {
  color: var(--muted);
}

.about-subhead {
  margin: 8px 0 10px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}

.about-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.95;
}

.about-list li::marker {
  color: var(--petal);
}

.modal-foot {
  margin: 24px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.noscript {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 200;
  padding: 14px;
  border-radius: 10px;
  background: #b3362b;
  color: #fff;
  font-size: 13px;
}

/* ---------------- Animations ---------------- */

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes revealIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(76, 139, 106, 0.42);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(76, 139, 106, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(76, 139, 106, 0);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------- Responsive ---------------- */

@media (max-width: 1080px) {
  .header-inner {
    grid-template-columns: auto 1fr;
    row-gap: 10px;
  }

  .brand {
    grid-column: 1;
  }

  .header-actions {
    grid-column: 2;
  }

  .tab-list {
    grid-column: 1 / -1;
    justify-self: center;
  }
}

@media (max-width: 960px) {
  .derive-grid,
  .tool-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .harvest-card {
    position: static;
  }

  .footer-inner {
    grid-template-columns: 1fr auto;
    gap: 18px;
  }

  .footer-note {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 820px) {
  .header-actions .about-trigger {
    display: none;
  }

  .local-badge {
    font-size: 10px;
    padding: 5px 9px;
  }

  .tab {
    padding: 8px 13px;
  }

  .trust-strip {
    grid-template-columns: 1fr;
    gap: 14px;
    padding-top: 18px;
  }

  .trust-item .icon {
    margin-top: 1px;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (max-width: 620px) {
  .header-inner {
    padding: 11px 16px;
    gap: 10px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand-name {
    font-size: 19px;
  }

  .brand-en {
    margin-top: 4px;
    font-size: 7.5px;
    letter-spacing: 0.24em;
  }

  .local-badge {
    display: none;
  }

  .tab-list {
    justify-self: stretch;
    justify-content: center;
  }

  .tab {
    flex: 1;
    justify-content: center;
    padding: 8px 10px;
  }

  .panel {
    padding-top: 30px;
  }

  .hero {
    margin-bottom: 24px;
  }

  .hero h1 {
    font-size: clamp(38px, 12vw, 54px);
  }

  .lede {
    margin-top: 14px;
    font-size: 13.5px;
    line-height: 1.8;
  }

  .card {
    padding: 20px;
    border-radius: 18px;
  }

  .card-heading {
    margin-bottom: 18px;
  }

  .card-heading h2 {
    font-size: 21px;
  }

  .result-stage {
    min-height: 214px;
    padding: 20px;
  }

  .result-value {
    font-size: clamp(20px, 6.1vw, 26px);
  }

  .result-actions {
    margin-top: 18px;
  }

  .mode-switch {
    margin-bottom: 20px;
  }

  .mode-button {
    padding: 9px 4px;
    font-size: 12px;
  }

  .charset {
    gap: 7px;
  }

  .segmented {
    display: flex;
    width: 100%;
  }

  .segment {
    flex: 1;
    justify-content: center;
    padding: 10px 8px;
  }

  .dropzone {
    min-height: 152px;
    padding: 20px;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    padding-bottom: 34px;
  }

  .footer-note,
  .footer-links {
    grid-column: auto;
    grid-row: auto;
  }

  .footer-links {
    flex-wrap: wrap;
    gap: 14px;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal {
    max-height: 90vh;
    padding: 24px;
    border-radius: 18px;
  }

  .modal-close {
    top: 12px;
    right: 12px;
  }

  .toast {
    bottom: 18px;
    width: max-content;
    max-width: calc(100vw - 32px);
    text-align: center;
  }
}

@media (max-width: 380px) {
  .tab-index {
    display: none;
  }

  .charset {
    grid-template-columns: 1fr;
  }
}

@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;
  }
}

/* ---------------- Collapsible notes ---------------- */

details.note-card {
  padding: 0;
}

.note-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.note-summary::-webkit-details-marker {
  display: none;
}

.note-summary-kicker {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
}

.note-summary:hover .note-summary-kicker {
  color: var(--emerald);
}

.note-summary h2 {
  margin: 0;
  font-size: 15px;
  color: var(--ink);
}

.note-chevron {
  width: 13px;
  height: 13px;
  margin-left: auto;
  color: var(--muted);
  transition: transform var(--transition);
}

details[open] .note-chevron {
  transform: rotate(180deg);
}

details.note-card > .steps,
details.note-card > .warning,
details.note-card > .aside-foot {
  margin-left: 20px;
  margin-right: 20px;
}

details.note-card > .warning {
  margin-bottom: 16px;
}

details.note-card > .aside-foot {
  padding-bottom: 18px;
}

/* ---------------- Compact single-screen density ----------------
 * Kept at the end of the file so these override the defaults above:
 * each panel should fit one viewport without scrolling. */

.panel .derive-grid,
.panel .tool-grid {
  gap: clamp(14px, 1.8vw, 20px);
}

.panel .card {
  padding: 16px 18px;
}

.panel .card-heading {
  margin-bottom: 12px;
}

.panel .field {
  margin-bottom: 10px;
}

.panel .length-block {
  margin: 14px 0 12px;
}

.panel .range {
  margin: 10px 0 5px;
}

.panel .result-stage {
  padding: 14px 16px;
}

.panel .result-value {
  font-size: clamp(20px, 2vw, 24px);
  margin: 8px 0 10px;
}

.panel .strength {
  margin-top: 12px;
}

.panel .trust-strip {
  padding: 12px 16px;
  gap: 14px;
}

.panel .trust-item {
  gap: 9px;
}

.panel .trust-item strong {
  font-size: 12px;
}

.panel .trust-item span {
  font-size: 10px;
}

.panel .segmented {
  margin-bottom: 14px;
}

.panel .dropzone {
  padding: 16px 12px;
}

.panel .file-chip {
  margin-top: 10px;
  padding: 8px 10px;
}

.panel .tool-card .primary,
.panel .tool-card .status {
  margin-top: 12px;
}

.panel .mode-note {
  margin: 0 0 14px;
}

/* ---------------- Single-screen fit (second pass) ---------------- */

.panel {
  padding: 16px 0 24px;
}

.hero {
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(24px, 2.4vw, 30px);
}

.hero .eyebrow {
  margin-bottom: 8px;
}

.lede {
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.6;
}

.panel .card {
  padding: 14px 16px;
}

.panel .card-heading {
  margin-bottom: 10px;
}

.panel .field {
  margin-bottom: 8px;
}

.input-wrap input {
  height: 42px;
}

.panel .mode-switch {
  margin-bottom: 10px;
}

.panel .length-block {
  margin: 10px 0 8px;
}

.panel .range {
  margin: 8px 0 4px;
}

.panel .seed-footer {
  margin-top: 4px;
  padding-top: 10px;
}

.panel .mode-note {
  margin: 0 0 10px;
}

.panel .result-stage {
  padding: 10px 12px;
}

.panel .result-label {
  margin-bottom: 8px;
}

.panel .result-value {
  margin: 6px 0 8px;
  font-size: clamp(18px, 1.7vw, 22px);
}

.panel .result-meta {
  gap: 6px;
}

.panel .strength {
  margin-top: 8px;
}

.panel .trust-strip {
  padding: 10px 14px;
  gap: 10px;
}

.panel .segmented {
  margin-bottom: 10px;
}

.panel .dropzone {
  padding: 12px 10px;
}

.panel .dropzone-mark {
  width: 36px;
  height: 36px;
  margin-bottom: 4px;
}

.panel .dropzone-mark .icon-large {
  width: 20px;
  height: 20px;
}

.panel .dropzone-title {
  font-size: 12.5px;
}

.panel .dropzone-hint {
  font-size: 10px;
}

.panel .file-chip {
  margin-top: 8px;
}

.panel .payload-block {
  margin-top: 10px;
}

.panel .mini-label {
  margin-bottom: 6px;
}

.panel .format-note {
  margin: 10px 0 12px;
  padding: 8px 10px;
}

.panel .primary {
  height: 44px;
}

.panel .status {
  margin-top: 8px;
}

.site-footer {
  padding: 20px 0;
}

/* ---------------- Single-screen fit (third pass) ---------------- */

.panel .result-stage {
  min-height: 172px;
  padding: 12px 14px;
}

.panel .result-value {
  font-size: clamp(20px, 2.4vw, 28px);
}

.panel .result-actions {
  margin-top: 12px;
}

.panel .dropzone {
  min-height: 128px;
  padding: 12px;
  gap: 5px;
}

.panel .dropzone-small {
  min-height: 96px;
}

.panel .format-note {
  margin: 8px 0 10px;
}

.site-footer {
  padding: 0;
  margin-top: 12px;
}

.footer-inner {
  padding: 18px clamp(18px, 3vw, 36px) 24px;
}

/* ---------------- Single-screen fit (buffer) ---------------- */

.panel {
  padding: 14px 0 20px;
}

.hero {
  margin-bottom: 12px;
}

.panel .card-heading {
  margin-bottom: 8px;
}

.panel .segmented {
  margin-bottom: 8px;
}

/* ---------------- Derive card alignment ----------------
 * 种子与果实两张卡等高，底边对齐。 */

.panel .derive-grid {
  align-items: stretch;
}

.panel .derive-grid > .card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ---------------- 刘海屏安全区 ----------------
 * viewport-fit=cover 下，内容会延伸到刘海与底部指示条；
 * env() 在非刘海设备为 0，规则等价于原 padding，无副作用；
 * 不支持 max()/env() 的浏览器丢弃整条声明，回退原值。 */

@supports (padding: max(0px)) {
  .header-inner,
  .panel-inner,
  .footer-inner {
    padding-left: max(clamp(18px, 3vw, 36px), env(safe-area-inset-left));
    padding-right: max(clamp(18px, 3vw, 36px), env(safe-area-inset-right));
  }

  .site-footer {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .toast {
    bottom: max(28px, calc(env(safe-area-inset-bottom) + 12px));
  }

  @media (max-width: 620px) {
    .header-inner {
      padding-left: max(16px, env(safe-area-inset-left));
      padding-right: max(16px, env(safe-area-inset-right));
    }

    .toast {
      bottom: max(18px, calc(env(safe-area-inset-bottom) + 12px));
    }
  }
}
