/* ─────────────────────────────────────────────
   一杯热茶 · 冬夜
   Палитра: глубокая ночь → слива → тёплое свечение
   ───────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --cream: #f7ecdf;
  --cream-dim: rgba(247, 236, 223, 0.66);
  --amber: #ffc48f;
  --amber-soft: rgba(255, 196, 143, 0.5);

  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100svh;
  display: grid;
  place-items: center;
  background-color: #0a0817;
  background-image:
    radial-gradient(115% 70% at 50% 112%, rgba(255, 154, 92, 0.34) 0%, rgba(255, 138, 96, 0.12) 38%, rgba(255, 138, 96, 0) 64%),
    radial-gradient(70% 45% at 50% 104%, rgba(255, 205, 150, 0.22), rgba(255, 205, 150, 0) 70%),
    linear-gradient(180deg, #06050d 0%, #0e0b20 30%, #1d1433 55%, #331d3a 78%, #45263a 92%, #54303a 100%);
  color: var(--cream);
  font-family: var(--sans);
  overflow-x: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── небо: сияние и звёзды ─────────────────── */

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.aurora {
  position: absolute;
  inset: -12%;
  filter: blur(58px);
  opacity: 0.5;
}

.aurora::before,
.aurora::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.aurora::before {
  width: 62vmax;
  height: 40vmax;
  left: -14vmax;
  top: -8vmax;
  background: radial-gradient(circle at 50% 50%, rgba(110, 78, 162, 0.55), rgba(110, 78, 162, 0) 68%);
  animation: drift-a 28s ease-in-out infinite alternate;
}

.aurora::after {
  width: 56vmax;
  height: 38vmax;
  right: -16vmax;
  top: 8vmax;
  background: radial-gradient(circle at 50% 50%, rgba(198, 98, 124, 0.4), rgba(198, 98, 124, 0) 70%);
  animation: drift-b 34s ease-in-out infinite alternate;
}

.stars {
  position: absolute;
  inset: 0;
}

.star {
  position: absolute;
  border-radius: 50%;
  background: #fff8ee;
  opacity: 0.6;
  animation: twinkle var(--dur, 6s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.15;
    transform: scale(0.85);
  }
  50% {
    opacity: 0.9;
    transform: scale(1);
  }
}

@keyframes drift-a {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(6vmax, 3vmax, 0) scale(1.12);
  }
}

@keyframes drift-b {
  from {
    transform: translate3d(0, 0, 0) scale(1.05);
  }
  to {
    transform: translate3d(-7vmax, 4vmax, 0) scale(0.94);
  }
}

/* ── снег ──────────────────────────────────── */

#snow {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(120% 85% at 50% 42%, rgba(0, 0, 0, 0) 42%, rgba(6, 4, 14, 0.55) 100%);
}

/* ── сцена ─────────────────────────────────── */

.stage {
  position: relative;
  z-index: 3;
  width: min(100%, 34rem);
  padding: clamp(1.5rem, 6vw, 3rem) 1.25rem calc(2.5rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(0.7rem, 2.6vw, 1.15rem);
}

/* тёплый ореол за чашкой */
.stage::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(80vw, 24rem);
  height: min(80vw, 24rem);
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 50% 50%, rgba(255, 168, 108, 0.16), rgba(255, 168, 108, 0) 68%);
  filter: blur(12px);
  animation: breathe 9s ease-in-out infinite;
  pointer-events: none;
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.75;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.07);
  }
}

.greeting {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1rem, 3.9vw, 1.3rem);
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  color: var(--cream-dim);
  line-height: 1.6;
}

.line {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.95rem, 8.8vw, 3.15rem);
  letter-spacing: 0.1em;
  text-indent: 0.1em;
  line-height: 1.35;
  color: #fff5e8;
  text-shadow: 0 0 38px rgba(255, 178, 116, 0.32), 0 0 90px rgba(255, 150, 90, 0.16), 0 1px 0 rgba(0, 0, 0, 0.18);
}

/* ── чашка ─────────────────────────────────── */

.cup {
  position: relative;
  width: clamp(118px, 33vw, 148px);
  aspect-ratio: 144 / 168;
  margin: clamp(0.2rem, 1.5vw, 0.6rem) 0 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  color: inherit;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.38)) drop-shadow(0 0 28px rgba(255, 170, 110, 0.2));
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.3, 1), filter 0.5s ease;
  animation: float 7s ease-in-out infinite;
}

.cup:hover {
  transform: translateY(-3px);
  filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.4)) drop-shadow(0 0 38px rgba(255, 178, 118, 0.32));
}

.cup:active {
  transform: scale(0.965);
}

.cup:focus-visible {
  outline: 2px solid var(--amber-soft);
  outline-offset: 12px;
  border-radius: 50%;
}

