/* ── Котик ─────────────────────────────────────────────────────────────
   Экран 2340×1080 → 851×392 CSS px при плотности 440 dpi.
   Всё крупное в vh/vw, текст в clamp(), чтобы переживало любой браузер. */

:root {
  --ink: #4A342C;
  --ink-2: rgba(74, 52, 44, .58);
  --ink-3: rgba(74, 52, 44, .32);
  --line: rgba(74, 52, 44, .14);
  --cloud: #B5A79C;
  --sun: #E7AE4F;
  --rain: #7FA8C9;
  --accent: #C96F66;

  --sky-day-a: #FFFDF8;
  --sky-day-b: #FCF3E7;
  --sky-day-c: #F5DDC7;
  --sky-night-a: #2A3459;
  --sky-night-b: #1A2138;
  --sky-night-c: #0F1322;
}

body[data-theme="night"] {
  --ink: #F6EADB;
  --ink-2: rgba(246, 234, 219, .62);
  --ink-3: rgba(246, 234, 219, .28);
  --line: rgba(246, 234, 219, .16);
  --cloud: #8E9DBB;
  --sun: #F0C06A;
  --rain: #8FB6D6;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #F6E9D9;
}

body {
  font-family: Nunito, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  cursor: default;
  transition: color 1.2s ease;
}

/* ── небо ─────────────────────────────────────────────────────────── */

.sky {
  position: fixed;
  inset: 0;
  transition: opacity 1.8s ease;
  will-change: opacity;
}

.sky--day {
  background: radial-gradient(135% 160% at 16% -12%, var(--sky-day-a) 0%, var(--sky-day-b) 42%, var(--sky-day-c) 100%);
}

.sky--night {
  opacity: 0;
  background: radial-gradient(135% 160% at 16% -12%, var(--sky-night-a) 0%, var(--sky-night-b) 45%, var(--sky-night-c) 100%);
}

body[data-theme="night"] .sky--night { opacity: 1; }
body[data-theme="night"] .sky--day { opacity: 0; }

.stars {
  position: fixed;
  inset: 0;
  opacity: 0;
  transition: opacity 2s ease;
  pointer-events: none;
}

body[data-theme="night"] .stars { opacity: 1; }

.stars i {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #FFF4DC;
  box-shadow: 0 0 6px rgba(255, 244, 220, .8);
  animation: twinkle 5s ease-in-out infinite;
}

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

.stage {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1.05fr) minmax(0, .78fr);
  align-items: center;
  gap: 0 1vw;
  padding: 0 max(3vw, env(safe-area-inset-right)) 0 max(2.4vw, env(safe-area-inset-left));
}

/* ── часы ─────────────────────────────────────────────────────────── */

.clock {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  animation: rise .9s ease-out both;
}

.clock__time {
  display: flex;
  align-items: baseline;
  font-weight: 800;
  font-size: min(27vh, 13vw);
  line-height: .84;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: var(--ink);
}

#hh, #mm { display: inline-block; width: 1.15em; text-align: center; }

.clock__sep {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  width: .34em;
  gap: .1em;
  margin: 0;
  padding-bottom: .03em;
}

.clock__sep i {
  display: block;
  width: .13em;
  height: .13em;
  margin: 0 auto;
  border-radius: 50%;
  background: currentColor;
  opacity: .58;
  animation: colon 4.5s ease-in-out infinite;
}

.clock__sep i:last-child { animation-delay: .1s; }

.clock__date {
  margin: 1.1vh 0 0;
  font-size: clamp(15px, 5.4vh, 26px);
  font-weight: 600;
  letter-spacing: .005em;
  white-space: nowrap;
  color: var(--ink);
}

.clock__place {
  margin-top: .3vh;
  font-size: clamp(10px, 3.1vh, 16px);
  font-weight: 600;
  letter-spacing: .055em;
  text-transform: uppercase;
  color: var(--ink-2);
  opacity: .72;
}

.clock__sun {
  display: flex;
  align-items: center;
  gap: .45em;
  margin-top: 1.6vh;
  font-size: clamp(10px, 3.3vh, 17px);
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.clock__sun .ico { width: 1.15em; height: 1.15em; opacity: .7; }
.clock__sun .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); margin: 0 .3em; }

/* ── котик ────────────────────────────────────────────────────────── */

.catcol {
  position: relative;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-width: 0;
  animation: rise 1s .08s ease-out both;
}

.cat {
  display: block;
  width: 100%;
  height: 86vh;
  margin-bottom: 1.2vh;
  overflow: visible;
}

.cat__all {
  transform-box: view-box;
  transform-origin: 210px 392px;
  animation: breathe 4.8s ease-in-out infinite;
}

body[data-cat="sleep"] .cat__all { animation-duration: 7s; }

body.waking .cat__all {
  animation: wake 1.7s cubic-bezier(.3, .8, .4, 1) both;
}

body[data-theme="night"] .cat__glow { opacity: .8; }
.cat__glow { opacity: .35; transition: opacity 1.8s ease; }

.cat__tail {
  transform-box: view-box;
  transform-origin: 286px 366px;
  animation: tail 5.4s ease-in-out infinite;
}

.cat__ear {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

.cat__ear--l { animation: ear-l 9.5s ease-in-out infinite; }
.cat__ear--r { animation: ear-r 12.5s ease-in-out infinite; }

.cat__eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: blink 6.4s infinite;
}

.cat__eye--r { animation-delay: 0s; }

