.tool-container {
    width: 100%;
    margin: 0 auto;
}

.card {
    background: white;
    border-radius: 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 1000px;   /* 新增：卡片最大宽度 1000px */
    width: 100%;         /* 新增：让卡片填满父容器宽度，但在超过 1000px 时停止 */
    margin: 0 auto;      /* 新增：水平居中 */
}

.card > * {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}


.tool-header {
    background: white;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e9edf4;
}

.tool-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    background: linear-gradient(145deg, #1e293b, #0f172a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-header p {
    color: #475569;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tool-header p span {
    background: #eef2ff;
    color: #1e40af;
    padding: 0.2rem 0.8rem;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.tool-main-panel {
    padding: 2rem;
    background: #ffffff;
}

/* 模式切换 */
.mode-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    background: #f8fafc;
    padding: 0.8rem 1.2rem;
    border-radius: 40px;
    border: 1px solid #e2e8f0;
}

.mode-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #475569;
}

.mode-selector {
    display: flex;
    gap: 0.5rem;
}

.mode-btn {
    background: white;
    border: 1px solid #cbd5e1;
    padding: 0.4rem 1.2rem;
    border-radius: 40px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.15s;
}

.mode-btn.active {
    background: #1e293b;
    border-color: #1e293b;
    color: white;
}

.mode-btn:hover:not(.active) {
    background: #f1f5f9;
    border-color: #94a3b8;
}

/* 输入源选项卡（仅编码模式显示） */
.input-source-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.source-tab {
    background: white;
    border: 1px solid #cbd5e1;
    padding: 0.4rem 1.2rem;
    border-radius: 40px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.15s;
}

.source-tab.active {
    background: #1e293b;
    border-color: #1e293b;
    color: white;
}

.source-tab:hover:not(.active) {
    background: #f1f5f9;
    border-color: #94a3b8;
}

/* 双栏布局 */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 680px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }
}

.input-col,
.output-col {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.label-row label {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.label-row label i {
    font-style: normal;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 400;
    color: #475569;
}

.clear-btn {
    background: none;
    border: 1px solid #e2e8f0;
    font-size: 0.75rem;
    padding: 0.3rem 1rem;
    border-radius: 40px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
    background: white;
}

.clear-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

.textarea {
    width: 100%;
    height: 250px;
    padding: 1rem 1.2rem;
    font-family: 'SF Mono', 'Fira Code', 'Roboto Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    background: #fafcff;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    resize: vertical;
    outline: none;
    transition: 0.15s;
    color: #0b1e33;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.02);
}

.textarea:focus {
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.output-box {
    background: #f1f5f9;
    border-color: #d1d9e6;
    color: #1e293b;
    resize: none;
}

.stats {
    font-size: 0.75rem;
    background: #ecfdf5;
    color: #065f46;
    padding: 0.2rem 1rem;
    border-radius: 30px;
    border: 1px solid #a7f3d0;
}

/* 文件上传区域（嵌入左侧列） */
.file-input-area {
    width: 100%;
    height: 250px; /* 与文本域等高 */
    padding: 1.5rem;
    background: #f8fafc;
    border: 1px dashed #94a3b8;
    border-radius: 20px;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.file-input-area:hover {
    background: #f1f5f9;
}

.file-input-area input {
    display: none;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #475569;
    cursor: pointer;
}

.file-upload-label span {
    font-size: 2rem;
}

.file-name-display {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #1e293b;
    max-width: 100%;
    word-break: break-word;
}

.hidden {
    display: none !important;
}

/* 选项区 */
.options-row {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin: 1rem 0;
    flex-wrap: wrap;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3b82f6;
}

.checkbox-item label {
    font-size: 0.9rem;
    color: #334155;
    cursor: pointer;
}

/* 操作栏 */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: space-between;
}

.btn-group {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.btn {
    background: white;
    border: 1px solid #cbd5e1;
    padding: 0.6rem 1.5rem;
    border-radius: 40px;
    font-weight: 500;
    font-size: 0.9rem;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.btn-primary {
    background: #1e293b;
    border-color: #1e293b;
    color: white;
    box-shadow: 0 8px 16px -6px rgba(30, 41, 59, 0.3);
}

.btn-primary:hover {
    background: #0f172a;
    border-color: #0f172a;
    transform: translateY(-1px);
}

.btn-secondary:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.btn-success {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    border-color: #059669;
}

.btn-icon {
    font-size: 1.1rem;
    line-height: 1;
}

/* 使用说明区域 */
.info-section {
    margin-top: 2rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 1.2rem;
}

.info-title {
    font-weight: 600;
    font-size: 1rem;
    color: #1e293b;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 640px) {
    .info-content {
        grid-template-columns: 1fr;
    }
}

.info-col h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.5rem;
}

.info-col ul {
    list-style-type: none;
    padding-left: 0;
}

.info-col li {
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 0.5rem;
    padding-left: 1.2rem;
    position: relative;
}

.info-col li::before {
    content: "•";
    color: #3b82f6;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.info-col code {
    background: #e2e8f0;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.8rem;
}

/* 错误提示 */
.error-message {
    background: #fee2e2;
    border-left: 5px solid #ef4444;
    color: #b91c1c;
    padding: 0.9rem 1.5rem;
    border-radius: 18px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 0.8rem;
}

.error-message.hidden {
    display: none;
}

.tool-footer-note {
    margin-top: 1.5rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.75rem;
    border-top: 1px dashed #e2e8f0;
    padding-top: 1.2rem;
}