:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  --text: rgba(248, 246, 240, 0.96);
  --muted: rgba(248, 246, 240, 0.66);
  --faint: rgba(248, 246, 240, 0.34);
  --focus: #f8e7c6;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: #101820;
}

body {
  min-height: 100svh;
  overflow: hidden;
}

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

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

button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.app {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 100svh;
  overflow: hidden;
  color: var(--text);
  background: #a5afb1;
}

.scene,
.weather,
.shade,
.loading-veil {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.scene {
  z-index: -4;
  opacity: 0.76;
  background-image: url("/assets/day-overcast.webp");
  background-position: center;
  background-size: cover;
  filter: blur(12px) grayscale(0.2) saturate(0.58) brightness(1.34) contrast(0.78);
  transform: scale(1.035);
  transition: background-image 900ms ease, filter 3000ms ease, opacity 2600ms ease;
  animation: breathe 18s ease-in-out infinite alternate;
}

.app[data-scene="night-rain"] .scene {
  background-image: url("/assets/night-rain.webp");
}

.app[data-scene="night-clear"] .scene {
  background-image: url("/assets/night-clear.webp");
}

.app[data-scene="day-clear"] .scene {
  background-image: url("/assets/day-clear.webp");
}

.app[data-scene="day-overcast"] .scene {
  background-image: url("/assets/day-overcast.webp");
}

.weather {
  z-index: -3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 2200ms ease 600ms;
}

.shade {
  z-index: -2;
  opacity: 0;
  pointer-events: none;
  background: rgba(5, 9, 12, 0.12);
  transition: opacity 2200ms ease;
}

.loading-veil {
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 48% 40%, rgba(255, 255, 255, 0.46), transparent 54%),
    linear-gradient(125deg, rgba(245, 248, 247, 0.72), rgba(222, 232, 234, 0.48));
  -webkit-backdrop-filter: blur(9px) saturate(0.66);
  backdrop-filter: blur(9px) saturate(0.66);
  opacity: 1;
  transition: opacity 2600ms ease;
}

.loading-veil::before,
.loading-veil::after {
  position: absolute;
  inset: -8%;
  content: "";
}

.loading-veil::before {
  background:
    repeating-linear-gradient(103deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 8px),
    repeating-radial-gradient(circle at 26% 38%, rgba(255, 255, 255, 0.2) 0 1px, transparent 1px 6px);
  mix-blend-mode: soft-light;
  opacity: 0.34;
  transform: rotate(-1.5deg);
}

.loading-veil::after {
  background:
    linear-gradient(98deg, transparent 12%, rgba(255, 255, 255, 0.22) 34%, transparent 53%),
    radial-gradient(ellipse at 72% 30%, rgba(255, 255, 255, 0.22), transparent 42%);
  filter: blur(5px);
  opacity: 0.58;
}

.app.context-ready .scene,
.app.context-ready .weather,
.app.context-ready .shade {
  opacity: 1;
}

.app.context-ready .scene {
  filter: blur(0) saturate(1);
}

.app.context-ready .loading-veil {
  opacity: 0;
}

.app.location-uncertain .scene {
  opacity: 0.84;
  filter: blur(10px) grayscale(0.16) saturate(0.64) brightness(1.28) contrast(0.82);
}

.app.location-uncertain .weather {
  opacity: 0;
}

.app.location-uncertain .shade {
  opacity: 0.24;
  background: rgba(226, 235, 236, 0.28);
}

.app.location-uncertain .loading-veil {
  opacity: 0.34;
  -webkit-backdrop-filter: blur(6px) saturate(0.76);
  backdrop-filter: blur(6px) saturate(0.76);
}

.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  align-self: start;
  width: 100%;
  padding: max(30px, env(safe-area-inset-top)) max(42px, env(safe-area-inset-right)) 0 max(42px, env(safe-area-inset-left));
}

.wordmark {
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  letter-spacing: 0.01em;
  text-decoration: none;
  text-shadow: 0 1px 16px rgba(0, 0, 0, 0.42);
}

.controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.language-control select,
.text-button,
.icon-button,
.location-button,
.dialog-close {
  min-height: 44px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.language-control select {
  max-width: 112px;
  padding: 0 4px;
  border-radius: 0;
  appearance: auto;
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0;
}

.icon-button {
  display: grid;
  width: 44px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  transition: color 350ms ease, background 350ms ease;
}

.icon-button:hover {
  color: var(--text);
  background: rgba(248, 246, 240, 0.08);
}

.icon-button svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.45;
}

