* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #f4f7f6;
    margin: 0;
    padding: 40px;
    display: flex;
    justify-content: center;
}

.container {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,.05);
    width: 90%;
    max-width: 1000px;
}

h1 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 24px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.subtitle {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-bottom: 30px;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 900px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }
}

.card {
    background-color: #fff;
    border-radius: 8px;
    padding: 25px;
    border: 1px solid #eee;
}

.card-title {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eaeaea;
    color: #2c3e50;
    font-size: 16px;
    font-weight: bold;
}

.card-title i {
    margin-right: 10px;
    color: #3498db;
}

/* 组合输入区样式（核心修改：固定高度+禁止溢出） */
.combined-input-area {
    border: 2px dashed #dcdcdc;
    border-radius: 6px;
    background-color: #fafafa;
    transition: border-color .3s;
    margin-bottom: 15px;
    /* 固定高度，避免上传后尺寸变化，可根据需要调整数值 */
    height: 420px; 
    display: flex;
    flex-direction: column;
    /* 防止内部内容溢出虚线框 */
    overflow: hidden; 
}

.combined-input-area.dragover {
    border-color: #007bff;
    background-color: #f0f8ff;
}

.upload-section {
    padding: 5px 20px;
    text-align: center;
    cursor: pointer;
    flex-shrink: 0;
    border-bottom: 1px solid #eee;
}

.upload-icon {
    font-size: 2.5rem;
    color: #7f8c8d;
    margin-bottom: 12px;
}

.upload-text {
    font-size: 1rem;
    margin-bottom: 8px;
    color: #2c3e50;
}

