.app-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    max-width: 280px;
    padding: 20px;
    text-align: center;
    animation: toastFadeIn 0.3s ease;
}

@keyframes toastFadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.app-toast-content {
    font-size: 16px;
    color: #333;
    line-height: 1.5;
}

.app-toast .toast-btn {
    margin-top: 15px;
    padding: 10px 30px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
}

.app-toast .toast-confirm-actions .toast-btn {
    flex: 1;
    min-width: 84px;
    margin-top: 0;
    padding: 10px 16px;
    white-space: nowrap;
}

.accuracy-low { color: #e74c3c; }
.accuracy-medium { color: #f39c12; }
.accuracy-good { color: #3498db; }
.accuracy-high { color: #27ae60; }

.accuracy-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: bold;
}

.accuracy-badge.low { background: #fde8e8; }
.accuracy-badge.medium { background: #fef5e7; }
.accuracy-badge.good { background: #e8f4fd; }
.accuracy-badge.high { background: #e8f8f0; }

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.pinyin-ruby {
    ruby-align: center;
    ruby-position: over;
    margin: 0 0.03em;
}

.pinyin-ruby rt {
    font-size: 0.55em;
    color: #667eea;
    letter-spacing: 0.02em;
    user-select: none;
}

.plain-char {
    display: inline;
}

.cx-detail-layout {
    display: block;
}

.cx-char-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0.08em 0.12em;
    margin: 0 0.04em;
    border-radius: 10px;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
    vertical-align: baseline;
    font: inherit;
    line-height: inherit;
}

.cx-char-btn:hover {
    background: rgba(102, 126, 234, 0.12);
    color: #4a59c7;
    transform: translateY(-1px);
}

.cx-char-btn.active {
    background: rgba(102, 126, 234, 0.18);
    color: #3647c1;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.18);
    transform: scale(1.28);
}

.cx-char-btn-large {
    font-size: 1.08em;
}

.cx-char-ruby {
    ruby-align: center;
    ruby-position: over;
}

.cx-char-panel {
    position: absolute;
    left: 0;
    top: 0;
    width: min(360px, calc(100vw - 24px));
    background: linear-gradient(180deg, #ffffff 0%, #f6f8ff 100%);
    border: 1px solid rgba(102, 126, 234, 0.16);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 16px 36px rgba(93, 108, 196, 0.16);
    display: none;
    z-index: 1000;
}

.cx-char-panel.active {
    display: block;
}

.cx-char-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.cx-char-panel-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    border-radius: 20px;
    background: linear-gradient(135deg, #667eea, #8a63d2);
    color: #fff;
    font-size: 2.1em;
    font-weight: bold;
    box-shadow: 0 10px 24px rgba(102, 126, 234, 0.28);
    flex-shrink: 0;
}

.cx-char-panel-title-wrap {
    flex: 1;
    min-width: 0;
}

.cx-char-panel-title {
    font-size: 1.2em;
    color: #27304f;
    margin-bottom: 6px;
    font-weight: bold;
}

.cx-char-panel-tip {
    color: #667085;
    font-size: 0.92em;
    line-height: 1.6;
}

.cx-char-panel-close {
    border: none;
    background: rgba(102, 126, 234, 0.1);
    color: #5060c8;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1em;
    flex-shrink: 0;
}

.cx-char-panel-close:hover {
    background: rgba(102, 126, 234, 0.18);
}

.cx-char-panel-section {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(102, 126, 234, 0.08);
}

.cx-char-panel-section h4 {
    color: #5060c8;
    margin-bottom: 8px;
    font-size: 0.98em;
}

.cx-char-panel-section p {
    color: #3f4657;
    line-height: 1.8;
    font-size: 0.98em;
}

@keyframes cxPanelFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#cxTuanshi,
.yaoci-title,
.yaoci-content {
    word-break: break-word;
}

#cxTuanshi {
    line-height: 2.2;
    color: #444;
}

.yaoci-title {
    line-height: 2;
}

.yaoci-content {
    line-height: 2.1;
}

.gua-symbol-container {
    display: inline-flex;
    flex-direction: column-reverse;
    text-align: center;
    font-size: 1em;
    line-height: 0.8;
}

.gua-symbol-container .yao-line {
    width: 80px;
    height: 5px;
    margin: 10px 0;
    transition: all 0.3s;
    position: relative;
    background: transparent;
    cursor: pointer;
}

.gua-symbol-container .yao-line.yang.normal {
    background: #333;
    border-radius: 2px;
}

.gua-symbol-container .yao-line.yang.old {
    background: #f44336;
    border-radius: 2px;
}

.gua-symbol-container .yao-line.normal:before,
.gua-symbol-container .yao-line.old:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 48%;
    height: 100%;
    border-radius: 2px;
    background: #333;
}

.gua-symbol-container .yao-line.normal:after,
.gua-symbol-container .yao-line.old:after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 48%;
    height: 100%;
    border-radius: 2px;
    background: #333;
}

.gua-symbol-container .yao-line.old:before,
.gua-symbol-container .yao-line.old:after {
    background: #f44336;
}

.gua-symbol-container .yao-line.yang:before,
.gua-symbol-container .yao-line.yang:after {
    display: none;
}

.cx-ganzhi-time {
    margin: 18px auto 10px;
    max-width: 680px;
    padding: 16px 18px;
    border: 1px solid rgba(102, 126, 234, 0.18);
    border-radius: 16px;
    background: linear-gradient(135deg, #f7f8ff 0%, #fffaf1 100%);
    color: #2f365f;
    text-align: center;
}

.cx-ganzhi-time.custom,
.cx-wuxing-state.custom {
    border-color: #d1d5db;
    background: #f3f4f6;
    color: #6b7280;
}

.cx-ganzhi-time.custom .cx-ganzhi-time-control input,
.cx-ganzhi-time.custom .cx-ganzhi-time-control button {
    border-color: #d1d5db;
    background: #e5e7eb;
    color: #4b5563;
}

.cx-ganzhi-now {
    margin-bottom: 8px;
    font-weight: bold;
}

.cx-ganzhi-time-control {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.cx-ganzhi-time-control input,
.cx-ganzhi-time-control button {
    min-height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(102, 126, 234, 0.28);
    font: inherit;
    font-size: 16px;
}

.cx-ganzhi-time-control input {
    min-width: 230px;
    padding: 0 14px;
    color: #2f365f;
    background: #ffffff;
}

.cx-ganzhi-time-control button {
    padding: 0 16px;
    background: #667eea;
    color: #ffffff;
    cursor: pointer;
    font-weight: 700;
}

.cx-ganzhi-time-control button:hover {
    background: #5368d7;
}

@media (max-width: 768px) {
    .cx-ganzhi-time-control {
        display: grid;
        grid-template-columns: 1fr;
    }

    .cx-ganzhi-time-control input,
    .cx-ganzhi-time-control button {
        width: 100%;
    }
}

@media (max-width: 420px) {
    .cx-ganzhi-pill-row-main {
        gap: 4px;
    }

    .cx-ganzhi-pill-list span {
        padding: 4px 6px;
        font-size: 0.78em;
    }
}

.cx-ganzhi-pill-list {
    display: grid;
    gap: 7px;
}

.cx-ganzhi-pill-row,
.cx-wuxing-state-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 7px;
}

.cx-ganzhi-pill-row-main {
    justify-content: flex-start;
    flex-wrap: wrap;
}

.cx-ganzhi-pill-row-meta {
    justify-content: flex-start;
}

.cx-ganzhi-pill-list span,
.cx-ganzhi-pill-list button,
.cx-wuxing-state-grid span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.1);
    color: #5060c8;
    font-size: 0.88em;
}

.cx-ganzhi-pill-list span,
.cx-ganzhi-pill-list button {
    border: 1px solid transparent;
    font-weight: 700;
}

.cx-ganzhi-pill-list button {
    font: inherit;
    cursor: pointer;
}

.cx-ganzhi-pill-list button:hover {
    filter: brightness(0.96);
    transform: translateY(-1px);
}

.cx-ganzhi-pill-list .cx-ganzhi-pill-year {
    background: #e8f2ff;
    border-color: #b8d9ff;
    color: #155ea8;
}

.cx-ganzhi-pill-list .cx-ganzhi-pill-month {
    background: #e9f8ee;
    border-color: #b8e7c7;
    color: #1f7a3a;
}

.cx-ganzhi-pill-list .cx-ganzhi-pill-day {
    background: #fff4df;
    border-color: #ffd38a;
    color: #9a5a00;
}

.cx-ganzhi-pill-list .cx-ganzhi-pill-hour {
    background: #f2eaff;
    border-color: #d7c0ff;
    color: #6540a3;
}

.cx-ganzhi-pill-list .cx-ganzhi-pill-gong {
    background: #fff0f0;
    border-color: #ffc3c3;
    color: #a83232;
}

.cx-ganzhi-pill-list .cx-ganzhi-pill-stage {
    background: #eef2f6;
    border-color: #cbd5e1;
    color: #344054;
}

.cx-ganzhi-pill-list .cx-ganzhi-pill-xunkong {
    background: #fff7ed;
    border-color: #fdba74;
    color: #9a3412;
}

.cx-ganzhi-pill-list .cx-ganzhi-missing-liuqin {
    display: inline;
    padding: 0;
    margin-left: 2px;
    border: 0;
    background: transparent;
    color: #dc2626;
    font-size: 1em;
    font-weight: 800;
}

.cx-ganzhi-picker-modal {
    position: fixed;
    inset: 0;
    z-index: 1250;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.48);
}

.cx-ganzhi-picker-modal.active {
    display: flex;
}

.cx-ganzhi-picker-panel {
    width: min(480px, 94vw);
    max-height: 88vh;
    overflow: auto;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.cx-ganzhi-picker-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid #eef2ff;
    background: linear-gradient(135deg, #f7f8ff 0%, #fffaf1 100%);
}

.cx-ganzhi-picker-title {
    color: #27304f;
    font-size: 1.2em;
    font-weight: 800;
}

.cx-ganzhi-picker-subtitle {
    margin-top: 4px;
    color: #667085;
    font-size: 0.92em;
}

.cx-ganzhi-picker-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.12);
    color: #5060c8;
    cursor: pointer;
}

.cx-ganzhi-picker-body {
    display: grid;
    gap: 16px;
    padding: 18px 20px;
}

.cx-ganzhi-picker-section h4 {
    margin-bottom: 10px;
    color: #5060c8;
}

.cx-ganzhi-picker-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.cx-ganzhi-picker-option {
    min-height: 38px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    background: #f8f9ff;
    color: #27304f;
    cursor: pointer;
    font-size: 1em;
    font-weight: 700;
}

.cx-ganzhi-picker-option.selected {
    border-color: #667eea;
    background: #667eea;
    color: #fff;
}

.cx-ganzhi-picker-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 20px 20px;
}