.sound-toggle .sound-wave,
.sound-toggle[aria-pressed="true"] .sound-muted {
  display: none;
}

.sound-toggle[aria-pressed="true"] .sound-wave {
  display: block;
}

.motion-state {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 9px rgba(248, 246, 240, 0.5);
}

.motion-toggle[aria-pressed="false"] .motion-state {
  background: var(--faint);
  box-shadow: none;
}

.greeting {
  position: absolute;
  top: 47%;
  left: 50%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(900px, calc(100% - 48px));
  text-align: center;
  transform: translate(-50%, -50%);
  transition: top 700ms cubic-bezier(0.22, 1, 0.36, 1);
}

.app.has-interaction .greeting {
  top: 42%;
}

.message-wrap {
  display: grid;
  min-height: 92px;
  place-items: center;
}

.message-wrap,
.context-line,
.progress {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 1600ms ease 900ms, transform 1800ms cubic-bezier(0.22, 1, 0.36, 1) 900ms;
}

.app.context-ready .message-wrap,
.app.context-ready .context-line,
.app.context-ready .progress {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.message {
  margin: 0;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
  font-size: clamp(38px, 4vw, 62px);
  font-weight: 400;
  line-height: 1.34;
  letter-spacing: 0.015em;
  text-wrap: balance;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.68);
  transition: opacity 560ms ease, transform 560ms ease;
}

.message.changing {
  opacity: 0;
  transform: translateY(7px);
}

.message.acknowledgement-leaving {
  opacity: 0;
  transform: translateY(7px);
  transition-duration: 1050ms;
}