.cat__pupil {
  transform-box: fill-box;
  transform-origin: center;
  animation: look 13s ease-in-out infinite;
}

.cat__eye-happy, .cat__eye-sleep { opacity: 0; }
.cat__eye-happy, .cat__eye-sleep { transition: opacity .12s linear; }

body.purr .cat__eye { opacity: 0; }
body.purr .cat__eye-happy { opacity: 1; }
body[data-cat="sleep"] .cat__eye { opacity: 0; }
body[data-cat="sleep"] .cat__eye-sleep { opacity: 1; }

.cat__zzz { opacity: 0; transition: opacity .6s ease; }
body[data-cat="sleep"] .cat__zzz { opacity: 1; }

.cat__zzz text {
  font-family: Nunito, sans-serif;
  font-weight: 800;
  font-size: 30px;
  fill: var(--ink-2);
  opacity: 0;
}

body[data-cat="sleep"] .cat__zzz text { animation: zzz 4.2s ease-out infinite; }
body[data-cat="sleep"] .cat__zzz text:nth-child(2) { animation-delay: 1.4s; }
body[data-cat="sleep"] .cat__zzz text:nth-child(3) { animation-delay: 2.8s; }

.cat__umbrella, .cat__scarf {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .6s ease, transform .6s ease;
  transform-box: view-box;
}

body[data-weather="rain"] .cat__umbrella,
body[data-weather="drizzle"] .cat__umbrella,
body[data-weather="thunder"] .cat__umbrella,
body[data-weather="sleet"] .cat__umbrella {
  opacity: 1;
  transform: translateY(0);
}

body[data-weather="snow"] .cat__scarf {
  opacity: 1;
  transform: translateY(0);
}

/* ── погода ───────────────────────────────────────────────────────── */

.weather {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding-left: .6vw;
  animation: rise .9s .16s ease-out both;
}

.weather__top {
  display: flex;
  align-items: center;
  gap: .9vw;
}

.weather__icon {
  width: 11vh;
  height: 11vh;
  flex: 0 0 auto;
  color: var(--cloud);
  margin-left: -.8vh;
}

.weather__temp {
  font-weight: 800;
  font-size: min(17vh, 8.2vw);
  line-height: .95;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.weather__desc {
  margin-top: .6vh;
  font-size: clamp(14px, 4.6vh, 23px);
  font-weight: 700;
  white-space: nowrap;
  color: var(--ink);
}

.weather__meta {
  display: flex;
  align-items: center;
  gap: .5em;
  margin-top: .25vh;
  font-size: clamp(10px, 3.2vh, 16px);
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}

.weather__meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); }

.weather__sep {
  height: 1px;
  background: var(--ink-3);
  opacity: .5;
  margin: 1.5vh 0 1.2vh;
}

.weather__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: clamp(10px, 3.3vh, 16px);
  font-weight: 600;
  color: var(--ink-2);
  line-height: 1.9;
  white-space: nowrap;
}

.weather__row .value {
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ── мелочи ───────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: 3vh;
  transform: translate(-50%, 14px);
  padding: .8em 1.3em;
  border-radius: 999px;
  background: rgba(30, 24, 20, .72);
  color: #FBEFDE;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease, transform .4s ease;
  backdrop-filter: blur(6px);
}

.toast.on { opacity: 1; transform: translate(-50%, 0); }

.hearts {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.heart {
  position: absolute;
  width: 18px;
  height: 18px;
  opacity: 0;
  animation: heart 1.5s ease-out forwards;
}

.heart svg { display: block; width: 100%; height: 100%; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ── анимации ─────────────────────────────────────────────────────── */

@keyframes breathe {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.012, 1.022); }
}

@keyframes wake {
  0% { transform: scale(1, 1) rotate(0); }
  30% { transform: scale(1.06, .94) rotate(-1deg); }
  55% { transform: scale(.97, 1.05) rotate(1deg); }
  75% { transform: scale(1.02, .985) rotate(0); }
  100% { transform: scale(1, 1) rotate(0); }
}

@keyframes tail {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(6deg); }
}

@keyframes ear-l {
  0%, 91%, 100% { transform: rotate(0); }
  93% { transform: rotate(-8deg); }
  96% { transform: rotate(3deg); }
}

@keyframes ear-r {
  0%, 88%, 100% { transform: rotate(0); }
  90% { transform: rotate(7deg); }
  94% { transform: rotate(-2deg); }
}

@keyframes blink {
  0%, 91.5%, 100% { transform: scaleY(1); }
  93.5%, 95% { transform: scaleY(.1); }
}

@keyframes look {
  0%, 100% { transform: translate(0, 0); }
  22% { transform: translate(2px, -1px); }
  48% { transform: translate(0, 1px); }
  72% { transform: translate(-2px, 0); }
}

@keyframes zzz {
  0% { opacity: 0; transform: translate(0, 8px) scale(.8); }
  25% { opacity: .9; }
  100% { opacity: 0; transform: translate(14px, -34px) scale(1.2); }
}

@keyframes colon {
  0%, 100% { opacity: .28; }
  50% { opacity: .62; }
}

@keyframes twinkle {
  0%, 100% { opacity: .25; transform: scale(.8); }
  50% { opacity: .95; transform: scale(1.15); }
}

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

@keyframes heart {
  0% { opacity: 0; transform: translate(0, 0) scale(.5) rotate(-6deg); }
  20% { opacity: .9; }
  100% { opacity: 0; transform: translate(var(--dx, 0px), -90px) scale(1.1) rotate(8deg); }
}
