:root {
  --ink: oklch(27% 0.026 43);
  --ink-soft: oklch(43% 0.025 45);
  --paper: oklch(94% 0.026 81);
  --paper-deep: oklch(89% 0.034 78);
  --desk: oklch(28% 0.055 48);
  --cinnabar: oklch(48% 0.15 33);
  --cinnabar-dark: oklch(38% 0.13 31);
  --sage: oklch(55% 0.045 136);
  --shadow: 0 26px 70px rgb(44 27 19 / 22%);
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --kai: "Kaiti SC", "STKaiti", "KaiTi", serif;
  --letter-font-size: 17px;
  --letter-line-height: 2;
  --letter-paragraph-gap: 18px;
  --paper-inline-padding: 58px;
  --paper-block-padding: 56px;
}

:root[data-letter-size="small"] {
  --letter-font-size: 15px;
  --letter-line-height: 1.9;
  --letter-paragraph-gap: 14px;
  --paper-inline-padding: 54px;
  --paper-block-padding: 52px;
}

:root[data-letter-size="large"] {
  --letter-font-size: 19px;
  --letter-line-height: 2.05;
  --letter-paragraph-gap: 22px;
  --paper-inline-padding: 64px;
  --paper-block-padding: 60px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  background: oklch(90% 0.02 75);
  font-family: var(--serif);
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.site-shell {
  min-height: 100vh;
}

.gate {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(90deg, rgb(31 18 13 / 74%), rgb(31 18 13 / 20%) 64%, rgb(31 18 13 / 36%)),
    url("assets/window-desk.png") center / cover;
}

.gate::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgb(255 247 228 / 2%) 4px);
  content: "";
  pointer-events: none;
}

.gate-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 73% 44%, transparent 0 16%, rgb(31 18 13 / 42%) 74%);
}

.gate-copy {
  width: min(460px, calc(100vw - 40px));
  margin-left: min(38vw, 560px);
  padding: 46px 48px 38px;
  color: oklch(94% 0.018 80);
  background: rgb(43 26 20 / 82%);
  border: 1px solid rgb(241 224 195 / 22%);
  box-shadow: 0 35px 100px rgb(15 8 5 / 48%);
  backdrop-filter: blur(4px);
  animation: arrive 900ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--cinnabar);
  font-size: 13px;
  letter-spacing: 0.2em;
}

.gate .eyebrow {
  color: oklch(77% 0.1 40);
}

.gate h1 {
  margin: 0;
  font-family: var(--kai);
  font-size: clamp(72px, 8vw, 112px);
  font-weight: 400;
  line-height: 0.95;
}

.gate-note {
  margin: 20px 0 44px;
  font-size: 17px;
  letter-spacing: 0.13em;
}

.pass-form label {
  display: block;
  margin-bottom: 10px;
  color: oklch(78% 0.018 77);
  font-size: 13px;
}

.pass-row {
  display: flex;
  border-bottom: 1px solid rgb(247 231 202 / 48%);
}

.pass-row input {
  min-width: 0;
  flex: 1;
  padding: 12px 0;
  color: oklch(96% 0.013 78);
  border: 0;
  outline: 0;
  background: transparent;
}

.pass-row input::placeholder {
  color: oklch(68% 0.02 66);
}

.pass-row button {
  padding: 8px 2px 8px 18px;
  color: oklch(85% 0.085 42);
  border: 0;
  background: transparent;
}

.form-message {
  min-height: 22px;
  margin: 10px 0 0;
  color: oklch(77% 0.1 40);
  font-size: 13px;
}

.verify-form {
  margin-top: 22px;
}

.first-name-field {
  margin-top: 24px;
}

.underlined-input {
  width: 100%;
  padding: 10px 0;
  color: oklch(96% 0.013 78);
  border: 0;
  border-bottom: 1px solid rgb(247 231 202 / 48%);
  outline: 0;
  background: transparent;
}

.gate-foot {
  margin: 34px 0 0;
  color: oklch(72% 0.016 80);
  font-size: 12px;
}

.pairing {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 40px 20px;
  background:
    linear-gradient(rgb(241 234 216 / 91%), rgb(235 225 202 / 96%)),
    url("assets/window-desk.png") center / cover;
}