.cx-ganzhi-picker-actions button {
    min-width: 80px;
    min-height: 38px;
    border: 1px solid rgba(102, 126, 234, 0.22);
    border-radius: 999px;
    background: #fff;
    color: #5060c8;
    cursor: pointer;
    font-weight: 700;
}

.cx-ganzhi-picker-actions button.primary {
    background: #667eea;
    color: #fff;
}

@media (max-width: 420px) {
    .cx-ganzhi-picker-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.cx-najia-image {
    position: relative;
    margin: 18px 0 52px;
}

.cx-related-fold {
    position: absolute;
    left: 50%;
    bottom: -16px;
    z-index: 8;
    display: none;
    gap: 6px;
    transform: translate(-50%, 50%);
}

.cx-related-fold-btn {
    width: 34px;
    height: 28px;
    border: 1px solid rgba(102, 126, 234, 0.36);
    border-radius: 999px;
    background: #fff;
    color: #4f46e5;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.16);
    transition: all 0.2s ease;
}

.cx-related-fold-btn.active {
    background: #667eea;
    color: #fff;
    transform: translateY(-2px);
}

@media (hover: hover) and (pointer: fine) {
    .cx-related-fold-btn:hover {
        background: #667eea;
        color: #fff;
        transform: translateY(-2px);
    }
}

.cx-related-panel {
    position: absolute;
    left: 50%;
    top: calc(100% + 18px);
    z-index: 7;
    width: max-content;
    max-width: min(92vw, 520px);
    padding: 14px 16px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 44px rgba(31, 41, 55, 0.18);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -10px) scaleY(0.86);
    transform-origin: top center;
    transition: opacity 0.24s ease, transform 0.24s ease;
}

