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

:root {
  --ink: #fff6f0;
  --muted: rgba(228, 245, 253, .6);
  --line: rgba(206, 235, 245, .18);
  --line-strong: rgba(220, 244, 252, .3);
  --accent: #7fe6d8;
  --font: "Outfit", "Segoe UI", system-ui, -apple-system, sans-serif;
  --app-h: 100dvh;
}

html, body { margin: 0; height: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: #0b1c25;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
}

.stage {
  position: relative;
  width: 100%;
  height: var(--app-h);
  overflow: hidden;
  isolation: isolate;
}

/* ---------- фон: осенний закат, боке, свет ---------- */

.bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-color: #0c1a22;
  background-image:
    radial-gradient(92% 74% at 50% 32%, rgba(6, 20, 28, 0) 42%, rgba(6, 18, 26, .42) 100%),
    linear-gradient(180deg, rgba(8, 24, 34, .34) 0%, rgba(8, 24, 34, .04) 32%, rgba(6, 18, 26, .14) 62%, rgba(4, 13, 19, .76) 100%),
    url("api/bg");
  background-size: auto, auto, cover;
  background-position: center, center, center 42%;
  background-repeat: no-repeat;
}

.sun {
  position: absolute;
  left: 34%;
  top: -8%;
  width: 56%;
  height: 64%;
  background: radial-gradient(circle at 52% 46%, rgba(228, 247, 255, .3), rgba(178, 226, 240, .1) 44%, rgba(150, 210, 230, 0) 70%);
  filter: blur(20px);
  mix-blend-mode: screen;
}

.bokeh {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, rgba(234, 250, 255, .9), rgba(170, 222, 238, .38) 46%, rgba(140, 200, 222, 0) 72%);
  opacity: calc(var(--o) * .4);
  filter: blur(11px);
  mix-blend-mode: screen;
  animation: drift 20s ease-in-out infinite alternate;
  animation-delay: var(--d, 0s);
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(2.2vw, -1.4vh, 0) scale(1.12); }
}

.trunks {
  position: absolute;
  inset: 0;
  display: none;
}

.shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 94% at 50% 42%, rgba(0, 0, 0, 0) 40%, rgba(4, 14, 20, .68) 100%),
    linear-gradient(180deg, rgba(4, 12, 18, .34), rgba(4, 12, 18, 0) 26%, rgba(4, 12, 18, 0) 58%, rgba(3, 10, 15, .72));
}

.grain {
  position: absolute;
  inset: 0;
  opacity: .07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- сцена ---------- */

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

.glass {
  background: linear-gradient(158deg, rgba(200, 232, 244, .2) 0%, rgba(20, 48, 64, .42) 42%, rgba(8, 24, 34, .58) 100%);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 26px 60px rgba(3, 12, 18, .46), inset 0 1px 0 rgba(228, 246, 255, .22);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
}

/* левая панель */

.rail {
  position: absolute;
  left: clamp(12px, 2.1vw, 30px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 1.4vh, 15px);
  padding: clamp(10px, 1.7vh, 16px) 0;
  width: clamp(46px, 3.9vw, 56px);
  border-radius: 999px;
}

.rail-btn {
  width: clamp(26px, 2.1vw, 32px);
  height: clamp(26px, 2.1vw, 32px);
  padding: 0;
  border: 0;
  background: none;
  color: rgba(255, 240, 232, .9);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: .92;
  transition: transform .18s ease, opacity .18s ease;
}

.rail-btn svg { width: 100%; height: 100%; }
.rail-btn:active { transform: scale(.88); opacity: .7; }

/* часы и календарь */

.clock-card {
  position: absolute;
  left: clamp(80px, 12.6vw, 200px);
  top: 50%;
  transform: translateY(-52%);
  z-index: 3;
  width: clamp(268px, 28vw, 404px);
  padding: clamp(16px, 2.3vh, 24px) clamp(16px, 1.6vw, 24px) clamp(14px, 2vh, 20px);
}

.clock {
  font-size: clamp(46px, 5.1vw, 84px);
  font-weight: 500;
  letter-spacing: -.01em;
  line-height: .94;
  font-variant-numeric: tabular-nums;
  color: #fffaf6;
  text-shadow: 0 2px 18px rgba(60, 12, 4, .35);
}

.date-line {
  margin-top: clamp(8px, 1.2vh, 13px);
  font-size: clamp(8px, .72vw, 11px);
  font-weight: 400;
  letter-spacing: .36em;
  text-transform: uppercase;
  color: var(--muted);
}

.cal {
  margin-top: clamp(14px, 2.2vh, 22px);
  padding: clamp(10px, 1.4vh, 15px) clamp(12px, 1vw, 16px) clamp(9px, 1.2vh, 13px);
  border-radius: 20px;
  background: linear-gradient(165deg, rgba(6, 18, 26, .26), rgba(6, 18, 26, .4));
  border: 1px solid rgba(206, 235, 245, .14);
}

.cal-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(216, 242, 252, .26);
  font-size: clamp(8px, .62vw, 10px);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255, 243, 236, .86);
}

