@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

        .chart-container {
            font-family: 'Roboto', sans-serif;
            color: #111;
            font-size: 13px;
        }

        /* =========================
           KHUNG CHỤP ẢNH
        ========================= */
        .chart-container {
            width: 720px;                /* 737px x scale(2) = ~1474px giống layout mẫu */
            background: #ffffff;
            border: 0px solid #2b2b2b;
            margin: 1rem auto;
        }

        /* =========================
           HEADER (GIỮ NHƯ CŨ)
        ========================= */
        .info-panel {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 12px;
            border-bottom: 1px solid #9e9e9e;
            line-height: 1.4;
            font-size: 12.5px;
        }
        .info-panel-text { text-align: left; }
        .info-panel-logo img { max-width: 140px; height: auto; }

        /* =========================
           BẢNG TỨ TRỤ
        ========================= */
        table { border-collapse: collapse; }

        .main-table {
            width: 100%;
            table-layout: fixed;
        }
        .main-table td {
            border: 1px solid #9e9e9e;
            padding: 6px 6px;
            text-align: center;
            vertical-align: middle;
        }
        .left-label {
            width: 120px;
            font-weight: 500;
            color: #1f4e79;
            background: #f3f4f6;
            text-transform: uppercase;
            font-size: 11px;
            letter-spacing: 0.3px;
        }
        .left-label .stack {
            display: inline-block;
            line-height: 1.15;
        }

        .solar-cell {
            font-weight: 300;
            font-size: 14px;
        }

        .chu-tinh-cell {
            font-weight: 600;
        }
        .nhat-chu {
            font-weight: 800;
            background: #ffca28;
        }

        .pillar-cell {
            padding-top: 10px;
            padding-bottom: 10px;
        }
        .pillar-can {
            font-weight: 700;
            font-size: 18px;
            line-height: 1.2;
            text-transform: uppercase;
        }
        .pillar-chi {
            font-weight: 700;
            font-size: 18px;
            line-height: 1.2;
            text-transform: uppercase;
        }

        .tang-an-cell {
            font-size: 13px;
            font-weight: 600;
        }
        .tang-an-cell span {
            margin: 0 8px 0 0;
            display: inline-block;
        }

        .pho-tinh-cell {
            font-size: 13px;
        }
        .pho-tinh-cell span {
            margin: 0 10px 0 0;
            display: inline-block;
        }

        .nap-am-cell {
            font-size: 13px;
        }

        .ln-age {
            font-size: 11px;
            color: #777;
        }

        .ts-cell {
            vertical-align: top;
            padding: 4px;
            text-align: center;
        }
        
        .ts-text {
            font-size: 10px;
            color: #d9534f;
            line-height: 1.2;
            word-wrap: break-word;
        }

        /* =========================
           ĐẠI VẬN / LƯU NIÊN
        ========================= */
        .van-table {
            width: 100%;
            table-layout: fixed;
            margin-top: -1px; /* khớp đường viền với bảng trên */
        }
        .van-table td {
            border: 1px solid #9e9e9e;
            padding: 6px 4px;
            text-align: center;
            vertical-align: middle;
        }

        .dv-cell .dv-can,
        .dv-cell .dv-chi {
            font-weight: 700;
            font-size: 12px;
            line-height: 1.05;
        }
        .dv-cell .dv-range {
            margin-top: 6px;
            font-size: 12px;
            color: #6c757d;
        }
        .dv-cell .dv-year {
            margin-top: 2px;
            font-size: 12px;
            font-weight: 700;
        }

        .ln-cell .ln-can,
        .ln-cell .ln-chi {
            font-weight: 700;
            font-size: 12px;
            line-height: 1.05;
        }
        .ln-cell .ln-year {
            margin-top: 6px;
            font-size: 12px;
            font-weight: 800;
        }
        .ln-cell .ln-age {
            margin-top: 2px;
            font-size: 12px;
            color: #6c757d;
        }

        .current-dai-van {
            background: #fff2cc; /* vàng nhạt */
        }
        .current-luu-nien {
            background: #ffca28; /* vàng đậm */
        }

        /* =========================
           THẦN SÁT + THÔNG TIN PHỤ
        ========================= */
        .bottom-section {
            display: flex;
            margin-top: -1px; /* khớp đường viền */
        }
        .aux-left {
            width: 220px;
            table-layout: fixed;
        }
        .aux-left td {
            border: 1px solid #9e9e9e;
            padding: 6px;
            font-size: 11px;
        }
        .aux-left .label {
            width: 120px;
            font-weight: 500;
            color: #1f4e79;
            background: #f2f2f2;
            text-align: center;
        }

        .aux-right {
            flex: 1;
            border-top: 1px solid #9e9e9e;
            border-right: 1px solid #9e9e9e;
            border-bottom: 1px solid #9e9e9e;
        }
        .aux-right table {
            width: 100%;
            table-layout: fixed;
        }
        .aux-right th,
        .aux-right td {
            border-left: 1px solid #9e9e9e;
            border-bottom: 1px solid #9e9e9e;
            padding: 6px;
            font-size: 11px;
            text-align: center;
            vertical-align: top;
        }
        .aux-right th {
            background: #f2f2f2;
            color: #1f4e79;
            font-weight: 800;
        }
        .aux-right .ts-title {
            text-transform: uppercase;
            letter-spacing: 0.3px;
        }

        /* =========================
           FOOTER + CHÚ GIẢI NGŨ HÀNH
        ========================= */
        .chart-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 10px;
            border-top: 1px solid #9e9e9e;
            font-size: 12px;
        }
        .legend {
            display: flex;
            gap: 10px;
            align-items: center;
        }
        .legend-item {
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }
        .legend-box {
            width: 14px;
            height: 10px;
            border: 1px solid #666;
        }
        .legend-box.kim { background: #6c757d; }
        .legend-box.moc { background: #28a745; }
        .legend-box.thuy { background: #0d6efd; }
        .legend-box.hoa { background: #dc3545; }
        .legend-box.tho { background: #fd7e14; }

        /* =========================
           NGŨ HÀNH (MÀU CHỮ)
        ========================= */
        .element-moc { color: #28a745; }
        .element-hoa { color: #dc3545; }
        .element-tho { color: #fd7e14; }
        .element-kim { color: #6c757d; }
        .element-thuy { color: #0d6efd; }

        /* =========================
           HIỂN THỊ ẢNH KẾT QUẢ
        ========================= */
        #result-display-container {
            max-width: 960px;
            margin: 2rem auto;
            text-align: center;
            display: none;
        }
        #result-image {
            max-width: 100%;
            height: auto;
            border: 1px solid #565656;
            border-radius: 8px;
            background-color: #fff;
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }
        #loading-indicator { margin-top: 4rem; }