.cx-related-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0) scaleY(1);
}

.cx-related-panel-title {
    margin-bottom: 10px;
    color: #4f46e5;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
}

.cx-related-panel-title:hover {
    text-decoration: underline;
}

.cx-related-panel-symbol .cx-najia-gua {
    padding: 12px;
    box-shadow: none;
}

.cx-related-panel-symbol .yao-line {
    cursor: pointer;
}

.cx-related-info-popup {
    position: fixed;
    z-index: 1400;
    width: min(320px, calc(100vw - 20px));
    padding: 14px 16px 16px;
    border: 1px solid rgba(102, 126, 234, 0.22);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 44px rgba(31, 41, 55, 0.2);
    color: #344054;
    text-align: left;
}

.cx-related-info-title {
    padding-right: 28px;
    margin-bottom: 8px;
    color: #4f46e5;
    font-weight: 800;
}

.cx-related-info-content {
    max-height: min(260px, 48vh);
    overflow: auto;
    line-height: 1.8;
    font-size: 0.95em;
}

.cx-related-info-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.12);
    color: #5060c8;
    cursor: pointer;
    line-height: 1;
}

.cx-tool-sidebar {
    position: fixed;
    left: 0;
    top: 38vh;
    z-index: 930;
    width: 48px;
    height: 48px;
    opacity: 0.82;
    transition: opacity 0.2s ease;
    user-select: none;
    touch-action: none;
}

