﻿/* ============================================================
 * 鏁欏笀 AI 宸ュ叿绠辨牱寮? * ============================================================ */

/* ========== 椤甸潰甯冨眬 ========== */
html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden;
}

body.md2word-active {
    overflow: hidden;
}

.html-animation-prompt.is-login-required,
.html-animation-prompt:disabled,
.md-input.is-login-required,
.md-input:disabled {
    cursor: not-allowed;
    border-color: #d1d5db;
    background: #f3f4f6;
    color: #94a3b8;
}

.html-animation-prompt.is-login-required::placeholder,
.html-animation-prompt:disabled::placeholder,
.md-input.is-login-required::placeholder,
.md-input:disabled::placeholder {
    color: #64748b;
    font-weight: 800;
}

/* ========== 椤甸潰鏍囬鍖?========== */
.md2word-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #3b82f6 100%);
    padding: var(--site-nav-height, 54px) 1.5rem 0.8rem;
    text-align: center;
    color: white;
}

.header-content h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
}

.header-content h1 i {
    margin-right: 0.4rem;
    opacity: 0.9;
}

.header-content p {
    font-size: 0.95rem;
    opacity: 0.85;
    margin: 0 0 0.8rem 0;
}

.header-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
}

.header-tags .tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 0.78rem;
    backdrop-filter: blur(4px);
}

.header-tags .tag.formula {
    background: rgba(245, 158, 11, 0.25);
    border-color: rgba(245, 158, 11, 0.4);
}

.header-tags .tag i {
    font-size: 0.7rem;
}

/* ========== AI 宸ュ叿绠卞竷灞€ ========== */
.teacher-tools-main {
    --tools-sidebar-width: 220px;
    --tools-content-gap: 16px;
    --tools-content-max-width: 1200px;
    --tools-page-side-padding: max(20px, calc((100vw - var(--tools-content-max-width)) / 2));
    --tools-content-left: max(var(--tools-page-side-padding), calc((100% - var(--tools-content-max-width)) / 2));
    position: fixed;
    top: var(--site-nav-height, 54px);
    right: 0;
    bottom: 0;
    left: 0;
    flex: 1;
    width: 100%;
    max-width: none;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 10px var(--tools-page-side-padding) 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: grid;
    grid-template-columns: var(--tools-sidebar-width) minmax(0, 1fr);
    gap: var(--tools-content-gap);
    box-sizing: border-box;
}

.tools-sidebar {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    align-self: flex-start;
    position: sticky;
    top: 10px;
}

body.md2word-active .teacher-tools-main {
    display: block;
    position: fixed;
    top: var(--site-nav-height, 54px);
    right: 0;
    bottom: 0;
    left: 0;
    gap: 16px;
    height: auto;
    overflow: hidden;
    align-items: flex-start;
}

body.md2word-active .tools-workspace,
body.md2word-active #toolMd2Word.active {
    min-height: 0;
    height: 100%;
    overflow: hidden;
    margin-top: 0;
}

body.md2word-active .tools-workspace {
    width: calc(var(--tools-content-max-width) - var(--tools-sidebar-width) - var(--tools-content-gap));
    max-width: calc(var(--tools-content-max-width) - var(--tools-sidebar-width) - var(--tools-content-gap));
    min-width: 0;
    height: 100%;
    margin-left: calc(var(--tools-content-left) + var(--tools-sidebar-width) + var(--tools-content-gap));
    align-self: flex-start;
}

body.md2word-active .tools-sidebar {
    position: absolute;
    top: 16px;
    left: var(--tools-content-left);
    width: var(--tools-sidebar-width);
    max-height: calc(100% - 40px);
    overflow-y: auto;
    margin-top: 0;
    align-self: flex-start;
    box-sizing: border-box;
}

