/* === Трекер сна ребёнка — стили === */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; overscroll-behavior: none; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'SF Pro Text', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}
:root {
  --bg: #FFF6E9;
  --bg-grad-1: #FFE9D6;
  --bg-grad-2: #FFD9C4;
  --surface: rgba(255, 251, 244, .88);
  --surface-2: rgba(255, 244, 230, .7);
  --border: rgba(139, 69, 99, .15);
  --border-soft: rgba(139, 69, 99, .1);
  --text: #3D2826;
  --text-soft: #6B5450;
  --text-muted: #9B8580;
  --primary: #8B4563;
  --primary-strong: #B5486B;
  --accent: #6B8E5A;
  --accent-soft: #A8C28C;
  --amber: #D4A85A;
  --amber-soft: #F4B860;
  --pink: #D4859B;
  --danger: #C76960;
  --shadow: 0 4px 16px rgba(139, 69, 99, .08);
  --shadow-strong: 0 6px 24px rgba(139, 69, 99, .15);
}
body.night {
  --bg: #1A1517;
  --bg-grad-1: #251B1F;
  --bg-grad-2: #1F1719;
  --surface: rgba(40, 32, 35, .85);
  --surface-2: rgba(50, 40, 44, .7);
  --border: rgba(212, 168, 90, .15);
  --border-soft: rgba(212, 168, 90, .08);
  --text: #F0E8E0;
  --text-soft: #C9B8B0;
  --text-muted: #8A7570;
  --primary: #D4859B;
  --primary-strong: #E89B7A;
  --accent: #A8C28C;
  --accent-soft: #8FA876;
  --amber: #E8A04E;
  --amber-soft: #D4859B;
  --pink: #D4859B;
  --shadow: 0 4px 16px rgba(0, 0, 0, .4);
  --shadow-strong: 0 6px 24px rgba(0, 0, 0, .55);
}
body::before {
  content: ''; position: fixed; inset: 0; z-index: -2;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-grad-1) 50%, var(--bg-grad-2) 100%);
}
#bg-decor { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
#bg-decor svg.moon {
  position: absolute; width: 140px; height: 140px;
  filter: drop-shadow(0 4px 16px rgba(232, 176, 112, .3));
  animation: moon-glow 8s ease-in-out infinite;
}
@keyframes moon-glow {
  0%, 100% { filter: drop-shadow(0 4px 16px rgba(232, 176, 112, .3)); }
  50% { filter: drop-shadow(0 4px 24px rgba(232, 176, 112, .5)); }
}
#bg-decor svg.bear {
  position: absolute; width: 90px; height: 90px;
  filter: drop-shadow(0 2px 8px rgba(139, 69, 99, .12));
  animation: bear-sway 6s ease-in-out infinite;
}
#bg-decor svg.bear:nth-of-type(2) { animation-delay: -3s; }
@keyframes bear-sway {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(2deg); }
}
#bg-decor svg.star {
  position: absolute; width: 22px; height: 22px;
  filter: drop-shadow(0 0 6px rgba(244, 184, 96, .4));
  animation: twinkle 4s ease-in-out infinite;
}
#bg-decor svg.star:nth-of-type(2) { animation-delay: -1s; }
#bg-decor svg.star:nth-of-type(3) { animation-delay: -2s; }
#bg-decor svg.star:nth-of-type(4) { animation-delay: -3s; }
#bg-decor svg.star:nth-of-type(5) { animation-delay: -1.5s; }
#bg-decor svg.star:nth-of-type(6) { animation-delay: -2.5s; }
#bg-decor svg.star:nth-of-type(7) { animation-delay: -3.5s; }
@keyframes twinkle {
  0%, 100% { opacity: .7; transform: scale(1) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.15) rotate(15deg); }
}
#bg-decor svg.cloud {
  position: absolute; width: 130px; height: 60px;
  filter: blur(1px);
  animation: cloud-drift 30s linear infinite;
}
#bg-decor svg.cloud:nth-of-type(2) { animation-delay: -15s; }
@keyframes cloud-drift {
  0% { transform: translateX(-150px); }
  100% { transform: translateX(calc(100vw + 150px)); }
}
body.night #bg-decor svg.moon { opacity: .95; }
body.night #bg-decor svg.star { opacity: .9; }
body.night #bg-decor svg.cloud { opacity: .3; }
body.night #bg-decor svg.bear { opacity: .35; filter: grayscale(.4) drop-shadow(0 2px 8px rgba(0,0,0,.3)); }

#app {
  min-height: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 90px;
  position: relative;
  background: transparent;
}
#app .card, #app .onb-card {
  background: var(--surface);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0 12px;
  background: linear-gradient(180deg, rgba(255,246,233,.94) 0%, rgba(255,246,233,.82) 80%, rgba(255,246,233,0) 100%);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
body.night .app-header {
  background: linear-gradient(180deg, rgba(26,21,23,.94) 0%, rgba(26,21,23,.82) 80%, rgba(26,21,23,0) 100%);
}
.app-title { font-size: 18px; font-weight: 600; letter-spacing: -.2px; }
.child-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 14px; min-height: 44px;
  font-size: 15px; font-weight: 500; color: var(--text);
  cursor: pointer;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.card-sub {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-soft);
  margin-top: 8px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.center { text-align: center; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-soft); font-size: 14px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 14px; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 16px;
  border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  font-size: 15px; font-weight: 500; cursor: pointer;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
  -webkit-user-select: none; user-select: none;
}
.btn:hover { background: var(--surface); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--primary-strong) 0%, var(--primary) 100%);
  color: #fff; border: none;
  box-shadow: 0 2px 8px rgba(139, 69, 99, .25);
}
.btn.primary:hover { box-shadow: 0 4px 14px rgba(139, 69, 99, .35); }
.btn.ghost { background: transparent; border: 1px solid var(--border); }
.btn.warn { background: #C76960; color: #fff; border: none; }
.btn.icon { padding: 8px; min-height: 40px; min-width: 40px; }
.btn.full { width: 100%; }

.onb-next {
  width: 100%;
  min-height: 56px;
  margin-top: 18px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #B5486B 0%, #8B4563 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(139, 69, 99, .28);
  transition: transform .15s ease, box-shadow .15s ease, background .2s ease, opacity .2s ease;
}
.onb-next:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(139, 69, 99, .36); }
.onb-next:active:not(:disabled) { transform: translateY(0); box-shadow: 0 2px 8px rgba(139, 69, 99, .24); }
.onb-next:disabled,
.onb-next.onb-next-disabled {
  background: #E5D4C4;
  color: #A89180;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
}
body.night .onb-next:disabled,
body.night .onb-next.onb-next-disabled {
  background: #3A2E2E;
  color: #8A7570;
}
.onb-next-label { letter-spacing: .2px; }
.onb-next-icon { display: inline-flex; align-items: center; }
.onb-back { width: 100%; margin-top: 8px; min-height: 44px; }
.onb-hint { margin-top: 10px; font-size: 12px; color: var(--text-muted); min-height: 16px; }
.onb-footer { display: none; }

/* === Декабрь 2026: фиксы тап-зон и кликабельности === */
#app, #app * { position: relative; z-index: 1; }
#bg-decor, #bg-decor * { pointer-events: none !important; z-index: 0 !important; }
.field input, .field select, .field textarea {
  min-height: 52px !important;
  font-size: 17px !important;
  padding: 12px 14px !important;
}
.onb-card { position: relative; z-index: 5; }
.onb-card .btn, .onb-card [data-next-btn], .onb-card input { position: relative; z-index: 6; }