.pairing-inner {
  width: min(620px, 100%);
  padding: 58px 64px;
  background:
    repeating-linear-gradient(0deg, transparent 0 31px, rgb(102 75 51 / 5%) 32px),
    var(--paper);
  box-shadow: var(--shadow);
}

.pairing h1 {
  margin: 0 0 20px;
  font-family: var(--kai);
  font-size: clamp(38px, 6vw, 56px);
  font-weight: 400;
}

.pairing-inner > p:not(.eyebrow) {
  color: var(--ink-soft);
  line-height: 1.8;
}

.pairing-actions {
  margin-top: 34px;
}

.invite-block,
.accept-block {
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid rgb(76 52 37 / 18%);
}

.invite-block label {
  display: block;
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 12px;
}

.invite-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.invite-row input {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgb(76 52 37 / 24%);
  background: rgb(255 250 235 / 48%);
  font-size: 12px;
}

.invite-block > button {
  margin-top: 12px;
}

.text-button {
  padding: 9px 0;
  color: var(--ink-soft);
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  font-size: 12px;
}

.pairing .text-button {
  margin-top: 28px;
}

.profile-logout {
  display: block;
  margin: 22px auto 0;
}

.empty-list {
  padding: 18px;
  color: var(--ink-soft);
  font-size: 12px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.letter-app {
  min-height: 100vh;
  background:
    linear-gradient(rgb(242 235 218 / 94%), rgb(234 225 204 / 97%)),
    url("assets/window-desk.png") center / cover fixed;
  animation: fade-in 560ms ease-out both;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 78px;
  padding: 0 5vw;
  background: rgb(241 234 216 / 93%);
  border-bottom: 1px solid rgb(88 61 44 / 15%);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  width: max-content;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.brand-mark,
.mini-seal {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--cinnabar);
  border: 1px solid currentColor;
  font-family: var(--kai);
  font-size: 20px;
  transform: rotate(-2deg);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: var(--kai);
  font-size: 20px;
  font-weight: 500;
}

.brand small {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 11px;
}

.primary-nav {
  display: flex;
  height: 100%;
  gap: 28px;
}

.nav-item {
  position: relative;
  padding: 0 4px;
  border: 0;
  background: transparent;
  font-size: 14px;
}

.nav-item::after {
  position: absolute;
  right: 0;
  bottom: 18px;
  left: 0;
  height: 1px;
  background: var(--cinnabar);
  content: "";
  opacity: 0;
  transform: scaleX(0);
  transition: 220ms ease;
}

.nav-item.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.avatar {
  justify-self: end;
  width: 38px;
  height: 38px;
  color: var(--paper);
  border: 0;
  border-radius: 50%;
  background: var(--sage);
}

.profile-panel {
  position: fixed;
  z-index: 25;
  top: 78px;
  right: 0;
  bottom: 0;
  width: min(390px, 100vw);
  padding: 42px 38px;
  background:
    repeating-linear-gradient(0deg, transparent 0 31px, rgb(102 75 51 / 5%) 32px),
    oklch(94% 0.026 81);
  border-left: 1px solid rgb(88 61 44 / 16%);
  box-shadow: -24px 20px 60px rgb(52 34 24 / 18%);
  animation: panel-in 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.profile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 44px;
}

.profile-header h2 {
  margin: 0;
  font-family: var(--kai);
  font-size: 32px;
  font-weight: 400;
}

.close-profile {
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--ink-soft);
  border: 1px solid rgb(76 52 37 / 24%);
  border-radius: 50%;
  background: transparent;
  font-family: serif;
  font-size: 24px;
  line-height: 1;
}

.name-field {
  display: block;
  margin-bottom: 30px;
}

.name-field span {
  display: block;
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 12px;
}

.name-field input {
  width: 100%;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid rgb(76 52 37 / 34%);
  outline: 0;
  background: transparent;
  font-family: var(--kai);
  font-size: 24px;
}

.name-field input:focus {
  border-color: var(--cinnabar);
}

.name-field input[readonly] {
  color: var(--ink-soft);
  cursor: default;
}

.profile-note {
  margin: 42px 0 24px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.8;
}

