/* AI builder: chat panel + live canvas (matches ui_kits/schooka-app/Create.jsx) */

.builder-shell { display: block; }

.builder {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---------- Chat panel ---------- */

.builder-chat {
  width: 420px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-right: 1px solid var(--border-soft);
}

.builder-chat__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-soft);
}
.builder-chat__title { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.builder-chat__credits {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink-700);
  background: var(--yellow-100);
  border-radius: var(--radius-pill);
  padding: 5px 11px;
}
.builder-chat__credits svg { color: var(--yellow-600); }
.builder-chat__subtitle { font-size: 12.5px; color: var(--text-muted); }

.builder-chat__scroll { flex: 1; overflow-y: auto; }
.builder-chat__messages,
#typing {
  padding: 18px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#typing { padding-top: 14px; padding-bottom: 4px; }

.builder-chat__footer {
  padding: 12px 16px 16px;
  background: var(--surface-card);
  border-top: 1px solid var(--border-soft);
}

/* ---------- Bubbles ---------- */

.bubble-row { display: flex; gap: 10px; }
.bubble-row--me { flex-direction: row-reverse; }

.bubble-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue-100);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.bubble-avatar img { width: 32px; margin-bottom: -2px; }

.bubble-image {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  overflow: hidden;
  width: 280px;
  max-width: 78%;
  box-shadow: 0 1px 0 rgba(30, 42, 99, .06);
}
.bubble-image__img {
  display: block;
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  background: var(--blue-100);
  animation: bubble-image-in .25s var(--ease-bounce);
}
.bubble-image__caption {
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@keyframes bubble-image-in {
  from { transform: scale(.9); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.bubble {
  max-width: 78%;
  padding: 10px 14px;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.45;
  white-space: pre-wrap;
}
.bubble--bot {
  background: var(--surface-card);
  color: var(--ink-900);
  border: 1px solid var(--border-soft);
  border-radius: 4px 18px 18px 18px;
  box-shadow: 0 1px 0 rgba(30, 42, 99, .06);
}
.bubble--me {
  background: var(--ink-900);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
}

/* Question card (agent asks with tappable answers) */

.question-card {
  background: var(--yellow-100);
  border: 2px solid var(--yellow-500);
  border-radius: 16px;
  padding: 14px 16px;
  max-width: 92%;
}
.question-card__head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.question-card__icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--yellow-500);
  color: var(--ink-900);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}
.question-card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.35;
}
.question-card__options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.question-card__chip {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  padding: 8px 16px;
  min-height: 40px;
  background: var(--surface-card);
  color: var(--ink-900);
  border: 2px solid var(--ink-900);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform var(--speed-fast) var(--ease-out), box-shadow var(--speed-fast) var(--ease-out);
}
.question-card__chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-sticker); }
.question-card__chip:active { transform: translateY(2px); box-shadow: none; }
.credits-exhausted__copy {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  margin: 10px 0 0;
}

.question-card__hint {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 800;
  color: var(--yellow-600);
}

.typing-status {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-muted);
  animation: status-pulse 1.6s ease-in-out infinite;
}
@keyframes status-pulse {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}

.typing-caret {
  display: inline-block;
  width: 8px;
  height: 15px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--blue-400);
  border-radius: 2px;
  animation: caret-blink 1s steps(2) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }

.typing-dots { display: inline-flex; gap: 4px; align-items: center; }
.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-300);
  animation: typing-bounce 1s infinite var(--ease-bounce);
}
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: none; opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- Chat input ---------- */

.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input {
  flex: 1;
  resize: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14.5px;
  padding: 10px 12px;
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-md);
  color: var(--ink-900);
  background: var(--surface-card);
}
.chat-input:focus, .chat-input:focus-visible {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink-900);
  cursor: pointer;
  transition: background var(--speed-fast) var(--ease-out), transform var(--speed-fast) var(--ease-out);
}
.icon-btn:hover { background: var(--surface-tint-blue); }
.icon-btn--primary {
  background: var(--brand-primary);
  color: #fff;
  border: var(--outline-ink);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sticker);
}
.icon-btn--primary:hover { background: var(--brand-primary-hover); transform: translateY(-1px); }
.icon-btn--primary:active { transform: translateY(3px); box-shadow: none; }

/* ---------- Player & touchboard ---------- */

