/* Базовые переменные + палитра «приключение / банковский мини-апп» (см. superrules) */
:root {
  --tg-theme-bg-color: #e8f4ef;
  --tg-theme-text-color: #2a2118;
  --tg-theme-button-color: #2a9d8f;
  --tg-theme-button-text-color: #ffffff;
  --bg: var(--tg-theme-bg-color, #e8f4ef);
  --text: var(--tg-theme-text-color, #2a2118);
  --accent: var(--tg-theme-button-color, #2a9d8f);
  --accent-deep: #1f7a70;
  --gold: #e9c46a;
  --forest: #2d5a27;
  --bark: #4a3728;
  --card-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.85);
  --radius: 14px;
  --radius-pill: 50px;
  --tab-h: 56px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(165deg, #b8e0d8 0%, #7ec8b8 35%, #e9c46a 90%, #f4e4a6 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

#app {
  max-width: 100%;
  min-height: 100vh;
}

#app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 12px));
}

.app-main {
  flex: 1;
  overflow-x: hidden;
}

.tab-screen {
  display: none;
  padding: 0.75rem 1rem 1rem;
  max-width: 520px;
  margin: 0 auto;
}

.tab-screen.active {
  display: block;
}

.welcome-block {
  text-align: center;
  margin: 0;
}

.welcome-title {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  color: var(--bark);
  font-weight: 700;
}

.welcome-lead,
.welcome-sub {
  margin: 0.35rem 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--bark);
  opacity: 0.95;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 1.25rem; /* опускаем кнопки вниз */
}

.home-tile {
  min-height: 4.25rem;
  padding: 0.75rem 0.6rem;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--bark);
  box-shadow: 0 4px 14px rgba(45, 90, 39, 0.12);
  cursor: pointer;
}

.home-tile:active {
  transform: scale(0.98);
  opacity: 0.95;
}

.home-tile:disabled,
.home-tile.btn-region-blocked {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.home-exit-wrap {
  margin-top: 1.25rem;
}

.btn-exit {
  width: 100%;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  border: 1px solid rgba(74, 55, 40, 0.25);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.45);
  color: var(--bark);
  cursor: pointer;
}

.home-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.home-hero__card {
  width: 100%;
  display: grid;
  place-items: center;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.home-hero__card img {
  width: min(260px, 72vw);
  max-height: 34vh;
  object-fit: contain;
  border-radius: 10px;
  display: block;
}

/* Нижний таб-бар (как в банковском мини-приложении: три сегмента) */
.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  min-height: var(--tab-h);
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(45, 90, 39, 0.12);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
}

.tab-bar__btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin: 0;
  padding: 6px 4px;
  border: none;
  background: transparent;
  color: #6b5d52;
  font-size: 0.62rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tab-bar__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  opacity: 0.85;
}

