/* ===== 论文改写助手 · 独立样式 v3 ===== */
/* 布局模式同平台产品页（sidebar + topbar + main），工具型双面板布局 */

/* ---- 滚动容器 ---- */
.rewrite {
    padding-bottom: 40px;
    min-width: 0;
}
.rewrite > * {
    max-width: min(1200px, 100%);
    margin-left: auto;
    margin-right: auto;
}

/* ---- 页面标题 ---- */
.page-head {
    margin: 4px auto 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}
.page-title {
    margin: 0;
    font-size: 30px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: .5px;
}
.page-desc {
    margin: 0;
    font-size: 15px;
    color: var(--text-2);
    line-height: 1.6;
}

/* ============================================================
   工具面板（输入 + 输出，并排双列）
   ============================================================ */
.tool-area {
    display: flex;
    gap: 20px;
    margin-bottom: 48px;
}
.tool-panel {
    flex: 1;
    min-width: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ---- 面板头部 ---- */
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(180deg, #f7f9fc, #eef2f9);
    border-bottom: 1px solid var(--border);
}
.panel-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

/* ---- 清空 / 复制按钮 ---- */
.btn-clear,
.btn-copy {
    padding: 5px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text-2);
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
}
.btn-clear:hover,
.btn-copy:hover:not(:disabled) {
    border-color: var(--brand);
    color: var(--brand);
    background: var(--brand-light);
}
.btn-copy:disabled {
    opacity: .4;
    cursor: not-allowed;
}

/* ---- 输入框 ---- */
.input-area {
    flex: 1;
    min-height: 340px;
    padding: 20px;
    border: none;
    outline: none;
    resize: vertical;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
    background: transparent;
}
.input-area::placeholder {
    color: var(--text-3);
}

/* ---- 输出区域 ---- */
.output-area {
    flex: 1;
    min-height: 340px;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
    overflow-y: auto;
    position: relative;
}
.output-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: var(--text-3);
    text-align: center;
}
.output-placeholder svg { opacity: .35; }
.output-placeholder p { margin: 0; font-size: 14px; }

/* ---- 加载动画 ---- */
.output-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
}
.loading-dots { display: flex; gap: 8px; }
.loading-dots span {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--brand);
    animation: dotPulse 1.2s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: .2s; }
.loading-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dotPulse {
    0%, 80%, 100% { transform: scale(.6); opacity: .4; }
    40% { transform: scale(1); opacity: 1; }
}
.output-loading p {
    margin: 0;
    font-size: 14px;
    color: var(--text-2);
}

/* ---- 结果输出 ---- */
.output-result {
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
}

/* ---- 错误输出 ---- */
.output-error {
    padding: 20px 0;
    text-align: center;
    color: #e04040;
    font-size: 14px;
}

/* ---- 面板底部 ---- */
.panel-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-top: 1px solid var(--border);
    background: #f8fafd;
}
.char-count {
    font-size: 13px;
    color: var(--text-3);
}
.char-overflow {
    font-size: 13px;
    color: #e04040;
    font-weight: 600;
    margin-left: 8px;
}

/* ---- 改写按钮 ---- */
.btn-rewrite {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--brand);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    padding: 10px 28px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all .2s ease;
    box-shadow: 0 3px 12px rgba(47, 107, 255, .2);
}
.btn-rewrite:hover:not(:disabled) {
    background: var(--brand-dark);
    box-shadow: 0 5px 18px rgba(47, 107, 255, .32);
    transform: translateY(-1px);
}
.btn-rewrite:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

/* ---- 状态标签 ---- */
.status-tag {
    font-size: 12.5px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
}
.status-ok { background: #dcfce7; color: #15803d; }
.status-error { background: #fee2e2; color: #b91c1c; }
.status-pending { background: #fff3cd; color: #92400e; }

/* ============================================================
   改写规则说明区域
   ============================================================ */
.workbench-section {
    margin-bottom: 48px;
}
.section-title {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    text-align: center;
}
.section-desc {
    margin: 0 0 24px;
    font-size: 14px;
    color: var(--text-2);
    text-align: center;
}

.features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 48px;
}
.feature-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px 20px;
    text-align: center;
    transition: box-shadow .2s ease;
}
.feature-item:hover {
    box-shadow: var(--shadow-card);
}
.feature-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    background: var(--brand-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand);
}
.feature-item h3 {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.feature-item p {
    margin: 0;
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.6;
}

/* ============================================================
   验证弹窗
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(28, 36, 51, .55);
    backdrop-filter: blur(3px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all .25s;
    padding: 20px;
}
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.modal-content {
    background: var(--card);
    border-radius: 16px;
    width: 100%;
    max-width: 430px;
    padding: 28px 26px;
    position: relative;
    transform: translateY(14px) scale(.97);
    transition: transform .25s;
    box-shadow: 0 20px 60px rgba(15, 30, 70, .25);
}
.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}
.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-3);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
}
.modal-close:hover {
    background: rgba(47, 107, 255, .18);
    color: var(--brand);
}
.modal-header {
    text-align: center;
    margin-bottom: 22px;
}
.modal-header h3 {
    margin: 0 0 6px;
    font-size: 19px;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.modal-header h3 svg {
    color: var(--brand);
    flex-shrink: 0;
}
.modal-header p {
    margin: 0;
    color: var(--text-3);
    font-size: 13px;
}
.qr-section {
    display: flex;
    gap: 18px;
    align-items: center;
    margin-bottom: 20px;
}
.qr-code {
    width: 130px;
    height: 130px;
    padding: 8px;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    flex-shrink: 0;
}
.qr-code img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.qr-tips { flex: 1; min-width: 0; }
.qr-tips p {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text-2);
    font-size: 13.5px;
    margin: 0 0 13px;
    line-height: 1.5;
}
.qr-tips p:last-child { margin-bottom: 0; }
.qr-tips strong { color: var(--brand); }
.step-num {
    font-style: normal;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--brand-light);
    color: var(--brand);
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ---- 验证码输入 ---- */
.verify-input {
    display: flex;
    gap: 10px;
}
.verify-input input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    outline: none;
    transition: border-color .15s;
    letter-spacing: 2px;
}
.verify-input input:focus {
    border-color: var(--brand);
}
.verify-input button {
    padding: 10px 22px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
}
.verify-input button:hover {
    background: var(--brand-dark);
}
.verify-status {
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    font-weight: 600;
    display: none;
}
.verify-status.error { color: #e04040; display: block; }
.verify-status.success { color: #16a34a; display: block; }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 900px) {
    .tool-area { flex-direction: column; }
    .features { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .page-title { font-size: 24px; }
    .features { grid-template-columns: 1fr; }
    .panel-head, .panel-foot { padding: 10px 14px; }
    .input-area, .output-area { min-height: 240px; padding: 14px; }
}