.cup.brewing {
  animation: none;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.38)) drop-shadow(0 0 44px rgba(255, 186, 128, 0.42));
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

.cup-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* лёгкий пар — всегда */
.steam-idle path {
  opacity: 0.12;
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: idle-steam 7s ease-in-out infinite;
}

.steam-idle path:nth-child(2) {
  animation-delay: 1.4s;
}

.steam-idle path:nth-child(3) {
  animation-delay: 2.8s;
}

@keyframes idle-steam {
  0%,
  100% {
    opacity: 0.08;
    transform: translateY(2px) scaleY(0.94);
  }
  50% {
    opacity: 0.26;
    transform: translateY(-3px) scaleY(1.04);
  }
}

/* пар при нажатии */
.steam-burst .wisp {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

.cup.brewing .steam-burst .wisp {
  animation: steam-burst 1.9s cubic-bezier(0.3, 0.6, 0.3, 1) forwards;
}

.cup.brewing .steam-burst .w2 {
  animation-delay: 0.12s;
}

.cup.brewing .steam-burst .w3 {
  animation-delay: 0.24s;
}

@keyframes steam-burst {
  0% {
    opacity: 0;
    transform: translateY(7px) scaleY(0.68);
  }
  22% {
    opacity: 0.95;
  }
  65% {
    opacity: 0.5;
  }
  100% {
    opacity: 0;
    transform: translateY(-13px) scaleY(1.14);
  }
}

.cup-halo {
  transform-origin: 72px 150px;
}

.cup.brewing .cup-halo {
  animation: warm-up 1.9s ease-out;
}

@keyframes warm-up {
  0% {
    opacity: 0.55;
    transform: scale(1);
  }
  35% {
    opacity: 1;
    transform: scale(1.14);
  }
  100% {
    opacity: 0.55;
    transform: scale(1);
  }
}

/* ── подпись и сообщение ───────────────────── */

.slot {
  position: relative;
  width: 100%;
  min-height: clamp(3.2rem, 12vw, 4.1rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-inline: 0.5rem;
}

.hint,
.note {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  margin: 0;
  transition: opacity 0.65s ease, transform 0.65s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.hint {
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: rgba(247, 236, 223, 0.5);
  animation: hint-breathe 4.5s ease-in-out infinite;
}

.hint.gone {
  opacity: 0;
  transform: translate(-50%, -50%) translateY(-4px);
  animation: none;
}

@keyframes hint-breathe {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.72;
  }
}

.note {
  font-family: var(--serif);
  font-size: clamp(0.98rem, 4vw, 1.16rem);
  letter-spacing: 0.05em;
  line-height: 1.65;
  color: var(--amber);
  text-shadow: 0 0 20px rgba(255, 170, 110, 0.35);
  opacity: 0;
  transform: translate(-50%, -50%) translateY(10px);
}

.note.show {
  opacity: 1;
  transform: translate(-50%, -50%);
}

/* ── кнопка «две города» ───────────────────── */

.journey-btn {
  position: fixed;
  left: 50%;
  bottom: calc(1.3rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.62rem 1.05rem 0.62rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 196, 143, 0.26);
  background: rgba(30, 16, 32, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--amber);
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.3s ease, border-color 0.3s ease, background 0.3s ease;
  animation: btn-glow 5.5s ease-in-out infinite;
}

.journey-btn:hover {
  transform: translateX(-50%) translateY(-2px);
  border-color: rgba(255, 196, 143, 0.48);
  background: rgba(46, 24, 40, 0.66);
}

.journey-btn:active {
  transform: translateX(-50%) scale(0.97);
}

.journey-btn:focus-visible {
  outline: 2px solid var(--amber-soft);
  outline-offset: 4px;
}

.journey-icon {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes btn-glow {
  0%,
  100% {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06),
      0 0 0 0 rgba(255, 180, 120, 0);
  }
  50% {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06),
      0 0 24px 0 rgba(255, 180, 120, 0.2);
  }
}

/* ── сцена «两座城之间» ─────────────────────── */

.journey {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
  background: rgba(8, 5, 14, 0.66);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.45s ease;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.journey[hidden] {
  display: none;
}

.journey.open {
  opacity: 1;
}

.journey-panel {
  position: relative;
  width: min(100%, 27rem);
  margin: auto;
  padding: 1.5rem 1.15rem 1.15rem;
  border-radius: 26px;
  border: 1px solid rgba(255, 196, 143, 0.18);
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 170, 110, 0.16), rgba(255, 170, 110, 0) 60%),
    radial-gradient(90% 60% at 50% 112%, rgba(255, 140, 90, 0.2), rgba(255, 140, 90, 0) 65%),
    linear-gradient(170deg, #2b1730 0%, #3a1d2c 55%, #4a2730 100%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.3, 1), opacity 0.45s ease;
}

.journey.open .journey-panel {
  opacity: 1;
  transform: none;
}

.journey-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 236, 214, 0.06);
  color: rgba(247, 236, 223, 0.62);
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease;
}

