@font-face {
  font-family: 'ComfortaaBold';
  src: url('../fonts/Comfortaa-Bold.ttf') format('truetype');
  font-weight: 700; font-style: normal; font-display: swap;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'ComfortaaBold', 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #F0F8EA;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.embed {
  background: transparent;
  height: 100vh;
}
body.embed #main-header,
body.embed #sidebar,
body.embed #sidebar-overlay {
  display: none !important;
}
body.embed #app-body {
  margin-top: 0;
  height: 100vh;
}
body.embed #chat-wrapper {
  max-width: 100%;
  margin: 0;
  padding: 10px 10px 0 10px;
}
body.embed #welcome-card { display: none !important; }
body.embed #suggestions  { display: none !important; }
body.embed #quick-actions { display: none !important; }
body.embed #project-top-slot { display: none !important; }
body.embed #input-area { border-radius: 14px 14px 0 0; padding: 10px; }
body.embed #chat-input { font-size: 15px; }
body.embed .bubble { max-width: 86%; font-size: 15px; }
body.embed.composer-only #app-body { height: 100vh; }
body.embed.composer-only #chat-wrapper { padding: 0; justify-content: flex-end; }
body.embed.composer-only #messages { display: none !important; }
body.embed.composer-only #quick-actions { display: none !important; }
body.embed.composer-only .chat-project-preview-row { display: none !important; }
body.embed.composer-only #project-top-slot { display: none !important; }
body.embed.composer-only #input-area {
  border-radius: 0;
  box-shadow: none;
  height: 100vh;
  align-items: center;
}

/* ── Top bar ── */
#main-header {
  background: #263d14;
  border-bottom: 2px solid #263d14;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}
.header-btn {
  color: #fff;
  border: none;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.header-btn:hover { background: rgba(255,255,255,0.15); }
/* New-chat icon button: square padding, white icon to match the header */
.header-icon-btn { display: inline-flex; align-items: center; justify-content: center; padding: 6px 10px; }
.header-icon-btn img { width: 18px; height: 18px; display: block; filter: brightness(0) invert(1); }
.user-pill { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25); color: #fff; font-size: 12px; padding: 5px 12px; border-radius: 20px; cursor: pointer; }
#header-title { color: #fff; font-size: 14px; letter-spacing: 1px; position: absolute; left: 50%; transform: translateX(-50%); text-align: center; }
.header-badge {
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 14px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.3);
}
.header-select {
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
  padding: 0 10px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  cursor: pointer;
}
.header-select option { color: #1a2a3a; }
.header-select:focus { border-color: rgba(255,255,255,0.55); }

/* ── Sidebar overlay ── */
#sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 900;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
#sidebar-overlay.open { opacity: 1; pointer-events: all; }

/* ── Sidebar ── */
#sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 300px;
  background: #fff;
  z-index: 950;
  display: flex; flex-direction: column;
  box-shadow: 4px 0 24px rgba(35,69,103,0.18);
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}
#sidebar.open { transform: translateX(0); }
#sidebar-header {
  background: #234567;
  padding: 18px 20px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; height: 60px;
}
#sidebar-header h2 { color: #fff; font-size: 16px; letter-spacing: 0.5px; }
#sidebar-close {
  background: none;
  border: 2px solid rgba(255,255,255,0.4);
  color: #fff; border-radius: 8px;
  width: 32px; height: 32px;
  cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease; font-family: inherit;
}
#sidebar-close:hover { background: rgba(255,255,255,0.15); border-color: #fff; }
#new-chat-btn {
  margin: 14px 16px 6px;
  padding: 10px 16px;
  border-radius: 10px; border: 0;
  background-color: #ff3856;
  box-shadow: rgb(201,46,70) 0px 5px 0px 0px;
  color: #fff; font-family: inherit; font-size: 13px;
  letter-spacing: 0.5px; cursor: pointer;
  transition: all 0.2s ease;
  text-align: left; display: flex; align-items: center; gap: 8px;
}
#new-chat-btn:hover  { box-shadow: rgb(201,46,70) 0px 3px 0px 0px; transform: translateY(1px); }
#new-chat-btn:active { box-shadow: rgb(201,46,70) 0px 0px 0px 0px; transform: translateY(5px); transition: 150ms; }
#sidebar-search {
  margin: 8px 16px;
  padding: 8px 12px;
  border: 2px solid #e0eaf2; border-radius: 10px;
  font-family: inherit; font-size: 13px; color: #1a2a3a;
  outline: none; transition: border-color 0.2s;
}
#sidebar-search:focus { border-color: #234567; }
#sidebar-search::placeholder { color: #a0b8cc; }
#chat-list {
  flex: 1; overflow-y: auto;
  padding: 6px 10px 16px;
  scrollbar-width: thin; scrollbar-color: #99c2d2 transparent;
  display: flex; flex-direction: column; gap: 4px;
}
#chat-list::-webkit-scrollbar { width: 5px; }
#chat-list::-webkit-scrollbar-thumb { background: #99c2d2; border-radius: 3px; }
.chat-list-section-label {
  font-size: 11px; color: #7a9bb5;
  text-transform: uppercase; letter-spacing: 0.8px;
  padding: 10px 6px 4px;
}
.chat-item {
  padding: 10px 12px; border-radius: 10px;
  cursor: pointer; transition: background 0.15s ease;
  border: 2px solid transparent;
}
.chat-item:hover { background: #f0f6fa; }
.chat-item.active { background: #e8f2f8; border-color: #99c2d2; }
.chat-item-title { font-size: 13px; color: #1a2a3a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-meta  { font-size: 11px; color: #7a9bb5; margin-top: 2px; }

/* ── App body (below fixed header) ── */
#app-body {
  margin-top: 60px;
  height: calc(100vh - 60px);
  display: flex;
  overflow: hidden;
}

/* ── Chat layout ── */
#chat-wrapper {
  flex: 1;
  min-width: 0;
  display: flex; flex-direction: column;
  max-width: 860px; width: 100%;
  margin: 0 auto;
  padding: 20px 16px 0 16px;
  transition: max-width 0.35s ease, margin 0.35s ease;
}
#chat-wrapper.project-top-pinned {
  padding-top: 0;
}
/* (Preview panel removed — now a separate page: codepreviewer.html) */