/* Flaticon SVG как маска: цвет вкладки = currentColor (активная / неактивная). */
.tab-bar__icon--mask {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.tab-bar__icon--home {
  -webkit-mask-image: url(images/tab-flaticon-tree-stars-5005651.svg);
  mask-image: url(images/tab-flaticon-tree-stars-5005651.svg);
}

.tab-bar__icon--history {
  -webkit-mask-image: url(images/tab-flaticon-parchment-7443643.svg);
  mask-image: url(images/tab-flaticon-parchment-7443643.svg);
}

.tab-bar__icon--profile {
  -webkit-mask-image: url(images/tab-flaticon-rating-2618529.svg);
  mask-image: url(images/tab-flaticon-rating-2618529.svg);
}

.tab-bar__label {
  max-width: 100%;
  line-height: 1.15;
  text-align: center;
  word-break: break-word;
}

.tab-bar__btn--active {
  color: var(--accent-deep);
}

.tab-bar__btn--active .tab-bar__icon {
  opacity: 1;
}

.faq-attribution {
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(91, 78, 64, 0.2);
  font-size: 0.75rem;
  line-height: 1.4;
  color: #6b5d52;
}

.faq-attribution a {
  color: var(--accent-deep);
  text-decoration: underline;
}

.faq-attribution__title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.faq-attribution__list {
  margin: 0.35rem 0 0;
  padding-left: 1.15rem;
}

.faq-attribution__list li {
  margin-bottom: 0.35rem;
}

.faq-attribution__note {
  margin: 0.65rem 0 0;
}

body.overlay-open .tab-bar {
  opacity: 0;
  pointer-events: none;
}

/* Пока открыт экран расклада / доната / настроек — нижний слой (#app-main с главной и Шутом)
   не должен ни отрисовываться «насквозь», ни давать второй вертикальный скролл.
   Раньше .screen-overlay был с rgba≈0.97 и главная оставалась display:block — отсюда «просвечивание»
   и двойной скроллбар (body + оверлей). */
body.overlay-open {
  overflow: hidden;
}

body.overlay-open #app-main {
  visibility: hidden;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.screen-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Непрозрачный фон: тот же градиент, что у body, без альфы — иначе видна картинка Шута под слоем */
  background: linear-gradient(165deg, #b8e0d8 0%, #7ec8b8 35%, #e9c46a 90%, #f4e4a6 100%);
}

.screen-overlay.active {
  display: block;
}

.overlay-inner {
  max-width: 560px;
  margin: 0 auto;
  padding: 0.75rem 1rem 1.5rem;
  min-height: min-content;
}

.nav-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.nav-buttons button {
  width: 100%;
  box-sizing: border-box;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--tg-theme-button-text-color, #fff);
  cursor: pointer;
}

.nav-buttons button:active {
  opacity: 0.9;
}

.back-row {
  margin-bottom: 0.75rem;
}

.donate-back-row {
  margin-bottom: 0.5rem;
}

/* Шапка: только контейнер; размеры кнопки — в общем блоке .btn-back-inline ниже */
.back-row .btn-back {
  display: block;
  width: 100%;
}

.message {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--text);
}

/* Пустой блок под кнопками на главной не показывать (убрать тёмную полосу) */
#home-message:empty {
  display: none;
}

/* Текст трактовки ИИ: белый фон, чёрный текст во всех экранах раскладов */
.interpretation-text {
  color: #1a1a1a !important;
  background: #fff !important;
  padding: 1rem;
  border-radius: var(--radius);
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 50vh;
  overflow-y: auto;
  margin: 0;
  border: 1px solid #e0e0e0;
}

.reading-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 1rem;
}

.reading-actions.readings-menu {
  gap: 0.5rem;
  margin-top: 1rem;
}
.reading-actions.readings-menu .readings-btn {
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  text-align: left;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  color: var(--bark);
  box-shadow: 0 2px 10px rgba(45, 90, 39, 0.08);
}

.reading-actions button {
  padding: 0.65rem 0.85rem;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, #3db5a8 0%, var(--accent) 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(42, 157, 143, 0.35);
}

.reading-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* «Назад» в блоке действий — не сжимать (общий .btn-back-inline ниже) */
.reading-actions .btn-back-inline {
  flex-shrink: 0;
}

/* Экран результата: карта — текст — Назад */
.card-day-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.card-day-result .card-day-single .card-item {
  width: 200px;
}
.card-day-result .interpretation-text {
  width: 100%;
  color: #1a1a1a !important;
  background: #fff !important;
  padding: 1rem;
  border-radius: var(--radius);
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 50vh;
  overflow-y: auto;
  margin: 0;
  border: 1px solid #e0e0e0;
}
.card-day-result .interpretation-text.error {
  color: #c00 !important;
}
/*
  Все кнопки «Назад» / возврата: один размер.
  Telegram Mini App подмешивает стили к button — !important на ключевые свойства.
*/
.screen .back-row > button[data-action="back"],
.screen .back-row > button[data-action="donate-close"],
.screen .back-row > button[data-action="settings-close"],
.btn-back-inline {
  display: block;
  width: 100% !important;
  max-width: 100%;
  box-sizing: border-box !important;
  min-height: 2.75rem;
  padding: 0.875rem 1rem !important;
  font-size: 1rem !important;
  line-height: 1.35;
  font-weight: 600;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.55) !important;
  backdrop-filter: blur(8px);
  color: var(--bark) !important;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: 0 2px 10px rgba(45, 90, 39, 0.1);
}

