/* Font Faces */
@font-face {
  font-family: 'PP Neue Montreal';
  src: url('./assets/fonts/ppneuemontreal-medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'PP Neue Montreal';
  src: url('./assets/fonts/ppneuemontreal-book.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Telegram WebApp Theme Variables */
:root {
  --bg: #0f0f10;
  --card: #17181a;
  --text: #e6e6e6;
  --muted: #9aa0a6;
  --accent: #2ea6ff;
  --outline: #2a2d31;
  --water-color: #eb3b40;
  --water-color-soft: #ff9aa0;
  --water-shadow: rgba(235,59,64,0.28);
  --vessel-border: #f69a9d;
  --vessel-bg-top: rgba(255,255,255,0.35);
}

/* Base styles */
* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: #f2f2f2; /* light base for main menu */
  overflow: hidden; /* prevent body scroll, use .page scrolling */
  font-family: 'PP Neue Montreal', -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

/* App Loader */
.app-loader { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.9); z-index: 9999; }
.app-loader[hidden] { display: none !important; }
.app-loader .spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(0,0,0,0.1); border-top-color: #eb3b40; animation: app-spin 0.8s linear infinite; }
@keyframes app-spin { to { transform: rotate(360deg); } }

/* No Access Screen Container */
.no-access-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  height: var(--app-height);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100; /* under loader */
}

/* Ensure hidden state always wins */
.no-access-container[hidden],
.no-access-container.is-hidden {
  display: none !important;
}

.no-access-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  height: var(--app-height);
  background-image: url('./assets/images/bg-no-access.png');
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover; /* ensure full-bleed */
  z-index: -1;
}

/* Background Layer */
.background-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Background image applied directly to container */

/* Content Layer */
.content-layer {
  position: relative;
  z-index: 3;
  text-align: center;
  color: #fff;
  padding: 40px 20px 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - 100px);
  min-height: calc(100dvh - 100px);
  min-height: calc(var(--app-height) - 100px);
}

/* Main Text Styling */
.main-text {
  margin-bottom: 40px;
}

.access-denied {
  font-size: 42px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
  color: #fff;
}

/* Instruction Text */
.instruction-text {
  margin-bottom: 50px;
}

.instruction {
  font-size: 20px;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0;
  color: #fff;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Buy Button Container */
.buy-button-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

/* Buy Button */
.buy-btn {
  background: #fff;
  border: none;
  border-radius: 0;
  padding: 16px 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  width: 100%;
  max-width: 400px;
}

.buy-btn:hover {
  transform: translateY(-1px);
}

.buy-btn:active {
  transform: translateY(0);
}

.buy-text {
  font-size: 18px;
  font-weight: 500;
  text-transform: uppercase;
  color: #000;
}

/* Light theme support */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6f7;
    --card: #ffffff;
    --text: #0f1419;
    --muted: #556170;
    --accent: #2ea6ff;
    --outline: #e6eaef;
  }
}

/* Telegram WebApp Theme Integration */
.telegram-theme {
  transition: all 0.3s ease;
}

.telegram-theme .no-access-container {
  background: var(--bg);
}

.telegram-theme .access-denied,
.telegram-theme .instruction {
  color: var(--text);
}

/* ---- Main menu (Calendar) ---- */
.page {
  height: 100vh;
  height: 100dvh;
  height: var(--app-height);
  background-color: #f2f2f2;
  background-image: url('./assets/images/bg-calendar.png');
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  padding: 24px 20px 140px; /* leave room for bottom nav */
  -webkit-overflow-scrolling: touch; /* smooth iOS scrolling */
  overflow-y: auto; /* ensure vertical scroll on long content */
}

.page-header { margin-bottom: 12px; }

.page-title {
  margin: 0 0 16px;
  color: #000;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  font-size: clamp(40px, 9vw, 104.49px);
}

/* Today banner */
.today-banner {
  position: relative;
  background: #eb3b40;
  color: #fff;
  height: 104px; /* half height */
  border-radius: 0;
  display: grid;
  grid-template-columns: 62.35px 1fr; /* halve square column */
  align-items: center;
  padding: 0 20px;
  margin: 8px 0 20px;
}

.today-square {
  width: 124.7px;
  height: 123.8px;
  border: 1px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56.56px;
  font-weight: 500;
}
.today-square {
  width: 62.35px; /* half */
  height: 61.9px; /* half */
  font-size: 28.28px; /* half */
}
.today-square span { transform: translateY(2px); }

