/* ================== AI 諮詢室：元氣網問答樣式對齊 ================== */
.rag-chatbot-wrapper {
    margin: 20px 0;
    width: 100%;
}
.rag-chatbot-form {
    margin-bottom: 20px;
    padding: 20px;
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.rag-chatbot-input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.rag-chatbot-lock {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 12px;
    color: #92400e;
    font-size: 13px;
}
.rag-chatbot-lock[hidden] {
    display: none !important;
}
.rag-chatbot-lock .memory-icon {
    color: #d97706;
}
.rag-chatbot-lock span {
    flex: 1 1 auto;
}
.rag-chatbot-lock button {
    flex-shrink: 0;
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    background-color: #3A7D44;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}
.rag-chatbot-lock button:hover {
    background-color: #2D6134;
}
@media (max-width: 1023px) {
    /* 手機/平板：文字換行後，「立即登入」按鈕改靠右對齊 */
    .rag-chatbot-lock button {
        margin-left: auto;
    }
}
.rag-chatbot-textarea {
    width: 100%;
    padding: 16px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    outline: none;
    transition: all 0.2s;
}
.rag-chatbot-textarea:focus {
    border-color: #3A7D44;
    box-shadow: 0 0 0 3px rgba(58, 125, 68, 0.15);
}
.rag-chatbot-textarea:disabled {
    background-color: #f8fafc;
    cursor: not-allowed;
    opacity: 0.7;
}
.rag-chatbot-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}
.rag-chatbot-submit,
.rag-chatbot-clear {
    padding: 10px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}
.rag-chatbot-submit {
    background-color: #3A7D44;
    color: white;
}
.rag-chatbot-submit:hover:not(:disabled) {
    background-color: #2D6134;
}
.rag-chatbot-submit:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
}
.rag-chatbot-clear {
    background-color: #64748b;
    color: white;
}
.rag-chatbot-clear:hover {
    background-color: #475569;
}
.rag-chatbot-answer {
    margin: 20px 0;
    padding: 20px;
    background-color: #f8fafc;
    border-radius: 12px;
    border-left: 4px solid #3A7D44;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.rag-chatbot-answer-title,
.rag-chatbot-sources-title {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}
.rag-chatbot-answer-content,
.rag-chatbot-sources-content {
    color: #334155;
    line-height: 1.7;
    font-size: 15px;
}
.rag-chatbot-answer-content p {
    margin: 0;
    white-space: pre-line;
    word-wrap: break-word;
}
.rag-chatbot-sources {
    margin: 20px 0;
    padding: 20px;
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.rag-chatbot-source-item--qa {
    border-bottom: 1px solid #f1f5f9;
    padding: 12px 0;
}
.rag-chatbot-source-item--qa:last-child {
    border-bottom: none;
}
.rag-chatbot-source-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    padding: 4px 0;
    transition: color 0.2s;
}
.rag-chatbot-source-toggle:hover {
    color: #3A7D44;
}
.rag-chatbot-source-number {
    font-weight: 700;
    color: #3A7D44;
}
.rag-chatbot-source-question {
    flex: 1;
}
.rag-chatbot-source-chevron {
    font-size: 12px;
    color: #94a3b8;
    transition: transform 0.2s;
}
.rag-chatbot-source-toggle[aria-expanded="true"] .rag-chatbot-source-chevron {
    transform: rotate(180deg);
}
.rag-chatbot-source-chunks {
    padding: 12px 0 4px 24px;
}
.rag-chatbot-chunk-text {
    padding: 12px;
    background-color: #f8fafc;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    color: #475569;
    border: 1px solid #f1f5f9;
}

/* 來源的標題粗體與清單項目符號來自瀏覽器預設值，Tailwind Preflight 會把
   h1-h6 的 font-weight 與 ul/ol 的 list-style 清掉。必須放在 .ai-title、
   .games-heading 等元件規則之前（0-1-0 打平由順序取勝），否則 800 會被
   這條 bold（700）蓋掉。 */
:is(.page-games, .page-ai, .page-resources) :where(h1, h2, h3, h4, h5, h6) {
  font-weight: bold;
}
:is(.page-games, .page-ai, .page-resources) :where(ul) {
  list-style-type: disc;
}
:is(.page-games, .page-ai, .page-resources) :where(ol) {
  list-style-type: decimal;
}

/* ================== AI 諮詢室（memory_0916/ai.html） ================== */
.page-ai {
    background: #FFF9FA;
    color: #3A2D31;
}
.memory-ai-main {
    width: 100%;
    max-width: 1180px;
    margin: auto;
    padding: 26px 24px 60px;
}
.ai-header-card {
    margin-bottom: 20px;
    padding: 24px;
    border: 1px solid #F0D9E0;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 3px 16px rgba(80, 40, 55, 0.07);
}
.ai-badge-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.ai-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border: 1px solid #FFDDE5;
    border-radius: 20px;
    background: #FFF2F5;
    color: #B74360;
    font-size: 12px;
    font-weight: 700;
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #FB6C8A;
    box-shadow: 0 0 0 2px rgba(251, 108, 138, 0.25);
    animation: status-pulse 2s infinite;
}
@keyframes status-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.88); }
}
.ai-tech-tag {
    padding: 3px 10px;
    border: 1px solid #F0D9E0;
    border-radius: 16px;
    background: #FFF8F4;
    color: #75676B;
    font-size: 11.5px;
    font-weight: 700;
}
.ai-title {
    margin: 0 0 6px;
    color: #3A2D31;
    font-size: 23px;
    font-weight: 800;
    letter-spacing: -0.2px;
}
.ai-subtitle {
    margin: 0;
    color: #75676B;
    font-size: 16px;
    line-height: 1.7;
}
.quick-ask-section {
    margin-bottom: 20px;
}
.quick-ask-label {
    display: block;
    margin-bottom: 10px;
    color: #75676B;
    font-size: 15px;
    font-weight: 700;
}
.quick-ask-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.quick-ask-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid #F0D9E0;
    border-radius: 14px;
    background: #fff;
    color: #3A2D31;
    box-shadow: 0 1px 3px rgba(80, 40, 55, 0.03);
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s ease;
}
.quick-ask-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: #FFDDE5;
    background: #FFF2F5;
    color: #B74360;
    box-shadow: 0 3px 8px rgba(183, 67, 96, 0.12);
}
.quick-ask-btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}
.page-ai .rag-chatbot-wrapper {
    width: 100%;
    margin: 20px 0;
}
.page-ai .rag-chatbot-form {
    margin-bottom: 20px;
    padding: 20px;
    border: 1px solid #F0D9E0;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 3px 16px rgba(80, 40, 55, 0.07);
}
.page-ai .rag-chatbot-input-group {
    gap: 14px;
}
.page-ai .rag-chatbot-lock {
    border-color: #FFDDE5;
    background: #FFF2F5;
    color: #75676B;
    font-size: 15px;
}
.page-ai .rag-chatbot-lock .memory-icon {
    color: #B74360;
}
.page-ai .rag-chatbot-lock button {
    background: #B74360;
    font-size: 14px;
    font-weight: 700;
}
.page-ai .rag-chatbot-lock button:hover {
    background: #9F3853;
}
.page-ai .rag-chatbot-textarea {
    min-height: 110px;
    padding: 16px;
    border: 1px solid #E4B8C4;
    border-radius: 12px;
    background: #fff;
    color: #3A2D31;
    font-size: 15px;
    line-height: 1.7;
}
.page-ai .rag-chatbot-textarea:focus {
    border-color: #FB6C8A;
    box-shadow: 0 0 0 3px rgba(251, 108, 138, 0.18);
}
.page-ai .rag-chatbot-textarea:disabled {
    background: #FFF8F4;
    opacity: 0.75;
}
.page-ai .rag-chatbot-submit,
.page-ai .rag-chatbot-clear {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 700;
}
.page-ai .rag-chatbot-submit {
    background: #B74360;
    box-shadow: 0 2px 8px rgba(183, 67, 96, 0.25);
}
.page-ai .rag-chatbot-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    background: #9F3853;
}
.page-ai .rag-chatbot-submit:disabled {
    background: #E4B8C4;
    box-shadow: none;
}
.page-ai .rag-chatbot-clear {
    border: 1px solid #F0D9E0;
    background: #FFF8F4;
    color: #75676B;
}
.page-ai .rag-chatbot-clear:hover {
    background: #FFF2F5;
    color: #B74360;
}
.page-ai .rag-chatbot-answer {
    margin: 20px 0;
    padding: 22px;
    border: 1px solid #F0D9E0;
    border-left: 5px solid #B74360;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 3px 16px rgba(80, 40, 55, 0.07);
}
.page-ai .rag-chatbot-answer-title,
.page-ai .rag-chatbot-sources-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    color: #3A2D31;
    font-size: 20px;
    font-weight: 800;
}
.page-ai .rag-chatbot-answer-title .memory-icon,
.page-ai .rag-chatbot-sources-title .memory-icon {
    color: #B74360;
}
.page-ai .rag-chatbot-answer-content,
.page-ai .rag-chatbot-sources-content {
    color: #3A2D31;
    font-size: 17px;
    line-height: 1.55;
}
.page-ai .rag-chatbot-sources {
    margin: 20px 0;
    padding: 22px;
    border: 1px solid #F0D9E0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 3px 16px rgba(80, 40, 55, 0.07);
}
.page-ai .rag-chatbot-source-item--qa {
    padding: 14px 0;
    border-bottom-color: #F0D9E0;
}
.page-ai .rag-chatbot-source-item--qa:last-child {
    padding-bottom: 4px;
}
.page-ai .rag-chatbot-source-toggle {
    gap: 10px;
    color: #3A2D31;
    font-size: 16px;
}
.page-ai .rag-chatbot-source-toggle:hover {
    color: #B74360;
}
.page-ai .rag-chatbot-source-number {
    flex-shrink: 0;
    color: #B74360;
    font-weight: 800;
}
.page-ai .rag-chatbot-source-question {
    line-height: 1.45;
}
.page-ai .rag-chatbot-source-chevron {
    flex-shrink: 0;
    margin-left: 6px;
    color: #6F6669;
}
.page-ai .rag-chatbot-source-chunks {
    padding: 10px 0 6px 28px;
}
.page-ai .rag-chatbot-chunk-text {
    padding: 12px 16px;
    border: 1px solid #F0D9E0;
    border-radius: 10px;
    background: #FFF8F4;
    color: #75676B;
    font-size: 15px;
    line-height: 1.7;
}
.source-tag {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 14px;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
}
.source-tag--senior {
    border: 1px solid #C9DEC8;
    background: #EDF4EF;
    color: #355A43;
}
.source-tag--expert {
    border: 1px solid #CED5E4;
    background: #F0F2F7;
    color: #3D4869;
}
@media (max-width: 600px) {
    .memory-ai-main {
        padding: 16px 14px 90px;
    }
    .ai-header-card {
        padding: 18px 16px;
    }
    .ai-title {
        font-size: 18px;
    }
    .page-ai .rag-chatbot-form {
        padding: 16px;
        border-radius: 16px;
    }
    .page-ai .rag-chatbot-answer,
    .page-ai .rag-chatbot-sources {
        padding: 16px;
    }
    .page-ai .rag-chatbot-source-toggle {
        flex-wrap: wrap;
        gap: 6px 8px;
    }
    .page-ai .rag-chatbot-source-question {
        order: 3;
        width: 100%;
        font-size: 14px;
    }
    .page-ai .rag-chatbot-source-chevron {
        margin-left: auto;
    }
    .page-ai .rag-chatbot-source-chunks {
        padding-left: 0;
    }
}