.cx-tool-sidebar:hover,
.cx-tool-sidebar.dragging {
    opacity: 1;
}

.cx-tool-sidebar.dragging {
    transition: none;
}

.cx-tool-sidebar-tab {
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(79, 70, 229, 0.78);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 0.76em;
    font-weight: 700;
    cursor: grab;
    box-shadow: 0 8px 22px rgba(79, 70, 229, 0.28);
}

.cx-tool-sidebar.dragging .cx-tool-sidebar-tab {
    border-radius: 50%;
    background: rgba(79, 70, 229, 0.92);
    cursor: grabbing;
}

.cx-tool-sidebar.cx-tool-dock-left,
.cx-tool-sidebar.cx-tool-dock-right {
    width: 24px;
    height: 54px;
}

.cx-tool-sidebar.cx-tool-dock-top,
.cx-tool-sidebar.cx-tool-dock-bottom {
    width: 54px;
    height: 24px;
}

.cx-tool-sidebar.cx-tool-dock-left .cx-tool-sidebar-tab {
    border-radius: 0 999px 999px 0;
}

.cx-tool-sidebar.cx-tool-dock-right .cx-tool-sidebar-tab {
    border-radius: 999px 0 0 999px;
}

.cx-tool-sidebar.cx-tool-dock-top .cx-tool-sidebar-tab {
    border-radius: 0 0 999px 999px;
}

.cx-tool-sidebar.cx-tool-dock-bottom .cx-tool-sidebar-tab {
    border-radius: 999px 999px 0 0;
}

.cx-tool-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.54);
}

.cx-tool-modal.from-sidebar .cx-tool-modal-panel {
    animation: cxToolExpandFromSidebar 0.26s ease-out;
    transform-origin: calc(var(--cx-tool-origin-x, 24px) - 50vw) calc(var(--cx-tool-origin-y, 50vh) - 50vh);
}

@keyframes cxToolExpandFromSidebar {
    from {
        opacity: 0;
        transform: translate(
            calc(var(--cx-tool-origin-x, 24px) - 50vw),
            calc(var(--cx-tool-origin-y, 50vh) - 50vh)
        ) scale(0.18);
    }
    to {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
}

.cx-tool-modal-panel {
    width: min(1120px, 96vw);
    max-height: min(86vh, 820px);
    overflow: hidden;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
    display: flex;
    flex-direction: column;
}

.cx-tool-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid #eef2ff;
    background: linear-gradient(135deg, #f7f8ff 0%, #fffaf1 100%);
}

.cx-tool-modal-back {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.12);
    color: #5060c8;
    cursor: pointer;
    font-size: 1.8em;
    line-height: 1;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cx-tool-modal-title {
    color: #27304f;
    font-size: 1.35em;
    font-weight: 800;
}

.cx-tool-modal-subtitle {
    margin-top: 5px;
    color: #667085;
    font-size: 0.95em;
}

.cx-tool-modal-close {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.12);
    color: #5060c8;
    cursor: pointer;
    font-size: 1.1em;
}

