/* 站度网 · 生辰八字起名工具
 * 说明：本文件只覆盖 .nm- 私有类；对 life-calc 的 .card/.alert 等公共类一律带 #app 前缀，
 * 靠加载顺序在后取胜，避免串味到模板的 #alertBox（它在 #app 之外）。
 */

#app {
    --nm-mu: #2e8b57;
    --nm-huo: #d9432f;
    --nm-tu: #b5860b;
    --nm-jin: #7c8391;
    --nm-shui: #2f6fb5;
    --nm-ink: #1f2937;
    --nm-line: #e8ecf3;
    --nm-soft: #f6f8fc;
    --nm-gold: #9a6b12;
    padding: 20px 0;
}

#app .container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ---------------- 表单 ---------------- */

.nm-form .grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.nm-form .grid-5 {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr;
    gap: 10px;
}

.nm-surname {
    letter-spacing: .1em;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
}

.nm-seg {
    display: inline-flex;
    border: 1px solid var(--nm-line);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.nm-seg button {
    border: 0;
    background: transparent;
    padding: 9px 20px;
    font-size: 14px;
    color: #55606f;
    cursor: pointer;
    font-family: inherit;
    transition: background .16s, color .16s;
}

.nm-seg button + button {
    border-left: 1px solid var(--nm-line);
}

.nm-seg button.on {
    background: var(--primary, #2563eb);
    color: #fff;
    font-weight: 600;
}

.nm-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.nm-row-l {
    font-size: 14px;
    color: #55606f;
    min-width: 64px;
}

.nm-check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    user-select: none;
}

.nm-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary, #2563eb);
}

.nm-geo {
    display: grid;
    grid-template-columns: 1fr 1fr 130px;
    gap: 10px;
    align-items: end;
    transition: opacity .2s;
}

.nm-lngtip {
    font-size: 12px;
    color: #8b95a5;
    margin-top: 6px;
}

.nm-adv {
    margin-top: 16px;
    border-top: 1px dashed var(--nm-line);
    padding-top: 12px;
}

.nm-adv summary {
    cursor: pointer;
    font-size: 14px;
    color: #55606f;
    list-style: none;
    outline: none;
}

.nm-adv summary::-webkit-details-marker {
    display: none;
}

.nm-adv summary::before {
    content: "▸ ";
    color: #9aa4b2;
}

.nm-adv[open] summary::before {
    content: "▾ ";
}

.nm-adv-body {
    margin-top: 12px;
}

