/* rfwm_3d · 放电针 3D 预览 —— 深色工业风，色系沿用品牌 */
:root {
    --brand-primary: #0f2847;
    --brand-gold: #c9a66b;
    --bg: #0a1120;
    --panel-bg: #101b30;
    --line: rgba(201, 166, 107, 0.25);
    --text: #e8edf5;
    --text-dim: #8fa0b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    display: flex;
    flex-direction: column;
}

/* 顶栏 */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--brand-primary);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
    gap: 8px;
}
header .brand {
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 0.02em;
}
header .brand .gold { color: var(--brand-gold); }
header a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13px;
}
header a:hover { color: var(--brand-gold); }

/* 主体：左面板 + 右画布 */
main {
    flex: 1;
    display: flex;
    min-height: 0;
}

#panel {
    width: 320px;
    flex-shrink: 0;
    background: var(--panel-bg);
    border-right: 1px solid var(--line);
    padding: 20px;
    overflow-y: auto;
}

.field { margin-bottom: 18px; }
.field > label.title {
    display: block;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}
.field > label.title .en { font-size: 11px; opacity: 0.7; margin-left: 4px; }

/* 单选组（材质 / 磨尖方式） */
.radio-group { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-group label {
    flex: 1;
    min-width: 84px;
    text-align: center;
    padding: 9px 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-dim);
    transition: all 0.15s;
    user-select: none;
}
.radio-group input { display: none; }
.radio-group input:checked + span { color: var(--brand-gold); }
.radio-group label:has(input:checked) {
    border-color: var(--brand-gold);
    background: rgba(201, 166, 107, 0.12);
    color: var(--brand-gold);
}
.radio-group label:has(input:disabled) {
    opacity: 0.35;
    cursor: not-allowed;
}

/* 数字输入 */
.num-row { display: flex; align-items: center; gap: 8px; }
.num-row input[type="number"] {
    flex: 1;
    background: #0b1424;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    font-size: 15px;
    padding: 9px 12px;
    outline: none;
}
.num-row input[type="number"]:focus { border-color: var(--brand-gold); }
.num-row .unit { color: var(--text-dim); font-size: 13px; min-width: 34px; white-space: nowrap; }

/* 抛光开关 */
.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
}
.switch-row input { width: 18px; height: 18px; accent-color: var(--brand-gold); cursor: pointer; }

/* 按钮 */
.btn {
    display: block;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
    transition: opacity 0.15s;
}
.btn:hover { opacity: 0.88; }
.btn-primary { background: var(--brand-gold); color: #182234; }
.btn-ghost {
    background: transparent;
    color: var(--brand-gold);
    border: 1px solid var(--brand-gold);
}

#error {
    display: none;
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(214, 40, 40, 0.15);
    border: 1px solid rgba(214, 40, 40, 0.4);
    color: #ff9b9b;
    font-size: 13px;
    line-height: 1.6;
}

.tip {
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.8;
}

/* 画布区 */
#stage {
    flex: 1;
    position: relative;
    min-width: 0;
    min-height: 0;
}
#viewport { position: absolute; inset: 0; }
#viewport canvas { display: block; }

#caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-dim);
    background: linear-gradient(transparent, rgba(6, 12, 24, 0.8));
    pointer-events: none;
}

/* 手机：上下堆叠 */
@media (max-width: 768px) {
    main { flex-direction: column; }
    #panel {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--line);
        max-height: 52vh;
        padding: 14px;
    }
    #stage { min-height: 320px; }
    /* 窄屏（<=320 逻辑像素）也不横向溢出 */
    .radio-group { gap: 6px; }
    .radio-group label { min-width: 0; padding: 9px 4px; font-size: 12.5px; }
    .num-row input[type="number"] { min-width: 0; }
    .field { margin-bottom: 14px; }
}