.screen .back-row > button[data-action="back"] {
  margin-top: 0;
}

.btn-back-inline {
  margin-top: 0.75rem;
}

.screen .back-row > button[data-action="back"]:active,
.btn-back-inline:active {
  opacity: 0.9;
}

#reading-content .card-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

/* Крупная карта для «Карта дня» */
#reading-content .card-day-single {
  justify-content: center;
  margin: 1rem auto;
}
#reading-content .card-day-single .card-item {
  width: 180px;
}

#reading-content .card-item {
  width: 80px;
  text-align: center;
}

#reading-content .card-item img {
  width: 100%;
  border-radius: 8px;
  display: block;
}

#reading-content .card-item span {
  font-size: 0.75rem;
  display: block;
  margin-top: 0.25rem;
}

/* Три карты в ряд (Прошлое — Настоящее — Будущее) */
#reading-content .card-list-three {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 1rem 0;
}
#reading-content .card-list-three .card-item {
  flex: 1;
  min-width: 70px;
  max-width: 120px;
}

/* Одна карта (быстрый вопрос) */
#reading-content .card-list-one {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  max-width: 11rem;
  margin: 1rem auto;
}
#reading-content .card-list-one .card-item {
  max-width: 120px;
  width: 100%;
}
#reading-content .card-list-one .reading-position-input {
  width: 100%;
  box-sizing: border-box;
}

/* Пять карт в ряд (Грядущий месяц и др.) */
#reading-content .card-list-five {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin: 1rem 0;
}
#reading-content .card-list-five .card-item {
  flex: 1;
  min-width: 55px;
  max-width: 85px;
}
#reading-content .card-list-five .card-item span {
  font-size: 0.7rem;
}

/* Семь карт (совместимость) */
#reading-content .card-list-seven {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin: 1rem 0;
}
#reading-content .card-list-seven .card-item {
  flex: 1;
  min-width: 55px;
  max-width: 85px;
}
#reading-content .card-list-seven .card-item span {
  font-size: 0.7rem;
}

.compat-subtitle {
  margin: 0.5rem 0 0.75rem 0;
}

/* Настройки */
#settings-content .settings-profile-head {
  text-align: center;
  margin: 1rem 0;
}
.settings-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: block;
  margin: 0 auto 0.5rem auto;
}
.settings-avatar-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 0.5rem auto;
}
.settings-nickname {
  font-weight: 600;
  margin: 0.25rem 0;
}
.settings-region-warning {
  background: rgba(255, 180, 0, 0.15);
  border: 1px solid rgba(255, 180, 0, 0.5);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}
.settings-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  cursor: pointer;
}
.settings-toggle input {
  width: 1.2rem;
  height: 1.2rem;
}