.cx-tool-modal-content {
    padding: 20px 24px 24px;
    overflow: auto;
}

.cx-tool-home-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.cx-tool-home-card {
    min-height: 52px;
    padding: 10px;
    border: 1px solid rgba(102, 126, 234, 0.18);
    border-radius: 16px;
    background: linear-gradient(135deg, #f7f8ff, #fffaf1);
    color: #27304f;
    cursor: pointer;
    text-align: center;
}

.cx-tool-home-card strong {
    display: block;
    margin-bottom: 0;
    color: #4f46e5;
    font-size: 1em;
}

.cx-relation-tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.cx-relation-tool-card {
    padding: 18px;
    border: 1px solid rgba(239, 68, 68, 0.14);
    border-radius: 16px;
    background: linear-gradient(135deg, #fff7ed, #fff1f2);
    text-align: center;
}

.cx-relation-tool-pair {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    color: #991b1b;
}

.cx-relation-tool-pair span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #fff;
    color: #dc2626;
    font-size: 1.4em;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.12);
}

.cx-relation-tool-pair strong {
    font-size: 1.05em;
}

.cx-relation-tool-meta {
    margin-top: 12px;
    color: #667085;
    font-size: 0.95em;
}

.cx-bagong-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid #edf0ff;
    border-radius: 16px;
}

.cx-tool-table-wrap {
    overflow-x: auto;
}

.cx-changsheng-table {
    width: 100%;
    min-width: 360px;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid #edf0ff;
    border-radius: 16px;
}

.cx-changsheng-table th,
.cx-changsheng-table td {
    padding: 10px 8px;
    border-right: 1px solid #edf0ff;
    border-bottom: 1px solid #edf0ff;
    text-align: center;
    white-space: nowrap;
}

.cx-changsheng-table th {
    background: #f6f8ff;
    color: #4f46e5;
    font-weight: 800;
}

.cx-changsheng-table tr:last-child th,
.cx-changsheng-table tr:last-child td {
    border-bottom: none;
}

.cx-changsheng-table th:last-child,
.cx-changsheng-table td:last-child {
    border-right: none;
}

.cx-bagong-table th,
.cx-bagong-table td {
    padding: 10px 8px;
    border-right: 1px solid #edf0ff;
    border-bottom: 1px solid #edf0ff;
    text-align: center;
    white-space: nowrap;
}

.cx-bagong-table th {
    background: #f6f8ff;
    color: #4f46e5;
    font-weight: 800;
}

.cx-bagong-table tr:last-child th,
.cx-bagong-table tr:last-child td {
    border-bottom: none;
}

.cx-bagong-table th:last-child,
.cx-bagong-table td:last-child {
    border-right: none;
}

.cx-bagong-table-btn {
    min-width: 48px;
    padding: 6px 9px;
    border: 1px solid rgba(102, 126, 234, 0.18);
    border-radius: 999px;
    background: #fff;
    color: #27304f;
    cursor: pointer;
    font-weight: 700;
}

.cx-bagong-table-btn:hover {
    border-color: #667eea;
    background: #eef2ff;
    color: #4f46e5;
}

.cx-tool-gua-modal {
    position: fixed;
    inset: 0;
    z-index: 1220;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.38);
}

.cx-tool-gua-panel {
    width: min(560px, 94vw);
    max-height: 84vh;
    overflow: auto;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.3);
    animation: cxPanelFadeIn 0.2s ease-out;
}

.cx-tool-gua-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid #eef2ff;
    background: linear-gradient(135deg, #f7f8ff 0%, #fffaf1 100%);
}

.cx-tool-gua-title {
    color: #27304f;
    font-size: 1.2em;
    font-weight: 800;
}

.cx-tool-gua-subtitle {
    margin-top: 4px;
    color: #667085;
}

.cx-tool-gua-content {
    padding: 22px;
    text-align: center;
}

.cx-tool-gua-content .cx-najia-gua {
    box-shadow: none;
}

.cx-najia-gua {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 18px;
    border-radius: 18px;
    background: #fffdf8;
    border: 1px solid #efe6d2;
    box-shadow: 0 10px 28px rgba(93, 76, 32, 0.08);
}

.cx-najia-left-list,
.cx-najia-right-list {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0;
}