.save-profile {
  width: 100%;
  padding: 13px 18px;
  color: var(--paper);
  border: 1px solid var(--cinnabar-dark);
  background: var(--cinnabar-dark);
}

.view {
  display: none;
  min-height: calc(100vh - 78px);
}

.view.is-visible {
  display: block;
  animation: lift-in 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.inbox-layout {
  display: grid;
  grid-template-columns: minmax(290px, 360px) minmax(620px, 1fr);
  min-height: calc(100vh - 78px);
}

.inbox-aside {
  padding: 54px 38px 36px 5vw;
  border-right: 1px solid rgb(88 61 44 / 14%);
}

.weather-line {
  display: flex;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 11px;
}

.inbox-aside h2,
.compose-header h2,
.keepsakes h2 {
  margin: 38px 0 8px;
  font-family: var(--kai);
  font-size: 34px;
  font-weight: 400;
}

.inbox-count {
  margin: 0 0 36px;
  color: var(--ink-soft);
  font-size: 13px;
}

.letter-list {
  margin: 0 -18px;
}

.letter-row {
  position: relative;
  display: grid;
  width: 100%;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 19px 18px;
  border: 0;
  border-bottom: 1px solid rgb(91 63 45 / 12%);
  background: transparent;
  text-align: left;
  transition: background 180ms ease;
}

.letter-row:hover,
.letter-row.is-selected {
  background: rgb(255 250 235 / 48%);
}

.unread-dot {
  position: absolute;
  top: 25px;
  left: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cinnabar);
}

.letter-row-copy {
  min-width: 0;
}

.letter-row-copy strong,
.letter-row-copy span {
  display: block;
}

.letter-row-copy strong {
  margin-bottom: 7px;
  font-size: 14px;
}

.letter-row-copy span {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.letter-row time {
  color: var(--ink-soft);
  font-size: 11px;
}

.write-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 36px;
  padding: 14px;
  color: var(--paper);
  border: 1px solid var(--cinnabar-dark);
  background: var(--cinnabar-dark);
  transition: transform 180ms ease, background 180ms ease;
}

.write-button:hover,
.seal-button:hover,
.reply-button:hover {
  background: var(--cinnabar);
  transform: translateY(-2px);
}

.letter-reading {
  padding: 36px clamp(42px, 7vw, 112px) 48px;
  overflow: hidden;
}

.letter-meta {
  display: flex;
  width: min(700px, 100%);
  justify-content: space-between;
  margin: 0 auto 18px;
  color: var(--ink-soft);
  font-size: 11px;
}

.paper,
.compose-paper {
  position: relative;
  width: min(700px, 100%);
  margin: auto;
  padding: calc(var(--paper-block-padding) + 10px)
    clamp(44px, 7vw, var(--paper-inline-padding))
    var(--paper-block-padding);
  background:
    repeating-linear-gradient(0deg, transparent 0 31px, rgb(102 75 51 / 7%) 32px),
    linear-gradient(110deg, var(--paper), oklch(96% 0.019 82));
  box-shadow: var(--shadow);
}

.paper::before,
.compose-paper::before {
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E");
  content: "";
  mix-blend-mode: multiply;
  pointer-events: none;
}

.salutation {
  margin: 0 0 28px;
  font-size: var(--letter-font-size);
}

.letter-body {
  font-family: var(--kai);
  font-size: var(--letter-font-size);
  line-height: var(--letter-line-height);
}

.letter-body p {
  margin: 0 0 var(--letter-paragraph-gap);
  text-indent: 2em;
}

.letter-image,
.compose-image-preview figure {
  display: grid;
  justify-items: center;
  margin: 26px auto 30px;
}

.letter-image img,
.compose-image-preview img {
  display: block;
  width: min(100%, 430px);
  max-height: 360px;
  object-fit: contain;
  border: 1px solid rgb(80 56 40 / 18%);
  box-shadow: 0 16px 36px rgb(56 36 24 / 16%);
}

.signature {
  display: grid;
  justify-items: end;
  margin-top: 42px;
  font-family: var(--kai);
}

.signature strong {
  margin: 4px 18px 2px 0;
  font-size: 22px;
  font-weight: 400;
}