/* FAQ */
.faq-list {
  margin: 1rem 0;
}
.faq-item {
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.faq-question {
  width: 100%;
  padding: 0.75rem 0.5rem;
  text-align: left;
  font-size: 0.95rem;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-arrow {
  font-size: 0.7rem;
  opacity: 0.8;
  transition: transform 0.2s;
}
.faq-question[aria-expanded="true"] .faq-arrow {
  transform: rotate(180deg);
}
.faq-answer {
  margin: 0.25rem 0.75rem 0.75rem 0.75rem;
  padding: 0.85rem 0.9rem;
  font-size: 0.9rem;
  line-height: 1.5;
  opacity: 1;
  color: #1a1a1a;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px rgba(45, 90, 39, 0.08);
}

.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.75rem 0;
  padding: 0.75rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.settings-toggle-text {
  flex: 1;
  min-width: 0;
}

/* iOS-like switch */
.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 30px;
  flex: 0 0 auto;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(74, 55, 40, 0.18);
  transition: 0.2s;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.65);
}
.slider:before {
  position: absolute;
  content: "";
  height: 24px;
  width: 24px;
  left: 3px;
  top: 2px;
  background-color: rgba(255, 255, 255, 0.95);
  transition: 0.2s;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.switch input:checked + .slider {
  background: linear-gradient(180deg, #3db5a8 0%, var(--accent) 100%);
}
.switch input:checked + .slider:before {
  transform: translateX(22px);
}
.faq-link-btn {
  margin-top: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--tg-theme-button-text-color, #fff);
  cursor: pointer;
}

/* Кельтский крест: схема позиций и результат */
.celtic-layout-wrap {
  margin: 1rem 0;
  text-align: center;
}
.celtic-layout-svg {
  max-width: 200px;
  height: auto;
  display: block;
  margin: 0 auto;
}
.celtic-desc-list {
  margin: 1rem 0;
  font-size: 0.85rem;
  line-height: 1.4;
}
.celtic-desc-item {
  margin: 0.25rem 0;
  opacity: 0.9;
}
.celtic-result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, auto);
  gap: 4px;
  margin: 1rem 0;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}
.celtic-card-slot {
  text-align: center;
  min-height: 60px;
}
.celtic-card-slot img {
  width: 100%;
  max-width: 72px;
  border-radius: 6px;
  display: block;
  margin: 0 auto;
}
.celtic-card-slot span {
  font-size: 0.65rem;
  display: block;
  margin-top: 2px;
  line-height: 1.2;
}
.celtic-pos-1 { grid-row: 2; grid-column: 2; }
.celtic-pos-2 { grid-row: 3; grid-column: 2; }
.celtic-pos-3 { grid-row: 1; grid-column: 2; }
.celtic-pos-4 { grid-row: 4; grid-column: 2; }
.celtic-pos-5 { grid-row: 2; grid-column: 1; }
.celtic-pos-6 { grid-row: 2; grid-column: 3; }
.celtic-pos-7 { grid-row: 4; grid-column: 4; }
.celtic-pos-8 { grid-row: 3; grid-column: 4; }
.celtic-pos-9 { grid-row: 2; grid-column: 4; }
.celtic-pos-10 { grid-row: 1; grid-column: 4; }
.celtic-summary {
  font-size: 0.85rem;
  margin: 0.75rem 0;
  line-height: 1.45;
  opacity: 0.95;
}

/* Поля ввода текста: белый фон, чёрный текст — читаемость в любой теме */
.reading-question-input {
  width: 100%;
  margin: 0.75rem 0;
  padding: 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  background: #fff;
  color: #1a1a1a;
  resize: vertical;
  box-sizing: border-box;
}
.reading-question-input::placeholder {
  color: #666;
}

.reading-position-input {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  font-family: inherit;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  background: #fff;
  color: #1a1a1a;
  box-sizing: border-box;
}
.reading-position-input::placeholder {
  color: #666;
}
#reading-content label {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

/* Длинная инструкция над полем имени (совместимость) */
#reading-content label.compat-name-instruction {
  line-height: 1.45;
  margin-top: 0.75rem;
  margin-bottom: 0.35rem;
  font-weight: 400;
  font-size: 0.88rem;
}

.error {
  color: #ff6b6b;
}

.error-actions {
  margin-top: 8px;
  display: flex;
  justify-content: center;
}

.loading {
  opacity: 0.7;
}