.cx-najia-side-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 25px;
    height: 25px;
    margin: 0;
    color: #344054;
    font-size: 15px;
    white-space: nowrap;
}

.cx-najia-left-row {
    justify-content: flex-end;
}

.cx-najia-right-row {
    justify-content: flex-start;
}

.cx-najia-side-row.changed {
    color: #c62828;
}

.cx-najia-shiying {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 50%;
    color: #fff;
    background: #667eea;
    font-size: 0.85em;
}

.cx-najia-shiying:empty {
    background: transparent;
}

.cx-najia-side-row span {
    padding: 3px 7px;
    border-radius: 8px;
    font-size: 0.9em;
}

.cx-najia-side-row .cx-najia-liushen {
    background: #eef2ff;
    color: #4f46e5;
}

.cx-najia-side-row .cx-najia-wuxing {
    background: #ecfdf3;
    color: #15803d;
}

.cx-najia-side-row .cx-najia-fushen {
    min-width: 76px;
    background: #fff7ed;
    color: #c2410c;
    text-align: center;
}

.cx-najia-side-row .cx-najia-fushen:empty {
    background: transparent;
}

.cx-najia-shiying {
    background: #fff7ed;
    color: #c2410c;
}

.cx-najia-side-row .cx-najia-ganzhi {
    background: #fef9c3;
    color: #854d0e;
}

.cx-najia-side-row .cx-najia-ganzhi .cx-najia-gan,
.cx-najia-side-row .cx-najia-ganzhi .cx-najia-zhi {
    padding: 0;
    border-radius: 0;
    font-size: 1em;
}

.cx-najia-zhi-an-dong {
    display: inline-block;
    color: #f97316;
    font-weight: 800;
    animation: cxNajiaAnDong 1.35s ease-in-out infinite;
    text-shadow: 0 0 7px rgba(249, 115, 22, 0.5), 0 0 12px rgba(251, 191, 36, 0.32);
}

.cx-najia-zhi-ri-po {
    display: inline-block;
    animation: cxNajiaRiPo 3s ease-in-out infinite;
}

@keyframes cxNajiaRiPo {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes cxNajiaAnDong {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-1px) rotate(-4deg);
    }
    50% {
        transform: translateY(1px) rotate(4deg);
    }
    75% {
        transform: translateY(-1px) rotate(-2deg);
    }
}

.cx-najia-side-row .cx-najia-liuqin {
    background: #f3e8ff;
    color: #7e22ce;
}

.cx-najia-side-row.changed span {
    background: #fff1f1;
    color: #c62828;
}

.cx-najia-side-row.changed .cx-najia-shiying {
    background: #fee2e2;
    color: #b91c1c;
}

.cx-najia-side-row.changed .cx-najia-shiying:empty {
    background: transparent;
}

.cx-wuxing-state {
    max-width: 680px;
    margin: 0 auto 18px;
    padding: 16px 18px;
    border-radius: 16px;
    background: #f9f9f9;
    text-align: left;
}

.cx-wuxing-state .cx-ganzhi-pill-list {
    margin-bottom: 7px;
}

.cx-wuxing-state-grid .cx-wuxing-state-wang {
    background: #e8f5e9;
    color: #2e7d32;
}

.cx-wuxing-state-grid .cx-wuxing-state-xiang {
    background: #fff7e6;
    color: #b26a00;
}

.cx-wuxing-state-grid .cx-wuxing-state-xiu {
    background: #e8f4fd;
    color: #1565c0;
}

.cx-wuxing-state-grid .cx-wuxing-state-qiu {
    background: #f3e8ff;
    color: #6a1b9a;
}

.cx-wuxing-state-grid .cx-wuxing-state-si {
    background: #ffebee;
    color: #c62828;
}

.gua-yao {
    display: block;
    height: 1.5em;
    margin: 0.2em 0;
    transition: all 0.3s;
}

.gua-yao.yang {
    color: #333;
}

.gua-yao.yang.changed {
    color: #f44336;
}

.gua-yao.yin {
    color: #333;
}

.gua-yao.yin.changed {
    color: #f44336;
}

.change-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin: 5px;
    font-size: 0.9em;
}

.change-btn:hover {
    background: #45a049;
}

.yaoci-item {
    background: white;
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    cursor: pointer;
    transition: all 0.3s;
}

