:root {
  --night: #07090d;
  --text: #e7e2d8;
  --warm: #d4c4a8;
  --dim: rgba(231, 226, 216, 0.5);
  --line: rgba(231, 226, 216, 0.14);
  --serif: "Cormorant Garamond", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: Outfit, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--night);
  color: var(--text);
}

body {
  font-family: var(--sans);
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

.sky {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(ellipse 48% 36% at 80% -4%, rgba(148, 168, 198, 0.18), transparent 68%),
    radial-gradient(ellipse 55% 42% at 50% 118%, rgba(78, 52, 38, 0.32), transparent 62%),
    var(--night);
}

.sky::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(ellipse at center, transparent 46%, rgba(0, 0, 0, 0.42) 100%);
}

.mist {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  animation: sway 42s ease-in-out infinite;
}

.orb-a {
  width: 46vw;
  height: 46vw;
  top: -14%;
  right: -10%;
  background: rgba(156, 176, 206, 0.16);
}

.orb-b {
  width: 40vw;
  height: 40vw;
  bottom: -16%;
  left: -12%;
  background: rgba(92, 64, 48, 0.22);
  animation-delay: -14s;
}

.orb-c {
  width: 28vw;
  height: 22vw;
  top: 38%;
  left: 34%;
  background: rgba(190, 198, 214, 0.07);
  animation-delay: -22s;
}

@keyframes sway {
  0%,
  100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(2.5%, -2%, 0); }
}

.top,
.writer,
.care {
  position: relative;
  z-index: 3;
  transition: opacity 0.45s ease;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 1.35rem 1.7rem 0;
}

.mark,
.hint,
.preface-even,
.preface-quiet,
.care,
.breath-kicker,
.breath-when,
.breath-read,
.breath-note,
.after,
.to span,
.exhale,
.breath-close,
.breath-hide {
  font-family: var(--sans);
  font-weight: 300;
}

.mark,
.hint {
  margin: 0;
}

.mark {
  letter-spacing: 0.28em;
  font-size: 0.72rem;
  color: rgba(231, 226, 216, 0.78);
}

.mark-dot {
  display: inline-block;
  width: 0.38rem;
  height: 0.38rem;
  margin-right: 0.65rem;
  border-radius: 50%;
  vertical-align: 0.05em;
  background: var(--warm);
  box-shadow: 0 0 12px rgba(212, 196, 168, 0.85);
}

.hint {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: rgba(231, 226, 216, 0.42);
}

.writer {
  width: min(32rem, calc(100% - 2.4rem));
  margin: 0 auto;
  padding: 0.7rem 0 9.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.writer::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -12% -18%;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(7, 9, 13, 0.78) 0%, rgba(7, 9, 13, 0.42) 52%, transparent 74%);
}

.preface {
  margin: 0 0 1.15rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preface-open {
  display: flex;
  flex-direction: column;
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.45rem, 2.5vw, 1.72rem);
  line-height: 1.22;
  letter-spacing: -0.015em;
}

.preface-say {
  margin: 0.55rem 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.5rem, 2.6vw, 1.85rem);
  line-height: 1.2;
  color: var(--warm);
}

.preface-even {
  margin: 0.55rem 0 0;
  padding: 0;
  list-style: none;
  font-weight: 300;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--dim);
}

