:root {
  --bg: var(--tg-theme-bg-color, #15151f);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #1e1e2c);
  --section-bg: var(--tg-theme-section-bg-color, #20202e);
  --text: var(--tg-theme-text-color, #ffffff);
  --hint: var(--tg-theme-hint-color, #8a8d9b);
  --accent: var(--tg-theme-button-color, #8a6bff);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --link: var(--tg-theme-link-color, #8ab4ff);
  --destructive: var(--tg-theme-destructive-text-color, #ff5d5d);
  --tabbar-h: 64px;
  --radius: 16px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* ---------- Заголовки / типографика ---------- */
.h1 {
  font-size: 24px;
  font-weight: 800;
  margin: 4px 0 2px;
}
.h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 10px;
}
.muted {
  color: var(--hint);
  font-size: 14px;
  line-height: 1.45;
}
.center {
  text-align: center;
}

/* ---------- Карточки ---------- */
.card {
  background: var(--section-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

/* ---------- Карточка знака (градиент) ---------- */
.sign-hero {
  position: relative;
  border-radius: 20px;
  padding: 22px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--accent) 0%, #5b3df0 100%);
  color: #fff;
  overflow: hidden;
}
.sign-hero .emoji {
  font-size: 56px;
  line-height: 1;
}
.sign-hero .name {
  font-size: 26px;
  font-weight: 800;
  margin-top: 8px;
}
.sign-hero .dates {
  opacity: 0.85;
  font-size: 14px;
  margin-top: 2px;
}
.sign-hero .bigemoji {
  position: absolute;
  right: -10px;
  top: -20px;
  font-size: 130px;
  opacity: 0.14;
  pointer-events: none;
}

/* ---------- Секции гороскопа ---------- */
.intro {
  font-size: 15px;
  line-height: 1.55;
}
.hsection {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.hsection:first-child {
  border-top: none;
}
.hsection .ico {
  font-size: 20px;
  flex: 0 0 auto;
}
.hsection .body .t {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}
.hsection .body .v {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

/* ---------- Строки профиля ---------- */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.row:first-child {
  border-top: none;
}
.row .k {
  color: var(--hint);
  font-size: 14px;
}
.row .v {
  font-size: 15px;
  font-weight: 600;
  text-align: right;
}

/* ---------- Чипы характеристик ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.chip {
  background: var(--secondary-bg);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
}

/* ---------- Формы ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.field > .label {
  font-size: 13px;
  font-weight: 600;
  color: var(--hint);
}
input[type="text"],
input[type="date"] {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  color: var(--text);
  background: var(--section-bg);
  border: 1px solid transparent;
  border-radius: 12px;
  outline: none;
}
input:focus {
  border-color: var(--accent);
}
.segmented {
  display: flex;
  gap: 8px;
}
.seg {
  flex: 1;
  padding: 12px 6px;
  font-size: 15px;
  color: var(--text);
  background: var(--section-bg);
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.seg.active {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

/* ---------- Кнопки ---------- */
.btn {
  display: block;
  width: 100%;
  padding: 15px;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 6px;
}
.btn.secondary {
  background: var(--secondary-bg);
  color: var(--text);
}
.btn.danger {
  background: transparent;
  color: var(--destructive);
}

/* ---------- Переключатель ---------- */
.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex: 0 0 auto;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  inset: 0;
  background: var(--secondary-bg);
  border-radius: 999px;
  transition: 0.2s;
}
.slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .slider {
  background: var(--accent);
}
.switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* ---------- Скелетон загрузки ---------- */
.skeleton {
  background: linear-gradient(90deg, var(--section-bg) 25%, var(--secondary-bg) 50%, var(--section-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: 10px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.sk-line {
  height: 14px;
  margin: 10px 0;
}
.sk-line.w60 { width: 60%; }
.sk-line.w80 { width: 80%; }

/* ---------- Нижняя навигация ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: var(--secondary-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 100;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--hint);
  cursor: pointer;
  font-size: 11px;
  transition: color 0.15s;
}
.tab .tab-ico {
  font-size: 22px;
  filter: grayscale(1) opacity(0.65);
  transition: filter 0.15s;
}
.tab.active {
  color: var(--accent);
}
.tab.active .tab-ico {
  filter: none;
}

/* ---------- Пустые состояния ---------- */
.empty {
  text-align: center;
  padding: 40px 20px;
}
.empty .big {
  font-size: 54px;
  margin-bottom: 12px;
}

.fade {
  animation: fade 0.25s ease;
}
@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