.reading-message-text {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Предупреждающий текст (карта дня для другого): светлый фон, тёмный текст — читаемо в любой теме */
.reading-notice-box {
  margin: 1rem 0;
  padding: 1rem;
  background: #f0f0f0;
  color: #1a1a1a;
  border-radius: var(--radius);
  line-height: 1.5;
  white-space: pre-wrap;
}

.muted {
  color: var(--text);
  opacity: 0.75;
  font-size: 0.9rem;
  margin: 0.25rem 0 0.75rem 0;
}

.small-hint {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.4;
}

.stream-hint {
  margin: 0.75rem 0 0.35rem 0;
  font-size: 0.9rem;
}

/* Блок «Заданный вопрос» под картами на экране результата и в истории. */
.reading-question-block {
  margin: 0.75rem 0 0.5rem 0;
  padding: 0.85rem 1rem;
  background: #fff;
  color: #1a1a1a;
  border-radius: var(--radius);
  border: 1px solid #e0e0e0;
  line-height: 1.5;
}
.reading-question-label {
  margin: 0 0 0.25rem 0;
  font-size: 0.95rem;
  color: #1a1a1a;
}
.reading-question-text {
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #1a1a1a;
  font-size: 0.95rem;
}

/* Блок «Ответ из Высших Царств» — обёртка для streaming-вывода. */
.reading-answer-block {
  margin: 0.75rem 0 0.5rem 0;
}
.reading-answer-label {
  margin: 0 0 0.25rem 0;
  font-size: 0.95rem;
}

/* Блок ошибки обращения к ИИ + кнопка «Попробовать еще раз». */
.reading-ai-error {
  margin: 0.75rem 0 0.5rem 0;
}
.reading-ai-error .error {
  margin: 0 0 0.5rem 0;
}

.interpretation-streaming {
  min-height: 3rem;
  white-space: pre-wrap;
}

.interpretation-streaming:empty::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--accent, #2481cc);
  animation: interpret-caret 0.9s step-end infinite;
}

@keyframes interpret-caret {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.date-input {
  display: block;
  width: 100%;
  max-width: 200px;
  margin: 0.5rem 0 1rem 0;
  padding: 0.5rem;
  font-size: 1rem;
  border-radius: var(--radius);
  border: 1px solid #999;
  background: #fff;
  color: #1a1a1a;
}
.date-input::placeholder {
  color: #666;
}

#reading-content label {
  display: block;
  margin-top: 0.5rem;
}

.alert-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.alert-overlay[hidden] {
  display: none;
}
.alert-box {
  background: #fff;
  color: #1a1a1a;
  padding: 1.25rem;
  border-radius: var(--radius);
  max-width: 90%;
  min-width: 260px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.alert-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
}
.alert-message {
  margin: 0 0 1rem 0;
  font-size: 0.95rem;
}
.alert-ok {
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: block;
  margin-left: auto;
}

/* Профиль / история: колонка */
#profile-content,
#history-content {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}
#profile-content > .message {
  margin-top: 0;
}

.profile-card {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  box-shadow: 0 4px 16px rgba(45, 90, 39, 0.08);
}

.profile-card .settings-avatar,
.profile-card .settings-avatar-placeholder {
  margin-bottom: 0.5rem;
}

.profile-card .profile-lines {
  text-align: left;
  margin-top: 0.75rem;
  font-size: 0.92rem;
  color: var(--bark);
  line-height: 1.55;
}

.bank-row-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

button.bank-row {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
  color: var(--bark);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

button.bank-row:active {
  opacity: 0.92;
}

#history-content .profile-history-title {
  color: var(--bark);
}

/*
  Профиль: светлый фон и тёмный текст (как трактовка / reading-notice-box).
  Иначе при светлой шапке Telegram тёмные карточки var(--card-bg) + чёрный текст дают низкий контраст.
*/
#profile-content .message {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #e0e0e0;
}
#profile-content .message p,
#profile-content .message strong {
  color: #1a1a1a;
}

#profile-content > .error {
  margin: 0.25rem 0 0 0;
  padding: 0.75rem 1rem;
  background: #fff5f5;
  color: #b00020;
  border: 1px solid #ffcdd2;
  border-radius: var(--radius);
  line-height: 1.45;
}