.signature time {
  color: var(--ink-soft);
  font-size: 12px;
}

.seal {
  position: absolute;
  right: 60px;
  bottom: 44px;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  color: var(--cinnabar);
  border: 2px solid currentColor;
  font-family: var(--kai);
  font-size: 25px;
  opacity: 0.82;
  transform: rotate(5deg);
}

.reading-actions,
.compose-actions {
  display: flex;
  width: min(700px, 100%);
  justify-content: flex-end;
  gap: 12px;
  margin: 22px auto 0;
}

.quiet-action,
.image-action,
.reply-button,
.seal-button,
.polish-button {
  min-width: 108px;
  padding: 12px 20px;
}

.quiet-action {
  border: 1px solid rgb(76 52 37 / 28%);
  background: transparent;
}

.image-action {
  color: var(--cinnabar-dark);
  border: 1px solid var(--cinnabar);
  background: rgb(248 241 223 / 48%);
}

.image-action:hover {
  background: rgb(158 47 36 / 7%);
}

.reply-button,
.seal-button {
  color: var(--paper);
  border: 1px solid var(--cinnabar-dark);
  background: var(--cinnabar-dark);
  transition: transform 180ms ease, background 180ms ease;
}

.compose-shell {
  width: min(1220px, calc(100vw - 64px));
  margin: auto;
  padding: 44px 0 52px;
}

.compose-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
}

.compose-header h2 {
  margin: 0;
}

.compose-header > p {
  color: var(--ink-soft);
  font-size: 12px;
}

.writing-desk {
  display: grid;
  grid-template-columns: minmax(580px, 780px) minmax(250px, 320px);
  align-items: start;
  justify-content: center;
  gap: 42px;
}

.compose-paper {
  width: 100%;
  min-height: 650px;
  padding-top: 48px;
}

.compose-fields {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 42px;
  color: var(--ink-soft);
  font-size: 12px;
}

.compose-fields label span {
  margin-right: 8px;
}

.compose-fields input,
.compose-signature input {
  width: 90px;
  padding: 3px 0;
  border: 0;
  border-bottom: 1px solid rgb(80 56 40 / 22%);
  outline: 0;
  background: transparent;
}

#letter-input {
  display: block;
  width: 100%;
  min-height: 410px;
  padding: 0;
  resize: none;
  color: var(--ink);
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--kai);
  font-size: var(--letter-font-size);
  line-height: var(--letter-line-height);
}

.compose-image-preview {
  display: grid;
  gap: 18px;
  margin: 24px 0 28px;
}

.compose-image-preview:empty {
  display: none;
}

.compose-image-preview figure {
  margin: 0;
}

.compose-image-preview figcaption,
.letter-image figcaption {
  margin-top: 9px;
  color: var(--ink-soft);
  font-size: 11px;
}

.compose-signature {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  font-family: var(--kai);
}

.compose-signature input {
  width: 78px;
  font-size: 19px;
}

.writing-tools {
  position: sticky;
  top: 112px;
  padding-top: 18px;
}

.font-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgb(76 52 37 / 14%);
}

.font-tools > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--cinnabar);
  border: 1px solid currentColor;
  font-family: var(--kai);
  font-size: 18px;
}

.font-size-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  flex: 1;
  gap: 8px;
}

.font-size-button {
  min-width: 0;
  padding: 9px 0;
  border: 1px solid rgb(76 52 37 / 18%);
  background: rgb(248 241 223 / 56%);
  font-family: var(--kai);
}

.font-size-button.is-active {
  color: var(--paper);
  border-color: var(--cinnabar-dark);
  background: var(--cinnabar-dark);
}

.image-insert-button {
  width: 100%;
  margin-bottom: 10px;
  padding: 11px 16px;
  color: var(--cinnabar-dark);
  border: 1px solid var(--cinnabar);
  background: rgb(248 241 223 / 56%);
}

.image-insert-button:disabled {
  cursor: progress;
  opacity: 0.6;
}

.upload-note {
  min-height: 20px;
  margin: 0 0 20px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.7;
}

.tool-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.mini-seal {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  font-size: 17px;
}