.preface-rite {
  margin: 0.75rem 0 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.65rem, 2.8vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.preface-quiet {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  margin: 0.4rem 0 0;
  font-weight: 300;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  color: rgba(231, 226, 216, 0.46);
}

.letter {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  text-align: left;
}

.to {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
}

.to span {
  flex: none;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  color: var(--dim);
}

.to input {
  width: 100%;
  padding: 0.15rem 0 0.25rem;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.55rem;
  line-height: 1.2;
}

textarea {
  width: 100%;
  min-height: 6.4rem;
  padding: 0.85rem 0 0;
  border: none;
  border-top: 1px solid var(--line);
  border-radius: 0;
  resize: none;
  background: transparent;
  font-family: var(--serif);
  font-size: 1.45rem;
  line-height: 1.65;
  caret-color: var(--warm);
}

textarea:focus,
.to input:focus,
.exhale:focus,
.breath-close:focus,
.breath-hide:focus {
  outline: none;
}

textarea:focus-visible,
.to input:focus-visible {
  border-color: rgba(212, 196, 168, 0.55);
}

::placeholder {
  color: rgba(231, 226, 216, 0.32);
  font-style: italic;
}

.to input::placeholder {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-style: normal;
  letter-spacing: 0.04em;
}

textarea.is-nudge::placeholder {
  color: rgba(212, 196, 168, 0.62);
}

.count {
  margin: -0.15rem 0 0;
  text-align: right;
  font-family: var(--sans);
  font-weight: 300;
  font-size: 0.75rem;
  color: rgba(231, 226, 216, 0.38);
}

.count.is-near {
  color: var(--warm);
}

.after {
  min-height: 1.3em;
  margin: 0;
  text-align: center;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  color: var(--warm);
  opacity: 0;
  transition: opacity 0.7s ease;
}

.after.is-on {
  opacity: 1;
}

.exhale,
.breath-close,
.breath-hide {
  align-self: center;
  padding: 0.8rem 1.7rem;
  border: 1px solid rgba(231, 226, 216, 0.22);
  border-radius: 999px;
  background: transparent;
  color: var(--warm);
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.exhale:hover,
.breath-close:hover,
.breath-hide:hover,
.exhale:focus-visible,
.breath-close:focus-visible,
.breath-hide:focus-visible {
  background: rgba(212, 196, 168, 0.08);
  border-color: rgba(212, 196, 168, 0.5);
  box-shadow: 0 0 28px rgba(212, 196, 168, 0.12);
}

.exhale:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
}

.care {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 1.75rem;
  padding: 0 1.2rem 1.2rem;
  text-align: center;
}

.help {
  position: relative;
}

.help-open {
  padding: 0;
  border: none;
  background: none;
  color: rgba(231, 226, 216, 0.58);
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.22em;
  text-decoration-color: rgba(231, 226, 216, 0.28);
}

.help-open:hover,
.help-open:focus-visible {
  color: var(--text);
}

.help-open:focus-visible {
  outline: 1px solid rgba(212, 196, 168, 0.5);
  outline-offset: 4px;
}

.help-panel {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: calc(100% + 0.7rem);
  transform: translateX(-50%);
  width: min(28rem, calc(100vw - 2rem));
  padding: 0.85rem 1rem;
  border: 1px solid rgba(212, 196, 168, 0.22);
  border-radius: 1rem;
  background: rgba(12, 16, 24, 0.96);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
  text-align: left;
}

.help-panel[hidden] {
  display: none;
}

.help-panel p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: rgba(231, 226, 216, 0.86);
}

.help-panel p + p {
  margin-top: 0.55rem;
}

.help-panel a,
.urgent a {
  color: var(--warm);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.urgent {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(231, 226, 216, 0.72);
}

html[data-lang="en"] [data-lang-only="ru"],
html[data-lang="ru"] [data-lang-only="en"] {
  display: none !important;
}

html[data-lang="en"] .urgent[data-lang-only="en"] {
  max-width: 28rem;
}

.air {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5.2rem 1.35rem 3rem;
  pointer-events: none;
}

.air-col {
  display: flex;
  flex-direction: column;
  justify-content: safe center;
  gap: 0.85rem;
  width: min(14.75rem, 18vw);
  max-height: calc(100dvh - 8.5rem);
  overflow-y: auto;
  overflow-anchor: none;
  scrollbar-width: none;
  pointer-events: auto;
}

/* When the column overflows, center clipping hides the top card. */
.air-col.is-tall {
  justify-content: flex-start;
}

.air-col::-webkit-scrollbar {
  display: none;
}

.breath-hold {
  width: 100%;
  flex: none;
}

.breath {
  position: relative;
  width: 100%;
  padding: 0.85rem 0.95rem 0.75rem;
  border: 1px solid rgba(232, 226, 214, 0.12);
  border-radius: 1.45rem;
  background:
    radial-gradient(ellipse at 28% 0%, rgba(255, 255, 255, 0.08), transparent 58%),
    rgba(176, 190, 208, 0.06);
  box-shadow: inset 0 0 28px rgba(255, 255, 255, 0.03), 0 16px 40px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(10px);
  cursor: pointer;
  pointer-events: auto;
  animation: drift var(--dur, 30s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

.breath:focus-visible {
  outline: 1px solid rgba(212, 196, 168, 0.5);
  outline-offset: 4px;
}

@keyframes drift {
  0%,
  100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -7px, 0); }
}

.breath-kicker,
.breath-to,
.breath-text,
.breath-when,
.breath-read,
.breath-note {
  margin: 0;
}

.breath-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  color: rgba(231, 226, 216, 0.46);
}

.breath-to {
  margin-top: 0.12rem;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.55rem;
  line-height: 1.1;
}

.breath-text {
  margin-top: 0.65rem;
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.5;
  color: rgba(231, 226, 216, 0.82);
  filter: blur(7px);
  user-select: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 1.3s ease, filter 1.3s ease;
}