.chev { width: 9px; height: 9px; opacity: .7; }

.cal-nav { display: flex; gap: 2px; }

.cal-nav button {
  width: 20px;
  height: 20px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(222, 244, 254, .09);
  color: rgba(236, 250, 255, .72);
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}

.cal-nav button svg { width: 12px; height: 12px; }
.cal-nav button:active { transform: scale(.9); background: rgba(222, 244, 254, .2); }

.cal-month {
  margin: clamp(9px, 1.4vh, 14px) 0 clamp(6px, 1vh, 10px);
  font-weight: 300;
  font-size: clamp(24px, 2.15vw, 34px);
  letter-spacing: .01em;
  color: #fff8f3;
  display: flex;
  align-items: baseline;
  gap: .28em;
}

.cal-day-big { font-variant-numeric: tabular-nums; }

.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.cal-days .day {
  padding: clamp(5px, .9vh, 7px) 0;
  border: 0;
  border-radius: 999px;
  background: none;
  font: inherit;
  font-size: clamp(9px, .7vw, 11px);
  font-variant-numeric: tabular-nums;
  color: rgba(255, 236, 226, .55);
  cursor: pointer;
  position: relative;
  transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}

.cal-days .day.today { color: #fff; box-shadow: inset 0 0 0 1px rgba(214, 242, 252, .55); }
.cal-days .day.sel { background: rgba(226, 247, 255, .93); color: #10303c; font-weight: 600; }

.cal-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: clamp(9px, 1.3vh, 13px);
  padding-top: clamp(7px, 1vh, 10px);
  border-top: 1px solid rgba(206, 235, 245, .14);
  font-size: clamp(8px, .64vw, 10px);
  letter-spacing: .06em;
  color: rgba(226, 244, 252, .48);
}

.cal-foot-item.accent { color: rgba(178, 234, 240, .82); }

/* персонаж */

.hero-wrap {
  position: absolute;
  left: 51.5%;
  bottom: 0;
  transform: translateX(-50%);
  height: 94%;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.hero {
  height: 100%;
  width: auto;
  max-width: 66vw;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 18px 46px rgba(3, 10, 16, .55)) drop-shadow(0 0 60px rgba(150, 214, 236, .2));
  animation: heroIn 1.1s cubic-bezier(.2, .7, .2, 1) both;
}

@keyframes heroIn {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.vert {
  position: absolute;
  right: -2.2%;
  top: 30%;
  writing-mode: vertical-rl;
  font-size: clamp(9px, .68vw, 11px);
  letter-spacing: .42em;
  text-transform: uppercase;
  color: rgba(228, 246, 255, .56);
  text-shadow: 0 1px 10px rgba(4, 12, 18, .55);
  white-space: nowrap;
}

/* правая панель */

.panel {
  position: absolute;
  right: clamp(14px, 3.1vw, 46px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: clamp(206px, 20.4vw, 296px);
  padding: clamp(10px, 1.2vw, 14px);
  border-radius: 26px;
}

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.ava {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  color: #10303c;
  background: rgba(240, 251, 255, .92);
  box-shadow: 0 4px 14px rgba(3, 12, 18, .38);
}

.name-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px 4px 11px;
  border-radius: 999px;
  background: rgba(242, 251, 255, .94);
  color: #12262f;
  font-size: clamp(9px, .66vw, 10.5px);
  font-weight: 600;
  letter-spacing: .01em;
  box-shadow: 0 5px 16px rgba(3, 12, 18, .3);
  max-width: 62%;
  overflow: hidden;
}

.name-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spark { width: 12px; height: 12px; flex: none; }

.hi {
  margin: clamp(9px, 1.4vh, 14px) 2px clamp(8px, 1.1vh, 11px);
  font-size: clamp(15px, 1.35vw, 20px);
  font-weight: 600;
  letter-spacing: .01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }

.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 13px;
  overflow: hidden;
  border: 1px solid rgba(206, 235, 245, .22);
  background: rgba(8, 24, 34, .38);
  box-shadow: inset 0 1px 0 rgba(228, 246, 255, .22);
}

.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb .t1 { object-position: 52% 14%; transform: scale(1.55); transform-origin: 55% 22%; filter: saturate(.95) brightness(.97); }
.thumb .t2 { object-position: 58% 18%; transform: scale(1.9); transform-origin: 66% 26%; filter: saturate(1.35) brightness(1.06) hue-rotate(-14deg); }

.sched {
  margin-top: 8px;
  padding: 9px 9px 8px;
  border-radius: 16px;
  background: linear-gradient(165deg, rgba(6, 18, 26, .3), rgba(6, 18, 26, .44));
  border: 1px solid rgba(206, 235, 245, .14);
}

.sched-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: clamp(7.5px, .58vw, 9px);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(230, 246, 253, .55);
}

