/* Экран «Создать раскраску» — MyVoice v1 + Fitzgerald */

@keyframes cc-breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

@keyframes cc-progress-indeterm {
  from {
    transform: scaleX(0);
    transform-origin: left;
  }
  to {
    transform: scaleX(0.92);
    transform-origin: left;
  }
}

.coloring-create-page {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  box-sizing: border-box;
}

/* Единый закрепляемый блок: шапка + полоска слотов */
.coloring-create-topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
}

.coloring-create-topbar--scrolled {
  box-shadow: var(--shadow-sm);
}

.coloring-create-header {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 72px;
  align-items: center;
  gap: var(--s-2);
  padding: 12px 16px 8px;
  background: transparent;
  box-sizing: border-box;
}

.coloring-create-header__back {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: var(--r-md);
  border: none;
  background: var(--surface-2);
  font-size: 22px;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease);
}

.coloring-create-header__back:active {
  transform: scale(0.96);
}

.coloring-create-header__titles {
  min-width: 0;
}

.coloring-create-header__title {
  margin: 0;
  font-size: var(--text-lg);
  line-height: var(--leading-lg);
  font-weight: 700;
  color: var(--text);
}

.coloring-create-strip-mount {
  max-width: 1040px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.coloring-create-dots {
  display: none;
  flex-direction: row;
  gap: var(--s-1);
  justify-content: flex-end;
  align-items: center;
  padding-right: 2px;
}

.coloring-create-dots--visible {
  display: flex;
}

.coloring-create-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}

.coloring-create-dot--filled {
  background: var(--text-soft);
}

.coloring-create-dot--hole {
  background: transparent;
  border: 2px solid var(--text-soft);
  box-sizing: border-box;
}

/* Полоска слотов внутри topbar — без своего sticky */
.cc-sentstrip {
  position: static;
  width: 100%;
  padding: 8px 16px 12px;
  background: transparent;
  border-bottom: none;
  box-sizing: border-box;
}

.cc-sentstrip__inner {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--s-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  padding-bottom: 2px;
  max-width: 1040px;
  margin: 0 auto;
  align-items: center;
}

.cc-strip-slot[data-required='false']:not(.cc-strip-slot--filled) {
  opacity: 0.55;
}

.cc-strip-slot[data-required='false'].cc-strip-slot--filled {
  opacity: 1;
}

.cc-sentstrip-speak {
  flex-shrink: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 48px;
  margin: 2px 2px 4px 4px;
  padding: 0 var(--s-2);
  border: none;
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-sm);
}

.cc-sentstrip-speak:active {
  transform: scale(0.94);
}

.cc-sentstrip-sentinel {
  display: none;
}

.cc-strip-slot {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-width: 70px;
  min-height: 72px;
  padding: var(--s-2);
  margin: 0;
  cursor: pointer;
  border-radius: var(--r-md);
  border: 2px dashed currentColor;
  background: transparent;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease);
}

.cc-strip-slot--people {
  color: var(--cat-people);
}

.cc-strip-slot--action {
  color: var(--cat-action);
}

.cc-strip-slot--thing {
  color: var(--cat-thing);
}

.cc-strip-slot--place {
  color: var(--cat-place);
}

.cc-strip-slot__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 100%;
  min-height: 56px;
}

.cc-strip-slot__ph-ico {
  opacity: 0.4;
  flex-shrink: 0;
}

.cc-strip-slot__empty-lbl {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: inherit;
}

.cc-strip-slot__fill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  flex: 1;
}

.cc-strip-slot__emoji {
  font-size: 32px;
  line-height: 1;
}

