:root {
  --bg: #f7f3ee;
  --surface: #fffaf5;
  --surface-2: #ffffff;
  --text: #1f1a17;
  --muted: #766a62;
  --line: #e8ddd2;
  --accent: #8f6f5a;
  --accent-dark: #755845;
  --accent-soft: #efe3d8;
  --success: #2e7d32;
  --warning: #c97a2b;
  --shadow: 0 10px 30px rgba(31, 26, 23, 0.08);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --container: 460px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: linear-gradient(180deg, #f8f3ee 0%, #f3ece5 100%);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
/* Статичный каркас: страница не скроллится, скролл только внутри активного экрана */
body { display: flex; justify-content: center; overflow: hidden; }
.app-shell {
  width: 100%; max-width: var(--container);
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background: transparent; position: relative; overflow: hidden;
}
.screen { display: none; }
.screen.active {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 18px 16px calc(92px + env(safe-area-inset-bottom));
}
.screen::-webkit-scrollbar { width: 0; }
.hero { padding-top: 18px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-radius: 999px; background: rgba(255,255,255,0.65);
  border: 1px solid rgba(255,255,255,0.8); box-shadow: var(--shadow);
  font-weight: 700; letter-spacing: 0.04em; font-size: 13px;
}
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #d7b79a, #8f6f5a);
}
.hero-card, .card {
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.9);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
}
.hero-card {
  margin-top: 18px; padding: 24px 20px 20px; overflow: hidden; position: relative;
}
.hero-card::after {
  content: ""; position: absolute; top: -40px; right: -40px; width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(143,111,90,0.22), rgba(143,111,90,0));
  pointer-events: none;
}
h1, h2, h3, p { margin: 0; }
.title-xl { font-size: 34px; line-height: 1.05; font-weight: 800; letter-spacing: -0.04em; margin-top: 18px; }
.title-lg { font-size: 26px; line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; }
.title-md { font-size: 18px; line-height: 1.25; font-weight: 700; }
.subtitle { margin-top: 14px; font-size: 15px; line-height: 1.55; color: var(--muted); }
.hero-preview { margin-top: 22px; display: grid; gap: 10px; }
.preview-item {
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px;
}
.preview-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.preview-text { font-size: 14px; line-height: 1.45; font-weight: 600; }
.section { margin-top: 18px; }
.card { padding: 18px 16px; width: 100%; max-width: 100%; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.body { font-size: 15px; line-height: 1.55; }
.profile-list { display: grid; gap: 10px; margin-top: 14px; }
.profile-item {
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px 14px;
}
.profile-item .label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.profile-item .value { font-weight: 700; font-size: 15px; }
.button, .ghost-button, .chip, .quick-button, .tab-button, .mini-button {
  border: none; cursor: pointer; font: inherit;
}
.button {
  width: 100%; background: var(--accent); color: white; padding: 16px 18px;
  border-radius: 16px; font-size: 15px; font-weight: 700;
  box-shadow: 0 10px 24px rgba(143,111,90,0.22); transition: 0.2s ease;
}
.button:active { transform: translateY(1px); background: var(--accent-dark); }
.ghost-button {
  width: 100%; background: transparent; color: var(--text); padding: 15px 18px;
  border-radius: 16px; border: 1px solid var(--line); font-size: 15px; font-weight: 600;
}
.stack { display: grid; gap: 12px; margin-top: 18px; }
.chips {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px;
  width: 100%; max-width: 100%; overflow: hidden;
}
.chip {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: 11px 14px; font-size: 14px; font-weight: 600; transition: 0.18s ease;
}
.chip.active { background: var(--accent-soft); border-color: #ccb19b; color: var(--accent-dark); }
.chat-suggestion { max-width: 100%; white-space: normal; word-break: break-word; flex: 0 1 auto; }
.input, .textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 16px; padding: 14px 14px; font: inherit; font-size: 15px; color: var(--text); outline: none;
}
.input:focus, .textarea:focus { border-color: #bea18a; box-shadow: 0 0 0 4px rgba(143,111,90,0.08); }
.textarea { min-height: 112px; resize: vertical; }
.field { margin-top: 14px; }
.field-label { font-size: 13px; color: var(--muted); margin-bottom: 8px; display: block; }
.home-hero {
  margin-top: 8px; padding: 22px 18px;
  background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(239,227,216,0.9));
  border-radius: 24px; border: 1px solid rgba(255,255,255,0.85); box-shadow: var(--shadow);
}
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.quick-button {
  padding: 14px 14px; border-radius: 18px; text-align: left; background: rgba(255,255,255,0.75);
  border: 1px solid var(--line); min-height: 82px; display: flex; flex-direction: column; justify-content: space-between;
}
.quick-button .name { font-size: 14px; font-weight: 700; }
.quick-button .desc { font-size: 12px; color: var(--muted); line-height: 1.35; }
.outfit-card {
  margin-top: 16px; padding: 18px 16px; background: rgba(255,255,255,0.86);
  border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow);
}
.outfit-section { margin-top: 14px; display: grid; gap: 8px; }
.outfit-block { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.outfit-block .label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.outfit-block .value { font-size: 15px; line-height: 1.5; font-weight: 600; }
.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.chat-shell { margin-top: 14px; display: grid; gap: 10px; }
.chat-message {
  max-width: 86%; padding: 13px 14px; border-radius: 18px;
  font-size: 14px; line-height: 1.5; white-space: pre-wrap;
}
.chat-message.ai { background: rgba(255,255,255,0.88); border: 1px solid var(--line); }
.chat-message.user { background: var(--accent-soft); margin-left: auto; border: 1px solid #dcc5b3; }
.chat-input-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 14px; }
#screen-chat .card { width: 100%; max-width: 100%; overflow: hidden; }
#screen-chat .chips { width: 100%; max-width: 100%; }
#screen-chat .chat-input-row { width: 100%; max-width: 100%; }
#screen-chat .input { min-width: 0; }
.send-btn {
  min-width: 54px; border-radius: 16px; background: var(--accent);
  color: white; border: none; font-size: 18px; font-weight: 800; cursor: pointer;
}
.saved-grid, .wardrobe-grid, .shop-grid, .pro-grid { display: grid; gap: 12px; margin-top: 14px; }
.saved-card, .wardrobe-card, .shop-card, .pro-card {
  background: rgba(255,255,255,0.86); border: 1px solid var(--line); border-radius: 18px; padding: 14px;
}
.saved-card-title, .wardrobe-card-title, .shop-card-title, .pro-card-title { font-weight: 700; margin-bottom: 8px; }
.wardrobe-image {
  width: 100%; height: 180px; object-fit: cover; border-radius: 14px;
  border: 1px solid var(--line); margin-bottom: 10px; display: block; background: #f3eee8;
}
.wardrobe-meta { font-size: 13px; color: var(--muted); margin-top: 6px; }
.saved-empty {
  padding: 28px 16px; text-align: center; border: 1px dashed #d7c5b6;
  border-radius: 18px; color: var(--muted); background: rgba(255,255,255,0.58);
}
.mini-button {
  background: var(--accent-soft); color: var(--accent-dark); border: 1px solid #d8bba4;
  padding: 10px 12px; border-radius: 12px; font-size: 13px; font-weight: 700;
}
.tag {
  display: inline-block; padding: 6px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; margin-bottom: 10px; background: #f6ede5; color: var(--accent-dark);
}
.warning-box {
  margin-top: 14px; background: #fff5e9; border: 1px solid #f0d2ad;
  border-radius: 18px; padding: 14px; color: #7d5522;
}
.price-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.discount {
  font-size: 12px; font-weight: 700; color: var(--success);
  background: #ebf7ec; border: 1px solid #cbe7ce; padding: 6px 8px; border-radius: 999px;
}
.bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px;
  width: calc(100% - 16px); max-width: calc(var(--container) - 16px);
  background: rgba(255,255,255,0.88); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.9); box-shadow: var(--shadow);
  border-radius: 22px; padding: 8px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; z-index: 100;
}
.tab-button {
  background: transparent; border-radius: 16px; padding: 10px 6px;
  font-size: 11px; font-weight: 700; color: var(--muted); display: grid; place-items: center; gap: 4px;
}
.tab-button.active { background: var(--accent-soft); color: var(--accent-dark); }
.emoji { font-size: 18px; line-height: 1; }
.hidden-nav { display: none; }