.yaoci-item:hover {
    background: #f5f5f5;
    transform: translateX(5px);
}

.yaoci-item.changed {
    border-left-color: #f44336;
    background: #ffebee;
}

.yaoci-item .yaoci-title {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.yaoci-item .yaoci-content {
    color: #666;
    line-height: 1.8;
}

.gua-result-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-top: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.gua-result-card .gua-symbol {
    font-size: 6em;
    text-align: center;
    color: #333;
    margin: 20px 0;
}

.gua-result-card .gua-name {
    text-align: center;
    font-size: 2em;
    margin: 20px 0;
    color: #333;
}

.gua-result-card .gua-ci {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    font-size: 1.1em;
    line-height: 1.8;
}

.gua-result-card .yao-ci-list {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

.gua-result-card .yao-ci-item {
    padding: 12px;
    margin: 8px 0;
    border-left: 4px solid #667eea;
    background: white;
    border-radius: 8px;
    transition: all 0.3s;
}

.gua-result-card .yao-ci-item:hover {
    background: #f5f5f5;
    transform: translateX(5px);
}

.gua-result-card .yao-ci-item.changed {
    border-left-color: #f44336;
    background: #ffebee;
}

.gua-result-card .bian-gua-info {
    background: #fff3e0;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    border-left: 4px solid #ff9800;
}

.yao-display {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    justify-content: center;
    gap: 0;
    min-height: 30px;
    margin-bottom: 2px;
    padding: 0 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    position: relative;
}

.yao-line {
    width: 80px;
    height: 5px;
    margin: 12px 0;
    transition: all 0.3s;
    position: relative;
    background: transparent;
}

.yao-line.yang.normal {
    background: #333;
    border-radius: 2px;
}

.yao-line.yang.old {
    background: #f44336;
    border-radius: 2px;
}

.yao-line.normal:before,
.yao-line.old:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 48%;
    height: 100%;
    border-radius: 2px;
    background: #333;
}

.yao-line.normal:after,
.yao-line.old:after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 48%;
    height: 100%;
    border-radius: 2px;
    background: #333;
}

.yao-line.old:before,
.yao-line.old:after {
    background: #f44336;
}

.yao-line.yang:before,
.yao-line.yang:after {
    display: none;
}

@media (max-width: 768px) {
    .cx-char-panel {
        width: min(320px, calc(100vw - 20px));
        max-height: min(70vh, 560px);
        overflow-y: auto;
        border-radius: 20px;
    }

    .cx-char-panel-header {
        position: sticky;
        top: 0;
        background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(246,248,255,0.96) 100%);
        padding-bottom: 8px;
        z-index: 1;
    }

    .cx-char-panel-badge {
        width: 56px;
        height: 56px;
        font-size: 1.8em;
    }

    .cx-char-btn.active {
        transform: scale(1.18);
    }

    .cx-ganzhi-time,
    .cx-wuxing-state {
        padding: 14px 12px;
    }

    .cx-najia-gua {
        width: 100%;
        padding: 8px 6px;
        gap: 6px;
        overflow-x: auto;
    }

    .cx-najia-side-row {
        gap: 3px;
        font-size: 12px;
    }

    .cx-najia-left-row {
        gap: 1px;
    }

    .cx-najia-side-row span {
        padding: 2px 4px;
        border-radius: 6px;
    }

    .cx-najia-left-row span {
        padding-left: 2px;
        padding-right: 2px;
    }

    .cx-najia-side-row .cx-najia-fushen {
        min-width: 52px;
        padding-left: 3px;
        padding-right: 3px;
    }

    .cx-najia-shiying {
        min-width: 20px;
        height: 20px;
        font-size: 0.78em;
    }

    .gua-symbol-container .yao-line {
        width: 68px;
    }

    .cx-tool-sidebar {
        top: auto;
        bottom: 96px;
        left: 6px;
    }

    .cx-tool-modal {
        padding: 10px;
    }

    .cx-tool-modal-panel {
        max-height: 92vh;
    }

    .cx-tool-modal-header,
    .cx-tool-modal-content {
        padding: 16px;
    }

    .cx-bagong-table {
        min-width: 720px;
    }

    .cx-tool-gua-modal {
        padding: 10px;
    }
}

.nav-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.nav-bar .back-btn {
    margin-bottom: 0;
}