.message.acknowledgement-entering {
  animation: acknowledgement-in 1500ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.aftercare-space {
  position: relative;
  width: min(620px, 100%);
  min-height: 34px;
  margin-top: 5px;
}

.aftercare-panel,
.aftercare-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aftercare-panel {
  max-height: none;
  overflow: visible;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 900ms ease, transform 1000ms cubic-bezier(0.22, 1, 0.36, 1);
}

.aftercare-panel.open {
  max-height: none;
  margin: 0;
  opacity: 1;
  transform: translateY(0);
}

.aftercare-button,
.aftercare-auth a {
  border: 0;
  color: rgba(248, 246, 240, 0.68);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  letter-spacing: 0.035em;
  text-decoration: underline;
  text-decoration-color: rgba(248, 246, 240, 0.28);
  text-underline-offset: 5px;
}

.aftercare-auth {
  display: flex;
  gap: 18px;
  margin-left: 18px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.aftercare-auth[hidden] {
  display: none;
}

.aftercare-auth.open {
  opacity: 1;
  transform: translateY(0);
}

.aftercare-status {
  margin: 0;
  color: rgba(248, 246, 240, 0.6);
  font-size: 13px;
  pointer-events: none;
}

.aftercare-status:empty {
  display: none;
}

.context-line {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 14px;
  min-height: 44px;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.72);
}

.location-button {
  padding: 0;
  text-decoration: underline;
  text-decoration-color: rgba(248, 246, 240, 0.32);
  text-underline-offset: 4px;
}

.progress {
  position: fixed;
  bottom: max(70px, env(safe-area-inset-bottom));
  left: 50%;
  display: flex;
  gap: 14px;
  margin-top: 0;
  transform: translate(-50%, 8px);
}

.app.context-ready .progress {
  transform: translate(-50%, 0);
}

.progress button {
  position: relative;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.progress button::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(248, 246, 240, 0.3);
  content: "";
  transform: translate(-50%, -50%);
  transition: width 250ms ease, background 250ms ease;
}

.progress button.active::after {
  width: 18px;
  border-radius: 999px;
  background: rgba(248, 246, 240, 0.92);
}

.reveal-panel[hidden] {
  display: none;
}

.reveal-panel {
  width: min(580px, 100%);
  max-height: 0;
  margin: 0 auto;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px);
  transition: max-height 700ms cubic-bezier(0.22, 1, 0.36, 1),
    margin-top 700ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 480ms ease,
    transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-panel.open {
  max-height: 430px;
  margin-top: 22px;
  opacity: 1;
  transform: translateY(0);
}

.reveal-panel.aftercare-panel,
.reveal-panel.aftercare-panel.open {
  max-height: none;
  margin: 0;
  overflow: visible;
}

.reveal-panel.aftercare-panel {
  opacity: 0;
  transform: translateY(5px);
}

.reveal-panel.aftercare-panel.open {
  opacity: 1;
  transform: translateY(0);
}

.choice-panel {
  position: absolute;
  top: calc(100% + 18px);
  left: 50%;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  width: max-content;
  max-width: 100%;
  margin: 0;
  transform: translate(-50%, 10px);
  transition: opacity 1400ms ease, transform 1400ms cubic-bezier(0.22, 1, 0.36, 1);
}

.choice-panel.open {
  max-height: 60px;
  margin: 0;
  transform: translate(-50%, 0);
}

.experience-button {
  min-height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  cursor: pointer;
}

.experience-button-primary {
  border: 1px solid rgba(244, 234, 217, 0.92);
  color: #172027;
  background: #f4ead9;
}

.experience-button-secondary {
  border: 1px solid rgba(248, 246, 240, 0.34);
  color: var(--text);
  background: rgba(10, 17, 22, 0.2);
  backdrop-filter: blur(10px);
}

.note-form {
  display: grid;
  gap: 12px;
  text-align: left;
}

.panel-prompt,
.voice-kicker {
  margin: 0;
  color: rgba(248, 246, 240, 0.72);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.note-form textarea {
  display: block;
  width: 100%;
  min-height: 98px;
  padding: 16px 18px;
  resize: none;
  border: 1px solid rgba(248, 246, 240, 0.3);
  border-radius: 14px;
  color: var(--text);
  background: rgba(10, 17, 22, 0.38);
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(10px);
}

.note-form textarea::placeholder {
  color: rgba(248, 246, 240, 0.48);
}

.audience-choice {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 0;
  border: 0;
}

.audience-choice legend {
  width: 100%;
  margin-bottom: 8px;
  color: rgba(248, 246, 240, 0.68);
  font-size: 13px;
}

.audience-choice label {
  cursor: pointer;
}

.audience-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.audience-choice span {
  display: grid;
  min-height: 42px;
  padding: 0 14px;
  place-items: center;
  border: 1px solid rgba(248, 246, 240, 0.2);
  border-radius: 11px;
  color: rgba(248, 246, 240, 0.66);
  background: rgba(10, 17, 22, 0.2);
  font-size: 13px;
  transition: border-color 240ms ease, color 240ms ease, background 240ms ease;
}

.audience-choice input:checked + span {
  border-color: rgba(248, 246, 240, 0.58);
  color: var(--text);
  background: rgba(248, 246, 240, 0.12);
}

.audience-choice input:focus-visible + span {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.audience-hint {
  min-height: 18px;
  margin: -4px 0 0;
  color: rgba(248, 246, 240, 0.5);
  font-size: 12px;
}

.note-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 10px;
}

.voice-panel {
  padding: 20px 24px;
  border: 1px solid rgba(248, 246, 240, 0.2);
  border-radius: 18px;
  text-align: left;
  background: rgba(10, 17, 22, 0.26);
  backdrop-filter: blur(12px);
  transition: max-height 700ms cubic-bezier(0.22, 1, 0.36, 1),
    margin-top 700ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 280ms ease,
    transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
}

.voice-panel blockquote {
  margin: 18px 0 12px;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
  font-size: clamp(19px, 2.2vw, 25px);
  line-height: 1.75;
}

.voice-context {
  margin: 0;
  color: rgba(248, 246, 240, 0.5);
  font-size: 12px;
}

.voice-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.voice-panel.changing blockquote,
.voice-panel.changing .voice-context {
  opacity: 0;
  transform: translateY(5px);
}

.voice-panel blockquote,
.voice-panel .voice-context {
  transition: opacity 280ms ease, transform 280ms ease;
}

.send-button,
.primary-button {
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  color: #172027;
  background: #f4ead9;
  cursor: pointer;
}

.send-button:disabled,
.primary-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.status {
  position: absolute;
  right: 24px;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 24px;
  z-index: 4;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}

.location-dialog,
.letter-dialog {
  width: min(480px, calc(100% - 32px));
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  color: #f6f2e9;
  background: rgba(17, 25, 31, 0.96);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}

.location-dialog::backdrop,
.letter-dialog::backdrop {
  background: rgba(3, 8, 11, 0.68);
  backdrop-filter: blur(8px);
}

.letter-dialog {
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 24%, rgba(105, 118, 122, 0.22), transparent 48%),
    rgba(13, 20, 25, 0.985);
  transform: scale(1.008);
  transition: opacity 900ms ease, transform 1200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.letter-dialog[open] {
  opacity: 1;
  transform: scale(1);
}

.dialog-close-row {
  display: flex;
  justify-content: flex-end;
  padding: 10px 16px 0;
}

.dialog-close {
  padding: 0;
}

.location-form {
  display: grid;
  gap: 12px;
  padding: 0 34px 34px;
}

.dialog-kicker {
  margin: 0;
  color: rgba(246, 242, 233, 0.52);
  font-family: Georgia, serif;
}

.location-form h2 {
  margin: 4px 0 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 30px;
  font-weight: 400;
}

.location-form > p:not(.dialog-kicker) {
  margin: 0 0 8px;
  color: rgba(246, 242, 233, 0.68);
  line-height: 1.7;
}

.location-form label {
  margin-top: 4px;
  color: rgba(246, 242, 233, 0.78);
  font-size: 14px;
}

.location-form input {
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.location-form .primary-button {
  margin-top: 8px;
}

.location-form .precise-location-button {
  width: 100%;
  margin: 0;
}

.location-form .location-permission-status {
  min-height: 0;
  margin: -4px 0 0;
  color: rgba(246, 242, 233, 0.68);
  font-size: 12px;
}

.location-permission-status:empty {
  display: none;
}

.location-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(246, 242, 233, 0.48);
  font-size: 12px;
}

.location-divider::before,
.location-divider::after {
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  content: "";
  flex: 1;
}

.location-form .dialog-privacy {
  margin-top: 8px;
  font-size: 12px;
}

.letter-shell {
  display: flex;
  width: min(760px, calc(100% - 48px));
  height: 100%;
  min-height: 0;
  padding: max(34px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom));
  margin: 0 auto;
  overflow: hidden;
  flex-direction: column;
}

.letter-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex: 0 0 auto;
}