.tool-heading h3 {
  margin: 0 0 5px;
  font-size: 16px;
  font-weight: 600;
}

.tool-heading p,
.privacy-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.7;
}

.tone-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 24px 0 18px;
  border: 1px solid rgb(78 54 39 / 22%);
}

.tone-button {
  min-height: 54px;
  padding: 7px;
  border: 0;
  border-right: 1px solid rgb(78 54 39 / 22%);
  background: transparent;
  font-size: 12px;
}

.tone-button:last-child {
  border-right: 0;
}

.tone-button.is-active {
  color: var(--paper);
  background: var(--ink);
}

.selection-preview {
  min-height: 142px;
  padding: 20px;
  background: rgb(255 250 235 / 55%);
  border-top: 1px solid rgb(78 54 39 / 18%);
  border-bottom: 1px solid rgb(78 54 39 / 18%);
}

.selection-preview p {
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--kai);
  font-size: 14px;
  line-height: 1.8;
}

.selection-preview .original {
  margin-bottom: 14px;
  color: var(--ink-soft);
  text-decoration: line-through;
  text-decoration-color: rgb(117 45 37 / 38%);
}

.selection-preview .rewritten {
  color: var(--ink);
}

.accept-rewrite {
  margin-top: 16px;
  padding: 8px 0;
  color: var(--cinnabar-dark);
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  font-size: 12px;
}

.polish-button {
  width: 100%;
  margin-top: 18px;
  color: var(--cinnabar-dark);
  border: 1px solid var(--cinnabar);
  background: transparent;
}

.polish-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.privacy-note {
  margin-top: 10px;
  text-align: center;
}

.keepsakes {
  width: min(680px, calc(100vw - 40px));
  margin: auto;
  padding: 16vh 0 80px;
  text-align: center;
}

.keepsakes h2 {
  margin: 20px 0 28px;
  font-size: clamp(34px, 5vw, 52px);
}

.keepsakes > p:not(.eyebrow) {
  color: var(--ink-soft);
}

.keepsake-line {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 52px 0;
}

.keepsake-line span {
  width: 12px;
  height: 12px;
  border: 2px solid var(--cinnabar);
  transform: rotate(45deg);
}

.keepsake-line i {
  width: 100px;
  height: 1px;
  background: rgb(92 62 43 / 24%);
}

.keepsakes .reply-button {
  margin-top: 24px;
}

.sent-overlay {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--paper);
  background: rgb(43 27 20 / 94%);
  animation: fade-in 300ms ease-out both;
}

.sent-envelope {
  position: relative;
  width: 270px;
  height: 168px;
  background: var(--paper-deep);
  box-shadow: 0 30px 70px rgb(10 6 4 / 35%);
  animation: send-away 2.2s 1.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.envelope-flap {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, transparent 49.5%, oklch(86% 0.035 78) 50%);
  clip-path: polygon(0 0, 100% 0, 50% 72%);
}

.sent-seal {
  position: absolute;
  top: 62px;
  left: 113px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--paper);
  border-radius: 50%;
  background: var(--cinnabar);
  font-family: var(--kai);
  font-size: 19px;
}

.sent-overlay > p {
  margin: 38px 0 8px;
  font-family: var(--kai);
  font-size: 28px;
}

.sent-overlay > span {
  color: oklch(75% 0.02 78);
  font-size: 13px;
}

.share-overlay {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgb(43 27 20 / 86%);
  backdrop-filter: blur(7px);
  animation: fade-in 240ms ease-out both;
}

.share-dialog {
  display: grid;
  width: min(920px, 100%);
  max-height: calc(100vh - 56px);
  grid-template-columns: minmax(300px, 1fr) 310px;
  grid-template-rows: auto 1fr auto auto;
  column-gap: 36px;
  padding: 34px;
  overflow: hidden;
  background: oklch(94% 0.026 81);
  box-shadow: 0 34px 90px rgb(12 7 4 / 42%);
}

.share-header {
  display: flex;
  grid-column: 2;
  align-items: flex-start;
  justify-content: space-between;
}

.share-header h2 {
  margin: 0;
  font-family: var(--kai);
  font-size: 28px;
  font-weight: 400;
}

