/* ============================================================
   椭圆曲线公钥密码算法可视化演示 - 样式表
   设计规范：教材级专业风格，低饱和度配色，严谨层次
   ============================================================ */

/* ---------- 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }

body {
    margin: 0; padding: 0;
    font-family: "Noto Sans SC", "Source Han Sans SC", "WenQuanYi Micro Hei",
                 "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem; line-height: 1.75;
    color: #2c3e50; background-color: #f7f8fa;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- 页面头部 ---------- */
.page-header {
    background: linear-gradient(135deg, #1a2a3a 0%, #2c4a6a 100%);
    color: #ffffff; padding: 2.5rem 1.5rem 2rem;
    text-align: center; border-bottom: 4px solid #3a7bd5;
}
.page-header h1 { font-size: 1.85rem; font-weight: 600; letter-spacing: 0.04em; margin: 0 0 0.4rem; }
.page-header .subtitle { font-size: 0.92rem; color: rgba(255,255,255,0.7); margin: 0; letter-spacing: 0.02em; }

/* ---------- 算法切换器 ---------- */
.switch-bar {
    display: flex; align-items: center; justify-content: center;
    gap: 1.25rem; padding: 1rem 1.5rem;
    background: #fff; border-bottom: 1px solid #e2e6ea;
    flex-wrap: wrap;
}
.switch-label { font-size: 0.95rem; font-weight: 600; color: #1a2a3a; }
.switch-option {
    display: inline-flex; align-items: center; gap: 0.4rem;
    cursor: pointer; font-size: 0.95rem; color: #2c3e50;
    padding: 0.35rem 0.7rem; border-radius: 4px;
    transition: background 0.15s;
}
.switch-option:hover { background: #f0f3f7; }
.switch-option input[type="radio"] { accent-color: #3a7bd5; width: 1rem; height: 1rem; }
.switch-option span { user-select: none; }

/* ---------- 主容器 ---------- */
.container {
    max-width: 820px; margin: 0 auto;
    padding: 1.75rem 1.25rem;
    display: flex; flex-direction: column; gap: 1.5rem;
}

/* ---------- 卡片 ---------- */
.card {
    background: #ffffff; border: 1px solid #e2e6ea; border-radius: 6px;
    padding: 1.75rem 2rem 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-header { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.4rem; }
.card-header h2 { font-size: 1.2rem; font-weight: 600; color: #1a2a3a; margin: 0; }

.step-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.7rem; height: 1.7rem;
    background: #3a7bd5; color: #fff;
    font-size: 0.85rem; font-weight: 600; border-radius: 50%; flex-shrink: 0;
}

.card-desc { font-size: 0.9rem; color: #5a6a7a; margin: 0.4rem 0 1rem; line-height: 1.8; }
.card-desc em { font-style: italic; color: #3a4a5a; font-weight: 500; }

/* ---------- 表单元素 ---------- */
label {
    display: block; font-size: 0.85rem; font-weight: 600;
    color: #4a5a6a; margin: 0.9rem 0 0.35rem; letter-spacing: 0.02em;
}
textarea, input[type="text"], select {
    width: 100%; padding: 0.65rem 0.85rem;
    border: 1px solid #d0d6dc; border-radius: 4px;
    font-family: "SF Mono", "JetBrains Mono", "Fira Code", "Consolas", monospace;
    font-size: 0.88rem; line-height: 1.6;
    color: #2c3e50; background: #fafbfc;
    transition: border-color 0.2s, box-shadow 0.2s;
}
input[type="text"] { font-family: inherit; }
select { font-family: inherit; cursor: pointer; }
textarea:focus, input:focus, select:focus {
    outline: none; border-color: #3a7bd5;
    box-shadow: 0 0 0 3px rgba(58,123,213,0.12); background: #fff;
}
textarea[readonly] { background: #f3f5f7; color: #4a5a6a; cursor: default; }

.fixed-curve {
    padding: 0.65rem 0.85rem; background: #eef3f8; border: 1px solid #c8d8e8;
    border-radius: 4px; font-family: "SF Mono", monospace; font-size: 0.88rem;
    color: #2c5a8a; margin-top: 0.35rem;
}

/* ---------- 按钮 ---------- */
.primary-btn {
    display: inline-block; margin-top: 1.1rem;
    padding: 0.65rem 1.6rem; font-size: 0.93rem; font-weight: 600;
    font-family: inherit; color: #ffffff; background: #3a7bd5;
    border: none; border-radius: 4px; cursor: pointer;
    letter-spacing: 0.03em; transition: background 0.2s, transform 0.1s;
}
.primary-btn:hover { background: #2c6bc5; }
.primary-btn:active { transform: scale(0.98); }

.secondary-btn {
    display: inline-block; margin: 0.5rem 0.5rem 0 0;
    padding: 0.5rem 1.1rem; font-size: 0.85rem; font-weight: 500;
    font-family: inherit; color: #3a5a7a; background: #eef3f8;
    border: 1px solid #c8d8e8; border-radius: 4px; cursor: pointer;
    transition: background 0.15s;
}
.secondary-btn:hover { background: #d8e4f0; }

/* ---------- Canvas 可视化区 ---------- */
.canvas-wrapper {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 0.5rem;
}
.canvas-col { display: flex; flex-direction: column; align-items: center; }
.canvas-title {
    font-size: 0.85rem; font-weight: 600; color: #4a5a6a;
    margin-bottom: 0.5rem; letter-spacing: 0.02em;
}
canvas {
    border: 1px solid #d8dde2; border-radius: 4px;
    background: #fafbfc; display: block;
    max-width: 100%; height: auto;
}
.anim-controls { margin-top: 0.75rem; }

/* ---------- 签名区双列 ---------- */
.sig-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.sig-col label { margin-top: 0; }

/* ---------- 状态提示 ---------- */
#status {
    margin-top: 1.25rem; padding: 0.8rem 1rem; border-radius: 4px;
    font-size: 0.93rem; font-weight: 600; text-align: center;
    letter-spacing: 0.02em; transition: all 0.3s;
}
.status-pending { background: #eef1f4; color: #6a7a8a; }
.status-info    { background: #e8f0fe; color: #2c5fa0; }
.status-valid   { background: #e6f7ee; color: #1a7a3a; border: 1px solid #b8e0c8; }
.status-invalid { background: #fdecea; color: #b03020; border: 1px solid #f0c0bc; }
.status-error   { background: #fdecea; color: #b03020; border: 1px solid #f0c0bc; }

/* ---------- 页脚 / 参考文献 ---------- */
.page-footer {
    max-width: 820px; margin: 1rem auto 0; padding: 1.5rem 1.25rem 2rem;
    font-size: 0.82rem; color: #6a7a8a; line-height: 1.9;
}
.ref-block h4 {
    font-size: 0.88rem; font-weight: 600; color: #3a4a5a;
    margin: 0 0 0.5rem; padding-bottom: 0.4rem;
    border-bottom: 1px solid #d8dde2;
}
.ref-block ul { padding-left: 1.2rem; margin: 0; }
.ref-block li { margin-bottom: 0.3rem; }
.footer-note { text-align: center; margin-top: 1.5rem; color: #8a9aaa; font-size: 0.8rem; }

/* ---------- 响应式 ---------- */
@media (max-width: 680px) {
    .page-header { padding: 1.75rem 1rem 1.25rem; }
    .page-header h1 { font-size: 1.35rem; }
    .switch-bar { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
    .container { padding: 1rem 0.75rem; }
    .card { padding: 1.25rem 1rem 1.5rem; }
    .canvas-wrapper { grid-template-columns: 1fr; }
    .sig-row { grid-template-columns: 1fr; }
}