#project-top-slot {
  display: none;
  flex-shrink: 0;
  margin: 0 0 14px 0;
}
#project-top-slot.active { display: block; }
#project-top-slot .project-card {
  max-width: none;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 6px 18px rgba(35,69,103,0.14);
}
#project-top-slot .pc-header {
  display: none;
}
#project-top-slot .pc-body {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
#project-top-slot .pc-success-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#project-top-slot .pc-success-row { justify-content: flex-start; }
#project-top-slot .pc-actions {
  flex-shrink: 0;
  padding-top: 0;
  margin-top: 0 !important;
}
@media (max-width: 640px) {
  #project-top-slot .pc-body {
    flex-direction: column;
    align-items: stretch;
  }
  #project-top-slot .pc-actions { width: 100%; }
  #project-top-slot .pc-actions button { flex: 1; }
}

#messages {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
  gap: 14px; padding-bottom: 16px;
  scrollbar-width: thin; scrollbar-color: #99c2d2 transparent;
}
#messages::-webkit-scrollbar { width: 6px; }
#messages::-webkit-scrollbar-thumb { background: #99c2d2; border-radius: 3px; }

/* ── Message rows ── */
.msg-row { display: flex; gap: 10px; align-items: flex-end; }
.msg-row.user { flex-direction: row-reverse; }
.bubble {
  max-width: 70%; padding: 12px 16px;
  border-radius: 18px; font-size: 16px;
  line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.bubble.ai   {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  color: #1a2a3a;
  padding: 4px 0;
  max-width: 78%;
}
.bubble.ai a,
.app-help-card a {
  color: #1d6fe0;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 800;
}
.bubble.ai a:hover,
.app-help-card a:hover {
  color: #ff3856;
}
.bubble.ai .blk {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .4s ease, transform .4s ease;
  margin: 0 0 10px;
}
.response-error-code {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 0 0 6px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #ffd0d7;
  background: #fff4f6;
  color: #b4233a;
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.bubble.ai .blk.in { opacity: 1; transform: none; }
.bubble.ai .x-h {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
  background: linear-gradient(90deg, #234567, #1d6fe0 45%, #ff3856);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.bubble.ai .x-lead { font-size: 17px; }
.bubble.ai .x-note { color: #5a7a95; font-size: 15px; }
.bubble.ai .x-bul,
.bubble.ai .x-step {
  display: grid;
  grid-template-columns: 26px minmax(0,1fr);
  gap: 10px;
  align-items: start;
}
.bubble.ai .x-dot {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #e8f2f8;
  color: #234567;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-top: 2px;
}
.bubble.ai .x-num {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: #234567;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  margin-top: 2px;
}
.bubble.ai .x-txt { min-width: 0; padding-top: 1px; }
.bubble.ai .x-callout {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #fff7e6;
  border: 1px solid #ffe2a8;
  border-left: 4px solid #d89e00;
  border-radius: 0 12px 12px 0;
  padding: 12px 16px;
  font-size: 16px;
  color: #6b4e08;
}
.bubble.ai .x-strong { color: #ff3856; font-weight: 800; font-size: calc(1em + 2px); display: inline-block; }
.bubble.ai .x-key { color: #234567; font-weight: 800; display: inline-block; }
.bubble.ai .x-good { color: #16a34a; font-weight: 800; display: inline-block; }
.bubble.ai .x-hl {
  background-image: linear-gradient(#ffe27a, #ffe27a);
  background-repeat: no-repeat;
  background-size: 0% 92%;
  background-position: 0 55%;
  padding: 0 4px;
  margin: 0 -1px;
  border-radius: 3px;
  font-weight: 700;
}
.bubble.ai .x-strong.lit,
.bubble.ai .x-key.lit,
.bubble.ai .x-good.lit { animation: xpop .45s both; }
.bubble.ai .x-hl.lit { animation: xsweep .55s forwards; }
@keyframes xpop { 0% { transform: scale(.6); } 65% { transform: scale(1.13); } 100% { transform: scale(1); } }
@keyframes xsweep { to { background-size: 100% 92%; } }
.teaching-chat-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.teaching-keyword-swap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  margin: 0 0 10px;
  padding: 7px 10px 7px 7px;
  border-radius: 10px;
  border: 1px solid #d8ecf5;
  background: #f7fbfd;
  color: #234567;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}
.teaching-keyword-swap strong {
  color: #1a2a3a;
}
.teaching-chat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  border-radius: 999px;
  padding: 5px 9px 5px 6px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  border: 1px solid #d8ecf5;
  background: #ffffff;
  color: #234567;
}
.teaching-chat-badge.major {
  border-color: #cde8c1;
  background: #f3fbef;
  color: #2f6b22;
}
.teaching-chat-badge.minor {
  border-color: #cfe8ff;
  background: #f0f8ff;
  color: #005a95;
}
.teaching-chat-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  object-fit: contain;
  flex: 0 0 auto;
}
.teaching-chat-info-btn {
  width: 30px;
  height: 30px;
  border: 1px solid #bde9e5;
  border-radius: 999px;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(35,69,103,0.08);
}
.teaching-chat-info-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(35,69,103,0.14);
}
.teaching-info-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(13,31,48,0.42);
}
.teaching-info-overlay.open { display: flex; }
.teaching-info-modal {
  width: min(100%, 430px);
  max-height: min(78vh, 620px);
  overflow: hidden;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(13,31,48,0.25);
  border: 1px solid #d8ecf5;
}
.teaching-info-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e8f2f8;
  background: #f7fbfd;
}
.teaching-info-head h3 {
  margin: 0;
  font-size: 16px;
  color: #234567;
}
.teaching-info-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: #e8f2f8;
  color: #234567;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.teaching-info-body {
  display: grid;
  gap: 8px;
  padding: 14px;
  max-height: calc(min(78vh, 620px) - 60px);
  overflow: auto;
}
.teaching-info-option {
  width: 100%;
  text-align: left;
  border: 1px solid #d8ecf5;
  border-radius: 10px;
  background: #ffffff;
  color: #1a2a3a;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}
.teaching-info-option:hover {
  border-color: #1fcfc1;
  background: #f0fffd;
}
.teaching-info-empty {
  margin: 0;
  color: #5a7a95;
  font-size: 14px;
}
.image-gen-card {
  width: min(100%, 460px);
  max-width: 78%;
  background: #fff;
  border: 2px solid #e8f2f8;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(35,69,103,0.10);
  overflow: hidden;
}
.image-gen-preview {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #f0f6fa;
}
.image-gen-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
}
.image-gen-title {
  color: #234567;
  font-size: 14px;
  font-weight: 800;
}
.image-gen-prompt {
  color: #5a7a95;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.image-gen-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}
.image-gen-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #d8ecf5;
  border-radius: 10px;
  background: #fff;
  color: #234567;
  font-family: inherit;
  font-size: 12px;
  padding: 8px 12px;
  text-decoration: none;
}
.image-gen-link:hover {
  border-color: #234567;
  background: #f0f6fa;
}
.code-editor-return-btn {
  align-self: center;
  border: 1.5px solid #d8ecf5;
  border-radius: 999px;
  background: #fff;
  color: #1d6fe0;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
  box-shadow: 0 2px 8px rgba(35,69,103,0.10);
  white-space: nowrap;
}
.code-editor-return-btn:hover,
.code-editor-return-btn:focus {
  border-color: #1d6fe0;
  background: #e8f2ff;
  outline: none;
}
.bubble.user { background: #234567; border-bottom-right-radius: 4px; box-shadow: 0 2px 8px rgba(35,69,103,0.18); color: #fff; }
.msg-time { font-size: 12px; color: #7a9bb5; margin-top: 3px; padding: 0 4px; align-self: flex-end; }
.msg-row.ai .msg-time { display: none !important; }
.app-help-card {
  max-width: 78%;
  color: #1a2a3a;
  line-height: 1.55;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 0;
}
.app-help-card .help-lead {
  font-size: 16px;
  color: #1a2a3a;
}
.app-help-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 2px 0;
}
.app-help-step,
.app-help-bullet {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}
.app-help-index,
.app-help-dot {
  width: 24px;
  min-width: 24px;
  height: 24px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e8f2f8;
  color: #234567;
  font-size: 13px;
  line-height: 1;
}
.app-help-dot {
  border-radius: 999px;
  font-size: 18px;
  padding-bottom: 2px;
}
.app-help-text {
  min-width: 0;
  padding-top: 1px;
}
.app-help-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f0f6fa;
  color: #234567;
  border: 1px solid #d8ecf5;
  font-size: 14px;
  white-space: normal;
}
.app-help-strong {
  color: #ff3856;
  font-weight: 800;
  font-size: calc(1em + 3px);
}
.app-help-note {
  color: #5a7a95;
  font-size: 15px;
}
.action-debug {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 78%;
  margin: -4px 0 0 0;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid #d8ecf5;
  background: rgba(255,255,255,0.78);
  color: #5a7a95;
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0;
}
.action-debug strong { color: #234567; font-weight: 700; }
.action-debug .debug-extra {
  color: #ff3856;
  font-weight: 700;
}
.action-debug.teaching-debug {
  max-width: min(680px, 92%);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: stretch;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 6px 18px rgba(35,69,103,0.08);
}
.teaching-debug .debug-chip {
  border: 1px solid #d8ecf5;
  border-radius: 9px;
  background: #f8fcfe;
  padding: 7px 9px;
  min-width: 0;
}
.teaching-debug .debug-label {
  display: block;
  color: #7a9bb5;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}
.teaching-debug .debug-value {
  display: block;
  color: #234567;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.quick-reply-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.quick-reply-btn {
  border: 2px solid #d0e4ef;
  border-radius: 10px;
  background: #fff;
  color: #234567;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  padding: 8px 16px;
  transition: all 0.15s ease;
  min-width: 76px;
}
.quick-reply-btn:hover,
.quick-reply-btn:focus {
  background: #234567;
  border-color: #234567;
  color: #fff;
  outline: none;
}
.quick-reply-btn.no {
  color: #c0392b;
  border-color: #ffc0cb;
}
.quick-reply-btn.no:hover,
.quick-reply-btn.no:focus {
  background: #ff3856;
  border-color: #ff3856;
  color: #fff;
}
.quick-reply-btn:disabled {
  opacity: 0.55;
  pointer-events: none;
}

/* ── Typing indicator ── */
.thinking-card {
  width: min(100%, 460px);
  background: #fff;
  border: 2px solid #e8f2f8;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(35,69,103,0.12);
  overflow: hidden;
}
.thinking-head {
  background: #234567;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 14px;
}
.thinking-head .spark {
  font-size: 16px;
  animation: thinkingPulse 1.4s ease-in-out infinite;
}
.thinking-head .sub {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.7;
  letter-spacing: 0.4px;
}
.thinking-body {
  padding: 14px 16px 16px;
}
.thinking-line {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 12px;
  align-items: center;
}
.thinking-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #234567;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  box-shadow: 0 0 0 4px rgba(35,69,103,0.14);
}
.thinking-dot span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
  animation: thinkingDotBounce 0.9s ease-in-out infinite;
}
.thinking-dot span:nth-child(2) { animation-delay: 0.14s; }
.thinking-dot span:nth-child(3) { animation-delay: 0.28s; }
.thinking-text {
  color: #234567;
  font-size: 14px;
  min-height: 20px;
  transition: opacity 0.18s ease;
  background: linear-gradient(90deg, #234567 0%, #234567 35%, #4f7393 50%, #234567 65%, #234567 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: thinkingTextFlow 1.8s linear infinite;
}
@keyframes thinkingPulse { 0%,100%{transform:scale(1); opacity:0.8;} 50%{transform:scale(1.18); opacity:1;} }
@keyframes thinkingDotBounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.55; } 40% { transform: translateY(-4px); opacity: 1; } }
@keyframes thinkingTextFlow { from { background-position: 100% 0; } to { background-position: -120% 0; } }

.typing-bubble {
  background: #fff; border-radius: 18px; border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(35,69,103,0.10);
  padding: 14px 18px; display: flex; gap: 5px; align-items: center;
}
.typing-bubble span {
  width: 7px; height: 7px; background: #99c2d2;
  border-radius: 50%; animation: bounce 1.2s infinite ease-in-out;
}
.typing-bubble span:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

/* ── Project card (inline in chat) ── */
.project-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(35,69,103,0.12);
  overflow: hidden;
  max-width: 420px;
  width: 100%;
  border: 2px solid #e8f2f8;
}
.pc-header {
  background: #234567;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
}
.pc-header-icon { font-size: 20px; }
.pc-header-title { color: #fff; font-size: 14px; flex: 1; }
.pc-template-badge {
  background: rgba(255,255,255,0.18);
  color: #fff; font-size: 11px;
  padding: 3px 9px; border-radius: 20px;
}
.pc-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.pc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-chip {
  font-size: 11px;
  background: #f0f6fa;
  color: #5a7a95;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #d8ecf5;
}

/* Collapsible blueprint */
.pc-blueprint-toggle {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: #7a9bb5;
  cursor: pointer; padding: 6px 0;
  border-top: 1px solid #f0f6fa;
  transition: color 0.15s;
  user-select: none;
}
.pc-blueprint-toggle:hover { color: #234567; }
.pc-blueprint-toggle .toggle-arrow { transition: transform 0.2s; }
.pc-blueprint-toggle.open .toggle-arrow { transform: rotate(180deg); }
.pc-blueprint-box {
  display: none;
  background: #1e2d3d;
  border-radius: 8px;
  padding: 12px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: #a8d8ea;
  line-height: 1.7;
  white-space: pre;
  max-height: 180px;
  overflow-y: auto;
  margin-top: 6px;
}
.pc-blueprint-box.open { display: block; }
.pc-blueprint-box.questions-preview { white-space: pre-wrap; }

/* Card action buttons */
.pc-actions { display: flex; gap: 8px; padding-top: 4px; }
.pc-create-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: 10px; border: 0;
  background-color: #ff3856;
  box-shadow: rgb(201,46,70) 0px 5px 0px 0px;
  color: #fff; font-family: inherit; font-size: 13px;
  cursor: pointer; transition: all 0.2s ease;
  letter-spacing: 0.3px;
}
.pc-create-btn:hover  { box-shadow: rgb(201,46,70) 0px 3px 0px 0px; transform: translateY(1px); }
.pc-create-btn:active { box-shadow: rgb(201,46,70) 0px 0px 0px 0px; transform: translateY(5px); transition: 150ms; }
.pc-create-btn:disabled {
  background: #d8e1e8;
  box-shadow: none;
  color: #6f8192;
  cursor: not-allowed;
  transform: none;
}
.pc-create-btn:disabled:hover,
.pc-create-btn:disabled:active {
  box-shadow: none;
  transform: none;
}
.pc-edit-btn {
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid #e0eaf2;
  background: #fff;
  font-family: inherit; font-size: 13px;
  color: #5a7a95; cursor: pointer;
  transition: all 0.15s;
}
.pc-edit-btn:hover { border-color: #234567; color: #234567; }

/* Created state */
.pc-created {
  background: #e6f9f0;
  border-color: #2ecc71;
}
.pc-created .pc-header { background: #16a34a; }
.pc-success-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
}
.pc-success-text { font-size: 13px; color: #16a34a; }
.pc-code-tag {
  font-family: monospace; font-size: 14px;
  background: #234567; color: #99c2d2;
  padding: 5px 12px; border-radius: 8px;
  letter-spacing: 2px;
}
.pc-open-btn {
  display: inline-block;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 10px; border: 0;
  background-color: #234567;
  box-shadow: #172e47 0px 4px 0px 0px;
  color: #fff; font-family: inherit; font-size: 12px;
  cursor: pointer; transition: all 0.2s;
}
.pc-open-btn:hover  { box-shadow: #172e47 0px 2px 0px 0px; transform: translateY(1px); }
.pc-open-btn:active { box-shadow: #172e47 0px 0px 0px 0px; transform: translateY(4px); transition: 150ms; }
.pc-open-btn:disabled {
  background: #d8e1e8;
  box-shadow: none;
  color: #6f8192;
  cursor: not-allowed;
  transform: none;
}
.pc-open-btn:disabled:hover,
.pc-open-btn:disabled:active {
  box-shadow: none;
  transform: none;
}

/* ── Design picker card ── */
.dp-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(35,69,103,0.10);
  overflow: hidden;
  max-width: 420px;
}
.dp-header {
  background: #234567;
  color: #fff;
  padding: 10px 14px;
  font-size: 15px;
  letter-spacing: 0.3px;
}
.dp-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.dp-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 10px 12px;
  border: 2px solid #e0eaf2; border-radius: 10px;
  background: #fff; color: #1a2a3a;
  font-family: inherit; font-size: 13px; cursor: pointer;
  transition: all 0.15s;
}
.dp-btn:hover { border-color: #234567; background: #f0f6fa; }
.dp-btn .dp-name { font-size: 13px; color: #1a2a3a; }
.dp-btn .dp-desc { font-size: 11px; color: #7a9bb5; margin-top: 2px; }
.dp-btn .dp-text { flex: 1; }
.dp-btn .dp-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: #f0f6fa; color: #5a7a95;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; flex-shrink: 0;
}
.dp-btn.current { border-color: #234567; background: #e8f2f8; }
.dp-btn.current .dp-num { background: #234567; color: #fff; }
.dp-btn.saving { opacity: 0.55; pointer-events: none; }
.dp-btn.saved { border-color: #2ecc71; background: #e6f9f0; }
.dp-btn.saved .dp-num { background: #2ecc71; color: #fff; }

/* ── Live quiz controls card ── */
.live-control-card {
  width: min(100%, 420px);
  background: #fff;
  border: 2px solid #e8f2f8;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(35,69,103,0.12);
  overflow: hidden;
}
.live-control-head {
  background: #234567;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
}
.live-control-title {
  min-width: 0;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-control-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.live-control-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ff3856;
  box-shadow: 0 0 0 4px rgba(255,56,86,0.16);
}
.live-control-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}
.live-control-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #5a7a95;
  font-size: 12px;
}
.live-control-code {
  font-family: monospace;
  color: #234567;
  letter-spacing: 1.2px;
}
.live-control-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: #f0f6fa;
  border: 1px solid #d8ecf5;
}
.live-control-mode-btn {
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #5a7a95;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  padding: 9px 8px;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.live-control-mode-btn.active {
  background: #fff;
  color: #234567;
  box-shadow: 0 2px 8px rgba(35,69,103,0.12);
}
.live-control-help {
  color: #7a9bb5;
  font-size: 11px;
  line-height: 1.35;
}
.live-control-actions,
.live-control-row {
  display: flex;
  gap: 8px;
}
.live-control-card[data-play-mode="single"] .live-control-actions,
.live-control-card[data-play-mode="single"] .live-control-row,
.live-control-card[data-play-mode="single"] .live-control-btn.finish {
  display: none;
}
.live-control-btn {
  min-width: 0;
  border-radius: 10px;
  border: 2px solid #d8ecf5;
  background: #fff;
  color: #234567;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  font-family: inherit;
  font-size: 12px;
  padding: 10px 12px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  white-space: nowrap;
}
.live-control-btn.primary {
  border: 0;
  background: #ff3856;
  box-shadow: rgb(201,46,70) 0 5px 0 0;
  color: #fff;
}
.live-control-btn.finish {
  border-color: #ffd2da;
  color: #ff3856;
}
.live-control-btn:hover {
  background: #f0f6fa;
  transform: translateY(1px);
}
.live-control-btn.primary:hover {
  background: #ff3856;
  box-shadow: rgb(201,46,70) 0 3px 0 0;
}
.live-control-btn:active,
.live-control-btn.busy {
  transform: translateY(4px);
}
.live-control-btn.primary:active,
.live-control-btn.primary.busy {
  box-shadow: rgb(201,46,70) 0 0 0 0;
}
.live-control-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.setup-card { background:#fff; border:2px solid #e8f2f8; border-radius:12px; box-shadow:0 4px 16px rgba(35,69,103,0.10); width:min(100%,560px); max-width:560px; overflow:hidden; }
.setup-header { background:#234567; color:#fff; padding:10px 14px; font-size:15px; }
.setup-body { padding:14px; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.setup-field { display:flex; flex-direction:column; gap:6px; }
.setup-label { font-size:12px; color:#5a7a95; }
.setup-input { width:100%; border:2px solid #e0eaf2; border-radius:10px; padding:10px 12px; font-family:inherit; font-size:14px; color:#1a2a3a; background:#fff; outline:none; }
.setup-input:focus { border-color:#234567; }
.setup-submit { padding:10px 16px; border-radius:10px; border:0; background-color:#ff3856; box-shadow:rgb(201,46,70) 0px 5px 0px 0px; color:#fff; font-family:inherit; font-size:13px; cursor:pointer; transition:all 0.2s ease; }
.setup-submit { grid-column:1 / -1; }
.setup-submit:hover { box-shadow:rgb(201,46,70) 0px 3px 0px 0px; transform:translateY(1px); }
.setup-submit:disabled { background:#d8e1e8; box-shadow:none; color:#6f8192; cursor:not-allowed; transform:none; }
.teaching-active-topic {
  width: min(100%, 860px);
  margin: 0 auto 10px;
  background: #ffffff;
  border: 1px solid #d8ecf5;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(35,69,103,0.08);
  padding: 10px 12px;
  display: none;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  color: #1a2a3a;
  font-size: 13px;
}
.teaching-active-topic strong { color: #234567; }
.teaching-active-topic span { min-width: 0; }
.teaching-other-form button {
  border: 1px solid #d8ecf5;
  background: #f7fbfd;
  color: #234567;
  border-radius: 999px;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.teaching-other-form button:hover { background: #eaf5fa; }
.teaching-other-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}
.teaching-other-form input {
  min-width: 180px;
  flex: 1;
  border: 1px solid #d8ecf5;
  border-radius: 999px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  color: #1a2a3a;
  outline: none;
}
.teaching-other-form input:focus { border-color: #234567; }
.edit-review-card {
  background:#fff;
  border:2px solid #e8f2f8;
  border-radius:12px;
  box-shadow:0 4px 16px rgba(35,69,103,0.10);
  width:min(100%,560px);
  max-width:560px;
  overflow:hidden;
}
.edit-review-header {
  background:#234567;
  color:#fff;
  padding:10px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  font-size:15px;
}
.edit-review-code {
  border:1px solid rgba(255,255,255,0.28);
  border-radius:999px;
  padding:3px 8px;
  font-size:11px;
  letter-spacing:1px;
  color:#d8ecf5;
  flex-shrink:0;
}
.edit-review-body {
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.edit-review-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}
.edit-review-panel {
  border:1px solid #d8ecf5;
  border-radius:10px;
  background:#f7fbfd;
  padding:10px;
  min-width:0;
}
.edit-review-label {
  color:#5a7a95;
  font-size:11px;
  margin-bottom:5px;
  text-transform:uppercase;
  letter-spacing:0.45px;
}
.edit-review-text {
  color:#1a2a3a;
  font-size:13px;
  line-height:1.45;
  overflow-wrap:anywhere;
}
.edit-review-list {
  display:flex;
  flex-direction:column;
  gap:7px;
}
.edit-review-item {
  display:grid;
  grid-template-columns:22px minmax(0,1fr);
  gap:8px;
  align-items:start;
  color:#1a2a3a;
  font-size:13px;
  line-height:1.45;
}
.edit-review-dot {
  width:22px;
  height:22px;
  border-radius:7px;
  background:#e8f2f8;
  color:#234567;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
  flex-shrink:0;
}
.edit-review-actions {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  padding-top:2px;
}
.edit-review-yes,
.edit-review-other {
  border-radius:10px;
  cursor:pointer;
  font-family:inherit;
  font-size:13px;
  padding:10px 14px;
  transition:all 0.18s ease;
}
.edit-review-yes {
  border:0;
  background:#ff3856;
  box-shadow:rgb(201,46,70) 0 5px 0 0;
  color:#fff;
  flex:1;
  min-width:130px;
}
.edit-review-yes:hover { box-shadow:rgb(201,46,70) 0 3px 0 0; transform:translateY(1px); }
.edit-review-other {
  border:2px solid #d8ecf5;
  background:#fff;
  color:#234567;
  min-width:110px;
}
.edit-review-other:hover { border-color:#234567; background:#f0f6fa; }
.edit-review-actions button:disabled {
  opacity:0.55;
  pointer-events:none;
  box-shadow:none;
  transform:none;
}
@media (max-width: 640px) {
  .setup-card { max-width:100%; }
  .setup-body { grid-template-columns:1fr; }
  .edit-review-grid { grid-template-columns:1fr; }
}

/* ══════════════════════════════════════
   Animated build card (creation flow)
   ══════════════════════════════════════ */
.build-card {
  width: min(100%, 460px);
  background: #fff;
  border: 2px solid #e8f2f8;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(35,69,103,0.12);
  overflow: hidden;
}
.build-head {
  background: #234567;
  color: #fff;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; font-size: 14px;
}
.build-head .spark { font-size: 16px; }
.build-head .sub { margin-left: auto; font-size: 11px; opacity: 0.7; letter-spacing: 0.4px; }
.build-body { padding: 8px 16px 14px; }
.step {
  display: grid; grid-template-columns: 26px 1fr; gap: 12px;
  padding: 12px 0; align-items: start;
  border-bottom: 1px solid #f0f6fa;
  opacity: 0.4; transition: opacity 0.3s ease;
}
.step:last-child { border-bottom: 0; }
.step.active, .step.done { opacity: 1; }
.step-dot {
  width: 26px; height: 26px; border-radius: 50%;
  background: #f0f6fa; color: #7a9bb5;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0; transition: all 0.25s ease;
}
.step.active .step-dot { background: #234567; color: #fff; box-shadow: 0 0 0 4px rgba(35,69,103,0.14); }
.step.done .step-dot { background: #2ecc71; color: #fff; }
.step-main { min-width: 0; }
.step-title { font-size: 14px; color: #1a2a3a; }
.step.active .step-title { color: #234567; }
.step-detail {
  font-size: 12px; color: #5a7a95; line-height: 1.5; margin-top: 4px;
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height 0.35s ease, opacity 0.3s ease, margin 0.3s ease;
}
.step.active .step-detail, .step.done .step-detail { max-height: 320px; opacity: 1; margin-top: 6px; }
.step-detail ul { margin: 4px 0 0; padding-left: 16px; }
.step-detail li { margin: 3px 0; }
.step-ask { color: #234567; font-size: 12px; margin-bottom: 8px; }
.label-row { display: flex; flex-wrap: wrap; gap: 7px; }
.build-label {
  border: 2px solid #d0e4ef; border-radius: 999px; background: #fff; color: #234567;
  cursor: pointer; font-family: inherit; font-size: 12px; padding: 7px 14px;
  transition: all 0.15s ease; box-shadow: 0 2px 6px rgba(35,69,103,0.08);
}
.build-label:hover:not(:disabled) { background: #234567; border-color: #234567; color: #fff; transform: translateY(-1px); }
.build-label.picked { background: #234567; border-color: #234567; color: #fff; }
.build-label:disabled { cursor: default; opacity: 0.55; }
.build-label.picked:disabled { opacity: 1; }

/* ══════════════════════════════════════
   Unified delivery card (preview + controls)
   ══════════════════════════════════════ */
.qp-card {
  width: min(100%, 920px);
  background: #fff;
  border: 2px solid #e8f2f8;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(35,69,103,0.12);
  overflow: hidden;
}
.qp-head {
  background: #234567; color: #fff;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
}
.qp-state {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; letter-spacing: 0.5px;
  border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.12);
  padding: 4px 9px; border-radius: 999px;
}
.qp-dot { width: 7px; height: 7px; border-radius: 50%; background: #ff3856; box-shadow: 0 0 0 3px rgba(255,56,86,0.25); }
.qp-title { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qp-icon-btn {
  margin-left: auto; border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.12);
  color: #fff; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 14px; flex-shrink: 0;
}
.qp-icon-btn:hover { background: rgba(255,255,255,0.2); }
.qp-body { display: flex; align-items: stretch; }
.qp-frame-shell {
  position: relative; flex: 1 1 auto; min-width: 0; align-self: stretch;
  aspect-ratio: 16 / 9; background: #fff; overflow: hidden; border-right: 1px solid #e8f2f8;
}
.qp-frame {
  position: absolute; top: 0; left: 0; width: 1280px; height: 720px;
  border: 0; display: block; transform-origin: top left; background: #fff;
}
.qp-body > .live-control-card {
  flex: 0 0 232px; width: 232px; max-width: 232px;
  border: 0; border-radius: 0; box-shadow: none;
}
.qp-controls {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; padding: 12px 14px; border-top: 1px solid #e8f2f8;
}
.qp-code { font-size: 12px; color: #5a7a95; }
.qp-code b { color: #234567; font-family: monospace; letter-spacing: 1.5px; }
.qp-control-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.qp-btn {
  border: 2px solid #d8ecf5; border-radius: 10px; background: #fff; color: #234567;
  font-family: inherit; font-size: 12px; padding: 9px 12px; cursor: pointer;
  transition: all 0.15s ease; white-space: nowrap;
}
.qp-btn:hover { background: #f0f6fa; border-color: #234567; }
.qp-btn.primary { border: 0; background: #ff3856; box-shadow: rgb(201,46,70) 0 4px 0 0; color: #fff; }
.qp-btn.primary:hover { box-shadow: rgb(201,46,70) 0 2px 0 0; transform: translateY(2px); }
.qp-btn.primary:active { box-shadow: none; transform: translateY(4px); }
@media (max-width: 620px) {
  .qp-body { flex-direction: column; }
  .qp-frame-shell { border-right: 0; border-bottom: 1px solid #e8f2f8; }
  .qp-body > .live-control-card { flex-basis: auto; width: 100%; max-width: none; }
}

/* ── Fullscreen preview overlay ── */
#ova-fs-overlay {
  position: fixed; inset: 0; z-index: 1200; background: #234567;
  display: none; flex-direction: column;
}
#ova-fs-overlay.open { display: flex; }
.ova-fs-bar { height: 48px; flex-shrink: 0; display: flex; align-items: center; padding: 0 16px; gap: 12px; }
.ova-fs-title { color: #fff; font-size: 13px; letter-spacing: 0.4px; }
.ova-fs-close {
  margin-left: auto; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25);
  color: #fff; font-family: inherit; font-size: 12px; padding: 7px 13px; border-radius: 999px; cursor: pointer;
}
.ova-fs-close:hover { background: rgba(255,255,255,0.2); }
#ova-fs-frame { flex: 1; width: 100%; border: 0; display: block; background: #fff; }

/* ── Project editor overlay ── */
#ova-edit-overlay {
  position: fixed; inset: 0; z-index: 1210; background: #eef5fa;
  display: none; flex-direction: column;
}
#ova-edit-overlay.open { display: flex; }
.ova-ed-bar {
  flex-shrink: 0; background: #234567; color: #fff;
  display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 56px;
}
.ova-ed-title { font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ova-ed-actions { margin-left: auto; display: flex; gap: 8px; flex-shrink: 0; }
.ova-ed-cancel {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25); color: #fff;
  font-family: inherit; font-size: 13px; padding: 8px 14px; border-radius: 999px; cursor: pointer;
}
.ova-ed-cancel:hover { background: rgba(255,255,255,0.2); }
.ova-ed-save {
  border: 0; background: #ff3856; box-shadow: rgb(201,46,70) 0 4px 0 0; color: #fff;
  font-family: inherit; font-size: 13px; padding: 9px 16px; border-radius: 10px; cursor: pointer;
  transition: all 0.18s ease;
}
.ova-ed-save:hover { box-shadow: rgb(201,46,70) 0 2px 0 0; transform: translateY(2px); }
.ova-ed-save:active { box-shadow: none; transform: translateY(4px); }
.ova-ed-save:disabled { background:#d8e1e8; box-shadow:none; color:#6f8192; cursor:not-allowed; transform:none; }
.ova-ed-stage { flex: 1; overflow-y: auto; padding: 20px 16px 32px; }
.ova-ed-list { width: 100%; max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.ova-ed-q {
  background: #fff; border: 2px solid #e8f2f8; border-radius: 14px;
  box-shadow: 0 4px 14px rgba(35,69,103,0.08); padding: 16px;
}
.ova-ed-q-head { font-size: 12px; color: #7a9bb5; text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 8px; }
.ova-ed-q-input {
  width: 100%; border: 2px solid #e0eaf2; border-radius: 10px; padding: 11px 12px;
  font-family: inherit; font-size: 15px; color: #1a2a3a; outline: none; margin-bottom: 12px;
}
.ova-ed-q-input:focus { border-color: #234567; }
.ova-ed-points-label { font-size: 11px; color: #7a9bb5; margin-bottom: 5px; }
.ova-ed-points {
  width: 100%; min-height: 96px; border: 2px solid #e0eaf2; border-radius: 10px; padding: 11px 12px;
  font-family: inherit; font-size: 14px; color: #1a2a3a; line-height: 1.6; resize: vertical; outline: none;
}
.ova-ed-points:focus { border-color: #234567; }
.ova-ed-opts { display: flex; flex-direction: column; gap: 8px; }
.ova-ed-opt {
  display: flex; align-items: center; gap: 10px;
  background: #f7fbfd; border: 1px solid #e0eaf2; border-radius: 10px; padding: 8px 10px;
}
.ova-ed-opt:focus-within { border-color: #c7dcf0; }
.ova-ed-opt input[type="radio"] { width: 18px; height: 18px; accent-color: #16a34a; flex-shrink: 0; cursor: pointer; }
.ova-ed-opt-letter {
  width: 22px; height: 22px; flex-shrink: 0; border-radius: 6px; background: #e8f2f8; color: #234567;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.ova-ed-opt-input { flex: 1; min-width: 0; border: 0; background: transparent; font-family: inherit; font-size: 14px; color: #1a2a3a; outline: none; padding: 4px 2px; }
.ova-ed-opt:has(input[type="radio"]:checked) { background: #e6f9f0; border-color: #2ecc71; }
.ova-ed-hint { max-width: 640px; margin: 16px auto 0; font-size: 12px; color: #5a7a95; text-align: center; }

/* ── Input area ── */
#input-area {
  background: rgba(255,255,255,0.8); border-radius: 20px;
  box-shadow: 0 6px 22px rgba(35,69,103,0.12);
  padding: 8px 10px;
  margin: 0 14px 14px;
  display: flex; gap: 8px; align-items: flex-end;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#input-area:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(35,69,103,0.18);
}
#quick-actions + #input-area { border-radius: 24px; }
.chat-project-preview-row {
  align-items: flex-start;
  width: 100%;
}
.chat-project-preview {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(35,69,103,0.12);
  border: 2px solid #e8f2f8;
  overflow: hidden;
  width: min(100%, 720px);
}
.chat-preview-head {
  background: #234567;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
}
.chat-preview-title { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-preview-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.chat-preview-hub-btn,
.chat-preview-close {
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}
.chat-preview-hub-btn { padding: 7px 10px; }
.chat-preview-close { width: 30px; height: 30px; font-size: 15px; }
.chat-preview-hub-btn:hover,
.chat-preview-close:hover { background: rgba(255,255,255,0.2); }
.chat-preview-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #fff;
}
#chat-project-preview-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 1440px;
  height: 810px;
  border: 0;
  display: block;
  background: #fff;
  transform-origin: top left;
}
@media (max-width: 720px) {
  .chat-project-preview { border-radius: 12px; }
}
.maths-help-card,
.subject-help-card,
.tool-frame-card {
  width: min(100%, 720px);
  max-width: 78%;
  background: transparent;
  border: 0;
  border-radius: 0 0 16px 16px;
  box-shadow: none;
  overflow: hidden;
  animation: iframeCardIntro 0.42s cubic-bezier(.2,.85,.25,1) both;
}
@keyframes iframeCardIntro {
  from { opacity: 0; transform: translateY(14px) scale(.96); transform-origin: bottom right; }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.maths-help-head,
.subject-help-head,
.tool-frame-head {
  background: #234567;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13px;
  border-radius: 16px 16px 0 0;
}
.subject-help-head {
  background: #ff3856;
}
.maths-help-label,
.subject-help-label,
.tool-frame-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.maths-help-frame,
.subject-help-frame,
.tool-frame {
  width: 100%;
  height: 380px;
  border: 0;
  display: block;
  background: transparent;
  border-radius: 0 0 16px 16px;
}
.subject-help-frame {
  height: 430px;
}
.tool-frame {
  height: 460px;
}
.scratch-section-card {
  width: min(100%, 560px);
  border: 0;
  box-shadow: 0 2px 10px rgba(35,69,103,0.08);
}
.scratch-section-frame {
  height: 120px;
  background: transparent;
  transition: height 0.15s ease;
}
#composer-field {
  flex: 1; display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  border: 2px solid transparent; border-radius: 10px;
  padding: 2px 8px; background: transparent;
  transition: border-color 0.2s; min-height: 34px;
}
#composer-field:focus-within { border-color: transparent; }
#chat-input {
  flex: 1; min-width: 80px; border: 0; border-radius: 0; background: transparent;
  padding: 4px 0; font-family: inherit; font-size: 15px;
  color: #1a2a3a; resize: none; outline: none;
  min-height: 24px; max-height: calc(1.5em * 5 + 20px); overflow-y: hidden;
  line-height: 1.5;
}
#chat-input::placeholder { color: #a0b8cc; }
.command-pill {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  background: #e8f2f8; color: #1d6fe0; font-weight: 800; font-size: 14px;
  border-radius: 8px; padding: 5px 6px 5px 10px; white-space: nowrap;
}
.command-pill .pill-x {
  border: 0; background: transparent; color: #1d6fe0;
  font-size: 16px; line-height: 1; cursor: pointer; opacity: 0.65;
  padding: 0 2px; font-family: inherit;
}
.command-pill .pill-x:hover { opacity: 1; }
.plus-upgrade-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  border-radius: 999px;
  padding: 5px 10px;
  background: #f0ebff;
  color: #6b3fd4;
  border: 1px solid #d8c9ff;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.plus-upgrade-pill[hidden] {
  display: none !important;
}
.plus-upgrade-pill:hover,
.plus-upgrade-pill:focus {
  background: #fbf8ff;
  border-color: #b997ff;
  color: #7c3aed;
  outline: none;
}
#send-btn {
  width: 40px; height: 40px; padding: 0;
  border-radius: 50%; border: 0;
  background-color: #234567;
  color: #fff; cursor: pointer;
  transition: all 0.2s ease;
  display: flex; align-items: center; justify-content: center;
  align-self: flex-end; flex: 0 0 auto;
}
#send-btn svg { width: 18px; height: 18px; display: block; }
#send-btn:hover  { background-color: #2c5480; }
#send-btn:active { transform: scale(0.94); transition: 100ms; }
#send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Suggestion chips ── */
#suggestions {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; padding: 20px 0 10px;
}
.suggestion-chip {
  background: #fff; border: 2px solid #d0e4ef;
  border-radius: 20px; padding: 8px 16px;
  font-family: inherit; font-size: 13px; color: #234567;
  cursor: pointer; transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(35,69,103,0.08);
}
.suggestion-chip:hover {
  background: #234567; color: #fff; border-color: #234567;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(35,69,103,0.18);
}
.suggestion-chip.create-chip {
  border-color: #ffc0cb; color: #c0392b;
}
.suggestion-chip.create-chip:hover {
  background: #ff3856; border-color: #ff3856; color: #fff;
}

/* ── Quick creation labels ── */
#quick-actions {
  background: rgba(255,255,255,0.82);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -3px 14px rgba(35,69,103,0.08);
  padding: 12px 14px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  border-bottom: 1px solid #e8f2f8;
}
.quick-action-label {
  border: 2px solid #d0e4ef;
  border-radius: 999px;
  background: #fff;
  color: #234567;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  padding: 7px 13px;
  transition: all 0.18s ease;
  box-shadow: 0 2px 6px rgba(35,69,103,0.08);
}
.quick-action-label:hover,
.quick-action-label:focus {
  background: #234567;
  border-color: #234567;
  color: #fff;
  transform: translateY(-1px);
  outline: none;
}
.quick-action-label.custom {
  border-color: #ffc0cb;
  color: #c0392b;
}
.quick-action-label.custom:hover,
.quick-action-label.custom:focus {
  background: #ff3856;
  border-color: #ff3856;
  color: #fff;
}

/* ── Welcome card ── */
#welcome-card {
  background: transparent; border-radius: 0;
  box-shadow: none;
  padding: 28px 24px 4px; text-align: center; margin-bottom: 0;
}
#welcome-card .wc-icon {
  width: 54px;
  height: 54px;
  object-fit: contain;
  display: block;
  margin: 0 auto 10px;
}
#welcome-card h2 { font-size: 20px; color: #234567; margin-bottom: 6px; }
#welcome-card p  { font-size: 13px; color: #5a7a95; line-height: 1.6; }

/* ── Intent hint strip ── */
.intent-hint {
  font-size: 11px; color: #7a9bb5;
  background: #f0f6fa;
  border-radius: 8px;
  padding: 5px 12px;
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 6px;
  align-self: flex-start;
}
#input-area {
  position: relative;
}
.slash-menu {
  position: absolute;
  left: 12px;
  right: 92px;
  bottom: calc(100% + 8px);
  max-height: 320px;
  overflow: auto;
  background: #fff;
  border: 2px solid #d0e4ef;
  border-radius: 14px;
  box-shadow: 0 12px 34px rgba(35,69,103,0.18);
  padding: 8px;
  z-index: 40;
  display: none;
}
.slash-menu.open { display: grid; gap: 6px; }
.slash-option {
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.slash-option:hover,
.slash-option.active {
  background: #e8f2f8;
}
.slash-title {
  color: #234567;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 3px;
}
.slash-desc {
  color: #6c8aa3;
  font-size: 11px;
  line-height: 1.35;
}
.slash-command {
  color: #ff3856;
  font-size: 11px;
  background: #fff1f4;
  border-radius: 999px;
  padding: 4px 8px;
  white-space: nowrap;
}
.slash-empty {
  padding: 12px;
  color: #7a9bb5;
  font-size: 12px;
  text-align: center;
}
.slash-token {
  color: #1d6fe0;
  font-weight: 800;
}
.bubble.user .slash-token {
  color: #cfe6ff;
}
.quota-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(12, 31, 51, 0.58);
  backdrop-filter: blur(8px);
}
.quota-overlay.open { display: flex; }
.quota-modal {
  width: min(460px, 100%);
  border: 2px solid rgba(255,255,255,0.72);
  border-radius: 18px;
  background: #f8fcff;
  box-shadow: 0 24px 70px rgba(14, 39, 65, 0.32);
  overflow: hidden;
}
.quota-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background: #244b70;
  color: #fff;
}
.quota-head h3 {
  margin: 0;
  font-size: 21px;
  letter-spacing: 0;
}
.quota-close {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,0.45);
  border-radius: 10px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.quota-body {
  padding: 22px;
  color: #17324d;
}
.quota-body p {
  margin: 0 0 14px;
  font-size: 17px;
  line-height: 1.45;
  color: #385a77;
}
.quota-meter {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid #c8dfef;
  border-radius: 12px;
  background: #eef8ff;
  color: #244b70;
  font-size: 15px;
  font-weight: 800;
}
.quota-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.quota-primary,
.quota-secondary {
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}
.quota-primary {
  background: #ff3856;
  color: #fff;
}
.quota-secondary {
  background: #dcecf7;
  color: #244b70;
}