.letter-shell h2 {
  margin: 6px 0 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 32px;
  font-weight: 400;
}

.auth-view > p {
  margin: 10px 0 22px;
  color: rgba(246, 242, 233, 0.66);
  line-height: 1.7;
}

.letter-close {
  padding: 0;
}

.oauth-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.oauth-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: #f6f2e9;
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
}

.oauth-button[hidden] {
  display: none;
}

.oauth-mark {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: #1d252b;
  background: #f6f2e9;
  font-weight: 700;
}

.microsoft-mark {
  border-radius: 5px;
}

.account-summary,
.letter-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.account-summary {
  margin: 14px 0 0;
  padding: 0;
  border: 0;
}

.account-summary p {
  min-width: 0;
  margin: 0;
  color: rgba(246, 242, 233, 0.62);
  font-size: 13px;
}

.account-summary strong {
  color: rgba(246, 242, 233, 0.9);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.dialog-text-button {
  padding: 6px 0;
  border: 0;
  color: rgba(246, 242, 233, 0.62);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
}

.account-view {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.account-view[hidden] {
  display: none;
}

.letter-nav {
  display: flex;
  gap: 22px;
  padding: 18px 0 10px;
  flex: 0 0 auto;
}

.letter-nav .dialog-text-button {
  position: relative;
  color: rgba(246, 242, 233, 0.44);
}

.letter-nav .dialog-text-button.active {
  color: rgba(246, 242, 233, 0.92);
}

.letter-nav .dialog-text-button.active::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: rgba(246, 242, 233, 0.55);
  content: "";
}

.letter-view {
  min-height: 0;
  opacity: 0;
  transform: translateY(7px);
}

.letter-view.active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 800ms ease, transform 1000ms cubic-bezier(0.22, 1, 0.36, 1);
}

#letter-compose-view {
  display: flex;
  min-height: 0;
  flex: 1;
}

.letter-form {
  display: grid;
  width: 100%;
  min-height: 0;
  gap: 9px;
  grid-template-rows: auto 50px auto 50px auto minmax(120px, 1fr) auto;
}

.letter-form label {
  margin-top: 5px;
  color: rgba(246, 242, 233, 0.76);
  font-size: 13px;
}

.letter-form input,
.letter-form textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 11px;
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.letter-form textarea {
  min-height: 120px;
  resize: none;
  line-height: 1.7;
}

.letter-form input::placeholder,
.letter-form textarea::placeholder {
  color: rgba(246, 242, 233, 0.38);
}

.letter-form .primary-button {
  justify-self: end;
  margin-top: 6px;
}

.history-view {
  min-height: 0;
  padding-top: 10px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.history-view h3 {
  margin: 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 22px;
  font-weight: 400;
}

.letter-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 14px 0 0;
  list-style: none;
}