.close-share {
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--ink-soft);
  border: 1px solid rgb(76 52 37 / 24%);
  border-radius: 50%;
  background: transparent;
  font-family: serif;
  font-size: 22px;
}

.share-preview {
  display: flex;
  min-height: 0;
  grid-row: 1 / -1;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 18px;
  overflow: auto;
  background: oklch(34% 0.028 49);
}

.share-page {
  width: min(100%, 430px);
  margin: 0;
}

.share-page img {
  display: block;
  width: 100%;
  height: auto;
  box-shadow: 0 20px 44px rgb(12 7 4 / 34%);
}

.share-page figcaption {
  margin-top: 10px;
  color: oklch(82% 0.015 78);
  font-size: 11px;
  text-align: center;
}

.share-note {
  align-self: end;
  margin: 30px 0 18px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
}

.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.share-actions button {
  min-width: 0;
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes lift-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes send-away {
  to {
    opacity: 0;
    transform: translateY(-160px) scale(0.72);
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
}

@media (max-width: 900px) {
  .gate {
    align-items: end;
    background-position: 35% center;
  }

  .gate-copy {
    width: 100%;
    margin: 0;
    padding: 34px 28px 28px;
    background: rgb(43 26 20 / 88%);
  }

  .gate h1 {
    font-size: 64px;
  }

  .gate-note {
    margin-bottom: 26px;
  }

  .pairing {
    padding: 0;
  }

  .pairing-inner {
    min-height: 100vh;
    padding: 52px 28px;
  }

  .topbar {
    grid-template-columns: 1fr auto;
    height: 68px;
    padding: 0 20px;
  }

  .brand small {
    display: none;
  }

  .primary-nav {
    position: fixed;
    z-index: 20;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    height: 62px;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    background: rgb(242 235 218 / 97%);
    border-top: 1px solid rgb(88 61 44 / 16%);
    backdrop-filter: blur(10px);
  }

  .nav-item::after {
    top: 0;
    bottom: auto;
    right: 28%;
    left: 28%;
  }

  .avatar {
    display: grid;
  }

  .profile-panel {
    top: 68px;
    bottom: 62px;
    width: 100%;
    padding: 34px 28px;
    border-left: 0;
  }

  .view {
    min-height: calc(100vh - 130px);
    padding-bottom: 62px;
  }

  .inbox-layout {
    display: block;
    min-height: auto;
  }

  .inbox-aside {
    padding: 30px 20px 18px;
    border-right: 0;
  }

  .inbox-aside h2 {
    margin-top: 26px;
  }

  .letter-list {
    margin: 0 -8px;
  }

  .letter-row:not(.is-selected) {
    display: none;
  }

  .write-button {
    display: none;
  }

  .letter-reading {
    padding: 12px 12px 36px;
  }

  .letter-meta {
    padding: 0 8px;
  }

  .paper,
  .compose-paper {
    padding: calc(var(--paper-block-padding) - 8px) 28px calc(var(--paper-block-padding) - 10px);
  }

  .letter-body {
    font-size: calc(var(--letter-font-size) - 1px);
  }

  .seal {
    right: 28px;
    bottom: 34px;
  }

  .compose-shell {
    width: 100%;
    padding: 26px 12px 32px;
  }

  .compose-header {
    padding: 0 8px;
  }

  .compose-header > p {
    display: none;
  }

  .writing-desk {
    display: flex;
    flex-direction: column;
    gap: 26px;
  }

  .compose-paper {
    min-height: 600px;
  }

  .writing-tools {
    position: static;
    width: 100%;
    padding: 12px 8px;
  }

  .compose-actions {
    padding: 0 8px;
  }

  .reading-actions,
  .compose-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .reading-actions .reply-button,
  .compose-actions .seal-button {
    grid-column: 1 / -1;
  }

  .share-overlay {
    padding: 0;
  }

  .share-dialog {
    width: 100%;
    height: 100%;
    max-height: none;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    gap: 18px;
    padding: 22px 18px;
  }

  .share-header {
    grid-column: 1;
  }

  .share-preview {
    grid-row: 2;
    padding: 12px;
  }

  .share-page {
    width: min(100%, 340px);
  }

  .share-note {
    margin: 0;
  }
}

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