:root {
  --ink: #17221d;
  --muted: #6d7771;
  --paper: #f5f4ef;
  --card: #fffefa;
  --line: #dcded8;
  --green: #145f43;
  --green-dark: #0b3e2c;
  --lime: #cbea8b;
  --danger: #b44242;
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; scroll-snap-type: y mandatory; background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Manrope, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
}

button, input, select { font: inherit; }
button { color: inherit; }

.screen { min-height: 100svh; scroll-snap-align: start; scroll-snap-stop: always; }
.intro-inner, .tool-inner { width: min(1100px, calc(100% - 40px)); margin: 0 auto; }
.intro-inner { position: relative; min-height: 100svh; }
.tool-screen { display: grid; align-items: center; padding: 42px 0 0; }

.topbar {
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 34, 29, .12);
}

.brand { display: flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; font-size: 18px; font-weight: 800; letter-spacing: -.03em; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; color: var(--green); background: var(--lime); border-radius: 10px; }
.brand-mark svg { width: 21px; }
.brand-muted { color: #87908b; font-weight: 500; }
.hero { display: flex; min-height: calc(100svh - 86px); flex-direction: column; align-items: center; justify-content: center; padding: 30px 0 110px; text-align: center; }
.eyebrow { margin: 0 0 18px; color: var(--green); font: 500 11px/1 DM Mono, monospace; letter-spacing: .18em; }
.hero h1 { max-width: 880px; margin: 0; font-size: clamp(48px, 7vw, 82px); line-height: 1.02; letter-spacing: -.06em; }
.hero h1 span { color: #8b938f; }
.hero-copy { max-width: 560px; margin: 24px auto 0; color: var(--muted); font-size: 16px; line-height: 1.75; }
.scroll-cue { position: absolute; left: 50%; bottom: 34px; display: inline-flex; align-items: center; gap: 8px; color: var(--green); font-size: 14px; font-weight: 700; text-decoration: none; transform: translateX(-50%); }
.scroll-cue svg { width: 18px; animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(3px); } }

.workspace { display: grid; grid-template-columns: 1.08fr .92fr; min-height: 500px; overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: 0 24px 70px rgba(36, 48, 41, .08); }
.input-panel, .result-panel { padding: 42px; }
.input-panel { position: relative; }
.drop-overlay { position: absolute; inset: 12px; z-index: 3; display: flex; visibility: hidden; flex-direction: column; align-items: center; justify-content: center; border: 2px dashed var(--green); border-radius: 16px; background: rgba(255,254,250,.96); color: var(--green); opacity: 0; pointer-events: none; transform: scale(.97); transition: opacity .2s, transform .2s, visibility .2s; }
.input-panel.dragging .drop-overlay { visibility: visible; opacity: 1; transform: scale(1); }
.drop-overlay strong { margin-top: 15px; color: var(--ink); font-size: 18px; letter-spacing: -.02em; }
.drop-overlay > span:last-child { margin-top: 7px; color: var(--muted); font-size: 12px; }
.drop-icon { position: relative; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; background: var(--lime); color: var(--green-dark); animation: drop-float 1.6s ease-in-out infinite; }
.drop-icon::after { position: absolute; inset: -7px; border: 1px solid var(--green); border-radius: 50%; content: ""; opacity: .2; animation: drop-ring 1.6s ease-out infinite; }
.drop-icon svg { width: 25px; }
@keyframes drop-float { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(3px); } }
@keyframes drop-ring { from { transform: scale(.85); opacity: .35; } to { transform: scale(1.18); opacity: 0; } }
.result-panel { display: flex; flex-direction: column; color: white; background: var(--green-dark); }
.section-heading { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 34px; }
.section-heading .step { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #cfd4ce; border-radius: 50%; color: var(--green); font: 500 10px DM Mono, monospace; }
.section-heading h2 { margin: 0 0 5px; font-size: 20px; letter-spacing: -.03em; }
.section-heading h2:only-child { margin-bottom: 0; }
.section-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.section-heading.light .step { color: var(--lime); border-color: rgba(255,255,255,.22); }
.section-heading.light p { color: rgba(255,255,255,.56); }

.input-panel > label, .settings-grid label { display: block; margin-bottom: 9px; color: #435048; font-size: 12px; font-weight: 700; }
.secret-field { position: relative; }
.secret-field input { width: 100%; height: 56px; padding: 0 52px 0 16px; border: 1px solid #cfd4ce; outline: 0; border-radius: 11px; background: #fafbf7; color: var(--ink); font: 500 14px DM Mono, monospace; letter-spacing: .04em; transition: .2s; }
.secret-field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(20,95,67,.1); background: white; }
.secret-field input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(180,66,66,.08); }
.icon-button { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.icon-button:hover { background: #eef1eb; }
.icon-button svg { width: 19px; }
.eye-closed { display: none; }
.secret-field.hidden .eye-open { display: none; }
.secret-field.hidden .eye-closed { display: block; }
.secret-field.hidden input { -webkit-text-security: disc; }
.field-error { min-height: 18px; margin: 7px 0 0; color: #89918c; font-size: 11px; }
.field-error { display: none; color: var(--danger); }

.action-row { display: flex; gap: 10px; margin-top: 23px; }
.file-input { display: none; }
.button { height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border: 1px solid transparent; border-radius: 9px; font-size: 12px; font-weight: 700; cursor: pointer; transition: transform .15s, background .15s, border-color .15s; }
.button:active { transform: translateY(1px); }
.button svg { width: 17px; }
.button.secondary { color: white; background: var(--green); }
.button.secondary:hover { background: #0f4d37; }
.button.ghost { border-color: var(--line); background: transparent; }
.button.ghost:hover:not(:disabled) { border-color: #b7beb8; background: #f7f8f4; }
.button:disabled { opacity: .42; cursor: not-allowed; }

.code-area { margin: auto 0; }
.code-label { margin: 0 0 18px; color: rgba(255,255,255,.55); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.code-button { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.code-button:disabled { cursor: default; }
.code-button svg { flex: none; width: 22px; color: rgba(255,255,255,.48); }
.code-button:not(:disabled):hover svg { color: var(--lime); }
.code { color: var(--lime); font: 500 clamp(36px, 5vw, 54px)/1 DM Mono, monospace; letter-spacing: .06em; white-space: nowrap; }
.timer-row { display: flex; align-items: center; gap: 14px; margin-top: 30px; }
.timer-track { height: 4px; flex: 1; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.14); }
.timer-fill { width: 0; height: 100%; border-radius: inherit; background: var(--lime); transition: width .2s linear; }
.timer-row span { min-width: 70px; color: rgba(255,255,255,.58); font: 400 10px DM Mono, monospace; text-align: right; }
.security-note { display: flex; gap: 12px; align-items: flex-start; margin-top: 42px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.12); }
.security-note > svg { flex: none; width: 20px; color: var(--lime); }
.security-note strong { display: block; margin-bottom: 4px; font-size: 11px; }
.security-note p { margin: 0; color: rgba(255,255,255,.5); font-size: 10px; line-height: 1.55; }

footer { display: flex; justify-content: space-between; padding: 24px 2px 26px; color: #919893; font-size: 10px; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 5; padding: 11px 16px; border-radius: 8px; color: white; background: #17221d; font-size: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .intro-inner, .tool-inner { width: min(100% - 24px, 600px); }
  .topbar { height: 70px; }
  .hero { min-height: calc(100svh - 70px); padding: 30px 4px 100px; }
  .hero h1 { font-size: clamp(40px, 11vw, 54px); }
  .workspace { grid-template-columns: 1fr; }
  .input-panel, .result-panel { padding: 30px 24px; }
  .result-panel { min-height: 390px; }
  footer { gap: 16px; }
}

@media (max-width: 440px) {
  .action-row .button { width: auto; flex: 1; padding-inline: 10px; }
  .code { font-size: 36px; }
  footer { flex-direction: column; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #edf2ee;
    --muted: #9ca7a0;
    --paper: #101512;
    --card: #19201c;
    --line: #343e38;
    --green: #73c59f;
    --green-dark: #082f21;
    --lime: #c8ed82;
    --danger: #ef8e8e;
  }

  .topbar { border-bottom-color: rgba(255,255,255,.11); }
  .brand-muted { color: #8d9992; }
  .hero h1 span { color: #89948e; }
  .workspace { box-shadow: 0 24px 70px rgba(0,0,0,.24); }
  .section-heading .step { border-color: #465149; }
  .input-panel > label { color: #bdc7c1; }
  .secret-field input { border-color: #465149; background: #131915; }
  .secret-field input:focus { border-color: var(--green); background: #1c241f; box-shadow: 0 0 0 3px rgba(115,197,159,.12); }
  .icon-button:hover { background: #29332d; }
  .button.ghost:hover:not(:disabled) { border-color: #59655e; background: #222b26; }
  .button.secondary { color: #102019; }
  .drop-overlay { background: rgba(25,32,28,.97); }
  footer { color: #7f8983; }
  .toast { color: #17221d; background: #edf2ee; }
}

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