.breath.is-fresh .breath-text {
  color: var(--text);
  filter: none;
}

.breath-when {
  margin-top: 0.55rem;
  font-size: 0.7rem;
  color: rgba(231, 226, 216, 0.4);
}

.breath-read {
  margin-top: 0.45rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: rgba(231, 226, 216, 0.55);
  opacity: 0.38;
  transition: opacity 0.3s ease;
}

.breath:hover .breath-read,
.breath:focus-visible .breath-read {
  opacity: 1;
}

.breath-note,
.breath-actions {
  display: none;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 5;
  background: rgba(5, 7, 10, 0.66);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.scrim.is-on {
  opacity: 1;
  pointer-events: auto;
}

.scrim[hidden] {
  display: none;
}

body.is-reading .writer,
body.is-reading .top,
body.is-reading .care {
  opacity: 0;
  pointer-events: none;
}

body.is-reading .breath:not(.is-open) {
  opacity: 0.12;
}

.breath.is-open {
  position: fixed;
  z-index: 6;
  left: 50%;
  top: 50%;
  width: min(36rem, calc(100vw - 2rem));
  max-width: none;
  max-height: min(78vh, 42rem);
  overflow: auto;
  padding: 1.55rem 1.6rem 1.25rem;
  border-color: rgba(212, 196, 168, 0.24);
  background:
    radial-gradient(ellipse at 18% 0%, rgba(255, 255, 255, 0.06), transparent 46%),
    rgba(12, 16, 24, 0.94);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
  cursor: default;
  transform: translate(-50%, -50%);
  animation: arrive 0.45s ease;
}

@keyframes arrive {
  from { opacity: 0; transform: translate(-50%, -46%); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

.breath.is-open .breath-to {
  font-size: 2.2rem;
}

.breath.is-open .breath-text {
  display: block;
  margin-top: 1rem;
  overflow: visible;
  color: var(--text);
  filter: none;
  transition: none;
  user-select: text;
  font-size: 1.4rem;
  line-height: 1.62;
  -webkit-line-clamp: unset;
}

.breath.is-open .breath-read {
  display: none;
}

.breath.is-open .breath-note {
  display: block;
  margin-top: 1.15rem;
  font-size: 0.8rem;
  color: rgba(212, 196, 168, 0.8);
}

.breath.is-open .breath-actions {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1.15rem;
}

.breath.is-open .breath-close,
.breath.is-open .breath-hide {
  display: inline-block;
  margin: 0;
}

.ghost {
  position: fixed;
  z-index: 8;
  margin: 0;
  pointer-events: none;
  white-space: pre-wrap;
  font-family: var(--serif);
  font-size: 1.45rem;
  line-height: 1.65;
  color: var(--text);
  animation: rise 1.7s ease forwards;
}

@keyframes rise {
  0% { opacity: 1; filter: blur(0); transform: translateY(0); }
  100% { opacity: 0; filter: blur(12px); transform: translateY(-16vh); }
}

@media (min-height: 1040px) and (min-width: 981px) {
  textarea {
    min-height: 8rem;
  }
}
@media (hover: none) {
  .breath-read {
    opacity: 0.7;
  }
}

@media (max-width: 980px) {
  .sky {
    overflow: visible;
  }

  .top {
    padding: 1rem 1rem 0;
    flex-direction: column;
    gap: 0.35rem;
  }

  .writer {
    flex: none;
    justify-content: flex-start;
    width: min(40rem, calc(100% - 1.6rem));
    padding: 1.5rem 0 1rem;
  }

  .preface-open {
    font-size: 1.42rem;
  }

  .preface-say,
  .preface-rite {
    font-size: 1.55rem;
  }

  textarea {
    min-height: 6.5rem;
    height: 6.5rem;
  }

  .air {
    position: relative;
    inset: auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: 0.75rem;
    order: 2;
    padding: 0.25rem 1rem 1.5rem;
  }

  .air-col {
    display: contents;
  }

  .writer {
    order: 1;
  }

  .care {
    order: 3;
  }

  .breath {
    position: relative;
    width: min(100%, 18rem);
    animation: none;
    transform: none;
  }

  .breath.is-open {
    position: fixed;
    left: 50%;
    top: 50%;
    width: min(36rem, calc(100vw - 1.25rem));
    transform: translate(-50%, -50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .orb,
  .breath,
  .ghost {
    animation: none;
  }

  .writer,
  .top,
  .care,
  .scrim,
  .breath-text,
  .after,
  .breath-read {
    transition: none;
  }
}