.dots { letter-spacing: .08em; opacity: .6; }

.sched-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

.sched-thumb {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(206, 235, 245, .22);
}

.sched-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 54% 16%; transform: scale(1.2); }

.sched-meta { min-width: 0; }

.sched-title {
  font-size: clamp(10px, .8vw, 12px);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sched-sub {
  margin-top: 1px;
  font-size: clamp(8.5px, .66vw, 10px);
  color: rgba(228, 245, 253, .55);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar {
  height: 3px;
  margin-top: 8px;
  border-radius: 3px;
  background: rgba(255, 236, 226, .16);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(90deg, #c8f6ee, #4ad2c4);
  transition: width .4s linear;
}

.controls { display: flex; align-items: center; justify-content: center; gap: clamp(10px, 1vw, 16px); margin-top: 8px; }

.ctl {
  width: 22px;
  height: 22px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(212, 240, 250, .24);
  background: rgba(226, 246, 255, .08);
  color: rgba(240, 252, 255, .9);
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, color .16s ease;
}

.ctl svg { width: 12px; height: 12px; }
.ctl:active { transform: scale(.9); }
.ctl.play { width: 28px; height: 28px; background: rgba(238, 251, 255, .93); color: #10303c; border-color: transparent; }
.ctl.play svg { width: 14px; height: 14px; }
.ctl .ico-pause { display: none; }
.sched.is-running .ctl.play .ico-play { display: none; }
.sched.is-running .ctl.play .ico-pause { display: block; }
#likeBtn.liked { color: #7fe6d8; background: rgba(127, 230, 216, .16); border-color: rgba(127, 230, 216, .5); }

/* док */

.dock {
  position: absolute;
  left: 50%;
  bottom: clamp(10px, 3vh, 30px);
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: clamp(9px, 1.1vw, 17px);
  padding: clamp(7px, 1.1vh, 11px) clamp(12px, 1.5vw, 22px);
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(214, 240, 250, .26), rgba(18, 46, 62, .44));
}

.dock .app {
  width: clamp(28px, 2.5vw, 38px);
  height: clamp(28px, 2.5vw, 38px);
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .18s ease, filter .18s ease;
}

.dock .app svg { width: 100%; height: 100%; }
.dock .app:active { transform: translateY(1px) scale(.92); filter: brightness(1.15); }

/* ---------- узкий экран ---------- */

@media (max-width: 900px), (orientation: portrait) {
  body { overflow: hidden; }

  .scene {
    display: flex;
    flex-direction: column;
    padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px calc(env(safe-area-inset-bottom, 0px) + 86px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .rail {
    position: static;
    transform: none;
    align-self: flex-start;
    flex-direction: row;
    width: auto;
    padding: 8px 14px;
    gap: 14px;
    border-radius: 999px;
  }

  .rail-btn { width: 24px; height: 24px; }

  .clock-card {
    position: static;
    transform: none;
    width: 100%;
    margin-top: 12px;
    padding: 16px 18px 14px;
    border-radius: 24px;
  }

  .clock { font-size: clamp(48px, 15vw, 72px); }
  .date-line { font-size: 9px; letter-spacing: .3em; }
  .cal { margin-top: 12px; border-radius: 18px; }
  .cal-month { font-size: clamp(24px, 8vw, 34px); }
  .cal-days .day { font-size: 11px; padding: 7px 0; }

  .hero-wrap {
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    height: auto;
    margin: -6px 0 0;
    order: 3;
    display: flex;
    justify-content: center;
    align-items: flex-end;
  }

  .hero {
    height: 38dvh;
    max-height: 330px;
    min-height: 220px;
    max-width: 100%;
    width: auto;
  }

  .vert { display: none; }

  .panel {
    position: static;
    transform: none;
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    border-radius: 24px;
    order: 4;
  }

  .thumbs { grid-template-columns: 1fr 1fr; gap: 8px; }
  .thumb { border-radius: 14px; }
  .hi { font-size: 17px; }

  .dock {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
    gap: 14px;
    padding: 8px 16px;
  }

  .dock .app { width: 32px; height: 32px; }
}

@media (max-height: 620px) and (orientation: landscape) {
  .clock { font-size: 42px; }
  .clock-card { width: 250px; padding: 12px 14px; }
  .cal-month { font-size: 22px; }
  .date-line { font-size: 8px; }
  .panel { width: 190px; padding: 8px; }
  .hi { font-size: 14px; margin: 7px 2px; }
  .sched { margin-top: 6px; padding: 7px; }
  .rail { gap: 7px; padding: 8px 0; }
  .rail-btn { width: 22px; height: 22px; }
  .hero-wrap { height: 98%; }
  .dock { padding: 6px 12px; gap: 10px; bottom: 8px; }
  .dock .app { width: 26px; height: 26px; }
}
