:root {
    /* 专属颜色编码，提升专业感与可读性 */
    --c-blue: #3498db;   /* 频率 f */
    --c-orange: #e67e22; /* 阻抗 Z */
    --c-purple: #9b59b6; /* 电感 L */
    --c-green: #2ecc71;  /* 电容 C */
    --bg-color: #f4f7f9;
    --card-bg: #ffffff;
    --text-main: #2c3e50;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.calculator-card {
    background: var(--card-bg);
    padding: 35px 40px;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02), 0 12px 30px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 500px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

h2 { margin-top: 0; text-align: center; margin-bottom: 25px; font-weight: 600; }

/* 模式切换器 (Segmented Control) */
.mode-selector {
    display: flex;
    background: #eef2f5;
    padding: 5px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.mode-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 13.5px;
    font-weight: 600;
    color: #7f8c8d;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.mode-btn.active {
    background: #fff;
    color: var(--text-main);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* 动态输入输出区域 */
.group { display: none; margin-bottom: 20px; animation: fadeIn 0.3s ease; }
.group.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.group label {
    display: flex;
    align-items: baseline;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.group .hint {
    font-size: 12px; color: #a0aec0; font-weight: normal; margin-left: auto;
}

.input-row { display: flex; gap: 10px; }

input[type="text"], select {
    padding: 12px 14px;
    border: 1px solid #dcdde1;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: all 0.2s ease;
    background-color: #fafbfc;
}

input[type="text"] {
    flex: 1; font-family: 'Courier New', monospace; font-weight: 600; color: #333;
}

select { width: 95px; cursor: pointer; color: #555; }

/* 各个物理量的专注颜色 */
.focus-l input:focus, .focus-l select:focus { border-color: var(--c-purple); box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.15); }
.focus-c input:focus, .focus-c select:focus { border-color: var(--c-green); box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.15); }
.focus-f input:focus, .focus-f select:focus { border-color: var(--c-blue); box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15); }
.focus-z input:focus, .focus-z select:focus { border-color: var(--c-orange); box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.15); }

.error-border { border-color: #e74c3c !important; }

.divider { height: 1px; background: #edf2f7; margin: 25px 0; }

/* 结果框统一样式 */
.result-box {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 12px;
    display: none;
    align-items: center;
    justify-content: space-between;
}
.result-box.active { display: flex; animation: fadeIn 0.4s ease; }

.result-title { font-size: 14px; font-weight: 600; }
.result-value { font-size: 24px; font-weight: 700; font-family: 'Courier New', Courier, monospace; letter-spacing: -0.5px; }

/* 结果框专属颜色 */
.res-f { background: #f0f7ff; border-left: 5px solid var(--c-blue); color: var(--c-blue); }
.res-z { background: #fff8f1; border-left: 5px solid var(--c-orange); color: var(--c-orange); }
.res-l { background: #f9f0ff; border-left: 5px solid var(--c-purple); color: var(--c-purple); }
.res-c { background: #f0fdf4; border-left: 5px solid var(--c-green); color: var(--c-green); }

.formula-container {
    display: none; justify-content: center; align-items: center;
    margin-top: 20px; color: #64748b; background: #f8fafc;
    padding: 12px; border-radius: 8px; border: 1px dashed #cbd5e1;
}
.formula-container.active { display: flex; animation: fadeIn 0.4s ease; }
.formula-label { font-size: 12px; margin-right: 15px; color: #94a3b8; font-weight: bold; }
.separator { margin: 0 15px; color: #cbd5e1; font-size: 18px; font-weight: 300; }