.journey-close:hover {
  background: rgba(255, 236, 214, 0.13);
  color: #fff3e4;
}

.journey-close svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.journey-title {
  margin: 0 0 0.3rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.1rem, 4.6vw, 1.35rem);
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  text-align: center;
  color: #fff3e4;
  text-shadow: 0 0 24px rgba(255, 170, 110, 0.25);
}

/* карта */

.map {
  position: relative;
  width: 100%;
  aspect-ratio: 360 / 160;
  margin: 0.4rem 0 0;
}

.map-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.land {
  fill: url(#landFill);
  stroke: rgba(255, 214, 180, 0.16);
  stroke-width: 1;
}

.contour {
  fill: none;
  stroke: rgba(255, 214, 180, 0.1);
  stroke-width: 1;
  stroke-linecap: round;
}

.route {
  fill: none;
  stroke: rgba(255, 214, 176, 0.52);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-dasharray: 0.5 8;
  animation: route-flow 7s linear infinite;
}

@keyframes route-flow {
  to {
    stroke-dashoffset: -17;
  }
}

.city-core {
  fill: #ffe6c8;
}

.city-glow {
  opacity: 0.9;
}

.city-label {
  position: absolute;
  top: 78%;
  transform: translateX(-50%);
  font-size: clamp(0.62rem, 2.6vw, 0.72rem);
  letter-spacing: 0.06em;
  color: rgba(247, 236, 223, 0.65);
  white-space: nowrap;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.city-label-a {
  left: 27.8%;
}

.city-label-b {
  left: 72.2%;
}

/* точки на линии */

.stops {
  position: absolute;
  inset: 0;
}

.stop {
  position: absolute;
  width: 2.7rem;
  height: 2.7rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  transform: translate(-50%, -50%);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.stop::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: rgba(255, 220, 186, 0.82);
  box-shadow: 0 0 10px rgba(255, 180, 120, 0.65);
  transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.stop::after {
  content: "";
  position: absolute;
  inset: 0.5rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 196, 143, 0.2);
  transition: border-color 0.3s ease;
}

.stop:hover::before {
  transform: scale(1.3);
}

.stop.active::before {
  transform: scale(1.45);
  background: #ffe9d0;
  box-shadow: 0 0 16px 2px rgba(255, 190, 130, 0.85);
}

.stop.active::after {
  border-color: rgba(255, 196, 143, 0.5);
}

.stop:focus-visible {
  outline: 2px solid var(--amber-soft);
  outline-offset: 2px;
}

/* листик с желанием */

.wish {
  position: relative;
  width: min(46%, 10.8rem);
  margin: 0.15rem auto 0;
}

.wish-leaf {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transform: scale(0.84) rotate(-7deg);
  transform-origin: 50% 65%;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.35));
  transition: opacity 0.55s ease, transform 0.7s cubic-bezier(0.34, 1.5, 0.64, 1);
}

.wish.show .wish-leaf {
  opacity: 1;
  transform: scale(1) rotate(-2deg);
}

.leaf-body {
  fill: url(#leafGrad);
}

.leaf-shine {
  fill: url(#leafShine);
}

.leaf-vein {
  fill: none;
  stroke: rgba(150, 110, 78, 0.32);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.leaf-vein.thin {
  stroke: rgba(150, 110, 78, 0.2);
  stroke-width: 1;
}

.leaf-stem {
  fill: none;
  stroke: #b98f63;
  stroke-width: 3;
  stroke-linecap: round;
}

.wish-text {
  position: absolute;
  inset: 30% 10% 16%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  text-align: center;
  font-family: var(--serif);
  font-size: clamp(0.82rem, 3.5vw, 0.95rem);
  line-height: 1.6;
  letter-spacing: 0.04em;
  color: #4b2b2c;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s ease 0.12s, transform 0.5s cubic-bezier(0.2, 0.8, 0.25, 1) 0.12s;
}

.wish.show .wish-text {
  opacity: 1;
  transform: none;
}

.journey-hint {
  margin: 0.5rem 0 0;
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.26em;
  text-indent: 0.26em;
  color: rgba(247, 236, 223, 0.42);
}

body.is-locked {
  overflow: hidden;
}

/* ── доступность ───────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .aurora::before,
  .aurora::after,
  .star,
  .cup,
  .stage::before,
  .hint,
  .journey-btn,
  .route,
  .steam-idle path {
    animation: none !important;
  }

  .cup.brewing .steam-burst .wisp {
    animation-duration: 0.01ms;
  }

  .journey,
  .journey-panel,
  .wish-leaf,
  .wish-text {
    transition-duration: 0.01ms;
  }
}