.cc-strip-slot__cap {
  font-size: var(--text-xs);
  line-height: 1.35;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.cc-strip-slot[data-filled='1'] {
  cursor: pointer;
  border-style: solid;
}

.cc-strip-slot--people[data-filled='1'] {
  background: var(--cat-people-bg);
  border-color: var(--cat-people);
}

.cc-strip-slot--action[data-filled='1'] {
  background: var(--cat-action-bg);
  border-color: var(--cat-action);
}

.cc-strip-slot--thing[data-filled='1'] {
  background: var(--cat-thing-bg);
  border-color: var(--cat-thing);
}

.cc-strip-slot--place[data-filled='1'] {
  background: var(--cat-place-bg);
  border-color: var(--cat-place);
}

.cc-strip-slot[data-filled='1']:active {
  transform: scale(0.96);
}

/* Категории */

.coloring-create-body {
  padding: var(--s-4) var(--s-4) calc(120px + env(safe-area-inset-bottom));
  max-width: 1040px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Семантическая подсказка под полоской слотов: тип взаимодействия + предупреждения */
.coloring-combo-hint {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 6px 12px 0;
  padding: 0;
  font-size: 12px;
}

.coloring-combo-hint--visible {
  display: flex;
}

.coloring-combo-hint__chip {
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(155, 79, 196, 0.14);
  color: #4a1f6b;
  text-transform: uppercase;
}

.coloring-combo-hint__verb {
  font-weight: 700;
  color: var(--text-muted, #6b6157);
}

.coloring-combo-hint__msg {
  border-radius: 8px;
  padding: 4px 10px;
  font-weight: 600;
  line-height: 1.3;
  max-width: 100%;
}

.coloring-combo-hint__msg--info {
  background: rgba(74, 144, 217, 0.12);
  color: #1f4c80;
}

.coloring-combo-hint__msg--warn {
  background: rgba(244, 67, 54, 0.14);
  color: #8a2a23;
}

.category-section {
  border-radius: var(--r-lg);
  padding: var(--s-4);
  margin-bottom: var(--s-4);
}

.category-section--people {
  background: color-mix(in srgb, var(--cat-people-bg) 55%, var(--bg));
}

.category-section--action {
  background: color-mix(in srgb, var(--cat-action-bg) 55%, var(--bg));
}

.category-section--thing {
  background: color-mix(in srgb, var(--cat-thing-bg) 55%, var(--bg));
}

.category-section--place {
  background: color-mix(in srgb, var(--cat-place-bg) 55%, var(--bg));
}

.category-header {
  margin-bottom: var(--s-3);
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--s-3);
  background: var(--surface);
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.category-section--people .category-chip {
  color: var(--cat-people);
}

.category-section--action .category-chip {
  color: var(--cat-action);
}

.category-section--thing .category-chip {
  color: var(--cat-thing);
}

.category-section--place .category-chip {
  color: var(--cat-place);
}

.category-emoji {
  font-size: 14px;
  line-height: 1;
}

.category-bar {
  display: block;
  width: 32px;
  height: 3px;
  border-radius: var(--r-full);
  margin-top: var(--s-2);
  margin-bottom: 14px;
}

.category-section--people .category-bar {
  background: var(--cat-people);
}

.category-section--action .category-bar {
  background: var(--cat-action);
}

.category-section--thing .category-bar {
  background: var(--cat-thing);
}

.category-section--place .category-bar {
  background: var(--cat-place);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

@media (min-width: 768px) {
  .category-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (min-width: 1024px) {
  .category-grid {
    grid-template-columns: repeat(8, 1fr);
  }
}

/* Карточки на экране — наследование .pick-card + локальная шкала эмодзи */

.category-grid .pick-card {
  width: 100%;
  min-width: 0;
  min-height: 88px;
}

.category-grid .pick-card__emoji {
  font-size: 32px;
}

.category-grid .pick-card__label {
  font-size: var(--text-xs);
  font-weight: 600;
}

.category-grid .pick-card__check {
  font-size: 11px;
  width: 20px;
  height: 20px;
}

.category-grid .pick-card:not(.pick-card--selected) .pick-card__check {
  display: none;
}

.category-grid .pick-card--selected .pick-card__label {
  color: var(--text);
}

/* Клон «полёта» */
.cc-flyclone {
  position: fixed;
  z-index: 400;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  min-height: 88px;
  padding: var(--s-3);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.cc-flyclone__emoji {
  font-size: 32px;
  line-height: 1;
}

/* Кнопка */

.coloring-create-cta-zone {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--s-4) var(--s-4) calc(var(--s-4) + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  z-index: 55;
}

.coloring-create-cta-zone--hidden .coloring-create-cta {
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}

.coloring-create-cta {
  display: flex;
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  min-height: 56px;
  border: none;
  border-radius: var(--r-md);
  justify-content: center;
  align-items: center;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  overflow: hidden;
  cursor: pointer;
  transition:
    opacity var(--dur) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.coloring-create-cta[disabled]:not(.coloring-create-cta--loading) {
  animation: none;
  cursor: default;
}

.coloring-create-cta[disabled]:not(.coloring-create-cta--loading):not(.coloring-create-cta--error) {
  background: #d9d2c7;
  color: #fff;
}

.coloring-create-cta--enabled {
  background: var(--accent);
  color: var(--accent-text);
  animation: cc-breathe 2.4s var(--ease) infinite;
}

.coloring-create-cta--enabled:active {
  animation-play-state: paused;
  transform: scale(0.98);
}

.coloring-create-cta--loading {
  background: #b8a8d6;
  color: #fff;
  pointer-events: none;
  animation: none;
}

.coloring-create-cta--error {
  background: var(--danger-bg);
  color: var(--danger);
  animation: none;
}

.coloring-create-cta-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  width: 0%;
  margin: 0;
  pointer-events: none;
  border: none;
  background: rgba(255, 255, 255, 0.6);
}

.coloring-create-cta-progress--prep {
  transition: none;
  animation: cc-progress-strip 8000ms linear forwards;
}

.coloring-create-cta-progress--full {
  width: 100% !important;
  transition:
    width 200ms linear,
    opacity 200ms linear;
}

@keyframes cc-progress-strip {
  from {
    width: 0%;
  }

  to {
    width: 90%;
  }
}

/* Превью успеха */

.coloring-create-preview-zone {
  max-width: 560px;
  margin: var(--s-5) auto 0;
  text-align: center;
}

.coloring-create-preview {
  margin: 0 auto;
  max-height: min(62vh, 420px);
  width: auto;
  max-width: 100%;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: scale(0.9);
  transition:
    opacity 350ms cubic-bezier(0.25, 0.9, 0.35, 1),
    transform 350ms cubic-bezier(0.25, 0.9, 0.35, 1);
}

.coloring-create-preview--shown {
  opacity: 1;
  transform: scale(1);
}

/* Караоке оверлей */

.phrase-display {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  padding: var(--s-6) var(--s-8);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  font-size: 28px;
  font-weight: 700;
  z-index: 2400;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 90vw;
  border: 1px solid var(--border);
}

.phrase-display--fade {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.95);
  transition:
    opacity 250ms var(--ease),
    transform 250ms var(--ease);
}

.phrase-word {
  color: var(--text-soft);
  transition:
    color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.phrase-word.active {
  color: var(--accent);
  transform: scale(1.14);
}

/* Лимиты — экран-достижение */

.limit-celebration {
  text-align: center;
  padding: 48px var(--s-6);
  margin: 0 auto;
  max-width: 560px;
  box-sizing: border-box;
}

.limit-emoji {
  font-size: 72px;
  line-height: 1;
  margin-bottom: var(--s-4);
}

.limit-title {
  font-size: var(--text-2xl);
  line-height: var(--leading-2xl);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 var(--s-2);
}

.limit-hint {
  font-size: var(--text-base);
  color: var(--text-muted);
  margin: 0 0 var(--s-4);
  line-height: var(--leading-base);
}

/* Наглядное ожидание: Time Timer (стандарт визуальной поддержки для детей с РАС).
   Жёлтый сектор "съедается" по часовой стрелке. Когда сектор кончился — в
   центре появляется иконка «можно рисовать». Без текста и цифр для ребёнка. */

.limit-wait-wrap {
  margin: 0 auto var(--s-8);
  max-width: 360px;
}

.limit-timetimer {
  display: flex;
  justify-content: center;
  margin: 0 auto var(--s-4);
}

.limit-timetimer__face {
  --yellow-deg: 360deg;
  position: relative;
  width: min(240px, 64vw);
  aspect-ratio: 1;
  border-radius: 50%;
  /* Серый растёт по часовой от 12:00 (жёлтый как «ещё нужно», съедается по кругу). */
  background:
    conic-gradient(
      from 0deg,
      #ecebe6 0deg calc(360deg - var(--yellow-deg)),
      #f5a623 calc(360deg - var(--yellow-deg)) 360deg
    ),
    radial-gradient(circle at 50% 50%, #fff 0%, #f4ede0 100%);
  border: 4px solid #2d2d2d;
  box-shadow:
    inset 0 0 0 6px #fff,
    0 8px 22px rgba(45, 45, 45, 0.12);
}

.limit-timetimer__face--ready {
  background: radial-gradient(circle at 50% 50%, #e8f7ec 0%, #c8e6c9 100%);
  border-color: #43c06d;
  animation: limit-timetimer-pulse 1.4s ease-in-out infinite;
}

@keyframes limit-timetimer-pulse {
  0%,
  100% {
    box-shadow:
      inset 0 0 0 6px #fff,
      0 0 0 0 rgba(67, 192, 109, 0.55);
  }

  50% {
    box-shadow:
      inset 0 0 0 6px #fff,
      0 0 0 14px rgba(67, 192, 109, 0);
  }
}

.limit-timetimer__center {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 38%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(45, 45, 45, 0.1);
  z-index: 3;
}

.limit-timetimer__center-icon {
  font-size: clamp(34px, 11vw, 48px);
  line-height: 1;
}

/* Часовые насечки — 12 штук по периметру для узнаваемости */

.limit-timetimer__ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.limit-timetimer__tick {
  position: absolute;
  left: 50%;
  top: 0;
  width: 4px;
  height: 50%;
  margin-left: -2px;
  background: transparent;
  transform-origin: 50% 100%;
  transform: rotate(var(--tick-angle, 0deg));
}

.limit-timetimer__tick::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 0;
  width: 100%;
  height: 10px;
  background: #2d2d2d;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .limit-timetimer__face {
    transition: none;
  }

  .limit-timetimer__face--ready {
    animation: none;
  }
}

.limit-wait-kid {
  margin: 0 0 var(--s-2);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: var(--leading-xl);
  color: var(--text);
  text-wrap: balance;
}

.limit-wait-adult {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.35;
}

.limit-countdown {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.limit-subtitle {
  font-size: var(--text-base);
  color: var(--text-muted);
  margin: 0 0 var(--s-8);
  line-height: var(--leading-base);
}

@supports not (background: color-mix(in srgb, white 50%, blue)) {
  .category-section--people {
    background: var(--cat-people-bg);
  }

  .category-section--action {
    background: var(--cat-action-bg);
  }

  .category-section--thing {
    background: var(--cat-thing-bg);
  }

  .category-section--place {
    background: var(--cat-place-bg);
  }
}
