:root {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1c2a21;
  background: #f7f8f5;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #b0d69b;
  outline-offset: 2px;
}
.hidden { display: none !important; }

.site-header { background: #fff; border-bottom: 1px solid #e3e8df; }
.header-inner { max-width: 1100px; min-height: 72px; margin: auto; padding: 0 28px; display: flex; align-items: center; gap: 44px; }
.brand { display: inline-flex; align-items: center; gap: 9px; padding: 0; border: 0; background: none; color: #213b29; font-size: 22px; font-weight: 800; letter-spacing: -.8px; }
.brand-mark { width: 29px; height: 29px; flex: none; }
.nav { display: flex; flex: 1; align-items: center; gap: 5px; }
.nav-item { border: 0; border-radius: 8px; padding: 10px 16px; background: transparent; color: #65746a; font-size: 13px; font-weight: 650; }
.nav-item:hover { background: #f3f6f1; color: #213b29; }
.nav-item.active { background: #e8f2e1; color: #244a2a; }
.nav-help { display: grid; flex: none; place-items: center; width: 34px; height: 34px; margin-left: auto; padding: 0; border: 1px solid #dce7d8; border-radius: 50%; font-size: 17px; font-weight: 700; }

.content { max-width: 790px; margin: 0 auto; padding: 48px 24px 96px; }
.page { display: none; }
.page.active { display: block; }
.page-heading { margin-bottom: 26px; }
.page-heading h1 { margin: 0 0 8px; font-size: clamp(30px, 5vw, 38px); line-height: 1.15; letter-spacing: -1.4px; }
.page-heading p { margin: 0; color: #68766d; font-size: 14px; line-height: 1.6; }
.panel, .result-card { background: #fff; border: 1px solid #dfe6dc; border-radius: 12px; box-shadow: 0 2px 14px #263d2a08; }
.panel { padding: 26px; margin-bottom: 18px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.panel-title h2 { margin: 0; font-size: 17px; letter-spacing: -.3px; }
.muted { margin: 0 0 18px; color: #68766d; font-size: 13px; line-height: 1.6; }
.field-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.field-heading label, .field-label { color: #304535; font-size: 13px; font-weight: 700; }
.field-meta { color: #8b978f; font-size: 11px; }
.text-action { border: 0; background: none; padding: 3px 0; color: #427948; font-size: 12px; font-weight: 700; white-space: nowrap; }
.text-action:hover { text-decoration: underline; }
.text-action.danger { color: #a04e49; }
.section-divider { height: 1px; background: #e9eee7; margin: 25px 0; }

select, .contact-form input, textarea { width: 100%; border: 1px solid #d8e1d5; border-radius: 8px; background: #fff; color: #24372a; }
select, .contact-form input { height: 45px; padding: 0 13px; font-size: 13px; }
textarea { padding: 13px 14px; resize: vertical; line-height: 1.55; font-size: 13px; }
textarea::placeholder, input::placeholder { color: #9ca9a0; }
#message-input { min-height: 170px; }
#encrypted-input { min-height: 190px; }
#encrypted-text-result { margin-top: 18px; }
#encrypted-text-output { min-height: 220px; }
.key-textarea { min-height: 115px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; overflow-wrap: anywhere; }
#my-public-key, #save-contact-keys { min-height: 64px; }
.segment { display: flex; width: fit-content; gap: 3px; padding: 3px; margin-bottom: 20px; border: 1px solid #e3e9e0; border-radius: 9px; background: #f2f5f0; }
.segment-button { border: 0; border-radius: 6px; background: transparent; color: #738075; padding: 8px 18px; font-size: 12px; font-weight: 700; }
.segment-button.active { background: #fff; color: #24452c; box-shadow: 0 1px 4px #23362418; }
.field-hint { margin-top: 10px; color: #7f8d81; font-size: 11px; }
.drop-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; min-height: 140px; padding: 20px; border: 1px dashed #a9bda8; border-radius: 9px; background: #fafcf9; text-align: center; cursor: pointer; }
.drop-zone:hover, .drop-zone.dragging { border-color: #5c9660; background: #f3f9f0; }
.drop-zone input { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
.drop-zone:focus-within { outline: 3px solid #427948; outline-offset: 2px; }
.drop-zone strong { color: #3c5841; font-size: 13px; }
.drop-zone span:last-child { color: #819284; font-size: 11px; }
.upload-icon { color: #638f66; font-size: 23px; line-height: 1; }
.primary-button, .secondary-button { border: 1px solid; border-radius: 7px; padding: 10px 14px; font-size: 12px; font-weight: 750; }
.primary-button { border-color: #233f2b; background: #233f2b; color: #fff; }
.primary-button:hover { background: #355a3e; }
.secondary-button { border-color: #cbdac9; background: #fff; color: #345c3a; }
.secondary-button:hover { background: #f3f8f0; }
.result-card { padding: 21px 24px; margin-top: 18px; border-color: #cbdcc6; background: #f8fcf5; }
.result-card.unverified { border-color: #e9c791; background: #fffaf2; }
.result-header { display: flex; align-items: center; gap: 9px; }
.result-header h2 { margin: 0; font-size: 15px; }
.result-header > .primary-button { margin-inline-start: auto; }
.result-check { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; background: #6da564; color: #fff; font-size: 12px; font-weight: 800; }
.result-card.unverified .result-check { background: #b97830; }
.result-card p { margin: 8px 0 0; color: #607365; font-size: 12px; line-height: 1.6; }
.result-card .sender-status { color: #286137; font-weight: 700; }
.result-card.unverified .sender-status { color: #8a4c18; }
.result-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.decrypted-text { max-height: 320px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 15px 0 0; padding: 14px; border: 1px solid #d5e3d0; border-radius: 7px; background: #fff; font-size: 12px; line-height: 1.6; }
.fingerprint { margin-top: 8px; color: #849587; font-size: 11px; overflow-wrap: anywhere; }
.contact-form { display: flex; flex-direction: column; align-items: flex-start; }
.contact-form input, .contact-form textarea { margin-bottom: 17px; }
.contact-form .field-heading { width: 100%; }
.key-library { margin-top: 24px; }
.library-empty { margin: 0; padding-top: 14px; border-top: 1px solid #e9eee7; color: #879589; font-size: 12px; }
.library-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid #e9eee7; }
.library-item > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.library-item strong { font-size: 13px; }
.library-item small { display: block; margin-top: 4px; color: #89978b; font-size: 10px; overflow-wrap: anywhere; }
.library-actions { display: flex; flex: none; align-items: center; gap: 12px; }
.library-actions button { padding: 3px 0; border: 0; background: none; color: #427948; font-size: 11px; font-weight: 750; }
.library-actions button:hover { text-decoration: underline; }
.library-actions button.delete { color: #aa635c; }
.help-panel h2 { margin: 0 0 14px; font-size: 17px; letter-spacing: -.3px; }
.help-panel ol { margin: 0; padding-left: 22px; }
.help-panel li, .help-panel p { color: #526356; font-size: 13px; line-height: 1.65; }
.help-panel li + li { margin-top: 10px; }
.help-panel p { margin: 0; }
.help-panel p + p { margin-top: 12px; }
.help-panel strong { color: #304535; }
.help-panel code { font-size: 12px; }
.help-action { margin-top: 16px; }
.toast { position: fixed; top: 22px; left: 50%; z-index: 10; max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 8px; background: #263f2d; color: #fff; box-shadow: 0 8px 22px #1b332535; font-size: 12px; opacity: 0; transform: translate(-50%, -12px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #9a5149; }

@media (max-width: 650px) {
  .header-inner { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
  .brand { font-size: 20px; }
  .brand-mark { width: 26px; height: 26px; }
  .nav { order: 3; width: 100%; }
  .nav-item { flex: 1; padding: 10px 8px; }
  .nav .nav-help { flex: none; padding: 0; }
  .content { padding: 18px 16px 40px; }
  .page-heading { margin-bottom: 16px; }
  .page-heading h1 { margin-bottom: 5px; font-size: 28px; }
  .page-heading p { line-height: 1.45; }
  .panel { padding: 16px; margin-bottom: 12px; }
  .panel-title { margin-bottom: 10px; }
  .muted { margin-bottom: 12px; line-height: 1.45; }
  .field-heading { margin-bottom: 6px; }
  .field-hint { margin-top: 7px; }
  .section-divider { margin: 16px 0; }
  .segment { margin-bottom: 12px; }
  #message-input { min-height: 130px; }
  #encrypted-input { min-height: 150px; }
  #encrypted-text-output { min-height: 160px; }
  .drop-zone { min-height: 110px; padding: 14px; }
  .result-card { padding: 16px; margin-top: 12px; }
  .result-actions { margin-top: 12px; }
  .contact-form input, .contact-form textarea { margin-bottom: 12px; }
  .key-library { margin-top: 16px; }
  .help-panel h2 { margin-bottom: 10px; }
  .help-panel li, .help-panel p { line-height: 1.5; }
}