#profile-content .muted {
  color: #555;
  opacity: 1;
}

/* Профиль: список раскладов и просмотр */
.profile-history-title {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}
#profile-content .profile-history-title {
  color: #1a1a1a;
}
.profile-history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.profile-history-item {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  text-align: left;
  font-size: 0.95rem;
  border: none;
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
}
#profile-content .profile-history-item,
#history-content .profile-history-item {
  background: #f5f5f7;
  color: #1a1a1a;
  border: 1px solid #e8e8ea;
}
.profile-history-item:active {
  opacity: 0.9;
}
#profile-content .profile-history-item:active,
#history-content .profile-history-item:active {
  background: #ebebed;
  opacity: 1;
}
#profile-content .profile-reading-detail .card-list,
#history-content .profile-reading-detail .card-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}
#profile-content .profile-reading-detail .card-item,
#history-content .profile-reading-detail .card-item {
  width: 80px;
  text-align: center;
}
#profile-content .profile-reading-detail .card-item img,
#history-content .profile-reading-detail .card-item img {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
}
/* Одна карта (день / неделя) — как на экране гадания */
#profile-content .profile-reading-detail .card-day-single,
#history-content .profile-reading-detail .card-day-single {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 1rem auto;
}
#profile-content .profile-reading-detail .card-day-single .card-item,
#history-content .profile-reading-detail .card-day-single .card-item {
  width: 180px;
}
/* Три / пять / семь карт — те же пропорции, что в reading-content */
#profile-content .profile-reading-detail .card-list-three,
#history-content .profile-reading-detail .card-list-three {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 1rem 0;
}
#profile-content .profile-reading-detail .card-list-three .card-item,
#history-content .profile-reading-detail .card-list-three .card-item {
  flex: 1;
  min-width: 70px;
  max-width: 120px;
}
#profile-content .profile-reading-detail .card-list-five,
#history-content .profile-reading-detail .card-list-five {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin: 1rem 0;
}
#profile-content .profile-reading-detail .card-list-five .card-item,
#history-content .profile-reading-detail .card-list-five .card-item {
  flex: 1;
  min-width: 55px;
  max-width: 85px;
}
#profile-content .profile-reading-detail .card-list-five .card-item span,
#history-content .profile-reading-detail .card-list-five .card-item span {
  font-size: 0.7rem;
}
#profile-content .profile-reading-detail .card-list-seven,
#history-content .profile-reading-detail .card-list-seven {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin: 1rem 0;
}
#profile-content .profile-reading-detail .card-list-seven .card-item,
#history-content .profile-reading-detail .card-list-seven .card-item {
  flex: 1;
  min-width: 55px;
  max-width: 85px;
}
#profile-content .profile-reading-detail .card-list-seven .card-item span,
#history-content .profile-reading-detail .card-list-seven .card-item span {
  font-size: 0.7rem;
}
.profile-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.5rem;
  justify-content: center;
  align-items: center;
}
.profile-detail-actions .btn-back-inline {
  margin-top: 0;
}
#profile-content .profile-reading-detail .interpretation-text,
#history-content .profile-reading-detail .interpretation-text {
  margin-top: 0.5rem;
}
#profile-content .profile-reading-detail,
#history-content .profile-reading-detail {
  color: #1a1a1a;
}
#profile-content .profile-reading-detail > p,
#history-content .profile-reading-detail > p {
  color: #1a1a1a;
}
#profile-content .profile-reading-detail > p.muted,
#history-content .profile-reading-detail > p.muted {
  color: #555;
}

/* Детали истории в табе: без верхней полосы «Назад» у экрана (кнопки внизу карточки) */
#screen-history-tab.history-detail-mode .back-row {
  display: none;
}

/* Поддержать: читаемый блок на белом фоне */
#donate-content .message {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #e8e8ea;
}
#screen-donate #donate-content a {
  color: #0066cc;
}

.nav-buttons button.btn-region-blocked,
.nav-buttons button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