.letter-card {
  padding: 15px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.letter-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.letter-card h4 {
  margin: 0;
  color: rgba(246, 242, 233, 0.94);
  font-size: 15px;
  font-weight: 500;
}

.letter-card time,
.letter-card-status {
  color: rgba(246, 242, 233, 0.46);
  font-size: 11px;
}

.letter-card-status {
  white-space: nowrap;
}

.letter-card-body {
  margin: 10px 0 0;
  color: rgba(246, 242, 233, 0.68);
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.letter-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: rgba(246, 242, 233, 0.46);
  font-size: 11px;
  flex-wrap: wrap;
}

.delete-message-button {
  margin-left: auto;
  color: rgba(246, 242, 233, 0.5);
}

.letter-empty {
  margin: 16px 0 0;
  color: rgba(246, 242, 233, 0.48);
  font-size: 13px;
}

.letter-status {
  min-height: 20px;
  margin: 16px 0 0;
  color: rgba(246, 242, 233, 0.68);
  font-size: 13px;
}

.letter-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  min-height: 32px;
  flex: 0 0 auto;
}

.privacy-policy-link {
  display: inline-block;
  margin-top: 4px;
  color: rgba(246, 242, 233, 0.44);
  font-size: 12px;
  text-underline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

noscript {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  padding: 24px;
  place-items: center;
  color: #f6f2e9;
  background: #101820;
}

@keyframes breathe {
  from { transform: scale(1.015); }
  to { transform: scale(1.045); }
}

@keyframes acknowledgement-in {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes letter-field-in {
  from {
    opacity: 0;
    filter: blur(3px);
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

.letter-dialog[open] .letter-form > * {
  animation: letter-field-in 900ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.letter-dialog[open] .letter-form > :nth-child(2) { animation-delay: 100ms; }
.letter-dialog[open] .letter-form > :nth-child(3),
.letter-dialog[open] .letter-form > :nth-child(4) { animation-delay: 180ms; }
.letter-dialog[open] .letter-form > :nth-child(5),
.letter-dialog[open] .letter-form > :nth-child(6) { animation-delay: 260ms; }
.letter-dialog[open] .letter-form > :nth-child(7) { animation-delay: 340ms; }

@media (max-width: 700px) {
  .topbar {
    padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  }

  .wordmark {
    font-size: 19px;
  }

  .controls {
    gap: 8px;
  }

  .language-control select {
    width: 76px;
    font-size: 14px;
  }

  .text-button {
    font-size: 14px;
  }

  .icon-button {
    width: 38px;
    min-height: 40px;
  }

  .motion-state {
    display: none;
  }

  .greeting {
    width: calc(100% - 36px);
    top: 45%;
  }

  .app.has-interaction .greeting {
    top: 39%;
  }

  .message-wrap {
    min-height: 118px;
  }

  .message {
    font-size: clamp(32px, 9.4vw, 44px);
    line-height: 1.45;
  }

  .context-line {
    margin-top: 6px;
    font-size: 14px;
  }

  .aftercare-space {
    min-height: 40px;
  }

  .aftercare-panel {
    flex-direction: column;
  }

  .aftercare-auth {
    gap: 12px;
    margin: 6px 0 0;
  }

  .progress {
    bottom: max(20px, env(safe-area-inset-bottom));
  }

  .reveal-panel.open {
    margin-top: 18px;
  }

  .choice-panel {
    flex-wrap: nowrap;
  }

  .choice-panel .experience-button {
    padding: 0 16px;
    font-size: 13px;
  }

  .voice-panel {
    padding: 18px;
  }

  .note-actions {
    align-items: flex-end;
  }

  .location-form {
    padding: 0 24px 28px;
  }

  .letter-shell {
    width: calc(100% - 36px);
    padding-top: max(22px, env(safe-area-inset-top));
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  .oauth-actions {
    grid-template-columns: 1fr;
  }

  .letter-card-header,
  .letter-card-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .letter-shell h2 {
    font-size: 28px;
  }

  .account-summary {
    margin-top: 10px;
  }

  .letter-nav {
    gap: 18px;
    padding-top: 10px;
  }

  .letter-form {
    grid-template-rows: auto 46px auto 46px auto minmax(92px, 1fr) auto;
  }

  .scene {
    background-position: 54% center;
  }
}

@media (max-height: 650px) {
  .greeting {
    top: 46%;
  }

  .message-wrap {
    min-height: 72px;
  }

  .note-form textarea {
    min-height: 78px;
  }

  .app.has-interaction .greeting {
    top: 38%;
  }
}

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

.motion-off .scene {
  animation: none;
  transform: scale(1.015);
}