.tools-sidebar-banner {
    min-height: 34px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    padding: 4px 2px;
    border-radius: 0;
    background: transparent;
    border: 0;
    color: #1d4ed8;
    font-size: 1rem;
    font-weight: 800;
    box-sizing: border-box;
}

.tools-sidebar-banner i {
    width: 18px;
    text-align: center;
}

.ai-credit-sidebar-btn {
    width: 100%;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 0 14px;
    padding: 0 12px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.ai-credit-sidebar-btn:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.tool-group + .tool-group {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
}

.tool-group-title {
    color: #94a3b8;
    font-size: 0.76rem;
    font-weight: 700;
    margin: 0 0 8px;
}

.tool-nav-item,
.tool-coming {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.tool-nav-item {
    border: 1px solid transparent;
    background: transparent;
    color: #334155;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    transition: all 0.18s ease;
}

.tool-nav-item:hover {
    background: #f8fafc;
    border-color: #dbeafe;
    color: #1d4ed8;
}

.tool-nav-item.active {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
    font-weight: 700;
}

.tool-nav-item i,
.tool-coming i {
    width: 18px;
    text-align: center;
}

.tool-status-pill {
    margin-left: auto;
    padding: 3px 7px;
    border-radius: 999px;
    border: 1px solid #fde68a;
    background: #fffbeb;
    color: #92400e;
    font-size: 0.68rem;
    font-weight: 800;
    white-space: nowrap;
}

.tool-coming {
    color: #94a3b8;
}

.tools-workspace {
    width: 100%;
    max-width: calc(var(--tools-content-max-width, 1200px) - var(--tools-sidebar-width, 220px) - var(--tools-content-gap, 16px));
    min-width: 0;
}

.tool-panel {
    display: none;
    min-width: 0;
}

.tool-panel.active {
    display: block;
}

.tool-panel-header {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.tool-panel-header.compact {
    margin-bottom: 10px;
}

.tool-panel-header.html-simple-title {
    justify-content: flex-start;
}

.tool-panel-header.html-simple-title h2 {
    color: #000;
    font-weight: 800;
}

.tool-title-row {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tool-panel-header h2 {
    margin: 0;
    color: #111827;
    font-size: 1.18rem;
    font-weight: 750;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-panel-header h2 i {
    color: #2563eb;
}

.tool-panel-header p {
    margin: 0;
    color: #64748b;
    font-size: 0.86rem;
    line-height: 1.35;
}

.tool-badge {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    padding: 5px 9px;
    border-radius: 999px;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    font-size: 0.78rem;
    font-weight: 700;
}

.tool-badge-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.credit-badge {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fed7aa;
}

.dev-badge {
    background: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}

/* ========== Shared Tool Controls ========== */
.field-label {
    display: block;
    color: #1f2937;
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.field-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-block span {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 700;
}

.field-block select {
    width: 100%;
    min-width: 0;
    height: 38px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 0 10px;
    background: #fff;
    color: #111827;
    outline: none;
    font-size: 0.86rem;
}

.field-block select.is-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.field-error {
    display: block;
    min-height: 16px;
    color: #dc2626;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.35;
}

.field-error:empty {
    display: none;
}

.field-block optgroup {
    font-weight: 700;
}

.field-block option {
    font-weight: 400;
}

.reference-upload-block {
    margin-top: 12px;
}

.reference-upload-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.reference-upload-head .field-label {
    margin-bottom: 0;
}

.reference-upload-head span {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 700;
}

.reference-upload-drop {
    min-height: 76px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.reference-upload-drop:hover {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
}

.reference-upload-drop.is-disabled,
.reference-upload-drop:has(input:disabled) {
    cursor: not-allowed;
    opacity: 0.62;
}

.reference-upload-drop.is-disabled:hover,
.reference-upload-drop:has(input:disabled):hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    color: #334155;
}

.reference-upload-drop input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.reference-upload-drop i {
    font-size: 1.15rem;
}

.reference-upload-drop span {
    font-size: 0.88rem;
    font-weight: 700;
}

.reference-upload-drop small {
    color: #64748b;
    font-size: 0.75rem;
}

.reference-preview-list {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.reference-preview-item {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
}

.reference-preview-item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.reference-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(15, 23, 42, 0.15);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #334155;
    cursor: pointer;
}

.reference-remove-btn:hover {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fff1f2;
}

.primary-tool-btn,
.secondary-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
}

.primary-tool-btn {
    flex: 1;
    border: 1px solid #2563eb;
    color: #fff;
    background: #2563eb;
}

.primary-tool-btn:hover:not(:disabled) {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.primary-tool-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.secondary-tool-btn {
    border: 1px solid #dbe3ef;
    background: #fff;
    color: #475569;
}

.secondary-tool-btn:hover {
    border-color: #93c5fd;
    color: #1d4ed8;
    background: #eff6ff;
}

.result-header {
    padding: 13px 16px;
    border-bottom: 1px solid #edf2f7;
}

.result-header h3 {
    margin: 0;
    color: #111827;
    font-size: 1rem;
}

.result-header p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 0.8rem;
}

/* ========== HTML 骞抽潰鍔ㄧ敾 ========== */
.html-animation-layout {
    display: grid;
    grid-template-columns: minmax(360px, 0.82fr) minmax(460px, 1.18fr);
    gap: 12px;
}

.html-animation-form-panel,
.html-animation-output-panel {
    min-width: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.html-animation-form-panel {
    padding: 16px;
}

.html-animation-output-panel {
    min-height: 620px;
    display: flex;
    flex-direction: column;
}

.html-animation-prompt {
    width: 100%;
    min-height: 190px;
    resize: vertical;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 12px;
    line-height: 1.65;
    font-size: 0.92rem;
    color: #111827;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.html-animation-prompt:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.html-dev-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 14px;
    padding: 12px;
    border: 1px solid #fde68a;
    border-radius: 8px;
    background: #fffbeb;
    color: #78350f;
}

.html-dev-notice i {
    margin-top: 3px;
    color: #d97706;
}

.html-dev-notice strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.html-dev-notice p {
    margin: 0;
    color: #92400e;
    font-size: 0.82rem;
    line-height: 1.6;
}

.html-animation-prompt:disabled,
.html-animation-options-grid select:disabled,
.html-animation-preset:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.html-animation-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 14px;
}

.html-animation-preset {
    border: 1px solid #dbe3ef;
    background: #f8fafc;
    color: #334155;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.18s ease;
}

.html-animation-preset:hover {
    border-color: #93c5fd;
    color: #1d4ed8;
    background: #eff6ff;
}

.html-animation-options-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.html-framework-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1e3a8a;
    font-size: 0.82rem;
    line-height: 1.55;
}

.html-framework-note i {
    margin-top: 3px;
    color: #2563eb;
}

.html-animation-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.html-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.html-result-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.html-save-hint {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 8px 14px 0;
    padding: 9px 10px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1e40af;
    font-size: 0.82rem;
    line-height: 1.45;
}

.html-save-hint i {
    flex: 0 0 auto;
    color: #2563eb;
}

.html-save-hint a {
    color: #1d4ed8;
    font-weight: 700;
    text-decoration: none;
}

.html-save-hint a:hover {
    text-decoration: underline;
}

#htmlAnimationStatus[data-status="success"] {
    color: #047857;
    font-weight: 700;
}

#htmlAnimationStatus[data-status="error"] {
    color: #b91c1c;
    font-weight: 700;
}

.html-action-btn {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 0 10px;
    background: #fff;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
}

.html-action-btn:hover:not(:disabled) {
    border-color: #93c5fd;
    color: #1d4ed8;
    background: #eff6ff;
}

.html-action-btn.primary {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

.html-action-btn.primary:hover:not(:disabled) {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.html-action-btn:disabled {
    opacity: 0.52;
    cursor: not-allowed;
}

.html-preview-shell {
    position: relative;
    margin: 14px;
    min-height: 300px;
    aspect-ratio: 16 / 9;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
}

.html-preview-shell[data-ratio="4:3"] {
    aspect-ratio: 4 / 3;
}

.html-preview-shell[data-ratio="1:1"] {
    aspect-ratio: 1 / 1;
    max-height: 520px;
}

.html-preview-shell[data-ratio="9:16"] {
    aspect-ratio: 9 / 16;
    max-height: 620px;
    margin-left: auto;
    margin-right: auto;
    width: min(100%, 380px);
}

.html-preview-shell iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
    background: #fff;
}

.html-preview-empty,
.html-preview-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px;
    background: #f8fafc;
    color: #94a3b8;
    text-align: center;
    pointer-events: none;
}

.html-preview-shell.has-preview .html-preview-empty {
    display: none;
}

.html-preview-empty i {
    font-size: 2.7rem;
    opacity: 0.58;
}

.html-preview-empty p,
.html-preview-loading p {
    margin: 0;
    font-size: 0.9rem;
}

.html-preview-loading .loading-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.html-code-block {
    flex: 1;
    min-height: 260px;
    display: flex;
    flex-direction: column;
    margin: 0 14px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.html-code-output {
    flex: 1;
    min-height: 220px;
    width: 100%;
    border: 0;
    outline: none;
    resize: vertical;
    padding: 12px;
    background: #0f172a;
    color: #e5e7eb;
    font-size: 0.82rem;
    line-height: 1.6;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, 'Courier New', monospace;
    box-sizing: border-box;
}

.html-code-output::placeholder {
    color: #94a3b8;
}

.html-history-panel {
    display: none;
    margin: 0 14px 14px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
}

.html-history-panel.is-open {
    display: block;
}

.html-history-head {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 12px;
    border-bottom: 1px solid #e5e7eb;
    color: #0f172a;
    font-size: 0.9rem;
}

.html-history-close {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
}

.html-history-close:hover {
    border-color: #bfdbfe;
    color: #1d4ed8;
    background: #eff6ff;
}

.html-history-list {
    max-height: 260px;
    overflow: auto;
    padding: 6px;
}

.html-history-item {
    width: 100%;
    display: grid;
    gap: 5px;
    padding: 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.html-history-item:hover {
    background: #f1f5f9;
}

.html-history-title {
    min-width: 0;
    color: #0f172a;
    font-size: 0.9rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.html-history-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    color: #64748b;
    font-size: 0.78rem;
}

.html-history-state {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    color: #64748b;
    font-size: 0.86rem;
}

/* ========== 鏍囬妯箙 ========== */
.md2word-banner {
    margin-top: 0;
    background: #3b82f6;
    padding: 14px 1.5rem;
    text-align: center;
}

.md2word-banner h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.md2word-banner h1 i {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* ========== 涓诲唴瀹瑰尯 ========== */
.md2word-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0.5rem 1rem 1.5rem;
    box-sizing: border-box;
}

/* ========== 宸ュ叿鏍?========== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0;
    gap: 0.5rem;
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    color: #374151;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toolbar-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #f0f7ff;
}

.toolbar-btn:active {
    transform: scale(0.97);
}

.toolbar-btn i {
    font-size: 0.85rem;
}

.btn-export {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white !important;
    border: none !important;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-export:hover:not(:disabled) {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

.btn-export:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.char-count {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-left: 0.25rem;
}

/* ========== 鍒嗗睆闈㈡澘 ========== */
.split-panel {
    flex: 1;
    display: flex;
    gap: 0;
    min-height: 560px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

#toolMd2Word.active {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#toolMd2Word .toolbar {
    flex-shrink: 0;
}

#toolMd2Word .split-panel {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.panel-left, .panel-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

#toolMd2Word .panel-right {
    margin-bottom: 2px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.6rem 1rem;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.panel-header i {
    color: #3b82f6;
    font-size: 0.85rem;
}

.panel-header-title,
.panel-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.panel-header-title {
    white-space: nowrap;
}

.panel-header-actions {
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

#toolMd2Word .panel-header .toolbar-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 7px;
}

#toolMd2Word .panel-header .char-count {
    margin-left: 0;
    white-space: nowrap;
}

/* 杈撳叆鍖?*/
.md-input {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    padding: 1rem;
    font-size: 0.9rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, 'Courier New', monospace;
    line-height: 1.7;
    color: #1f2937;
    background: white;
    box-sizing: border-box;
}

.md-input::placeholder {
    color: #9ca3af;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 鍒嗛殧绾?*/
.panel-divider {
    width: 6px;
    background: #e5e7eb;
    cursor: col-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
    position: relative;
}

.panel-divider:hover,
.panel-divider.dragging {
    background: #3b82f6;
}

.divider-handle {
    color: #9ca3af;
    font-size: 0.7rem;
}

.panel-divider:hover .divider-handle,
.panel-divider.dragging .divider-handle {
    color: white;
}

/* 棰勮鍖?*/
.md-preview {
    flex: 1;
    min-height: 0;
    padding: 1rem 1.25rem;
    overflow-y: auto;
    color: #1f2937;
    line-height: 1.8;
    font-size: 0.92rem;
}

.preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
    text-align: center;
}

.preview-empty i {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.preview-empty p {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ========== 棰勮鍖?Markdown 鎺掔増鏍峰紡 ========== */
.md-preview h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #e5e7eb;
    color: #111827;
}

.md-preview h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.25rem 0 0.6rem 0;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #f3f4f6;
    color: #1f2937;
}

.md-preview h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem 0;
    color: #374151;
}

.md-preview h4, .md-preview h5, .md-preview h6 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0.8rem 0 0.4rem 0;
    color: #4b5563;
}

.md-preview p {
    margin: 0 0 0.7rem 0;
}

.md-preview ul, .md-preview ol {
    margin: 0.3rem 0 0.7rem 0;
    padding-left: 1.5rem;
}

.md-preview li {
    margin-bottom: 0.25rem;
}

.md-preview strong {
    font-weight: 600;
    color: #111827;
}

.md-preview em {
    font-style: italic;
    color: #4b5563;
}

.md-preview blockquote {
    margin: 0.5rem 0 0.7rem 0;
    padding: 0.5rem 1rem;
    border-left: 4px solid #3b82f6;
    background: #f0f7ff;
    border-radius: 0 8px 8px 0;
    color: #374151;
}

.md-preview blockquote p {
    margin: 0;
}

.md-preview code {
    background: #f3f4f6;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    color: #e11d48;
}

.md-preview pre {
    background: #1f2937;
    color: #e5e7eb;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5rem 0 0.7rem 0;
    font-size: 0.85rem;
    line-height: 1.6;
}

.md-preview pre code {
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

.md-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0 0.7rem 0;
    font-size: 0.88rem;
}

.md-preview th, .md-preview td {
    border: 1px solid #d1d5db;
    padding: 0.45rem 0.75rem;
    text-align: left;
}

.md-preview th {
    background: #f3f4f6;
    font-weight: 600;
    color: #374151;
}

.md-preview tr:nth-child(even) {
    background: #f9fafb;
}

.md-preview hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 1rem 0;
}