.nm-adv-body .grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.nm-actions {
    margin-top: 18px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.nm-actions .btn-primary {
    padding: 11px 30px;
    font-size: 15px;
    font-weight: 600;
}

/* ---------------- 提示条 ---------------- */

.nm-alert {
    display: none;
    margin-bottom: 14px;
    padding: 10px 14px;
    border-radius: 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 14px;
}

.nm-alert.on {
    display: block;
}

/* ---------------- 结果区外壳 ---------------- */

.nm-result {
    display: none;
    margin-top: 18px;
}

.nm-result.on {
    display: block;
}

.nm-result > .card {
    margin-bottom: 14px;
}

/* ---------------- 真太阳时 ---------------- */

.nm-time-chain {
    display: flex;
    align-items: stretch;
    gap: 8px;
    flex-wrap: wrap;
}

.nm-tc {
    flex: 1 1 150px;
    min-width: 130px;
    background: var(--nm-soft);
    border: 1px solid var(--nm-line);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nm-tc-l {
    font-size: 12px;
    color: #7b8494;
}

.nm-tc b {
    font-size: 15px;
    color: var(--nm-ink);
    font-variant-numeric: tabular-nums;
    letter-spacing: .01em;
}

.nm-tc-s {
    font-size: 11px;
    color: #9aa4b2;
}

.nm-tc-final {
    background: linear-gradient(135deg, #eef4ff, #f7f1ff);
    border-color: #c7d7f7;
}

.nm-tc-final b {
    color: #1d4ed8;
    font-size: 17px;
}

.nm-tc-op {
    align-self: center;
    color: #b6bfcc;
    font-size: 15px;
    font-weight: 700;
}

.nm-note {
    margin-top: 10px;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.7;
}

.nm-warn {
    margin-top: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    font-size: 13px;
    color: #92400e;
    line-height: 1.7;
}

/* ---------------- 八字排盘 ---------------- */

.nm-bazi-top {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.nm-bazi-meta {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.9;
}

.nm-muted {
    color: #8b95a5;
    font-size: 12.5px;
}

.nm-dmbox {
    text-align: center;
    border: 1px solid #e6e9f0;
    border-radius: 12px;
    padding: 8px 22px;
    background: #fbfcfe;
    min-width: 108px;
}

.nm-dm-t {
    font-size: 12px;
    color: #8b95a5;
}

.nm-dm-v {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.3;
}

.nm-dm-s {
    font-size: 12px;
    color: #6b7280;
}

.nm-tablewrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--nm-line);
    border-radius: 10px;
}

.nm-bazi {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 420px;
}

.nm-bazi th {
    background: var(--nm-soft);
    font-weight: 600;
    color: #4b5563;
    padding: 8px 6px;
    font-size: 13px;
    border-bottom: 1px solid var(--nm-line);
}

.nm-bazi td {
    padding: 7px 6px;
    text-align: center;
    border-bottom: 1px solid #f1f4f9;
    color: #374151;
}

.nm-bazi tr:last-child td {
    border-bottom: 0;
}

.nm-bazi .nm-rt {
    background: var(--nm-soft);
    font-size: 12.5px;
    color: #6b7280;
    width: 62px;
    font-weight: 500;
}

.nm-gz {
    font-size: 21px;
    font-weight: 700;
    line-height: 1.4;
}

.nm-wxchip {
    display: inline-block;
    min-width: 20px;
    padding: 1px 6px;
    margin: 1px 2px;
    border-radius: 6px;
    font-size: 12px;
    font-style: normal;
    line-height: 1.6;
    color: #fff;
    text-align: center;
}

.nm-wxchip.lg {
    font-size: 13px;
    padding: 2px 10px;
    margin-right: 6px;
}

.nm-wxchip.on {
    background: #fff !important;
    border: 1px dashed #c0392b;
    color: #c0392b !important;
}

.nm-wx-mu { background: var(--nm-mu); }
.nm-wx-huo { background: var(--nm-huo); }
.nm-wx-tu { background: var(--nm-tu); }
.nm-wx-jin { background: var(--nm-jin); }
.nm-wx-shui { background: var(--nm-shui); }

span.nm-wx-mu, .nm-gz.nm-wx-mu { background: none; color: var(--nm-mu); }
span.nm-wx-huo, .nm-gz.nm-wx-huo { background: none; color: var(--nm-huo); }
span.nm-wx-tu, .nm-gz.nm-wx-tu { background: none; color: var(--nm-tu); }
span.nm-wx-jin, .nm-gz.nm-wx-jin { background: none; color: var(--nm-jin); }
span.nm-wx-shui, .nm-gz.nm-wx-shui { background: none; color: var(--nm-shui); }

.nm-hide span {
    font-size: 13px;
    margin: 0 1px;
}

.nm-ny {
    font-size: 12px;
    color: #7b8494;
}

.nm-dm {
    color: #b91c1c;
}

.nm-wxwrap {
    margin-top: 14px;
    display: grid;
    gap: 6px;
}

.nm-wxrow {
    display: grid;
    grid-template-columns: 26px 1fr 56px;
    align-items: center;
    gap: 10px;
}

.nm-wxk {
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.nm-wxbar {
    height: 9px;
    border-radius: 6px;
    background: #eef1f6;
    overflow: hidden;
}

.nm-wxbar i {
    display: block;
    height: 100%;
    border-radius: 6px;
    transition: width .5s ease;
}

i.nm-wx-mu { background: var(--nm-mu); }
i.nm-wx-huo { background: var(--nm-huo); }
i.nm-wx-tu { background: var(--nm-tu); }
i.nm-wx-jin { background: var(--nm-jin); }
i.nm-wx-shui { background: var(--nm-shui); }

.nm-wxv {
    font-size: 12.5px;
    color: #6b7280;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.nm-ratio {
    margin-top: 14px;
}

.nm-ratio-bar {
    height: 10px;
    border-radius: 6px;
    background: #e8ecf3;
    overflow: hidden;
}

.nm-ratio-bar i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #6aa9f0, #2563eb);
}

.nm-ratio-t {
    margin-top: 7px;
    font-size: 13px;
    color: #4b5563;
    line-height: 1.8;
}

.nm-ratio-t b {
    color: var(--nm-ink);
}

.nm-xy {
    margin-top: 14px;
    display: grid;
    gap: 8px;
    padding: 12px;
    background: var(--nm-soft);
    border-radius: 10px;
}

.nm-xy-item {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 13px;
}

.nm-xy-l {
    color: #6b7280;
    min-width: 52px;
}

.nm-xy-item em {
    font-style: normal;
    font-size: 11px;
    color: #9aa4b2;
    margin-right: 6px;
}

.nm-yun {
    margin-top: 12px;
    font-size: 12.5px;
    color: #6b7280;
    line-height: 1.8;
    padding-top: 10px;
    border-top: 1px dashed var(--nm-line);
}

/* ---------------- 候选名字 ---------------- */

.nm-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.nm-card {
    position: relative;
    border: 1px solid var(--nm-line);
    border-radius: 12px;
    background: #fff;
    padding: 12px 10px 10px;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    transition: border-color .16s, box-shadow .16s, transform .16s;
    min-width: 0;
}

.nm-card:hover {
    border-color: #c7d7f7;
    box-shadow: 0 4px 14px rgba(37, 99, 235, .09);
}

.nm-card.on {
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .14);
}

.nm-card-name {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--nm-ink);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nm-card-py {
    font-size: 11px;
    color: #9aa4b2;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nm-card-wx {
    margin-top: 6px;
    display: flex;
    justify-content: center;
    gap: 3px;
}

.nm-card-wx .nm-wxchip {
    font-size: 11px;
    padding: 0 5px;
    min-width: 18px;
}

.nm-card-tag {
    margin-top: 7px;
    font-size: 11px;
    color: #7b8494;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nm-ring {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    line-height: 1;
}

.nm-ring b { font-size: 12px; }
.nm-ring i { font-size: 8px; font-style: normal; opacity: .85; }
.nm-ring-a { background: linear-gradient(135deg, #16a34a, #22c55e); }
.nm-ring-b { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.nm-ring-c { background: linear-gradient(135deg, #b5860b, #d9a521); }
.nm-ring-d { background: linear-gradient(135deg, #6b7280, #9ca3af); }

.nm-empty {
    padding: 26px 16px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.9;
    background: var(--nm-soft);
    border-radius: 10px;
}

/* ---------------- 详解 ---------------- */

.nm-det-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--nm-line);
    flex-wrap: wrap;
}

.nm-det-name {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: .1em;
    color: var(--nm-ink);
}

.nm-det-py {
    margin-left: 10px;
    font-size: 13px;
    color: #8b95a5;
}

.nm-det-head .nm-ring {
    position: static;
    width: 46px;
    height: 46px;
}

.nm-det-head .nm-ring b { font-size: 18px; }
.nm-det-head .nm-ring i { font-size: 10px; }

.nm-parts {
    margin-top: 14px;
    display: grid;
    gap: 7px;
}

.nm-part {
    display: grid;
    grid-template-columns: 68px 1fr 62px;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    color: #55606f;
}

.nm-part-b {
    height: 8px;
    background: #eef1f6;
    border-radius: 5px;
    overflow: hidden;
}

.nm-part-b i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #93c5fd, #2563eb);
    border-radius: 5px;
}

.nm-part-v {
    text-align: right;
    color: #8b95a5;
    font-variant-numeric: tabular-nums;
}

.nm-h3 {
    margin: 20px 0 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--nm-ink);
    padding-left: 9px;
    border-left: 3px solid var(--primary, #2563eb);
    line-height: 1.3;
}

.nm-chars {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.nm-ch {
    display: flex;
    gap: 12px;
    border: 1px solid var(--nm-line);
    border-radius: 10px;
    padding: 12px;
    background: #fcfdff;
}

.nm-ch-zi {
    font-size: 40px;
    font-weight: 700;
    line-height: 1;
    color: var(--nm-ink);
    flex: 0 0 auto;
    padding-top: 2px;
}

.nm-ch-meta {
    font-size: 13px;
    color: #4b5563;
    line-height: 1.9;
    min-width: 0;
}

.nm-k {
    display: inline-block;
    min-width: 62px;
    color: #8b95a5;
    font-size: 12px;
}

.nm-ch-mean {
    margin-top: 4px;
    padding-top: 5px;
    border-top: 1px dashed var(--nm-line);
    color: #374151;
}

.nm-shuli {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 560px;
}

.nm-shuli th {
    background: var(--nm-soft);
    padding: 8px 6px;
    font-weight: 600;
    color: #4b5563;
    text-align: left;
    font-size: 12.5px;
    border-bottom: 1px solid var(--nm-line);
}

.nm-shuli td {
    padding: 7px 6px;
    border-bottom: 1px solid #f1f4f9;
    color: #374151;
    vertical-align: top;
}

.nm-shuli .nm-rt {
    font-weight: 600;
    color: var(--nm-ink);
    white-space: nowrap;
}

.nm-shuli .nm-desc {
    color: #5b6675;
    line-height: 1.65;
    font-size: 12.5px;
}

.nm-lv {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
}

.nm-lv-a { background: #dcfce7; color: #15803d; }
.nm-lv-b { background: #dbeafe; color: #1d4ed8; }
.nm-lv-c { background: #fef3c7; color: #a16207; }
.nm-lv-d { background: #fee2e2; color: #b91c1c; }

.nm-tip-inline {
    margin-top: 8px;
    line-height: 1.7;
}

.nm-sc {
    margin-top: 14px;
    padding: 12px;
    background: var(--nm-soft);
    border-radius: 10px;
}

.nm-sc-chain {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.nm-sc-ar {
    color: #b6bfcc;
}

.nm-sc-notes {
    margin: 8px 0 0;
    padding-left: 18px;
    font-size: 12.5px;
    color: #5b6675;
    line-height: 1.9;
}

.nm-ph-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.nm-ph-cell {
    flex: 0 0 auto;
    border: 1px solid var(--nm-line);
    border-radius: 8px;
    padding: 6px 14px;
    text-align: center;
    background: #fcfdff;
}

.nm-ph-cell b {
    display: block;
    font-size: 15px;
    color: var(--nm-ink);
    font-weight: 600;
}

.nm-ph-cell i {
    font-style: normal;
    font-size: 11px;
    color: #8b95a5;
}

.nm-ph-good,
.nm-ph-bad {
    margin-top: 10px;
    font-size: 12.5px;
    line-height: 1.9;
}

.nm-ph-good { color: #15803d; }
.nm-ph-bad { color: #b45309; }

.nm-sx {
    font-size: 13px;
    color: #4b5563;
    line-height: 1.95;
}

.nm-good { color: #15803d; }
.nm-bad2 { color: #b91c1c; margin-left: 10px; }

.nm-verdict {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f0f7ff, #f7f3ff);
    border: 1px solid #dbe6fb;
    font-size: 13px;
    color: #334155;
    line-height: 1.95;
}

/* ---------------- 说明 ---------------- */

.nm-tip {
    margin-top: 6px;
}

.nm-tip h3 {
    margin: 0 0 10px;
    font-size: 15px;
    color: var(--nm-ink);
}

.nm-tip ol {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    color: #5b6675;
    line-height: 2;
}

.nm-tip li b {
    color: #374151;
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 768px) {
    #app {
        padding: 0;
    }

    #app .container {
        padding: 0;
    }

    .nm-form .grid-3,
    .nm-adv-body .grid-3 {
        grid-template-columns: 1fr 1fr;
    }

    .nm-form .grid-5 {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .nm-geo {
        grid-template-columns: 1fr 1fr;
    }

    .nm-geo > .field:last-child {
        grid-column: 1 / -1;
    }

    .nm-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .nm-card-name {
        font-size: 19px;
    }

    .nm-chars {
        grid-template-columns: 1fr;
    }

    .nm-ch-zi {
        font-size: 34px;
    }

    .nm-time-chain {
        gap: 6px;
    }

    .nm-tc {
        flex: 1 1 44%;
        min-width: 0;
        padding: 8px 10px;
    }

    .nm-tc-op {
        flex: 0 0 12px;
        font-size: 13px;
    }

    .nm-tc b {
        font-size: 13.5px;
    }

    .nm-tc-final b {
        font-size: 15px;
    }

    .nm-det-name {
        font-size: 26px;
    }

    .nm-part {
        grid-template-columns: 58px 1fr 54px;
        font-size: 12px;
    }

    .nm-actions .btn-primary {
        flex: 1 1 100%;
    }

    /* 四柱表收窄至视口内，免横向滚动 */
    .nm-bazi {
        min-width: 0;
        font-size: 13px;
    }

    .nm-bazi th,
    .nm-bazi td {
        padding: 7px 3px;
    }

    .nm-bazi .nm-rt {
        width: 44px;
        font-size: 11.5px;
    }

    .nm-wxchip {
        margin: 0;
    }
}

@media (max-width: 400px) {
    .nm-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nm-tc {
        flex: 1 1 100%;
    }

    .nm-tc-op {
        display: none;
    }
}

/* ---- 相关工具互链（20261102b） ---- */
.nm-rel {
    margin-top: 14px;
}

.nm-rel-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.nm-rel-item {
    min-width: 0;
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #e6eaf2;
    border-radius: 12px;
    padding: 12px 14px;
    text-decoration: none;
    background: #fbfcff;
    transition: transform .12s, box-shadow .15s, border-color .15s;
}

.nm-rel-item:hover {
    transform: translateY(-2px);
    border-color: #bcd0f5;
    box-shadow: 0 4px 14px rgba(37, 99, 235, .12);
}

.nm-rel-t {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nm-rel-t b {
    font-size: 14px;
    color: #2a3142;
}

.nm-rel-t i {
    font-style: normal;
    font-size: 12px;
    color: #8a93a6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nm-rel-go {
    margin-left: auto;
    color: #b9c2d4;
    flex: 0 0 auto;
}

@media (max-width: 768px) {
    .nm-rel-grid {
        grid-template-columns: 1fr;
    }
}
