:root {
  color-scheme: light;
  --ink: #1c1c1e;
  --muted: #8e8e93;
  --paper: #f2f2f7;
  --card: rgba(255, 255, 255, .82);
  --green: #2481cc;
  --green-dark: #1769aa;
  --line: rgba(60, 60, 67, .12);
  --glass: rgba(255, 255, 255, .68);
  --sheet: rgba(247, 247, 252, .94);
  --tg-safe-top: env(safe-area-inset-top, 0px);
  --tg-safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}
@keyframes planet-float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-7px) rotate(2deg); }
}
@keyframes added-pop {
  0% { transform: scale(1); box-shadow: 0 5px 18px rgba(35, 55, 75, .055); }
  38% { transform: scale(1.045); box-shadow: 0 10px 28px rgba(36, 129, 204, .2); }
  100% { transform: scale(1); box-shadow: 0 5px 18px rgba(35, 55, 75, .055); }
}
@keyframes art-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-9px) scale(1.1) rotate(-5deg); }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 92% 8%, rgba(166, 211, 255, .26), transparent 32%),
    var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }

.app-shell {
  width: min(100%, 680px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(12px + var(--tg-safe-top)) 22px calc(28px + var(--tg-safe-bottom));
}

.topbar, .brand, .section-heading, .cart-heading, .cart-total,
.product-bottom, .cart-row, .quantity-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar { height: 48px; }
.brand {
  justify-content: flex-start;
  gap: 9px;
  color: var(--ink);
  font-family: Manrope, sans-serif;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -1px;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 11px 11px 11px 4px;
  background: var(--green);
  color: #fff;
  font-size: 19px;
  line-height: 1;
}

.icon-button {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  cursor: pointer;
}
.icon-button svg, .search-box svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}
.cart-count {
  position: absolute;
  top: -3px;
  right: -3px;
  display: grid;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  place-items: center;
  border: 2px solid var(--paper);
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.welcome {
  position: relative;
  overflow: hidden;
  margin-top: 21px;
  padding: 28px 25px 22px;
  border-radius: 25px;
  background: #e9ece2;
}
.welcome::after {
  position: absolute;
  right: -30px;
  bottom: -67px;
  width: 205px;
  height: 205px;
  border: 1px solid rgba(82, 107, 76, .12);
  border-radius: 46% 54% 60% 40%;
  box-shadow: 0 0 0 18px rgba(82, 107, 76, .04), 0 0 0 38px rgba(82, 107, 76, .035);
  content: "";
  transform: rotate(-24deg);
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.6px;
}
h1, h2, p { margin-top: 0; }
.welcome h1, h2 {
  font-family: Manrope, sans-serif;
  letter-spacing: -1.2px;
}
.welcome h1 {
  position: relative;
  z-index: 1;
  margin-bottom: 9px;
  font-size: clamp(25px, 7vw, 34px);
  font-weight: 700;
  line-height: 1.13;
}
.welcome-copy { margin-bottom: 17px; color: #74796e; font-size: 12px; }
.delivery-note {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid rgba(82, 107, 76, .13);
  border-radius: 18px;
  background: rgba(255, 255, 255, .54);
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 600;
}
.delivery-icon { font-size: 13px; }

.catalog { padding-top: 30px; }
.section-heading { align-items: flex-end; gap: 12px; }
.section-heading .eyebrow { margin-bottom: 4px; }
h2 { margin-bottom: 0; font-size: 22px; font-weight: 700; }
.search-box {
  display: flex;
  width: 130px;
  height: 38px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--muted);
}
.search-box svg { width: 17px; height: 17px; flex: 0 0 auto; }
.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
}
.search-box input::placeholder { color: #a4a69e; }

.categories {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 19px -22px 18px;
  padding: 0 22px 2px;
  scrollbar-width: none;
}
.categories::-webkit-scrollbar { display: none; }
.category-chip {
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: transparent;
  color: #777b71;
  cursor: pointer;
  font-size: 11px;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.category-chip.active { border-color: var(--green); background: var(--green); color: #fff; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.product-card {
  overflow: hidden;
  border: 1px solid rgba(37, 41, 33, .035);
  border-radius: 17px;
  background: var(--card);
}
.product-art {
  display: grid;
  min-height: 126px;
  place-items: center;
  font-size: 55px;
}
.product-info { padding: 12px 12px 13px; }
.product-category { margin: 0 0 5px; color: #9a9c92; font-size: 9px; }
.product-name { min-height: 34px; margin: 0 0 12px; font-size: 12px; font-weight: 600; line-height: 1.4; }
.product-bottom { gap: 5px; }
.product-price { font-size: 13px; font-weight: 700; }
.add-button {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 0;
  border-radius: 11px;
  background: #edf0e9;
  color: var(--green-dark);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: transform .12s ease, background .15s ease;
}
.add-button:active { background: #dce5d6; transform: scale(.93); }
.empty-state { padding: 32px 10px; color: var(--muted); text-align: center; font-size: 13px; }

.modal-backdrop {
  position: fixed;
  z-index: 5;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(24, 28, 22, .38);
  backdrop-filter: blur(3px);
}
.modal-backdrop[hidden] { display: none; }
.cart-panel {
  display: flex;
  width: min(100%, 680px);
  max-height: min(82dvh, 690px);
  flex-direction: column;
  padding: 24px 22px calc(19px + var(--tg-safe-bottom));
  border-radius: 25px 25px 0 0;
  background: var(--paper);
  animation: rise .2s ease-out;
}
@keyframes rise { from { transform: translateY(20px); opacity: .8; } to { transform: translateY(0); opacity: 1; } }
.cart-heading { flex: 0 0 auto; margin-bottom: 18px; }
.cart-heading h2 { font-size: 24px; }
.close-cart { width: 36px; height: 36px; }
.cart-items { overflow-y: auto; }
.cart-row { gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.cart-thumb { display: grid; width: 52px; height: 52px; flex: 0 0 auto; place-items: center; border-radius: 14px; font-size: 27px; }
.cart-product { min-width: 0; flex: 1; }
.cart-product-name { overflow: hidden; margin: 0 0 4px; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.cart-product-price { margin: 0; color: var(--muted); font-size: 10px; }
.quantity-control { gap: 9px; }
.quantity-control button {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  cursor: pointer;
  font-size: 15px;
}
.quantity-control span { min-width: 10px; font-size: 11px; text-align: center; }
.cart-empty { padding: 35px 0; text-align: center; }
.cart-empty span { font-size: 35px; }
.cart-empty p { margin: 9px 0 4px; font-weight: 600; }
.cart-empty small { color: var(--muted); font-size: 11px; }
.cart-footer { flex: 0 0 auto; padding-top: 14px; }
.cart-total { margin-bottom: 14px; font-size: 13px; }
.cart-total strong { font-family: Manrope, sans-serif; font-size: 18px; }
.checkout-button {
  display: flex;
  width: 100%;
  height: 51px;
  align-items: center;
  justify-content: space-between;
  padding: 0 17px;
  border: 0;
  border-radius: 15px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.checkout-button:active { background: var(--green-dark); }
.checkout-button span:last-child { font-size: 19px; }
.checkout-hint { margin: 10px 0 0; color: var(--muted); font-size: 10px; text-align: center; }
.toast {
  position: fixed;
  z-index: 10;
  right: 20px;
  bottom: calc(22px + var(--tg-safe-bottom));
  left: 20px;
  width: fit-content;
  max-width: calc(100% - 40px);
  margin: auto;
  padding: 11px 16px;
  border-radius: 13px;
  background: #252921;
  color: white;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  font-size: 12px;
  transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.visible { opacity: 1; transform: translateY(0); }

@media (min-width: 600px) {
  .app-shell { padding-right: 28px; padding-left: 28px; }
  .welcome { padding: 34px 32px 25px; }
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
  .product-art { min-height: 145px; font-size: 62px; }
  .categories { margin-right: -28px; margin-left: -28px; padding-right: 28px; padding-left: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.app-shell { padding-right: 20px; padding-left: 20px; }
.topbar {
  position: sticky;
  z-index: 2;
  top: var(--tg-safe-top);
  height: 56px;
  margin: 0 -20px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(60, 60, 67, .06);
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
}
.brand { font-family: inherit; letter-spacing: -.5px; }
.brand-mark { border-radius: 11px; }
.icon-button {
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 15px;
  background: var(--glass);
  box-shadow: 0 2px 10px rgba(20, 45, 70, .06);
  backdrop-filter: blur(16px);
}
.welcome {
  margin-top: 18px;
  border: 1px solid rgba(255, 255, 255, .8);
  background: var(--hero, linear-gradient(132deg, rgba(220, 239, 255, .9), rgba(241, 247, 255, .78)));
  box-shadow: 0 12px 30px rgba(40, 100, 160, .08), inset 0 1px 0 rgba(255, 255, 255, .9);
  backdrop-filter: blur(20px);
}
.welcome::after {
  border-color: rgba(36, 129, 204, .12);
  box-shadow: 0 0 0 18px rgba(36, 129, 204, .04), 0 0 0 38px rgba(36, 129, 204, .035);
}
.eyebrow { font-size: 10px; }
.welcome h1, h2 { font-family: inherit; letter-spacing: -.7px; }
.welcome-copy { color: #687889; font-size: 13px; }
.delivery-note {
  border-color: rgba(255, 255, 255, .8);
  background: rgba(255, 255, 255, .58);
  color: #286da5;
  font-size: 11px;
  backdrop-filter: blur(14px);
}
.search-box {
  height: 40px;
  border-color: rgba(255, 255, 255, .86);
  border-radius: 14px;
  background: var(--glass);
  box-shadow: 0 3px 12px rgba(20, 45, 70, .04);
  backdrop-filter: blur(16px);
}
.search-box input { font-size: 12px; }
.categories { margin-right: -20px; margin-left: -20px; padding-right: 20px; padding-left: 20px; }
.category-chip {
  border-color: rgba(60, 60, 67, .1);
  border-radius: 18px;
  background: rgba(255, 255, 255, .52);
  color: #63636a;
  font-size: 12px;
}
.category-chip.active { box-shadow: 0 4px 12px rgba(36, 129, 204, .2); }
.product-card {
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 21px;
  background: var(--card);
  box-shadow: 0 5px 18px rgba(35, 55, 75, .055);
  backdrop-filter: blur(18px);
  transition: transform .18s ease, box-shadow .18s ease;
}
.product-card:active { transform: scale(.985); }
.product-art { min-height: 132px; }
.product-info { padding: 13px 13px 14px; }
.product-category { color: var(--muted); font-size: 10px; }
.product-name { font-size: 13px; }
.product-price { font-size: 14px; }
.add-button {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(36, 129, 204, .11);
  color: var(--green);
}
.add-button:active { background: rgba(36, 129, 204, .2); }
.modal-backdrop {
  background: rgba(20, 28, 38, .3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.cart-panel {
  max-height: min(85dvh, 720px);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 28px 28px 0 0;
  background: var(--sheet);
  box-shadow: 0 -12px 40px rgba(25, 45, 65, .12);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
}
.quantity-control button { border-radius: 11px; }
.cart-total strong { font-family: inherit; }
.checkout-button { border-radius: 16px; }
.toast {
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(29, 33, 38, .88);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
  backdrop-filter: blur(18px);
}

@media (min-width: 600px) {
  .topbar { margin-right: -28px; margin-left: -28px; padding-right: 28px; padding-left: 28px; }
  .categories { margin-right: -28px; margin-left: -28px; padding-right: 28px; padding-left: 28px; }
}

:root {
  --hero: linear-gradient(132deg, rgba(220, 239, 255, .9), rgba(241, 247, 255, .78));
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f5f5f7;
  --muted: #a1a1aa;
  --paper: #101318;
  --card: rgba(31, 37, 47, .88);
  --green: #58a6e7;
  --green-dark: #3d8acb;
  --line: rgba(235, 235, 245, .13);
  --glass: rgba(20, 25, 33, .78);
  --sheet: rgba(24, 29, 38, .97);
  --hero: linear-gradient(132deg, rgba(34, 57, 78, .96), rgba(29, 38, 53, .9));
}

body, .topbar, .welcome, .search-box, .product-card, .category-chip,
.cart-panel, .icon-button, .product-info, .cart-row, .quantity-control button {
  transition:
    color .32s ease,
    background-color .38s ease,
    border-color .32s ease,
    box-shadow .38s ease;
}

body { background-color: var(--paper); }
.header-actions { display: flex; align-items: center; gap: 9px; }
.theme-toggle { overflow: hidden; }
.theme-toggle svg { position: absolute; transition: transform .45s cubic-bezier(.2, .8, .2, 1), opacity .3s ease; }
.theme-toggle .sun-icon { opacity: 0; transform: rotate(-70deg) scale(.5); }
.theme-toggle .moon-icon { opacity: 1; transform: rotate(0) scale(1); }
:root[data-theme="dark"] .theme-toggle .sun-icon { opacity: 1; transform: rotate(0) scale(1); }
:root[data-theme="dark"] .theme-toggle .moon-icon { opacity: 0; transform: rotate(70deg) scale(.5); }

.welcome { animation: welcome-in .72s cubic-bezier(.2, .8, .2, 1) both; }
.welcome::after { animation: halo-drift 12s ease-in-out infinite alternate; }
.delivery-note { animation: note-in .6s .22s cubic-bezier(.2, .8, .2, 1) both; }
.catalog { animation: section-in .6s .12s cubic-bezier(.2, .8, .2, 1) both; }
.product-card {
  animation: card-in .62s cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: calc(var(--card-index, 0) * 70ms);
}
.product-card:hover {
  box-shadow: 0 12px 28px rgba(35, 55, 75, .12);
  transform: translateY(-4px);
}
.product-card.added { animation: added-pop .52s cubic-bezier(.2, .9, .3, 1.3); }
.product-card.added .product-art { animation: art-bounce .52s cubic-bezier(.2, .9, .3, 1.3); }
.product-art { transition: filter .35s ease, transform .45s cubic-bezier(.2, .8, .2, 1); }
.product-card:hover .product-art { filter: saturate(1.13); transform: scale(1.055) rotate(-2deg); }
.category-chip { transition: color .22s ease, background .22s ease, border-color .22s ease, transform .2s ease, box-shadow .22s ease; }
.category-chip:active { transform: scale(.94); }
.add-button, .checkout-button, .quantity-control button, .icon-button {
  transition: transform .2s cubic-bezier(.2, .8, .2, 1), background-color .2s ease, box-shadow .2s ease;
}
.add-button:hover, .icon-button:hover { box-shadow: 0 5px 14px rgba(36, 129, 204, .16); transform: translateY(-2px); }
.add-button:active, .checkout-button:active, .quantity-control button:active, .icon-button:active { transform: scale(.92); }
.cart-count.bump { animation: badge-pop .42s cubic-bezier(.2, .9, .3, 1.4); }
.cart-panel { animation: sheet-in .48s cubic-bezier(.16, 1, .3, 1); }
.cart-row { animation: row-in .38s cubic-bezier(.2, .8, .2, 1) both; }
.cart-row:nth-child(2) { animation-delay: 45ms; }
.cart-row:nth-child(3) { animation-delay: 90ms; }
.toast.visible { animation: toast-in .38s cubic-bezier(.2, .8, .2, 1) both; }

:root[data-theme="dark"] body {
  background-image: radial-gradient(ellipse at 92% 8%, rgba(56, 122, 180, .17), transparent 34%);
}
:root[data-theme="dark"] .topbar { border-bottom-color: rgba(255, 255, 255, .08); }
:root[data-theme="dark"] .welcome { border-color: rgba(173, 207, 238, .13); }
:root[data-theme="dark"] .welcome::after {
  border-color: rgba(100, 177, 235, .18);
  box-shadow: 0 0 0 18px rgba(100, 177, 235, .06), 0 0 0 38px rgba(100, 177, 235, .035);
}
:root[data-theme="dark"] .welcome-copy { color: #b7c4d2; }
:root[data-theme="dark"] .delivery-note {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .08);
  color: #c3e2fb;
}
:root[data-theme="dark"] .category-chip { background: rgba(255, 255, 255, .055); color: #c6c7cc; }
:root[data-theme="dark"] .category-chip.active { background: var(--green); color: #fff; }
:root[data-theme="dark"] .product-card {
  border-color: rgba(255, 255, 255, .08);
  box-shadow: 0 7px 22px rgba(0, 0, 0, .2);
}
:root[data-theme="dark"] .product-card:hover { box-shadow: 0 12px 28px rgba(0, 0, 0, .32); }
:root[data-theme="dark"] .product-art { filter: brightness(.78) saturate(.82); }
:root[data-theme="dark"] .search-box { border-color: rgba(255, 255, 255, .12); }
:root[data-theme="dark"] .search-box input::placeholder { color: #858b96; }
:root[data-theme="dark"] .icon-button { border-color: rgba(255, 255, 255, .12); }
:root[data-theme="dark"] .add-button { background: rgba(88, 166, 231, .16); color: #80c4ff; }
:root[data-theme="dark"] .cart-panel { border-color: rgba(255, 255, 255, .1); }
:root[data-theme="dark"] .cart-thumb { filter: brightness(.78) saturate(.82); }
:root[data-theme="dark"] .quantity-control button { border-color: rgba(255, 255, 255, .12); }

.hero-planet {
  position: absolute;
  z-index: 0;
  right: 12px;
  bottom: 3px;
  display: grid;
  width: 178px;
  height: 150px;
  place-items: center;
  perspective: 650px;
  pointer-events: none;
  animation: planet-float 5.2s ease-in-out infinite;
}
.hero-orbit {
  position: absolute;
  width: 148px;
  height: 58px;
  border: 1px solid rgba(71, 158, 220, .27);
  border-radius: 50%;
  box-shadow: 0 0 14px rgba(71, 158, 220, .12), inset 0 0 10px rgba(71, 158, 220, .08);
  transform: rotate(-24deg) rotateX(62deg);
  animation: orbit-breathe 3.8s ease-in-out infinite alternate;
}
.hero-orbit-back {
  width: 115px;
  height: 83px;
  border-color: rgba(127, 196, 244, .2);
  transform: rotate(38deg) rotateX(67deg);
  animation-delay: -.9s;
}
.hero-star {
  position: relative;
  display: grid;
  width: 84px;
  height: 84px;
  place-items: center;
  color: #eaf8ff;
  font-family: Georgia, serif;
  font-size: 78px;
  line-height: 1;
  transform-style: preserve-3d;
  animation: star-spin 5.5s linear infinite;
  filter: drop-shadow(0 7px 12px rgba(31, 120, 190, .3));
}
.hero-star-face, .hero-star-depth {
  position: absolute;
  background: linear-gradient(145deg, #fff 12%, #c9ecff 45%, #70b9ee 78%, #e8f7ff);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 19px rgba(129, 205, 255, .45);
  backface-visibility: hidden;
}
.hero-star-face { transform: translateZ(5px); }
.hero-star-depth {
  background: linear-gradient(145deg, #438fc7, #17619d);
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 0 #347eaf, 0 4px 0 #286b9d, 0 6px 0 #205981;
  transform: translateZ(-5px) rotateY(180deg);
}
.hero-sparkle {
  position: absolute;
  top: 31px;
  right: 28px;
  color: #d7efff;
  font-size: 20px;
  text-shadow: 0 0 13px rgba(146, 213, 255, .85);
  animation: sparkle-float 2.4s ease-in-out infinite;
}
:root[data-theme="dark"] .hero-orbit {
  border-color: rgba(120, 194, 248, .35);
  box-shadow: 0 0 18px rgba(71, 158, 220, .18), inset 0 0 12px rgba(71, 158, 220, .1);
}
:root[data-theme="dark"] .hero-star { filter: drop-shadow(0 8px 18px rgba(69, 158, 220, .42)); }

@keyframes welcome-in {
  from { opacity: 0; transform: translateY(20px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes section-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes note-in {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes halo-drift {
  from { transform: translate3d(0, 0, 0) rotate(-24deg); }
  to { transform: translate3d(-12px, -9px, 0) rotate(-8deg); }
}
@keyframes badge-pop {
  0% { transform: scale(.7); }
  65% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
@keyframes sheet-in {
  from { opacity: .7; transform: translateY(38px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes row-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes star-spin {
  from { transform: rotateX(18deg) rotateY(0deg) rotateZ(-8deg); }
  to { transform: rotateX(18deg) rotateY(360deg) rotateZ(352deg); }
}
@keyframes orbit-breathe {
  from { opacity: .48; scale: .94; }
  to { opacity: 1; scale: 1.06; }
}
@keyframes sparkle-float {
  0%, 100% { opacity: .58; transform: translateY(2px) scale(.86) rotate(0); }
  50% { opacity: 1; transform: translateY(-5px) scale(1.12) rotate(22deg); }
}

@media (max-width: 430px) {
  .hero-planet { right: -18px; width: 146px; opacity: .78; }
  .hero-star { font-size: 67px; }
  .hero-orbit { width: 126px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-delay: 0ms !important;
    animation-duration: .01ms !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

.settings-panel {
  display: flex;
  width: min(100%, 680px);
  max-height: min(85dvh, 720px);
  flex-direction: column;
  overflow-y: auto;
  padding: 24px 22px calc(22px + var(--tg-safe-bottom));
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 28px 28px 0 0;
  background: var(--sheet);
  box-shadow: 0 -12px 40px rgba(25, 45, 65, .12);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  animation: sheet-in .48s cubic-bezier(.16, 1, .3, 1);
}
.settings-section { padding: 18px 0; border-top: 1px solid var(--line); }
.settings-section h3 { margin: 0 0 5px; font-size: 15px; font-weight: 650; }
.settings-description { margin: 0; color: var(--muted); font-size: 12px; }
.theme-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
.theme-option {
  display: grid;
  min-width: 0;
  gap: 8px;
  justify-items: center;
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--glass);
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
  transition: border-color .2s ease, background .2s ease, transform .2s ease, box-shadow .2s ease;
}
.theme-option:active { transform: scale(.96); }
.theme-option[aria-pressed="true"] {
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 10%, var(--glass));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 18%, transparent);
}
.theme-preview {
  display: grid;
  width: 100%;
  height: 52px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.theme-preview span { width: 55%; height: 8px; border-radius: 8px; background: var(--green); box-shadow: 0 13px 0 rgba(127, 139, 151, .3); }
.light-preview { background: linear-gradient(135deg, #f2f2f7 50%, #fff 50%); }
.dark-preview { background: linear-gradient(135deg, #101318 50%, #252b35 50%); }
.system-preview { background: linear-gradient(135deg, #f2f2f7 50%, #171a20 50%); }
.system-preview span { background: linear-gradient(90deg, #2481cc 50%, #58a6e7 50%); }
.animation-setting { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.switch { position: relative; display: inline-flex; flex: 0 0 auto; align-items: center; cursor: pointer; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-track {
  position: relative;
  width: 49px;
  height: 29px;
  border-radius: 16px;
  background: #b8b8bd;
  transition: background .2s ease, box-shadow .2s ease;
}
.switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  content: "";
  transition: transform .22s cubic-bezier(.2, .8, .2, 1);
}
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 3px solid color-mix(in srgb, var(--green) 35%, transparent); outline-offset: 3px; }
.settings-note { margin: 0; padding-top: 4px; color: var(--muted); font-size: 11px; text-align: center; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}
.version-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.update-button {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--green) 25%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--green) 9%, var(--glass));
  color: var(--green);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  transition: transform .2s ease, opacity .2s ease, background .2s ease;
}
.update-button:hover:not(:disabled) { background: color-mix(in srgb, var(--green) 16%, var(--glass)); transform: translateY(-1px); }
.update-button:active:not(:disabled) { transform: scale(.97); }
.update-button:disabled { cursor: wait; opacity: .65; }
.update-status { min-height: 0; margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.update-status:empty { display: none; }
.update-reload { width: 100%; margin-top: 9px; }
.update-reload[hidden] { display: none; }
:root[data-theme="dark"] .settings-panel { border-color: rgba(255, 255, 255, .1); }
:root[data-theme="dark"] .theme-option { background: rgba(255, 255, 255, .04); }
:root[data-theme="dark"] .theme-option[aria-pressed="true"] { background: color-mix(in srgb, var(--green) 18%, var(--sheet)); }
:root[data-theme="dark"] .switch-track { background: #555b65; }
:root[data-theme="dark"] .switch input:checked + .switch-track { background: var(--green); }

:root.animations-off *, :root.animations-off *::before, :root.animations-off *::after {
  animation: none !important;
  scroll-behavior: auto !important;
  transition-duration: .01ms !important;
}