.md-preview a {
    color: #3b82f6;
    text-decoration: none;
}

.md-preview a:hover {
    text-decoration: underline;
}

.md-preview img {
    max-width: 100%;
    border-radius: 8px;
    margin: 0.5rem 0;
}

/* MathJax 鍏紡鏍峰紡璋冩暣 */
.md-preview .MathJax {
    font-size: 1.05em !important;
}

/* ========== 浣跨敤璇存槑 ========== */
.usage-tips {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.usage-tips h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.8rem 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.usage-tips h3 i {
    color: #f59e0b;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.tip-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.tip-step {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.tip-text strong {
    display: block;
    font-size: 0.9rem;
    color: #1f2937;
    margin-bottom: 0.2rem;
}

.tip-text p {
    margin: 0;
    font-size: 0.82rem;
    color: #6b7280;
    line-height: 1.5;
}

/* ========== 瀵煎嚭涓伄缃?========== */
.export-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.export-overlay.show {
    display: flex;
}

.export-loading {
    background: white;
    padding: 2rem 2.5rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.export-loading .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

.export-loading p {
    color: #374151;
    font-size: 0.95rem;
    margin: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== Footer 閫傞厤 ========== */
.footer {
    margin-top: auto;
}

/* ========== 鍝嶅簲寮忛€傞厤 ========== */
@media (max-width: 768px) {
    .teacher-tools-main {
        --tools-page-side-padding: 12px;
        grid-template-columns: 1fr;
        padding-top: 8px;
        padding-bottom: 18px;
    }

    .tools-sidebar {
        position: static;
        display: flex;
        gap: 10px;
        overflow-x: auto;
        padding: 10px;
    }

    .tools-sidebar-banner {
        flex: 0 0 auto;
        min-width: 130px;
        min-height: 38px;
        margin: 0;
        padding: 8px 2px;
        font-size: 0.9rem;
    }

    .ai-credit-sidebar-btn {
        flex: 0 0 auto;
        width: auto;
        min-width: 140px;
        margin: 0;
    }

    .tool-group {
        min-width: 180px;
    }

    .tool-group + .tool-group {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
    }

    .tool-group-muted {
        display: none;
    }

    .tool-panel-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .tool-title-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .tool-badge-row {
        justify-content: flex-start;
    }

    .html-animation-layout {
        grid-template-columns: 1fr;
    }

    .html-animation-output-panel {
        min-height: 520px;
    }

    .html-animation-options-grid {
        grid-template-columns: 1fr;
    }

    .html-result-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .html-preview-shell {
        min-height: 240px;
    }

    .reference-preview-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .md2word-header {
        padding: var(--site-nav-height, 54px) 1rem 1rem;
    }

    .header-content h1 {
        font-size: 1.3rem;
    }

    .header-content p {
        font-size: 0.85rem;
    }

    .header-tags .tag {
        font-size: 0.72rem;
        padding: 0.2rem 0.5rem;
    }

    .md2word-main {
        padding: 0 0.75rem 1rem;
    }

    .toolbar {
        flex-wrap: wrap;
    }

    .split-panel {
        flex-direction: column;
        min-height: 600px;
    }

    #toolMd2Word.active {
        min-height: calc(100vh - 90px);
    }

    #toolMd2Word .split-panel {
        min-height: calc(100vh - 150px);
    }

    .panel-left, .panel-right {
        flex: none;
        height: max(320px, calc((100vh - 170px) / 2));
    }

    .panel-divider {
        width: 100%;
        height: 6px;
        cursor: row-resize;
    }

    .divider-handle {
        transform: rotate(90deg);
    }

    .tips-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .reference-preview-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .header-tags {
        gap: 0.3rem;
    }

    .toolbar-btn {
        padding: 0.4rem 0.7rem;
        font-size: 0.8rem;
    }

    .toolbar-btn span {
        display: none;
    }

    .html-animation-actions,
    .html-result-actions {
        width: 100%;
    }

    .html-animation-actions .primary-tool-btn,
    .html-animation-actions .secondary-tool-btn,
    .html-result-actions .html-action-btn {
        flex: 1;
    }

    .panel-left, .panel-right {
        height: max(300px, calc((100vh - 160px) / 2));
    }
}

body.md2word-active #toolMd2Word.active,
body.md2word-active #toolMd2Word .split-panel {
    min-height: 0;
    overflow: hidden;
}