.player { display: flex; flex-direction: column; height: 100vh; }
.player__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}
.player__wordmark { font-size: var(--text-lg); }
.player__title { font-size: var(--text-lg); }
.player__cover {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--ink-900);
  flex-shrink: 0;
}
.player__cover img { width: 100%; height: 100%; object-fit: cover; }
.player__spacer { flex: 1; }
.player__byline { font-size: var(--text-sm); color: var(--text-muted); font-weight: 700; }
.player__frame { flex: 1; width: 100%; border: none; background: var(--paper); }
.player__frame--teaser { filter: blur(3px) saturate(.9); pointer-events: none; user-select: none; }

/* Signup gate over shared activities */

.signup-gate {
  position: fixed;
  inset: 0;
  background: rgba(30, 42, 99, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 24px;
}
.signup-gate__card {
  background: var(--surface-card);
  border: var(--outline-ink);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop);
  padding: 32px 36px 28px;
  max-width: 430px;
  width: 100%;
  text-align: center;
  position: relative;
  animation: gate-in .35s var(--ease-bounce);
}
@keyframes gate-in {
  from { opacity: 0; transform: scale(.92) translateY(14px); }
  to { opacity: 1; transform: none; }
}
.signup-gate__kooka {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--blue-100);
  object-fit: cover;
  object-position: top;
}
.signup-gate__card h2 { font-size: var(--text-xl); margin-top: 10px; }
.signup-gate__card p { color: var(--text-muted); font-weight: 600; font-size: var(--text-sm); margin: 8px 0 18px; }
.signup-gate__login { margin-top: 14px; font-size: var(--text-sm); }

.touchboard { min-height: 100vh; display: flex; flex-direction: column; }
.touchboard__bar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 28px;
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-soft);
}
.touchboard__logo { height: 46px; }
.touchboard__bar h1 { font-size: var(--text-xl); }
.touchboard__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 28px;
}
.touchboard-tile { padding: 0; text-decoration: none; color: var(--ink-900); display: block; }
.touchboard-tile:hover { color: var(--ink-900); }
.touchboard-tile__band {
  height: 170px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}
.touchboard-tile__cover { width: 100%; height: 100%; object-fit: cover; }
.touchboard-tile__kooka { height: 150px; margin-bottom: -8px; }
.touchboard-tile__body { padding: 16px 18px 18px; }
.touchboard-tile__title { font-family: var(--font-display); font-weight: 800; font-size: var(--text-xl); }
.touchboard-tile__meta { font-size: var(--text-sm); font-weight: 700; color: var(--text-muted); margin-top: 2px; }
.touchboard__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}
.touchboard__empty p { color: var(--text-muted); font-weight: 600; margin: 0 0 14px; }

/* ---------- Canvas ---------- */

.builder-canvas {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface-card);
  min-width: 0;
}

.builder-canvas__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
}
.builder-canvas__empty-kooka { width: 150px; }
.builder-canvas__empty-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--ink-900);
}
.builder-canvas__empty-sub { font-size: 14px; font-weight: 600; color: var(--text-muted); }

.builder-canvas__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-soft);
}
.builder-canvas__bar h2 { font-size: 22px; }
.builder-canvas__cover {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--blue-100);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--ink-900);
  flex-shrink: 0;
}
.builder-canvas__cover img { width: 100%; height: 100%; object-fit: cover; }
.builder-canvas__bar-spacer { flex: 1; }

.builder-canvas__body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.builder-canvas__frame {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--paper);
}

/* ---------- Customize panel ---------- */

.customize-panel {
  width: 340px;
  flex-shrink: 0;
  border-left: 1px solid var(--border-soft);
  overflow-y: auto;
  background: var(--surface-card);
  padding: 16px;
}

.customize-form__head h3 { font-size: var(--text-lg); }
.customize-form__head p { font-size: 12.5px; color: var(--text-muted); margin: 2px 0 14px; }

.cfield { margin-bottom: 14px; }
.cfield__label {
  display: block;
  font-weight: var(--weight-strong);
  font-size: var(--text-sm);
  margin-bottom: 4px;
}
.cfield__hint { font-size: 12px; color: var(--text-faint); font-weight: 700; }

.input--sm { min-height: 38px; padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }

.clist { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.clist__row {
  position: relative;
  border: 2px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 12px 12px 4px;
}
.clist__row .cfield { margin-bottom: 10px; }
.clist__remove {
  position: absolute;
  top: 6px;
  right: 6px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}
.clist__remove:hover { color: var(--danger); background: var(--coral-100); }
