:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans", "Microsoft YaHei", sans-serif;
  color: #fff8f0;
  background: #342a2a;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button { font: inherit; }
[hidden] { display: none !important; }
::selection { background: #e6b28b; color: #342a2a; }

.scene { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: #342a2a; }
.scene::before {
  content: "";
  position: absolute;
  inset: -30px;
  background: url("./assets/sunset.jpg") center 48% / cover no-repeat;
  filter: blur(24px);
  opacity: .78;
}
.scene-photo {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 75vh);
  height: auto;
  max-height: 100%;
  object-fit: contain;
  mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
}
.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgb(24 24 32 / 28%) 0%, rgb(29 24 30 / 26%) 28%, rgb(25 23 29 / 31%) 60%, rgb(22 22 27 / 12%) 85%, rgb(22 22 27 / 28%) 100%);
}

.page {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  padding: max(25px, env(safe-area-inset-top)) max(48px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(48px, env(safe-area-inset-left));
}

.header { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.wordmark { display: block; flex: 0 0 auto; width: 130px; height: 64px; }
.wordmark img { display: block; width: 100%; height: 100%; filter: drop-shadow(0 2px 7px rgb(30 20 25 / 18%)); }
.guestbook-open { display: flex; align-items: center; gap: 8px; padding: 0; border: 0; color: #efd2be; background: none; cursor: pointer; }
.guestbook-arrow { display: block; width: 32px; height: 42px; color: #f1c6b4; }
.tap-cue { display: block; width: 100%; height: 100%; overflow: visible; }
.tap-hand { stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; fill: rgb(242 202 181 / 7%); animation: gentle-tap 2.8s ease-in-out infinite; }
.tap-ring { stroke: currentColor; stroke-width: 1.1; transform-origin: 19px 10px; opacity: 0; animation: tap-ripple 2.8s ease-out infinite; }
.tap-ring-inner { animation-delay: .18s; }
.guestbook-open:hover .tap-cue { color: #fff1dc; }
@keyframes gentle-tap { 0%, 65%, 100% { transform: translateY(3px); } 22%, 38% { transform: translateY(0); } 30% { transform: translateY(-1px); } }
@keyframes tap-ripple { 0%, 22% { transform: scale(.65); opacity: 0; } 29% { opacity: .65; } 61%, 100% { transform: scale(1.6); opacity: 0; } }
.guestbook-open:focus-visible { outline: 1px solid #efc8ac; outline-offset: 7px; border-radius: 3px; }
.languages { display: flex; align-items: center; gap: 8px; }
.languages button {
  position: relative;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 8px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: rgb(255 248 240 / 76%);
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease;
}
.languages button::after { content: ""; position: absolute; height: 1px; bottom: 5px; left: 9px; right: 10px; background: currentColor; transform: scaleX(0); transition: transform 180ms ease; }
.languages button[aria-pressed="true"] { color: #fff8f0; }
.languages button[aria-pressed="true"]::after { transform: scaleX(1); }
.languages button:hover { color: #fff; background: rgb(255 255 255 / 7%); }
.languages button:focus-visible { outline: 2px solid #f3c9a5; outline-offset: 3px; }

.main { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; place-items: center; padding: 30px 0 150px; }
.memory { min-width: 0; width: min(100%, 840px); text-align: center; animation: arrive 1000ms ease both; }
.counter { margin: 0; font-weight: 400; text-shadow: 0 2px 25px rgb(21 16 22 / 28%); }
.counter-intro { display: block; font-size: clamp(20px, 2.1vw, 26px); letter-spacing: .24em; line-height: 1.7; padding-left: .24em; }
.counter-value { display: inline-flex; align-items: baseline; justify-content: center; gap: 16px; margin-top: 13px; }
.days { font-family: "Bodoni 72", Didot, "Times New Roman", serif; font-size: clamp(108px, 13vw, 180px); line-height: 1.05; font-weight: 400; font-variant-numeric: lining-nums tabular-nums; letter-spacing: -.045em; }
.unit { font-size: 21px; letter-spacing: .15em; }
.counter-after { display: block; font-size: 23px; line-height: 1.6; margin-top: 8px; }
.divider { display: flex; align-items: center; justify-content: center; margin: 30px auto 27px; width: 68px; height: 10px; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: rgb(249 222 199 / 50%); }
.divider span { width: 4px; height: 4px; margin: 0 10px; border-radius: 50%; background: #edc5a1; }
.message { margin: 0; text-shadow: 0 2px 15px rgb(19 14 18 / 65%); font-weight: 400; }
.reflection { display: block; font-size: clamp(15px, 1.4vw, 18px); line-height: 2; letter-spacing: .08em; text-wrap: balance; }
.longing { display: block; margin-top: 11px; font-size: clamp(19px, 1.8vw, 23px); letter-spacing: .12em; line-height: 1.8; text-wrap: balance; }
.footer { display: flex; align-items: center; justify-content: center; gap: 17px; color: rgb(255 248 240 / 76%); }
.footer p { margin: 0; font-size: 10px; line-height: 1.6; letter-spacing: .22em; }
.footer time { margin-left: 7px; font-size: 11px; }
.footer-line { width: 34px; height: 1px; background: rgb(255 248 240 / 25%); }
.noscript { font-size: 13px; line-height: 1.8; }

.guest-messages { display: flex; align-items: center; gap: 9px; width: min(100%, 620px); margin: 22px auto 0; color: #f4d5c7; }
.messages-window { overflow: hidden; min-width: 0; flex: 1; mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.messages-track { display: flex; width: max-content; animation: drift var(--scroll-duration, 28s) linear infinite; }
.messages-group { display: flex; flex: 0 0 auto; align-items: center; min-width: min(580px, 80vw); }
.guest-note { display: inline-block; padding: 6px 32px; font-size: 14px; letter-spacing: .05em; line-height: 1.8; white-space: nowrap; }
.guest-note::before { content: "♡"; margin-right: 14px; opacity: .8; }
.messages-pause { flex: 0 0 32px; width: 32px; height: 36px; border: 0; background: transparent; color: inherit; font-size: 12px; cursor: pointer; }
.messages-track.is-paused, .messages-window:hover .messages-track { animation-play-state: paused; }
@keyframes drift { to { transform: translateX(-50%); } }
.guest-dialog { width: min(440px, calc(100% - 36px)); max-height: calc(100svh - 40px); padding: 38px 32px 30px; border: 1px solid rgb(233 190 171 / 35%); border-radius: 14px; background: linear-gradient(145deg, #43353e, #292730); color: #fff3e8; box-shadow: 0 24px 100px #140d2055; text-align: center; }
.guest-dialog::backdrop { background: rgb(20 16 24 / 55%); backdrop-filter: blur(8px); }
.dialog-close { position: absolute; top: 8px; right: 9px; width: 36px; height: 36px; border: 0; background: transparent; color: #e8cabc; font-size: 26px; font-weight: 200; cursor: pointer; }
.dialog-heart { color: #d7a292; font-size: 30px; font-weight: 200; }
.guest-dialog h2 { margin: 15px 0 28px; font-size: 22px; letter-spacing: .1em; font-weight: 400; line-height: 1.5; }
.guest-dialog label { display: block; margin: 0 0 12px; text-align: left; font-size: 13px; line-height: 1.6; letter-spacing: .05em; color: #e6cfc5; }
.guest-dialog input, .guest-dialog textarea { display: block; width: 100%; border: 1px solid #a985784d; border-radius: 7px; padding: 12px 14px; background: #ffffff08; color: #fff3e8; font: inherit; font-size: 16px; line-height: 1.7; }
.guest-dialog input { text-align: center; letter-spacing: .26em; }
.guest-dialog textarea { resize: vertical; min-height: 130px; }
.guest-dialog :focus-visible, .messages-pause:focus-visible { outline: 2px solid #dfb2a2; outline-offset: 3px; }
.dialog-submit { width: 100%; margin-top: 20px; min-height: 45px; padding: 11px 16px; border: 1px solid #d4a797; border-radius: 7px; background: #d4a797; color: #30252c; font: inherit; font-size: 14px; letter-spacing: .06em; cursor: pointer; }
.dialog-submit:hover { background: #e3b9a9; }
.guest-dialog button:disabled { opacity: .55; cursor: wait; }
.guest-status { margin: 17px 0 0; color: #f1c9b9; font-size: 13px; line-height: 1.8; }
.guest-status:empty { display: none; }
.message-meta { display: flex; justify-content: space-between; gap: 14px; margin-top: 9px; color: #bba6a1; font-size: 11px; line-height: 1.6; text-align: left; }
#character-count { white-space: nowrap; }

html:lang(en) .counter-intro, html:lang(de) .counter-intro { letter-spacing: .09em; padding-left: .09em; }
html:lang(en) .reflection, html:lang(de) .reflection { letter-spacing: .035em; }
html:lang(en) .longing, html:lang(de) .longing { letter-spacing: .04em; }
html:lang(de) .unit, html:lang(en) .unit { letter-spacing: .03em; }

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

@media (max-width: 600px) {
  .page { padding: max(18px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(27px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left)); }
  .header { gap: 12px; }
  .wordmark { width: 108px; height: 54px; }
  .guestbook-open { gap: 3px; }
  .guestbook-arrow { width: 27px; height: 37px; }
  .header { gap: 8px; }
  .languages { gap: 0; }
  .languages { gap: 1px; }
  .languages button { padding-inline: 5px; font-size: 11px; letter-spacing: .4px; }
  .scene::before { inset: 0; background: linear-gradient(180deg, #756d76, #9b8d90 55%, #9d837d); filter: none; opacity: 1; }
  .scene-photo { mask-image: linear-gradient(180deg, transparent, #000 8%, #000); }
  .main { padding: 36px 0 148px; }
  .counter-intro { font-size: 19px; letter-spacing: .17em; }
  .counter-value { gap: 12px; margin-top: 17px; }
  .days { font-size: clamp(104px, 30vw, 144px); }
  .unit { font-size: 18px; }
  .divider { margin-top: 29px; margin-bottom: 24px; }
  .reflection { font-size: 14px; line-height: 2.05; letter-spacing: .06em; }
  .longing { margin-top: 14px; font-size: 19px; }
  .guest-messages { margin-top: 17px; }
  .guest-note { font-size: 12px; }
  .guest-dialog { padding-inline: 23px; }
}

@media (min-width: 351px) and (max-width: 380px) {
  .wordmark { width: 100px; height: 50px; }
}

@media (max-width: 350px) {
  .page { padding-inline: 15px; }
  .header { flex-wrap: wrap; justify-content: center; gap: 6px; }
  .guestbook-open { width: 100%; justify-content: center; }
  .wordmark { width: 108px; }
  .wordmark img { width: 108px; margin: 0 auto; }
  .counter-intro { font-size: 17px; }
}

@media (max-height: 600px) and (min-width: 601px) {
  .page { padding-block: 15px; }
  .main { padding-block: 22px; }
  .days { font-size: 90px; }
  .counter-intro { font-size: 19px; }
  .divider { margin-block: 14px; }
  .reflection { font-size: 14px; }
  .longing { margin-top: 4px; font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .messages-window { overflow-x: auto; mask-image: none; }
  .messages-group[aria-hidden="true"], .messages-pause { display: none; }
}