/* Лёгкая анимация появления экрана */
.screen.active { animation: fadeIn 0.25s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Всплывающее уведомление (toast) */
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff; padding: 12px 18px; border-radius: 14px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: 0.25s ease; z-index: 200; max-width: 90%;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Камера-сканер */
.cam-view {
  width: 100%; border-radius: 18px; background: #000;
  aspect-ratio: 3 / 4; max-height: 60vh; object-fit: cover; display: block;
  border: 1px solid var(--line);
}
#camera-box { margin-top: 12px; }

/* Индикатор «печатает…» / загрузки */
.chat-message.loading { opacity: 0.7; font-style: italic; }

/* Планировщик образов */
.planner-day {
  background: rgba(255,255,255,0.78); border: 1px solid var(--line);
  border-radius: 16px; padding: 12px 14px; margin-top: 10px;
}
.planner-dayname { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.planner-select { width: 100%; }

/* PRO: заблокированные функции «по подписке» */
.pro-card.locked { position: relative; }
.lock-badge {
  display: inline-block; padding: 5px 10px; border-radius: 999px; font-size: 11px;
  font-weight: 700; background: #efe3d8; color: var(--accent-dark); margin-bottom: 8px;
}
.pro-card.locked .pro-card-title::after {
  content: " 🔒"; font-size: 13px;
}

@media (max-width: 380px) {
  .title-xl { font-size: 30px; }
  .quick-grid, .action-row { grid-template-columns: 1fr; }
  .bottom-nav { grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 6px; }
  .tab-button { font-size: 10px; padding: 8px 2px; }
}

/* Очень узкие экраны/планшеты */
@media (min-width: 560px) {
  .app-shell { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
