:root {
  color-scheme: light;
  --page: #f8f9f5;
  --paper: #fff;
  --ink: #1c3028;
  --muted: #52635a;
  --green: #245641;
  --deep-green: #193f30;
  --mint: #d4e8dd;
  --border: #dce4dc;
  --soft: #edf3ed;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Avenir Next", Avenir, system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 3px solid #517f69; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
svg { width: 20px; height: 20px; flex: none; vertical-align: middle; }
.shell { width: min(100% - 64px, 1090px); margin-inline: auto; }

.site-header { border-bottom: 1px solid #e4e9e1; background: #fcfdf9; }
.bar {
  min-height: 75px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  justify-items: start;
  align-items: center;
  gap: 18px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.35rem; font-weight: 750; letter-spacing: -.055em; }
.brand-icon { display: grid; place-items: center; width: 36px; height: 36px; background: var(--green); color: white; border-radius: 11px; }
.brand-icon svg { width: 22px; height: 22px; }
.brand-dot { color: #588975; }
nav { display: flex; align-items: center; gap: 7px; }
.nav-item { color: var(--muted); padding: 7px 15px; border-radius: 8px; font-size: .9rem; font-weight: 600; white-space: nowrap; }
.nav-item:hover, .nav-item[aria-current] { background: var(--soft); color: var(--green); }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 15px;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: .9rem;
  font-weight: 660;
  line-height: 1.25;
  white-space: nowrap;
  background: transparent;
  transition: background .18s ease, border-color .18s ease;
}
.button svg { width: 18px; height: 18px; }
.outline, .account-button { border-color: var(--border); background: white; }
.outline:hover, .account-button:hover { background: var(--soft); border-color: #cadace; }
.account-button, .sender-home { justify-self: end; }
.primary { background: var(--green); color: white; border-color: var(--green); }
.primary:hover { background: var(--deep-green); border-color: var(--deep-green); }

.dashboard { padding-top: 47px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 29px; }
.page-heading h1, .sender h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(3rem, 5.3vw, 4.25rem); letter-spacing: -.068em; line-height: 1.02; }
.page-heading p { margin-top: 11px; color: var(--muted); }
.page-heading .button { margin-bottom: 3px; }
.share-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  align-items: center;
  min-height: 278px;
  padding: 35px 40px;
  border: 1px solid #caddd1;
  border-radius: 21px;
  background: var(--mint);
  scroll-margin-top: 24px;
}
.share-art {
  position: absolute;
  z-index: -1;
  inset: 0 0 0 auto;
  width: 52%;
  background: url("/envelope.webp") right center / min(100%, 560px) auto no-repeat;
  mask-image: linear-gradient(90deg, transparent, #000 28%);
}
.share-content { width: min(100%, 505px); }
.share-content h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.3rem, 4vw, 3rem); letter-spacing: -.06em; line-height: 1.04; }
.share-content > p { margin-top: 10px; color: #3e594b; }
.link-row { display: flex; align-items: stretch; gap: 9px; margin-top: 23px; }
.link-field {
  min-width: 0;
  flex: 1;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 13px;
  border: 1px solid #c4d8ca;
  border-radius: 9px;
  background: #f9fcfa;
  color: #4f675b;
  font-size: .9rem;
}
.link-field span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-row .button { padding-inline: 16px; }
.share-content .share-caption { display: flex; align-items: center; gap: 6px; margin-top: 13px; font-size: .875rem; }
.share-caption svg, .footer svg { width: 15px; height: 15px; }

.messages-section { margin-top: 35px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 13px; }
.section-label { display: flex; align-items: center; gap: 12px; }
.section-label h2 { font-family: var(--serif); font-size: 2.05rem; font-weight: 400; letter-spacing: -.045em; }
.message-count { min-width: 26px; padding: 1px 7px; border: 1px solid #dbe6de; border-radius: 20px; background: var(--soft); color: var(--green); text-align: center; font-size: .875rem; font-weight: 700; }
.refresh-button { min-height: 36px; padding: 6px 12px; }
.refresh-button svg { width: 15px; height: 15px; }
.empty-card, .message-list { border: 1px solid var(--border); border-radius: 16px; background: var(--paper); }
.empty-card { min-height: 215px; display: grid; align-content: center; justify-items: center; text-align: center; padding: 24px; }
.empty-icon { display: inline-grid; place-items: center; width: 54px; height: 54px; background: var(--soft); border-radius: 50%; color: var(--green); }
.empty-icon svg { width: 25px; height: 25px; }
.empty-card h3 { margin-top: 13px; font-size: 1.08rem; font-weight: 700; letter-spacing: -.025em; }
.empty-card p { margin-top: 4px; color: var(--muted); }
.message { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 15px; padding: 20px 23px; }
.message + .message { border-top: 1px solid var(--border); }
.message .empty-icon { width: 39px; height: 39px; }
.message .empty-icon svg { width: 19px; height: 19px; }
.message-meta { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 12px; }
.message-meta time { font-size: .8rem; color: var(--muted); }
.message p { margin-top: 4px; color: #344a3f; white-space: pre-wrap; overflow-wrap: anywhere; }
.load-more { display: flex; margin: 15px auto 0; }
.footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; padding-block: 16px 24px; color: var(--muted); font-size: .875rem; }
.footer span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.footer-brand { font-weight: 750; letter-spacing: -.035em; }

.sender { max-width: 570px; padding-block: clamp(42px, 8vw, 100px); }
.sender-card { background: white; border: 1px solid var(--border); border-radius: 22px; padding: clamp(22px, 5vw, 42px); box-shadow: 0 18px 55px #183a2710; }
.preview-label { margin-bottom: 10px; color: var(--muted); text-align: center; font-size: .875rem; font-weight: 650; }
.sender-top { text-align: center; }
.sender h1 { font-size: clamp(2.55rem, 6vw, 3.6rem); margin-top: 15px; overflow-wrap: anywhere; }
.sender-top p { color: var(--muted); margin-top: 12px; }
.sender form { margin-top: 25px; }
.sender-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 5px; color: var(--muted); font-size: .875rem; }
#send-another { display: flex; margin: 22px auto 0; }

dialog { position: fixed; inset: 0; width: min(470px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 27px; background: white; color: var(--ink); border: 1px solid var(--border); border-radius: 19px; box-shadow: 0 18px 70px #17352432; }
dialog::backdrop { background: #1a322a65; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.dialog-heading h2 { font-family: var(--serif); font-size: 2rem; font-weight: 400; line-height: 1.1; letter-spacing: -.045em; }
.dialog-description { margin-block: 10px 19px; color: var(--muted); }
.icon-button { min-width: 34px; min-height: 34px; display: grid; place-items: center; padding: 5px; border: 1px solid transparent; border-radius: 8px; color: var(--muted); background: transparent; }
.icon-button:hover { background: var(--soft); color: var(--ink); }
label { display: block; margin-bottom: 6px; font-size: .9rem; font-weight: 700; }
input, textarea { width: 100%; min-width: 0; border: 1px solid #cbd9ce; border-radius: 9px; background: #fbfdfa; color: var(--ink); padding: 10px 12px; }
input::placeholder, textarea::placeholder { color: #64776a; }
textarea { display: block; resize: vertical; min-height: 135px; }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix > span { display: flex; align-items: center; background: var(--soft); padding: 0 11px; border: 1px solid #cbd9ce; border-right: 0; border-radius: 9px 0 0 9px; color: var(--muted); }
.input-prefix input { border-radius: 0 9px 9px 0; }
.form-hint, .form-error { margin-top: 7px; font-size: .875rem; }
.form-hint { color: var(--muted); }
.form-error { color: #9f302f; }
.full { width: 100%; margin-top: 17px; }
.saved-key { font-family: ui-monospace, monospace; font-size: .875rem; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; margin-top: 17px; }
.danger { background: #972e32; color: white; }
.danger:hover { background: #7c2327; }
.toast { position: fixed; z-index: 5; bottom: 24px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); width: max-content; padding: 10px 16px; background: var(--deep-green); color: white; border-radius: 10px; font-size: .9rem; box-shadow: 0 4px 18px #1735242a; }
#key-status { margin-top: 9px; color: var(--muted); font-size: .875rem; }

@media (max-width: 820px) {
  .share-art { width: 48%; opacity: .9; }
  .share-content { width: min(65%, 505px); }
}
@media (max-width: 620px) {
  .shell { width: calc(100% - 32px); }
  .bar { min-height: 63px; grid-template-columns: 1fr auto; gap: 9px; }
  .bar nav { display: none; }
  .brand { font-size: 1.24rem; }
  .brand-icon { width: 33px; height: 33px; }
  .dashboard { padding-top: 32px; }
  .page-heading { align-items: start; flex-direction: column; gap: 13px; margin-bottom: 19px; }
  .page-heading p { margin-top: 7px; }
  .page-heading .button { min-height: 36px; margin: 0; }
  .share-card { min-height: 0; padding: 22px 18px 17px; border-radius: 16px; align-items: start; }
  .share-art { width: 100%; height: 150px; position: relative; order: 2; background-size: 335px auto; background-position: calc(50% - 49px) 52%; mask-image: linear-gradient(90deg, transparent, #000 18%, #000 88%, transparent); }
  .share-content { width: 100%; }
  .share-content > p { margin-top: 7px; }
  .link-row { margin-top: 17px; }
  .link-field { min-height: 44px; padding-inline: 9px; gap: 6px; }
  .link-row .button { padding-inline: 10px; }
  .messages-section { margin-top: 23px; }
  .empty-card { min-height: 193px; }
  .message { padding: 15px 11px; gap: 8px; }
  .footer { margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
svg { fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.sender-home { grid-column: -2; }