@media (max-width: 768px) {
    body.md2word-active .teacher-tools-main {
        display: flex;
        flex-direction: column;
    }

    body.md2word-active .tools-sidebar {
        position: static;
        flex: 0 0 auto;
        width: 100%;
        max-height: none;
        overflow-y: visible;
    }

    body.md2word-active .tools-workspace {
        width: 100%;
        height: 100%;
        margin-left: 0;
    }

    body.md2word-active #toolMd2Word .split-panel {
        height: 100%;
    }

    body.md2word-active #toolMd2Word .panel-left,
    body.md2word-active #toolMd2Word .panel-right {
        flex: 1 1 0;
        height: auto;
        min-height: 0;
    }
}

/* ========== AI 宸ュ叿鎿嶄綔姝ラ鎸囧紩 ========== */
.ai-tools-guide-entry {
    width: 100%;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 0 14px;
    padding: 0 12px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.9rem;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.ai-tools-guide-entry:hover {
    border-color: #93c5fd;
    background: #dbeafe;
    color: #1e40af;
}

.ai-tools-guide-focus {
    position: fixed;
    z-index: 10020;
    pointer-events: none;
    border: 2px solid #fbbf24;
    border-radius: 8px;
    box-shadow:
        0 0 0 9999px rgba(15, 23, 42, 0.66),
        0 0 0 6px rgba(251, 191, 36, 0.18),
        0 16px 42px rgba(15, 23, 42, 0.26);
    transition: left 0.22s ease, top 0.22s ease, width 0.22s ease, height 0.22s ease;
}

.ai-tools-guide-popover {
    position: fixed;
    z-index: 10030;
    padding: 16px;
    color: #172033;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.32);
    line-height: 1.6;
}

.ai-tools-guide-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #64748b;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.ai-tools-guide-close:hover {
    background: rgba(15, 23, 42, 0.06);
    color: #111827;
}

