/* ─── Child Talent Assistant ─── */
#childTalentSection {
    display: none;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.ct-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0px 10px 10px 10px;
    height: 100%;
    overflow-y: auto;
}

/* Lead screen */
.ct-lead-box {
    max-width: 400px;
    width: 100%;
    text-align: center;
    animation: ctFadeIn 0.3s ease;
}

.ct-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1f2937;
}

.ct-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 24px;
    line-height: 1.5;
}

.ct-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.ct-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: -6px;
}

.ct-input,
.ct-select {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    font-size: 16px;
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
    box-sizing: border-box;
}

.ct-input:focus,
.ct-select:focus {
    border-color: #c98b5f;
    box-shadow: 0 0 0 3px rgba(201, 139, 95, 0.15);
}

.ct-row {
    display: flex;
    gap: 10px;
}

.ct-row .ct-select {
    flex: 1;
}

.ct-btn {
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #d4a574, #c98b5f);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    margin-top: 4px;
}

.ct-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(201, 139, 95, 0.35);
}

.ct-btn:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
}

/* Chat screen */
.ct-chat-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    position: relative;
    animation: ctFadeIn 0.3s ease;
}

.ct-screen {
    position: relative;
}

.ct-chat-header {
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 14px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.ct-chat-header-name {
    font-weight: 700;
    font-size: 15px;
    color: #1f2937;
}

.ct-chat-header-meta {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.ct-chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 6px 4px 10px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.ct-message {
    max-width: 82%;
    padding: 11px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.55;
    position: relative;
    word-break: break-word;
    animation: ctFadeIn 0.18s ease;
}

.ct-message b {
    font-weight: 700;
    color: inherit;
}

.ct-message.ai {
    align-self: flex-start;
    background: #fff;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.ct-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #006b9b, #0078b8);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 107, 155, 0.25);
}

.ct-message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #d4a574, #c98b5f);
    color: #fff;
    position: absolute;
    bottom: 2px;
    left: -34px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.ct-message.user .ct-message-avatar {
    left: auto;
    right: -34px;
    background: linear-gradient(135deg, #006b9b, #0078b8);
}

.ct-message.ai {
    margin-left: 34px;
}

.ct-message.user {
    margin-right: 34px;
}

.ct-chat-input-area {
    display: flex;
    gap: 8px;
    padding: 8px 4px 4px;
    flex-shrink: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.ct-chat-input {
    flex: 1;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    font-size: 15px;
    outline: none;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ct-chat-input:focus {
    border-color: #c98b5f;
    box-shadow: 0 0 0 3px rgba(201, 139, 95, 0.12);
}

.ct-chat-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #d4a574, #c98b5f);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.ct-chat-send:hover {
    transform: scale(1.05);
}

.ct-chat-send:disabled {
    opacity: 0.5;
    cursor: wait;
    transform: none;
}

.ct-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    align-self: flex-start;
    margin-left: 34px;
}

.ct-typing span {
    width: 6px;
    height: 6px;
    background: #c98b5f;
    border-radius: 50%;
    animation: ctBounce 1.2s infinite ease-in-out;
}

.ct-typing span:nth-child(2) { animation-delay: 0.2s; }
.ct-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ctBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

@keyframes ctFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Message text formatting */
.ct-message-text {
    line-height: 1.55;
}
.ct-message-text p {
    margin: 0 0 10px 0;
}
.ct-message-text p:last-child {
    margin-bottom: 0;
}
.ct-message-text br {
    display: block;
    content: "";
    margin-bottom: 2px;
}

/* ─── Tabs ─── */
.ct-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: rgba(0,0,0,0.03);
    border-radius: 12px;
    margin-bottom: 8px;
    flex-shrink: 0;
}
.ct-tab {
    flex: 1;
    padding: 8px 6px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.ct-tab.active {
    background: #fff;
    color: #1f2937;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.ct-tab:hover:not(.active) {
    color: #374151;
}
.ct-tab-content {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}
.ct-tab-content.active {
    display: flex;
}

/* ─── Program offer ─── */
.ct-program-toggle {
    display: block;
    width: 100%;
    padding: 10px 14px;
    margin-top: 6px;
    border: 1px solid #f3d9b8;
    border-radius: 12px;
    background: linear-gradient(135deg, #fef9f3, #fff7ed);
    color: #92400e;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.ct-program-toggle:hover {
    background: linear-gradient(135deg, #fff7ed, #fef3e3);
}
.ct-program-details {
    display: none;
    background: linear-gradient(135deg, #fef9f3, #fff7ed);
    border: 1px solid #f3d9b8;
    border-radius: 14px;
    padding: 14px;
    margin-top: 8px;
    animation: ctFadeIn 0.2s ease;
    flex-shrink: 0;
}
.ct-program-details.open {
    display: block;
}
.ct-program-title {
    font-size: 15px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 8px;
}
.ct-program-desc {
    font-size: 13px;
    color: #78350f;
    line-height: 1.45;
}
.ct-program-desc p {
    margin: 0 0 6px;
}
.ct-program-desc ul {
    margin: 0;
    padding-left: 16px;
}
.ct-program-desc li {
    margin-bottom: 3px;
}
.ct-buy-btn {
    margin-top: 10px;
    background: linear-gradient(135deg, #d97706, #b45309);
    font-size: 14px;
    padding: 12px;
}
.ct-buy-btn:hover {
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.4);
}

/* ─── Diary ─── */
.ct-diary-instruction {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
    padding: 10px 12px;
    background: rgba(0,0,0,0.02);
    border-radius: 12px;
    margin-bottom: 10px;
    flex-shrink: 0;
}
.ct-diary-entries {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px;
    margin-bottom: 8px;
}
.ct-diary-entry {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 12px;
    position: relative;
}
.ct-diary-entry-date {
    font-size: 11px;
    color: #9ca3af;
    margin-bottom: 4px;
}
.ct-diary-entry-text {
    font-size: 13.5px;
    color: #374151;
    line-height: 1.45;
}
.ct-diary-entry-del {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: #d1d5db;
    font-size: 14px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}
.ct-diary-entry-del:hover {
    color: #ef4444;
}
.ct-diary-input-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 4px 4px;
    flex-shrink: 0;
    border-top: 1px solid rgba(0,0,0,0.05);
}
.ct-diary-textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    font-size: 14px;
    outline: none;
    resize: none;
    font-family: inherit;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.ct-diary-textarea:focus {
    border-color: #c98b5f;
}
.ct-diary-save-btn {
    align-self: flex-end;
    padding: 10px 20px;
    font-size: 14px;
}

/* ─── Empty state ─── */
.ct-diary-empty {
    text-align: center;
    padding: 30px 10px;
    color: #9ca3af;
    font-size: 13px;
}

/* ─── Free message counter ─── */
.ct-free-msg-counter {
    text-align: center;
    padding: 6px 10px;
    font-size: 12px;
    color: #9ca3af;
}
.ct-free-msg-counter .ct-limit-warn {
    color: #e74c3c;
    font-weight: 500;
}

/* ─── Limit CTA ─── */
.ct-limit-cta {
    background: linear-gradient(135deg, #fef7f0, #fff3e6);
    border: 1px solid #f0c89a;
    border-radius: 14px;
    padding: 16px;
    margin: 12px 8px;
    text-align: center;
}
.ct-limit-cta p {
    font-size: 13px;
    color: #5a4a3a;
    margin: 0 0 12px;
}

/* ─── Mini-test ─── */
.ct-mini-test {
    background: #fefaf6;
    border: 1px solid #f0dcc8;
    border-radius: 16px;
    padding: 16px;
    margin: 12px 0;
}
.ct-mini-test-title {
    font-size: 15px;
    font-weight: 600;
    color: #4a3728;
    margin-bottom: 4px;
}
.ct-mini-test-desc {
    font-size: 12.5px;
    color: #8a7a6a;
    margin-bottom: 12px;
}
.ct-test-q {
    margin-bottom: 14px;
}
.ct-test-q-text {
    font-size: 13.5px;
    font-weight: 500;
    color: #3a2a1a;
    margin-bottom: 8px;
}
.ct-test-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ct-test-opt {
    background: #fff;
    border: 1px solid #e0d4c8;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    color: #5a4a3a;
}
.ct-test-opt:hover {
    border-color: #c98b5f;
    background: #fff8f2;
}
.ct-test-opt.selected {
    background: #c98b5f;
    border-color: #c98b5f;
    color: #fff;
}
.ct-test-submit {
    margin-top: 10px;
    width: 100%;
}

/* ─── Program progress ─── */
.ct-program-progress {
    background: #fff;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.ct-progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: #4a3728;
    margin-bottom: 8px;
}
.ct-progress-bar {
    height: 8px;
    background: #f0e8e0;
    border-radius: 4px;
    overflow: hidden;
}
.ct-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #c98b5f, #e8a86d);
    border-radius: 4px;
    transition: width 0.5s ease;
}
.ct-progress-phases {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 10.5px;
    color: #bbb;
}
.ct-progress-phases span.active {
    color: #c98b5f;
    font-weight: 500;
}

/* ─── Active task ─── */
.ct-active-task {
    background: linear-gradient(135deg, #fffbf7, #fff5eb);
    border: 1px solid #f0dcc8;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
}
.ct-active-task-header {
    font-size: 12px;
    color: #8a7a6a;
    margin-bottom: 6px;
}
.ct-active-task-title {
    font-size: 15px;
    font-weight: 600;
    color: #3a2a1a;
    margin-bottom: 8px;
}
.ct-active-task-desc {
    font-size: 13px;
    color: #5a4a3a;
    line-height: 1.5;
    margin-bottom: 14px;
}
.ct-active-task-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ct-task-result-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 13px;
    outline: none;
    resize: none;
    font-family: inherit;
    box-sizing: border-box;
}
.ct-task-result-input:focus {
    border-color: #c98b5f;
}
.ct-btn-secondary {
    background: #fff;
    color: #c98b5f;
    border: 1px solid #c98b5f;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 13px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}
.ct-btn-secondary:hover {
    background: #fff8f2;
}

/* ─── Task start box ─── */
.ct-task-start-box {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.ct-task-welcome {
    font-size: 15px;
    font-weight: 600;
    color: #4a3728;
    margin-bottom: 8px;
}
.ct-task-start-box p {
    font-size: 13px;
    color: #6b5b4b;
    margin: 0 0 14px;
}

/* ─── Completed tasks ─── */
.ct-tasks-history {
    margin-top: 16px;
}
.ct-tasks-history-title {
    font-size: 13px;
    font-weight: 600;
    color: #4a3728;
    margin-bottom: 8px;
}
.ct-task-done-item {
    background: #f9f6f3;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
}
.ct-task-done-head {
    font-size: 13px;
    font-weight: 500;
    color: #2d8a4e;
}
.ct-task-done-result {
    font-size: 12px;
    color: #6b5b4b;
    margin-top: 4px;
    font-style: italic;
}
.ct-task-done-feedback {
    font-size: 12px;
    color: #8a7a6a;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #eee;
}

/* ─── Program complete ─── */
.ct-program-complete {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #f0fff4, #e6ffed);
    border-radius: 16px;
    margin-bottom: 12px;
}
.ct-complete-icon {
    font-size: 40px;
    margin-bottom: 10px;
}
.ct-complete-title {
    font-size: 18px;
    font-weight: 700;
    color: #2d8a4e;
    margin-bottom: 8px;
}
.ct-program-complete p {
    font-size: 13px;
    color: #3a5a4a;
    margin: 0 0 14px;
}

/* ─── Weekly report ─── */
.ct-weekly-report {
    background: #fff;
    border: 1px solid #e8e0d8;
    border-radius: 14px;
    padding: 16px;
    margin: 12px 0;
}
.ct-report-header {
    font-size: 14px;
    font-weight: 600;
    color: #4a3728;
    margin-bottom: 10px;
}
.ct-report-text {
    font-size: 13px;
    color: #5a4a3a;
    line-height: 1.6;
}
.ct-report-btn {
    margin-top: 12px;
    width: 100%;
    background: #f5f0eb;
    color: #4a3728;
    border: 1px solid #e0d4c8;
}
.ct-report-btn:hover {
    background: #ece4dc;
}

/* ─── Loading ─── */
.ct-loading {
    text-align: center;
    padding: 30px 10px;
    color: #9ca3af;
    font-size: 13px;
}

/* Mobile */
@media (max-width: 480px) {
    .ct-message {
        max-width: 90%;
        font-size: 13.5px;
    }
    .ct-title { font-size: 18px; }
    .ct-tab { font-size: 11.5px; padding: 7px 4px; }
    .ct-program-offer { padding: 14px; }
    .ct-test-opt { font-size: 11px; padding: 5px 10px; }
    .ct-active-task { padding: 12px; }
    .ct-progress-phases { font-size: 9.5px; }
}