.today-text { margin-left: 20px; }
.today-subtitle,
.today-title {
  font-size: clamp(28px, 4.2vw, 33.1px);
  letter-spacing: -0.02em;
  line-height: 1;
}

/* Calendar image */
.calendar-section { margin: 12px 0 18px; }
.calendar-image-about { display: block; width: 100%; height: auto; padding: 0 3px; }
.calendar-image {
  width: 100%;
  height: auto;
  display: block;
}

/* Legend */
.legend { margin: 6px 2px 14px; }
.legend-text {
  font-size: 16.74px; /* half */
  letter-spacing: -0.02em;
  line-height: 1;
  color: #000;
  opacity: .4;
}
.legend-text .span { font-family: 'PP Neue Montreal'; }

/* Divider */
.divider {
  height: 1px;
  background: rgba(0,0,0,.08);
  margin: 16px 0 18px;
}

/* ---- Measure screen ---- */
.measure-page .page-title { color: #000; font-size: clamp(26.7px, 6vw, 69.66px); flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.measure-page .page-header { position: relative; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.measure-close { position: static; width: auto; height: auto; border: 0; background: none; color: #eb3b40; padding: 0; margin: 0; border-radius: 0; font-size: clamp(28px, 7vw, 44px); line-height: 1; }
.measure-close:focus, .measure-close:focus-visible { outline: none; }
.measure-form { display: grid; gap: 26px; margin-top: 8px; }
.measure-field { display: grid; gap: 10px; }
.measure-label { color: #000; font-size: clamp(18px, 4.6vw, 30px); opacity: .9; }
.measure-input {
  appearance: none;
  width: 100%;
  height: 72px;
  border-radius: 0;
  border: 1px solid rgba(235,59,64,.2);
  background: rgba(235,59,64,.12);
  padding: 18px 16px;
  font-family: 'PP Neue Montreal', -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-size: clamp(18px, 4.6vw, 28px);
  color: #000;
}
.measure-input::placeholder { color: rgba(0,0,0,.35); }
.measure-input:focus { outline: none; }
.measure-input.is-invalid { border-color: #eb3b40; }
.measure-error { margin: -6px 0 0; min-height: 18px; color: #eb3b40; font-size: 14px; opacity: .9; }
.measure-actions { position: static; padding: 0; background: none; height: auto; display: block; margin-top: 24px; }
.measure-submit { width: 100%; height: 62px; border: 0; border-radius: 0; background: #eb3b40; color: #fff; text-transform: uppercase; font-size: clamp(16px, 4.6vw, 22px); font-weight: 500; appearance: none; -webkit-appearance: none; outline: none; box-shadow: none; -webkit-tap-highlight-color: transparent; margin-bottom: calc(16px + env(safe-area-inset-bottom)); }
.measure-submit:focus, .measure-submit:focus-visible { outline: none; box-shadow: none; }
.measure-submit:disabled { background: rgba(235,59,64,.35); }

/* hide bottom nav on the measurements screen for focus */
#measure-screen ~ .bottom-nav { display: grid; }
#measure-screen:not([hidden]) ~ .bottom-nav { display: none; }

/* reduce extra bottom space on measure screen (bottom nav hidden) */
.measure-page { padding-bottom: 24px; }

/* Training card */
.training-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 20px;
  align-items: start;
  padding: 6px 0 12px;
  color: #000;
}

.training-image {
  width: 130px;
  height: 130px;
  object-fit: cover;
  display: block;
}

.training-content { position: relative; }

.training-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px; /* ~1.2x smaller from previous */
  padding: 0 10px; /* ~1.2x smaller from previous */
  border-radius: 15px; /* ~1.2x smaller from previous */
  background: rgba(235, 59, 64, 0.24);
  border: 0.7px solid #eb3b40;
  color: #000;
  font-size: 16.3px; /* ~1.2x smaller from previous */
  letter-spacing: -0.01em;
  line-height: 1.09;
  margin-bottom: 16px;
}

.training-title {
  margin: 0 0 18px;
  font-weight: 500;
  font-size: clamp(24px, 4.6vw, 43.7px); /* slightly larger */
  letter-spacing: -0.02em;
  line-height: 1;
}

.training-link {
  color: #eb3b40;
  text-decoration: underline;
  font-size: clamp(18px, 3.8vw, 32px);
}

/* Bottom navigation */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 96px;
  padding-bottom: max(0px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  gap: 8px;
  background-color: rgba(255,255,255,0.7);
  border-top: 0.4px solid #fff;
  z-index: 10;
}

.nav-btn {
  appearance: none;
  border: 0;
  background: none;
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-size: clamp(24px, 5vw, 38px);
  color: rgba(0,0,0,.6);
}
.nav-btn.is-active { color: #eb3b40; }

/* Icon system using CSS masks to ensure consistent rendering on iOS */
.nav-btn .icon { display: inline-block; width: 28px; height: 28px; background-color: currentColor; }
.nav-btn .icon { -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; }
.nav-btn .i-calendar { -webkit-mask-image: url('./assets/images/icons/calendar.svg'); mask-image: url('./assets/images/icons/calendar.svg'); }
.nav-btn .i-links { -webkit-mask-image: url('./assets/images/icons/links.svg'); mask-image: url('./assets/images/icons/links.svg'); }
.nav-btn .i-news { -webkit-mask-image: url('./assets/images/icons/news.svg'); mask-image: url('./assets/images/icons/news.svg'); }
.nav-btn .i-star { -webkit-mask-image: url('./assets/images/icons/star.svg'); mask-image: url('./assets/images/icons/star.svg'); }
/* sculpture profile icon: use high-res PNG alpha as mask for crispness */
.nav-btn .i-sculpture { -webkit-mask-image: url('./assets/images/sculptor-nav-item.png'); mask-image: url('./assets/images/sculptor-nav-item.png'); }
/* optional rendering hint (some browsers ignore on masks, harmless otherwise) */
.nav-btn .i-sculpture { image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges; }
/* align sculpture icon baseline with other icons */
.bottom-nav .nav-btn .i-sculpture { transform: none; margin-top: 0; position: relative; }

/* ---- Links Screen ---- */
#links-screen .page-title { color: #000; }

.links {
  display: grid;
  gap: 28px;
}

.link-card {
  position: relative;
  background: linear-gradient(0deg, #eb3b40, rgba(255,255,255,0));
  color: #fff;
  padding: 24px;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.link-card__image {
  position: static;
  width: clamp(190px, 38vw, 300px);
  height: auto;
  object-fit: contain;
  pointer-events: none;
  margin-top: 12px;
  margin-left: -12px;
  margin-bottom: 12px;
}

.link-card__title {
  position: static;
  margin: 0 0 10px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  font-size: clamp(36px, 7vw, 64px);
}

.link-card__desc {
  position: static;
  margin: 0 0 18px;
  font-size: clamp(16px, 3.5vw, 26px);
  line-height: 1.2;
}

.link-card__note {
  position: absolute;
  right: 20px;
  top: 16px;
  font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  opacity: .87;
}

.link-card__btn {
  position: static;
  height: 57px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  background: #eb3b40;
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  width: 100%;
}

/* Dark scheme adjustments */
@media (prefers-color-scheme: dark) {
  html, body { background-color: #121212; }
  .training-link { color: #ff6b70; }
}



.rating-podium {
  position: relative;
  margin: 0px 0 28px;
  padding-top: 210px; /* reserve vertical space so avatars sit above the stairs */
}

.rating-podium__bg {
  position: relative;
  z-index: 0;
  width: 100%;
  height: auto;
  display: block;
  margin-top: -56px; /* raise stairs higher, avatars stay */
}

.podium-avatar {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 1; /* ensure above stairs image */
}
.podium-avatar__img {
  width: 90px; /* unified size */
  height: 90px;
  border-radius: 224.43px;
  object-fit: cover;
}
.podium-avatar__name { color: #000; font-size: clamp(20px, 3.4vw, 22px); opacity: .7; }

/* Positions based on background reference */
.podium-avatar--first { left: 50%; top: 12px; transform: translateX(-50%); }
.podium-avatar--first .podium-avatar__img { width: 90px; height: 90px; border-radius: 224.43px; }

.podium-avatar--second { left: 15%; top: 44px; transform: translateX(-50%); }
.podium-avatar--second .podium-avatar__img { width: 90px; height: 90px; border-radius: 187.66px; }
.podium-avatar__img--left { margin-top: 36px; }

.podium-avatar--third { left: 85%; top: 44px; transform: translateX(-50%); }
.podium-avatar--third .podium-avatar__img { width: 90px; height: 90px; border-radius: 187.66px; }
.podium-avatar__img--right { margin-top: 18px; }

.leaderboard-title { margin: 16px 0 10px; color: #000; font-size: clamp(32px, 7vw, 72px); letter-spacing: -0.02em; line-height: 1; font-weight: 400; }

.leaderboard-list { display: grid; gap: 0; }

.leaderboard-row { display: grid; grid-template-columns: 26px 52px 1fr; align-items: center; gap: 10px; padding: 12px 0; }
.leaderboard-num { width: 26px; font-size: 28px; letter-spacing: -0.02em; line-height: 1; font-weight: 500; color: #000; display: flex; align-items: center; justify-content: center; }
.leaderboard-avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
.leaderboard-name { width: 220px; font-size: 22px; letter-spacing: -0.01em; line-height: 1.05; color: #000; opacity: .7; }
.you-tag { color: #eb3b40; }

.leaderboard-divider { height: 1px; background: rgba(0,0,0,.2); }

/* ---- Home Screen ---- */
#home-screen .page-title { color: #000; }
#home-screen .home-carousel { margin-top: 8px; }

.home-carousel { position: relative; overflow: hidden; display: block; }
.home-track { display: flex; will-change: transform; transition: transform .35s ease; }
.home-slide { flex: 0 0 100%; padding: 0 0 12px; display: block; }
.home-dots { position: absolute; left: 43.16px; top: 46.86px; display: flex; gap: 8px; }
.home-dot { width: 10px; height: 10px; border-radius: 50%; border: 0; background: rgba(0,0,0,.2); }
.home-dot.is-active { background: #eb3b40; }
.home-dot.is-active { background: #eb3b40; }

/* Make each card scale to device width while preserving original design sizes */
.home-card { position: relative; width: 100%; }
.card-canvas { position: relative; width: 100%; max-width: 100%; }
.card-canvas { --design-width: 964; }
.card-canvas .rectangle-parent { position: absolute; top: 0; left: 50%; transform: translateX(-50%); }
.card-canvas { aspect-ratio: 964 / 392.5; position: relative; }
/* shrink the design so the whole canvas fits vertically and horizontally */
.home-card .rectangle-parent { width: 964px; height: 392.5px; }
.home-carousel { padding-top: 4px; }

/* Ensure the white canvas background fills width */
.home-card .group-child { left: 0; width: 100%; }

/* Card styles from spec */
.rectangle-parent {
  width: 100%;
  position: relative;
  height: 392.5px;
  text-align: left;
  font-size: 59.07px;
  color: rgba(235, 59, 64, 0.77);
  font-family: 'PP Neue Montreal', -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}
.group-child {
  position: absolute;
  top: 0px;
  left: calc(50% - 482px);
  background-color: #fff;
  width: 964px;
  height: 392.5px;
}
.wrapper {
  position: absolute;
  top: 181.14px;
  left: calc(50% - 442.3px);
  border-radius: 314.44px;
  background-color: rgba(235, 59, 64, 0.1);
  border: 1.2px solid #fff;
  box-sizing: border-box;
  width: 121.1px;
  height: 121.1px;
  overflow: hidden;
}
.div {
  position: absolute;
  top: 32.06px;
  left: calc(50% - 16.49px);
  line-height: 97%;
  text-transform: uppercase;
  font-weight: 500;
}
.container {
  position: absolute;
  top: 181.14px;
  left: calc(50% - 254.19px);
  border-radius: 314.44px;
  background-color: rgba(235, 59, 64, 0.1);
  border: 1.2px solid #fff;
  box-sizing: border-box;
  width: 121.1px;
  height: 121.1px;
  overflow: hidden;
}
.rectangle-div {
  position: absolute;
  top: 32.06px;
  left: calc(50% - 17.49px);
  line-height: 97%;
  text-transform: uppercase;
  font-weight: 500;
}
.frame {
  position: absolute;
  top: 181.14px;
  left: calc(50% - 66.06px);
  border-radius: 314.44px;
  background-color: rgba(235, 59, 64, 0.1);
  border: 1.2px solid #fff;
  box-sizing: border-box;
  width: 121.1px;
  height: 121.1px;
  overflow: hidden;
}
.frame-div {
  position: absolute;
  top: 181.14px;
  left: calc(50% + 122.05px);
  border-radius: 314.44px;
  background-color: rgba(235, 59, 64, 0.1);
  border: 1.2px solid #fff;
  box-sizing: border-box;
  width: 121.1px;
  height: 121.1px;
  overflow: hidden;
}
.rectangle-wrapper {
  position: absolute;
  top: 181.14px;
  left: calc(50% + 310.17px);
  border-radius: 314.44px;
  background-color: rgba(235, 59, 64, 0.1);
  border: 1.2px solid #fff;
  box-sizing: border-box;
  width: 121.1px;
  height: 121.1px;
  overflow: hidden;
}
.home-card .wrapper,
.home-card .container,
.home-card .frame,
.home-card .frame-div,
.home-card .rectangle-wrapper { display: flex; align-items: center; justify-content: center; }
.home-card .wrapper .div,
.home-card .container .rectangle-div,
.home-card .frame .rectangle-div,
.home-card .frame-div .rectangle-div,
.home-card .rectangle-wrapper .rectangle-div { position: static; top: auto; left: auto; transform: none; }
.div5 {
  position: absolute;
  top: 86.28px;
  left: calc(50% - 442.3px);
  font-size: 60.44px;
  letter-spacing: -0.02em;
  line-height: 100%;
  font-family: 'PP Neue Montreal';
  color: #000;
}
.div6 {
  position: absolute;
  top: 317.12px;
  left: calc(50% - 442.3px + 60.55px); /* center of first circle (wrapper) */
  font-size: 35.79px;
  letter-spacing: -0.02em;
  line-height: 100%;
  font-family: 'PP Neue Montreal';
  color: #000;
  opacity: 0.3;
  transform: translateX(-50%);
  text-align: center;
}
.div7 {
  position: absolute;
  top: 317.12px;
  left: calc(50% + 310.17px + 60.55px); /* center of last circle */
  font-size: 35.79px;
  letter-spacing: -0.02em;
  line-height: 100%;
  font-family: 'PP Neue Montreal';
  color: #000;
  opacity: 0.3;
  transform: translateX(-50%);
  text-align: center;
}
.group-item {
  position: absolute;
  top: 46.86px;
  left: 43.16px;
  width: 44.3px;
  height: 15.7px;
}

/* --- Rating interactions --- */
/* Keep card interactive at all times; no dimming */
.home-card .rating-hit { cursor: pointer; transition: transform .08s ease, background-color .12s ease, border-color .12s ease; }
.home-card .rating-hit:active { transform: scale(0.98); }
.home-card .is-selected { background-color: rgba(105,149,122,0.22); border-color: #69957A; }
/* Selected circle number color */
.home-card .is-selected .div,
.home-card .is-selected .rectangle-div { color: #69957A; }

.rating-ripple {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(105,149,122,0.25) 0%, rgba(105,149,122,0.15) 45%, rgba(105,149,122,0.0) 70%);
  transform: scale(0);
  animation: rating-ripple .6s ease-out forwards;
  pointer-events: none;
}

@keyframes rating-ripple {
  to { transform: scale(1); opacity: 0; }
}

.rating-toast {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  background: rgba(0,0,0,0.76);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 18px;
  letter-spacing: -0.01em;
  line-height: 1.1;
  opacity: 0;
  transition: opacity .16s ease, transform .18s ease;
}
.rating-toast:is(:not(.is-hide)) { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.rating-toast.is-hide { opacity: 0; transform: translate(-50%, -50%) scale(0.98); }

/* ---- News card ---- */
.news-list { display: grid; gap: 16px; margin-top: 8px; }
.news-card {
  position: relative;
  background: #eee;
  color: #000;
  min-height: clamp(220px, 45vw, 360px);
  overflow: hidden;
}
.news-card__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.news-card__overlay { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(255,255,255,.85) 0%, rgba(255,255,255,.5) 16%, rgba(255,255,255,.15) 40%, rgba(255,255,255,0) 64%); }
.news-card__content { position: relative; padding: 12px 16px 12px; display: grid; gap: 6px; align-content: end; min-height: inherit; }
.news-card__date { font-size: clamp(16px, 3vw, 18px); opacity: .3; }
.news-card__title { margin: 0; letter-spacing: -0.02em; line-height: 1.02; font-size: clamp(20px, 7.2vw, 40px); font-family: 'PP Neue Montreal'; }
.news-card .home-dots {
  position: absolute;
  left: calc(43.16px * var(--mood-scale, 1));
  top: calc(46.86px * var(--mood-scale, 1));
  display: flex;
  gap: 8px;
  transform: scale(var(--mood-scale, 1));
  transform-origin: top left;
}
.news-card .home-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ---- Water tracker banner ---- */
.vector-parent {
  width: 100%;
  position: relative;
  overflow: hidden;
  text-align: left;
  color: #fff;
  font-family: 'PP Neue Montreal';
  margin: 12px 0; /* adjust top/bottom spacing around water tracker banner */
}
.vector-canvas {
  position: relative;
  width: 100%;
  max-width: 964px;
  margin: 0 auto;
  height: 104px; /* same height as today-banner */
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-image: url('./assets/images/water-checker.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.vector-title {
  position: static;
  letter-spacing: -0.02em;
  line-height: 1;
  font-weight: 500;
  font-size: clamp(22px, 5.6vw, 34px);
}
.vector-div {
  position: static;
  font-size: clamp(16px, 4.4vw, 22px);
  letter-spacing: -0.02em;
  line-height: 1.16;
  opacity: .95;
}

/* ---- Water tracker screen ---- */
.water-page .page-title { color: #000; }

.water-target {
  width: auto;
  position: relative;
  font-size: 26.9px;
  letter-spacing: -0.02em;
  line-height: 100%;
  font-weight: 500;
  font-family: 'PP Neue Montreal';
  color: #eb3b40;
  text-align: center;
  display: block;
  opacity: 0.5;
  margin: 6px auto 14px;
}

.water-vessel {
  position: relative;
  width: 100%;
  max-width: 160px;
  height: 360px;
  margin: 0 auto 20px;
  border-radius: 40px;
  border: 4px solid var(--vessel-border);
  box-sizing: border-box;
  background: linear-gradient(180deg, var(--vessel-bg-top), rgba(255,255,255,0));
  overflow: hidden;
}

.water-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%; /* dynamic */
  background: none; /* top edge shaped by waves above the base fill */
  box-shadow: none;
  transition: height .4s ease;
}

.water-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--water-color); /* dynamic via JS */
  z-index: 0; /* sits under the waves */
  /* hard step earlier so waves cover seam completely */
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 80px, rgba(0,0,0,1) 80px, rgba(0,0,0,1) 100%);
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 80px, rgba(0,0,0,1) 80px, rgba(0,0,0,1) 100%);
}

/* At full target: fill to the very top and hide waves */
.water-fill.is-full::after {
  -webkit-mask-image: none;
  mask-image: none;
}
.water-fill.is-full .water-svg { display: none; }

.water-fill__label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: clamp(18px, 5vw, 30px);
  letter-spacing: -0.02em;
  font-family: 'PP Neue Montreal';
  z-index: 3;
}

/* Animated liquid waves (SVG) */
.water-svg { position: absolute; left: -30%; right: -30%; top: -60px; height: 160px; z-index: 2; pointer-events: none; overflow: visible; }
.water-liquid .wave-back { opacity: .5; }
.water-liquid .wave-front { opacity: .92; }
.water-bubbles circle { fill: rgba(255,255,255,0.55); mix-blend-mode: screen; }

.water-add { margin: 22px 0 8px; }
.water-add__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; max-width: 320px; margin: 0 auto; }
@media (min-width: 420px) { .water-add__grid { grid-template-columns: repeat(4, 1fr); max-width: 100%; } }
.water-add__btn {
  appearance: none;
  border: 1px solid #f2b2b4;
  background: rgba(235,59,64,.08);
  color: #eb3b40;
  height: 44px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  font-family: 'PP Neue Montreal', -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
}
.water-add__btn:active { transform: translateY(1px); }

.water-info { margin-top: 22px; color: #000; }
.water-info__title { font-size: clamp(28px, 6.4vw, 56px); letter-spacing: -0.02em; line-height: 1.02; font-weight: 500; margin: 0 0 10px; }
.water-info__text { opacity: .6; font-size: clamp(16px, 3.6vw, 22px); line-height: 1.3; }

/* ---- Sculptor Screen ---- */
#sculptor-screen .page-title { margin: 0; }
.sculptor-page { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sculptor-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sculptor-header__right { display: inline-flex; align-items: center; gap: 8px; }
.sculptor-count {
  width: auto; height: auto; position: relative;
  font-size: clamp(20px, 6vw, 69.66px); /* 1.5x меньше заголовка при верхнем пороге */
  letter-spacing: -0.01em; line-height: 1;
  font-family: 'PP Neue Montreal'; color: #000; text-align: left;
  display: inline-block;
}
.sculptor-tasks-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(0,0,0,0.18);
  background: transparent;
  background-color: transparent;
  color: #000;
  padding: 10px 16px;
  border-radius: 999px;
  font-family: 'PP Neue Montreal', -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-size: clamp(18px, 4.4vw, 30px);
  line-height: 1;
}
.sculptor-tasks-btn:active { transform: translateY(1px); }
.sculptor-logo { width: 22px; height: 22px; display: inline-block; }

.sculptor-level { margin: 8px 0 14px; }
.sculptor-level__label {
  width: auto; height: auto; position: relative;
  font-size: clamp(22px, 6.4vw, 44px); /* меньше */
  letter-spacing: -0.01em; line-height: 0.95; font-family: 'PP Neue Montreal';
  color: #000; text-align: left; display: inline-block; opacity: .7;
}
.sculptor-progress { width: 100%; height: 14.4px; position: relative; border-radius: 80px; background-color: rgba(235, 59, 64, 0.28); overflow: hidden; margin-top: 10px; }
.sculptor-progress__fill { height: 100%; width: 0%; background: #eb3b40; border-radius: inherit; transition: width .35s ease; }

.sculptor-figure { margin-top: 14px; }
.sculptor-figure__img { display: block; width: 100%; height: auto; }

/* Pixi stage container overlays the image fallback and will replace it when ready */
.sculptor-figure__stage {
  position: relative;
  width: 100%;
  height: auto;
  display: none; /* shown after Pixi is ready */
}
.sculptor-figure__stage canvas { width: 100% !important; height: auto !important; display: block; touch-action: pan-y; }

/* ---- Gift bottom sheet ---- */
.gift-sheet {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  pointer-events: auto;
  overscroll-behavior: contain;
}
.gift-sheet[hidden] { display: none !important; }
.gift-card {
  width: 100%;
  background: #fff;
  border-radius: 28px 28px 0 0;
  padding: 26px 18px 22px;
  text-align: center;
}
.gift-card__img { width: clamp(140px, 42vw, 220px); height: auto; display: block; margin: 0 auto 14px; }
.gift-card__title { margin: 0 0 16px; color: #000; font-weight: 500; letter-spacing: -0.02em; line-height: 1.06; font-family: 'PP Neue Montreal'; font-size: clamp(22px, 5.6vw, 36px); }
.gift-card__btn { width: 100%; height: 56px; border: 0; background: #eb3b40; color: #fff; text-transform: uppercase; font-family: 'PP Neue Montreal'; font-size: clamp(16px, 4.4vw, 22px); border-radius: 6px; }

/* Always hide bottom nav while any sheet is visible */
body:has(#gift-sheet:not([hidden]), #task-info-sheet:not([hidden])) .bottom-nav { display: none; }

/* ---- Task info sheet layout tweaks ---- */
.task-info-card {
  position: relative;
  overflow: hidden;
  min-height: auto; /* Let content dictate height, but keep minimums via padding/gap if needed */
  display: flex;
  flex-direction: column;
  align-items: stretch; /* Full width children */
  gap: 20px; /* Consistent vertical spacing */
  /* Balanced padding: top enough for close button, bottom for safety */
  padding: 44px 24px calc(24px + env(safe-area-inset-bottom));
  text-align: left;
}

.task-info-card__title { 
  position: relative; 
  z-index: 2; 
  text-align: left; 
  margin: 0;
  padding-right: 40px; /* Prevent overlap with close button */
  font-size: clamp(22px, 5.6vw, 32px); 
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: #000;
  text-transform: none; /* Easier to read */
}

.task-info-card__desc { 
  position: relative; 
  z-index: 2; 
  text-align: left; 
  margin: 0; 
  width: 100%;
  color: rgba(0,0,0,0.85);
  font-size: 17px;
  line-height: 1.5;
}

.task-info-card__desc p {
  margin: 0 0 12px;
}
.task-info-card__desc p:last-child {
  margin-bottom: 0;
}
.task-info-card__desc ul {
  margin: 0 0 12px;
  padding-left: 20px;
  list-style-type: disc;
}
.task-info-card__desc li {
  margin-bottom: 4px;
  padding-left: 0;
}

/* helper note below the task CTA */
.task-info-card__note { 
  margin: 0; 
  color: #000; 
  font-size: 15px; 
  text-align: left; 
  width: 100%;
  background: rgba(235, 59, 64, 0.06); 
  padding: 14px 16px;
  border-radius: 12px;
  line-height: 1.4;
  /* Removed border-left for a cleaner, more contained look */
}

/* Update close button position */
.task-info-close { 
  position: absolute; 
  right: 16px; 
  top: 16px; 
  border: 0; 
  background: rgba(0,0,0,0.05); /* Subtle background circle */
  border-radius: 50%;
  color: #000; 
  font-size: 20px; 
  line-height: 1; 
  padding: 0; 
  width: 32px; 
  height: 32px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  z-index: 3; 
  transition: background .2s;
}
.task-info-close:active { background: rgba(0,0,0,0.1); }
.task-info-close:focus, .task-info-close:focus-visible { outline: none; }

/* Ensure the button is properly spaced */
.task-info-card .gift-card__btn {
  margin-top: 8px; /* Extra space before button */
  flex-shrink: 0;
}

/* ---- Tasks screen ---- */
.tasks-page .page-title { color: #000; font-size: clamp(40px, 9vw, 104.49px); letter-spacing: -0.02em; line-height: 1.02; font-weight: 500; margin: 0 0 6px; }
.tasks-page { padding-bottom: 180px; }
.tasks-subtitle { margin: 0 0 18px; color: #000; opacity: .6; font-size: clamp(16px, 4vw, 22px); line-height: 1.3; }
.tasks-grid { --tasks-gap-x: 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px var(--tasks-gap-x); align-items: start; }
@media (max-width: 360px) { .tasks-grid { --tasks-gap-x: 12px; gap: 22px var(--tasks-gap-x); } }
.task-card { position: relative; text-align: center; display: flex; flex-direction: column; align-items: center; }
.task-card__figure { position: relative; width: 100%; display: block; overflow: hidden; height: clamp(160px, 45vw, 224px); padding-bottom: 0; }
.task-card__img { display: block; width: 100%; height: 100%; object-fit: contain; }
.task-card__title { margin-top: 4px; color: #000; font-family: 'PP Neue Montreal'; letter-spacing: -0.01em; line-height: 1.1; font-size: clamp(13px, 3.6vw, 20px); }
.task-card__lock { position: absolute; right: 6px; top: 6px; width: clamp(12px, 3.6vw, 22px); height: auto; opacity: .6; }
.task-card__go { position: absolute; left: 50%; right: auto; transform: translateX(-50%); bottom: 12px; z-index: 2; height: 40px; padding: 0 18px; border-radius: 4px; border: 0; background: #eb3b40; color: #fff; font-family: 'PP Neue Montreal'; font-size: clamp(14px, 3.8vw, 18px); text-transform: uppercase; min-width: clamp(120px, 44%, 220px); }
.task-card__img { display: block; width: 100%; height: 100%; object-fit: contain; }
.task-card__img.is-dimmed { opacity: .5; }
.task-card.is-locked .task-card__img { opacity: .5; }
/* grid rows: 3 in first, 2 in second → handled by 5 items naturally */

/* Compact row of two statues placed closer together, same width as top row */
.tasks-row.tasks-row--two { grid-column: 1 / -1; display: flex; justify-content: center; align-items: flex-start; gap: var(--tasks-gap-x); }
.tasks-row.tasks-row--two > .task-card { width: calc((100% - (var(--tasks-gap-x) * 2)) / 3); }
@media (max-width: 360px) { .tasks-row.tasks-row--two { gap: var(--tasks-gap-x); } }

/* ---- Wide screens (tablet/laptop): center phone viewport and add side lines ---- */
@media (min-width: 768px) {
  :root {
    --phone-width: 430px;
    --frame-line-width: 2px;
    --frame-line-gap: 24px;
    --frame-line-opacity: 0.28;
  }

  /* Decorative vertical lines flanking the phone viewport */
  body::before, body::after {
    content: '';
    position: fixed;
    top: 0;
    bottom: 0;
    width: var(--frame-line-width);
    background: var(--frame-line-color);
    opacity: var(--frame-line-opacity);
    pointer-events: none;
    z-index: 2;
  }
  body::before { left: calc(50% - (var(--phone-width) / 2) - var(--frame-line-gap)); }
  body::after { left: calc(50% + (var(--phone-width) / 2) + var(--frame-line-gap) - var(--frame-line-width)); }

  /* Constrain app pages to phone width */
  .page { max-width: var(--phone-width); margin-left: auto; margin-right: auto; }

  /* Center fixed footer nav to match phone width */
  .bottom-nav { left: 50%; right: auto; transform: translateX(-50%); width: var(--phone-width); }

  /* Center gift bottom sheet */
  .gift-sheet { left: 50%; right: auto; transform: translateX(-50%); width: var(--phone-width); }

  /* Center the no-access overlay to phone width */
  .no-access-container { width: var(--phone-width); left: 50%; right: auto; transform: translateX(-50%); }
  .no-access-container::before { width: 100%; }
}