.ai-tools-guide-kicker {
    padding-right: 28px;
    font-size: 12px;
    font-weight: 800;
    color: #2563eb;
}

.ai-tools-guide-progress {
    height: 5px;
    margin: 8px 0 12px;
    overflow: hidden;
    background: #e5e7eb;
    border-radius: 999px;
}

.ai-tools-guide-progress span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #f59e0b);
    border-radius: inherit;
    transition: width 0.2s ease;
}

.ai-tools-guide-popover h3 {
    margin: 0 0 8px;
    color: #0f172a;
    font-size: 17px;
    line-height: 1.35;
    letter-spacing: 0;
}

.ai-tools-guide-popover p {
    margin: 0;
    color: #475569;
    font-size: 14px;
}

.ai-tools-guide-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.ai-tools-guide-btn {
    min-height: 34px;
    padding: 7px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.ai-tools-guide-btn:hover:not(:disabled) {
    border-color: #2563eb;
    color: #1d4ed8;
}

.ai-tools-guide-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.ai-tools-guide-btn.primary {
    border-color: #2563eb;
    background: #2563eb;
    color: #ffffff;
}

.ai-tools-guide-btn.primary:hover {
    border-color: #1d4ed8;
    background: #1d4ed8;
    color: #ffffff;
}

.ai-tools-guide-btn.ghost {
    border-color: transparent;
    color: #64748b;
}

.ai-tools-guide-btn.ghost:hover {
    background: #f8fafc;
    color: #334155;
}

@media (max-width: 768px) {
    .ai-tools-guide-entry {
        flex: 0 0 auto;
        width: auto;
        min-width: 118px;
        margin: 0;
    }

    .ai-tools-guide-popover {
        padding: 14px;
    }

    .ai-tools-guide-actions {
        justify-content: stretch;
    }

    .ai-tools-guide-btn {
        flex: 1 1 auto;
    }
}