.upload-hint {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.paste-hint {
    color: #3498db;
    font-size: 0.9rem;
    margin-top: 8px;
    font-weight: 500;
}

.text-input-section {
    flex-grow: 1;
    padding: 15px;
    display: flex;
}

/* 文本框样式（核心修改：禁止拖拽+滚动条） */
.text-input {
    width: 100%;
    height: 100%;
    min-height: 140px;
    border: none;
    padding: 0;
    font-family: Consolas, Monaco, monospace;
    font-size: 14px;
    /* 禁止拖拽调整大小 */
    resize: none; 
    outline: none;
    background: transparent;
    white-space: pre-wrap;
    word-wrap: break-word;
    /* 内容超出时显示纵向滚动条 */
    overflow-y: auto; 
}

.file-input {
    display: none;
}

.key-info {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.btn-group {
    margin-top: 15px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

button {
    padding: 10px 25px;
    font-size: 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background-color: #007bff;
    color: #fff;
    width: 210px;
}

button:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-verifyBtn {
    background-color: #28a745;
}

.btn-verifyBtn:hover {
    background-color: #218838;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 4px solid #007bff;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    color: #e74c3c;
    background-color: #fdeaea;
    padding: 15px;
    border-radius: 6px;
    margin-top: 20px;
    display: none;
    align-items: center;
    gap: 10px;
}

.result-area {
    margin-top: 30px;
    padding: 25px;
    border-radius: 8px;
    background-color: #fff;
    border: 1px solid #eee;
    display: none;
}

.result-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 16px;
    font-weight: bold;
}

.result-header i {
    margin-right: 10px;
    font-size: 1.2rem;
}

.match-result {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    font-size: 1.2rem;
    font-weight: bold;
}

.match-success {
    background-color: #d5f4e6;
    color: #27ae60;
    border: 2px solid #2ecc71;
}

.match-failure {
    background-color: #fdeaea;
    color: #e74c3c;
    border: 2px solid #e74c3c;
}

.info-box {
    background-color: #f8f9fa;
    border-left: 4px solid #007bff;
    padding: 15px;
    margin-top: 25px;
    border-radius: 0 8px 8px 0;
}

.info-box h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    font-size: 16px;
}

.info-box h3 i {
    margin-right: 10px;
}

.info-box ul {
    padding-left: 20px;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.info-box li {
    margin-bottom: 8px;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
    color: #7f8c8d;
    font-size: 12px;
}

.status-ok {
    color: #27ae60;
}

.status-error {
    color: #e74c3c;
}

/* ==================== 平板端适配（≤768px，包含小平板/大屏手机） ==================== */
@media (max-width: 768px) {
    /* 容器边距缩小，充分利用屏幕空间 */
    .container {
        padding: 20px;
        width: 95%;
    }

    /* 标题字号缩小，减少顶部占用 */
    h1 {
        font-size: 20px;
        margin-bottom: 8px;
    }
    .subtitle {
        margin-bottom: 20px;
        font-size: 13px;
    }

    /* 卡片内边距缩小 */
    .card {
        padding: 15px;
    }
    .card-title {
        font-size: 15px;
        margin-bottom: 15px;
        padding-bottom: 12px;
    }

    /* 输入区高度改为自适应，不再固定420px */
    .combined-input-area {
        height: auto;
        min-height: 300px;
    }

    /* 隐藏移动端无效的「拖拽上传」提示 */
    .upload-text {
        display: none;
    }
    .upload-section {
        padding: 12px 15px;
    }
    .upload-icon {
        font-size: 2rem; /* 图标缩小，节省空间 */
    }
    .upload-hint {
        font-size: 0.85rem;
    }
    .paste-hint {
        font-size: 0.85rem;
    }

    /* 文本框字体改为16px，避免iOS点击输入框时自动放大页面（核心坑点） */
    .text-input {
        font-size: 16px;
    }

    /* 底部操作按钮组：竖排+占满宽度，方便拇指点击 */
    .btn-group[style*="justify-content: flex-end"] {
        flex-direction: column;
        gap: 10px;
    }
    .btn-group[style*="justify-content: flex-end"] button {
        width: 100% !important; /* 覆盖原有210px固定宽度 */
        padding: 12px 25px; /* 加大点击区域 */
    }

    /* 结果/下载区块内边距缩小 */
    .result-area, .info-box {
        padding: 15px;
    }
    .info-box h3 {
        font-size: 15px;
    }
    .info-box li {
        font-size: 13px;
    }

    /* 弹窗内边距缩小，适配小屏幕 */
    .modal-header, .modal-body, .modal-footer {
        padding: 15px;
    }
    .modal-header {
        font-size: 15px;
    }
    .modal-body {
        font-size: 13px;
    }

    /* 单选框组：小屏幕下适当增大点击区域 */
    .btn-group[style*="justify-content: center"] label {
        padding: 6px 0;
    }
}

/* ==================== 小屏手机适配（≤480px，如iPhone SE/12 mini等） ==================== */
@media (max-width: 480px) {
    body {
        padding: 15px 0; /* 进一步缩小页面边距 */
    }
    .container {
        padding: 15px;
        width: 98%;
    }

    /* 单选框组改为竖排，避免文字挤在一起 */
    .btn-group[style*="justify-content: center"] {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .btn-group[style*="justify-content: center"] label {
        margin-right: 0 !important; /* 覆盖原有20px右外边距 */
        width: 100%;
    }

    /* 弹窗按钮占满宽度，方便点击 */
    .modal-footer {
        flex-direction: column;
    }
    .modal-footer button {
        width: 100%;
    }

    /* 底部footer改为竖排，隐藏无意义的分隔符 */
    footer[style*="text-align: center"] {
        display: flex;
        flex-direction: column;
        gap: 8px;
        font-size: 12px;
    }
    footer[style*="text-align: center"] span {
        display: none; /* 隐藏中间的「|」分隔符 */
    }
    footer[style*="text-align: center"] a {
        margin: 0 !important; /* 覆盖原有左右外边距 */
    }

    /* 上传区提示文字进一步缩小 */
    .upload-hint, .paste-hint {
        font-size: 0.8rem;
    }
}

/* ==================== 通用移动端优化（所有屏幕生效） ==================== */
/* 禁止iOS按钮默认样式，避免外观变形 */
button {
    -webkit-appearance: none;
    appearance: none;
}
/* 确保单选框/复选框点击区域足够大 */
input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
}
/* 禁止页面缩放（但允许用户手动缩放看长私钥，不要加user-scalable=no！） */
/* 已通过textarea字体16px解决iOS自动缩放问题 */