* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

body {
    background: linear-gradient(135deg, #1a237e, #4a148c);
    color: #333;
    min-height: 100vh;
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    line-height: 1.5;
}

body.is-fullscreen {
    padding: 0;
    align-items: flex-start;
    background: #f0f3f5;
}

body.is-fullscreen .container {
    max-width: 100%;
    width: 100%;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    min-height: 100vh;
    padding: 20px; 
}

.container {
    width: 100%;
    max-width: 450px;       
    aspect-ratio: 9/16;     
    max-height: 95vh;       
    margin: 0 auto;
    background-color: rgba(255, 255, 255, 0.97);
    padding: 0; 
    border-radius: 15px;    
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
    overflow-y: auto;       
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

body.result-mode .container {
    max-width: 1800px;      
    width: 98%; 
    aspect-ratio: auto;     
    max-height: none;       
    border-radius: 15px;    
    display: block;         
    overflow: hidden;
}

header {
    background: linear-gradient(to right, #5e35b1, #3949ab);
    color: white;
    padding: 18px 22px;
    position: relative;
    display: flex;
    align-items: center; 
}

.container:not(.result-mode-active) h1 {
    font-size: 1.8rem;
    font-weight: 600;
}
.container:not(.result-mode-active) .subtitle {
    font-size: 1.25rem;
}

.header-main-title {
    display: flex;
    align-items: center; 
    justify-content: space-between; 
    width: 100%;
    gap: 15px;
}

.header-text {
    flex-grow: 1;
    text-align: center; 
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.header-logo {
    width: 75px;
    height: 75px;
    object-fit: contain;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.2)); 
}

h1 { 
    color: white; 
    border-bottom: none; 
    padding-bottom: 0; 
    margin-bottom: 0; 
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.2; 
}

.subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
    max-width: 500px;
    margin: 0 auto; 
}

.content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
body.result-mode .content {
    display: block; 
    justify-content: flex-start;
}

h2 { font-size: 1.5em; margin-top: 25px; color: #5e35b1; font-weight: 600;}
h3 { font-size: 1.2em; margin-top: 20px; color: #5e35b1; font-weight: 600;}
h4 {
    font-size: 1.1em; 
    margin: 20px 0 10px 0; 
    color: #5e35b1; 
    font-weight: 600;
}

#decade-pillars-title {
    font-size: 1.05em;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 20px; 
    margin-bottom: 18px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
}

.card-title {
    color: #5e35b1;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f5f5f5;
    font-size: 1.1rem;
    font-weight: 600;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr; 
    gap: 15px;
    margin-bottom: 25px;
    text-align: left; 
}

body.result-mode .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.form-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start; 
}

label { 
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
    font-size: 0.85rem; 
    text-align: left; 
    width: 100%;
}

input, select { 
    width: 100%; 
    padding: 11px; 
    border: 2px solid #e0e0e0; 
    border-radius: 9px; 
    font-size: 1rem; 
    transition: all 0.3s;
    max-width: 100%;
}

input:focus, select:focus { 
    border-color: #5e35b1; 
    outline: none; 
    box-shadow: 0 0 0 3px rgba(94, 53, 177, 0.2);
}

input[type="date"], input[type="time"] {
    -webkit-appearance: none; 
    font-family: inherit;
}
input[type="date"]::-webkit-inner-spin-button,
input[type="time"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-clear-button,
input[type="time"]::-webkit-clear-button {
    -webkit-appearance: none; 
    display: none;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-picker-indicator {
    opacity: 1;
    -webkit-appearance: none; 
}

button[type="submit"] {
    background: linear-gradient(to right, #ff9800, #f57c00);
    color: white;
    border: none;
    padding: 13px;
    border-radius: 9px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 3px 8px rgba(245, 124, 0, 0.3);
    flex-grow: 1;
}

button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(245, 124, 0, 0.4);
    background: #f57c00;
}

#reset-button {
    background-color: #95a5a6; 
    color: white;
    border: none;
    padding: 13px;
    border-radius: 9px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    flex-grow: 1;
}

#reset-button:hover {
    background-color: #7f8c8d;
}

.copyright-input {
    text-align: center;
    font-size: 0.85rem;
    color: #888;
    margin-top: 10px;
}
.copyright-input a {
    color: #5e35b1;
    text-decoration: none;
    font-weight: bold;
}

.main-result-layout {
    display: grid;
    grid-template-columns: 320px 1fr; 
    gap: 20px;
    align-items: start;
}

.left-result-panel {
    height: auto;
}

.right-result-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0; 
}

.watermark-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('wm.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: 60%;
    opacity: 0.07;
    pointer-events: none;
    z-index: 999;
}

@media (max-width: 1000px) {
    .main-result-layout {
        display: flex;
        flex-direction: column;
    }

    .right-result-panel {
        order: 1;
        width: 100%; 
        max-width: 100%; 
        min-width: 0; 
    }

    .left-result-panel {
        order: 2;
        width: 100%;
        max-width: 100%;
    }
}

#results { 
    margin-top: 0px; 
    padding-top: 0; 
    border-top: none; 
}

.result-grid {
    display: grid;
    grid-template-columns: 1fr; 
    gap: 20px;
    margin-bottom: 2px;
}

.info-box {
    background: #f0f7ff;
    border-left: 0px solid #5e35b1;
    padding: 15px; 
    border-radius: 9px;
    font-size: 0.9em;
    line-height: 1.6;
    height: 100%; 
}

.info-box strong {
    color: #5e35b1;
}

#fengshui-info, #kongwang-info {
    margin-top: 10px; 
    border-top: 1px dashed #c0d9fa; 
    padding-top: 10px;
}

.warning {
    background-color: #fee; border-left: 6px solid #e74c3c;
    color: #c0392b; padding: 15px; margin-top: 15px;
    border-radius: 6px;
}

.bazi-table-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.bazi-controls-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

#now-button, #new-input-button {
    background-color: #5e35b1;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}
#now-button:hover, #new-input-button:hover {
    background-color: #3949ab;
}

#new-input-button {
    background-color: #00897b; 
}
#new-input-button:hover {
    background-color: #00695c;
}

#static-bazi-chart .shi-shen-small {
    display: none !important;
}

.bazi-table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 2px;
}

.bazi-table {
    width: 100%; 
    border-collapse: collapse; 
    text-align: center; 
    margin-bottom: 2px;
    border-radius: 8px; 
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid #e0e0e0;
    position: relative;
    min-width: 0; 
    table-layout: fixed;
    --visible-cols: 8;
}

.bazi-table th, .bazi-table td { 
    border: 1px solid #f0f3f5;
    padding: 8px; 
    vertical-align: middle;
    background-color: rgba(255, 255, 255, 0.85);
    position: relative;
    z-index: 1;
    font-size: 0.9em;
    word-wrap: break-word; 
}
.bazi-table th { 
    background-color: rgba(236, 240, 241, 0.9);
    font-weight: bold; 
    font-size: 0.9em;
    color: #34495e;
    padding: 10px 8px;
}
.bazi-table .pillar-label { 
    font-size: 0.8em;
    color: #7f8c8d; 
    font-weight: normal; 
    background-color: rgba(247, 249, 251, 0.9);
    border-right: 1px solid #dfe6e9; 
}

.stem-display, .branch-display {
    font-weight: bold; line-height: 1.2;
}
.stem-char-large { 
    font-size: 1.6em; 
    font-weight: 700;
} 

.shi-shen-small {
    font-size: 0.75em;
    font-weight: bold;
    display: block;
    margin-top: 2px;
    line-height: 1;
}

.hidden-stems { 
    font-size: 0.85em; 
    color: #333; 
    text-align: center;
    padding: 8px 10px; 
    line-height: 1.5;
}
.pillar-divider {
    border-left: 3px solid #bdc3c7 !important; 
}

.bazi-table th.col-decade, .bazi-table td.col-decade,
.bazi-table th.col-year, .bazi-table td.col-year,
.bazi-table th.col-month, .bazi-table td.col-month,
.bazi-table th.col-day, .bazi-table td.col-day {
    width: auto;
    min-width: 0;
    max-width: none;
}

.element-counts-wrapper {
    display: block; 
}
.element-count-container h3 {
     margin-top: 0;
}

.element-count-table { 
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    border-radius: 8px; 
    overflow: hidden; 
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05); 
    table-layout: fixed; 
}
.element-count-table th, .element-count-table td {
    padding: 8px 2px; 
    border: 1px solid #e0e0e0;
    text-align: center;
    font-size: 0.8em; 
}
.element-count-table .count-val { 
    font-size: 1.1em; 
    font-weight: bold; 
    color: #2c3e50; 
    background-color: #fff; 
}

.element-totals {
    margin-top: 15px;
    padding: 10px;
    background-color: #f7f9fb;
    border-radius: 8px;
    text-align: center;
    font-size: 0.85em;
}
.element-totals span {
    margin: 0 8px;
    font-weight: bold;
}

.growth-phase-cell, .nayin-cell {
    font-size: 0.8em;
    font-weight: bold;
    line-height: 1.3;
    padding: 6px 4px;
    text-align: center;
    vertical-align: middle;
}
.nayin-cell span {
    font-weight: bold;
    font-size: 1.1em;
}

.bazi-table .growth-phase-cell, 
.bazi-table .nayin-cell {
    font-size: 0.65em;
    padding: 4px 2px;
}
.bazi-table .nayin-cell span {
    font-size: 1.0em; 
}

.shensha-cell {
    font-size: 0.5em;
    line-height: 1.3;
    padding: 6px 4px;
    text-align: center;
    vertical-align: top;
    min-height: 50px;
}

.bazi-table .shensha-cell {
    font-size: 0.5em;
}

.shensha-cell span {
    display: block;
    margin-bottom: 2px;
}

.shensha-good { color: #2E7D32; }
.shensha-bad { color: #C62828; }
.shensha-special { color: #B8860B; }

.element-wood, .element-木 { color: #2E7D32 !important; } 
.element-fire, .element-火 { color: #C62828 !important; } 
.element-earth, .element-土 { color: #5D4037 !important; } 
.element-metal, .element-金 { color: #B8860B !important; } 
.element-water, .element-水 { color: #1565C0 !important; } 

.positive-rel { color: #2E7D32; font-weight: bold; font-size: 1.4em; }
.negative-rel { color: #C62828; font-weight: bold; font-size: 1.4em; }

.luck-pillars-horizontal-table {
    width: 100%;
    table-layout: auto; 
    border-collapse: collapse;
    text-align: center;
    margin-bottom: 2px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid #e0e0e0;
    position: relative;
}

.luck-pillars-horizontal-table th, 
.luck-pillars-horizontal-table td,
#luck-pillars-table-horizontal th, 
#luck-pillars-table-horizontal td,
#annual-pillars-container .luck-pillars-horizontal-table th, 
#annual-pillars-container .luck-pillars-horizontal-table td,
#monthly-pillars-container .luck-pillars-horizontal-table th,
#monthly-pillars-container .luck-pillars-horizontal-table td,
#day-pillars-container .luck-pillars-horizontal-table th,
#day-pillars-container .luck-pillars-horizontal-table td {
    border: 1px solid #f0f3f5;
    padding: 6px 4px !important; 
    vertical-align: middle;
    background-color: #fff;
    min-width: 50px; 
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.9rem !important; 
    line-height: 1.3;
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

.luck-pillars-horizontal-table th {
    background-color: #ecf0f1;
    font-weight: bold;
    color: #34495e;
    padding: 10px 8px !important;
}

.luck-pillars-horizontal-table td:hover {
     background-color: #f0f7ff;
}

.branch-compound-cell {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 100%;
    width: 100%;
}

.branch-main {
    font-weight: bold;
    font-size: 1.3em; 
}

.hidden-stems-vertical {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    font-size: 0.7em;
    line-height: 1.2;
    color: #555;
}

.hidden-stem-item {
    white-space: nowrap;
    text-align: left;
}

.shi-shen-luck-pillar {
    font-size: 0.75em !important;
    font-weight: normal; 
    display: block;
    line-height: 1;
}

.luck-pillars-horizontal-table .growth-phase-cell,
#luck-pillars-table-horizontal .growth-phase-cell,
#annual-pillars-container .luck-pillars-horizontal-table .growth-phase-cell,
#monthly-pillars-container .luck-pillars-horizontal-table .growth-phase-cell {
     font-size: 0.75em !important;
     font-weight: bold;
}

.luck-pillars-horizontal-table .nayin-cell,
#luck-pillars-table-horizontal .nayin-cell,
#annual-pillars-container .luck-pillars-horizontal-table .nayin-cell,
#monthly-pillars-container .luck-pillars-horizontal-table .nayin-cell {
    font-size: 0.7em !important;
    font-weight: bold;
}

.luck-pillars-horizontal-table .shensha-cell,
#luck-pillars-table-horizontal .shensha-cell,
#annual-pillars-container .luck-pillars-horizontal-table .shensha-cell,
#monthly-pillars-container .luck-pillars-horizontal-table .shensha-cell {
    font-size: 0.6em !important;
    font-weight: normal; 
}

.luck-pillars-horizontal-table .stem-char-large {
    font-size: 1.4em !important; 
    font-weight: bold;
}

.selected-decade-column,
.selected-year-column,
.selected-month-column,
.selected-day-column {
    background-color: #e3f2fd !important; 
    border-left: 2px solid #5e35b1 !important; 
    border-right: 2px solid #5e35b1 !important; 
    border-top: 2px solid #5e35b1 !important; 
    transition: background-color 0.3s ease;
}

.selected-decade-column .stem-char-large,
.selected-year-column .stem-char-large,
.selected-month-column .stem-char-large,
.selected-day-column .stem-char-large {
    color: #5e35b1;
}

.luck-pillars-horizontal-table .selected-decade-column,
.luck-pillars-horizontal-table .selected-year-column,
.luck-pillars-horizontal-table .selected-month-column,
.luck-pillars-horizontal-table .selected-day-column {
    border-left: 1px solid #f0f3f5 !important; 
    border-right: 1px solid #f0f3f5 !important;
    border-top: 1px solid #f0f3f5 !important;
    border-bottom: 1px solid #f0f3f5 !important;
}

.luck-pillars-horizontal-table th:first-child,
#luck-pillars-table-horizontal th:first-child {
    width: 75px !important;       
    min-width: 75px !important;   
    max-width: 75px !important;   
    font-size: 0.8em !important;  
    padding: 6px 2px !important;  
    white-space: normal !important; 
    overflow: hidden;
    line-height: 1.2;
    text-align: center;
}

#day-pillars-container {
    display: block; 
    width: 100%;
    font-size: 1rem; 
}

#day-pillars-container .luck-pillars-horizontal-table th,
#day-pillars-container .luck-pillars-horizontal-table td {
    font-size: 0.9rem !important; 
    padding: 6px 4px !important;   
}

#day-pillars-container .luck-pillars-horizontal-table .stem-char-large {
    font-size: 1.4em !important; 
}

#day-pillars-container .luck-pillars-horizontal-table .shensha-cell {
    font-size: 0.6em !important;
}

#day-pillars-container .luck-pillars-horizontal-table .growth-phase-cell,
#day-pillars-container .luck-pillars-horizontal-table .nayin-cell {
    font-size: 0.75em !important;
}

@media (min-width: 769px) {
    .bazi-table .growth-phase-cell, 
    .bazi-table .nayin-cell {
        font-size: 0.85em !important; 
    }

    .bazi-table .shensha-cell {
        font-size: 0.85em !important; 
        line-height: 1.3; 
    }
    
    .bazi-table .shensha-cell span {
        margin-bottom: 3px;
    }
    
    #monthly-pillars-container .luck-pillars-horizontal-table .growth-phase-cell,
    #monthly-pillars-container .luck-pillars-horizontal-table .nayin-cell {
        font-size: 1.0em !important;
    }

    #monthly-pillars-container .luck-pillars-horizontal-table .shensha-cell {
        font-size: 0.85em !important;
    }

    .luck-pillars-horizontal-table .row-stem span:not(.shi-shen-luck-pillar),
    .luck-pillars-horizontal-table .stem-char-large {
        font-weight: normal !important; 
    }
    
    .luck-pillars-horizontal-table .branch-main {
        font-weight: normal !important; 
    }

    .luck-pillars-horizontal-table .nayin-cell,
    .luck-pillars-horizontal-table .nayin-cell span {
        font-weight: normal !important;
    }
    
    .bazi-table .stem-char-large,
    .bazi-table .branch-main,
    .bazi-table .branch-display span {
        font-size: clamp(1.5em, calc(12em / var(--visible-cols)), 3.5em) !important; 
    }
}

body.hide-monthly-details #monthly-pillars-container .row-12p,
body.hide-monthly-details #monthly-pillars-container .row-nayin,
body.hide-monthly-details #monthly-pillars-container .row-shensha {
    display: none !important;
}

body.hide-monthly-nayin #monthly-pillars-container .row-nayin {
    display: none !important;
}
body.hide-monthly-12p #monthly-pillars-container .row-12p {
    display: none !important;
}
body.hide-monthly-shensha #monthly-pillars-container .row-shensha {
    display: none !important;
}

.bazi-table .stem-char-large {
    font-size: 2.0em !important; 
    line-height: 1.1; 
}

#day-master .stem-char-large {
    font-size: 1.1em !important; 
    vertical-align: baseline;    
}

.jodoh-icon, 
#relationship-info,
label[for="toggle-jodoh"], 
.hide-jodoh-icon { 
    display: none !important; 
}

#hour-section, 
#hour-pillars-container { 
    display: none !important; 
}

.col-hour {
    display: none !important;
}

#static-temp-section,
#dynamic-temp-section,
#static-temp-info-wrapper,
#bazi-temperature-status,
#bazi-temperature-status-clone,
#bazi-temperature-status-dynamic {
    display: none !important;
}

#health-info-container,
.health-potential-section {
    display: none !important;
}

#element-analysis-section,
#bazi-strength-status,
#bazi-strength-analysis,
#favorable-elements-display,
#bazi-strength-status-summary,
#bazi-strength-analysis-summary,
#favorable-elements-display-summary,
#bazi-dynamic-support-analysis {
    display: none !important;
}

.interaction-grid,
#static-interaction-column,
#dynamic-interaction-column {
    display: none !important;
}

#dynamic-element-section {
    display: none !important;
}

.element-counts-wrapper {
    grid-template-columns: 1fr !important;
}

#luck-pillars-table-horizontal .row-12p,
#luck-pillars-table-horizontal .row-nayin,
#luck-pillars-table-horizontal .row-shensha,
#annual-pillars-container .row-12p,
#annual-pillars-container .row-nayin,
#annual-pillars-container .row-shensha {
    display: none !important;
}

#monthly-pillars-container .row-12p,
#monthly-pillars-container .row-nayin,
#monthly-pillars-container .row-shensha {
    display: table-row !important;
}

#hour-pillars-container .row-12p,
#hour-pillars-container .row-nayin,
#hour-pillars-container .row-shensha {
    display: none !important;
}

#day-pillars-container .row-12p,
#day-pillars-container .row-nayin,
#day-pillars-container .row-shensha {
    display: none !important;
}

.fab-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.fab-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease-in-out;
    max-height: 0;
    overflow: hidden;
    padding-bottom: 0px; 
}
.fab-container.active .fab-options {
    max-height: 400px; 
}

.fab-button, .fab-main-button {
    border-radius: 50%;
    border: none;
    color: white;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    transition: background-color 0.3s, transform 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    padding: 0;
    aspect-ratio: 1;
}
.fab-button {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    font-size: 18px;
}

.fab-main-button {
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
    background-color: #5e35b1;
    font-size: 24px;
}
.fab-main-button:hover {
    background-color: #3949ab;
}

#font-increase, #font-decrease { background-color: #7e57c2; font-size: 18px; }
#font-reset { background-color: #ff9800; font-size: 18px; }
#save-jpeg-button { background-color: #4caf50; font-size: 20px; }
#save-pdf-button { background-color: #f44336; font-size: 16px; }

#toggle-options-fab {
    background-color: #607d8b; 
    font-size: 18px;
}

.fab-button:hover {
    transform: scale(1.1);
}
.fab-button:disabled {
    background-color: #9e9e9e;
    cursor: not-allowed;
    transform: none;
}

.bazi-nav-controls {
    display: flex;
    flex-direction: column; 
    gap: 5px;
    margin-bottom: 15px;
    margin-top: 5px;
}

.nav-row {
    display: flex;
    gap: 5px;
    width: 100%;
}

.bazi-nav-button {
    flex: 1; 
    background-color: #f0f4f8;
    border: 1px solid #dcdfe3;
    border-radius: 6px;
    padding: 6px 4px;
    font-size: 0.85rem; 
    cursor: pointer;
    transition: background-color 0.2s;
}
.bazi-nav-button:hover {
    background-color: #e3e9ef;
}

.display-options-card {
    background: #f7f9fb;
    border-radius: 9px;
    padding: 15px 20px;
    margin: 15px 0;
    border: 1px solid #e0e0e0;
}

.options-section-group {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.options-section-group.no-border {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.group-header-row {
    display: flex;
    align-items: center;
    justify-content: flex-start; 
    gap: 15px; 
    margin-bottom: 10px;
}

.group-title {
    font-size: 0.95rem;
    color: #5e35b1;
    font-weight: 600;
}

.options-top-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.display-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px 15px;
}

.compact-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
}

.display-options-grid label,  
.standard-label,              
.select-all-sub {             
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500; 
    color: #333;      
    margin: 0;
    cursor: pointer;
    line-height: 1.2;
    text-transform: none; 
}

.display-options-card input[type="checkbox"] {
    margin: 0;
    padding: 0;
    -webkit-appearance: checkbox;
    height: 16px;
    width: 16px;
    accent-color: #5e35b1; 
    cursor: pointer;
}

.display-options-grid label:hover,
.standard-label:hover,
.select-all-sub:hover {
    opacity: 0.8;
}

body.hide-col-decade .col-decade { display: none; }
body.hide-col-year .col-year { display: none; }
body.hide-col-month .col-month { display: none; }
body.hide-col-day .col-day { display: none; }

body.hide-details #decade-section h3,
body.hide-details #annual-section h3,
body.hide-details #monthly-section h3,
body.hide-details #day-section h3,
body.hide-details #decade-pillars-title,
body.hide-details #annual-pillars-container h4,
body.hide-details #monthly-pillars-container h4,
body.hide-details #day-pillars-container h4 {
    display: none !important;
}

body.hide-details .luck-pillars-horizontal-table .row-hidden,
body.hide-details .luck-pillars-horizontal-table .row-12p,
body.hide-details .luck-pillars-horizontal-table .row-shensha,
body.hide-details .luck-pillars-horizontal-table .row-nayin {
    display: none !important;
}

#toggle-options-fab {
    background-color: #607d8b; 
    font-size: 20px;
    padding-bottom: 2px;
}

.section-hidden {
    display: none !important;
}

#decade-section h3,
#annual-section h3,
#monthly-section h3,
#day-section h3,
#decade-pillars-title,
#annual-pillars-container h4,
#monthly-pillars-container h4,
#day-pillars-container h4,
#static-element-section h3 {
    display: none !important;
}

@media (max-width: 768px) {
    body { padding: 10px; margin: x;}
    .container { border-radius: 10; box-shadow: none; }
    header { padding: 15px; }
    h1 { font-size: 1rem; }
    .subtitle { font-size: 0.7rem; }
    .content { padding: 15px; }
    .form-grid { grid-template-columns: 1fr; gap: 10px; }
    
    #fullscreen-toggle {
        display: none !important;
    }

    .bazi-table th, .bazi-table td { 
        padding: 2px 1px !important; 
        font-size: 0.7rem !important; 
        height: auto;
    }
    
    .bazi-table th {
        font-size: 0.65rem !important;
        padding: 4px 1px !important;
        white-space: nowrap; 
        overflow: hidden;
        text-overflow: clip;
    }

    .bazi-table .stem-char-large,
    .bazi-table .branch-display span { 
        font-size: clamp(1.1em, calc(8.8em / 4), 2.5em) !important; 
        font-weight: bold;
    }
    .bazi-table th.col-decade, 
    .bazi-table td.col-decade,
    .bazi-table th.col-year, 
    .bazi-table td.col-year,
    .bazi-table th.col-month, 
    .bazi-table td.col-month,
    .bazi-table th.col-day, 
    .bazi-table td.col-day {
        display: none !important;
    }
    body.show-col-decade .col-decade, 
    body.show-col-year .col-year,
    body.show-col-month .col-month,
    body.show-col-day .col-day {
        display: table-cell !important;
    }
    body.hide-col-decade .col-decade, 
    body.hide-col-year .col-year,
    body.hide-col-month .col-month, 
    body.hide-col-day .col-day {
        display: none !important;
    }

    .bazi-table {
        --visible-cols: 4; 
    }

    .bazi-table .shi-shen-small { 
        font-size: 0.55em !important; 
        transform: scale(0.9); 
        transform-origin: center top;
        margin-top: 0;
        white-space: nowrap;
    }

    .bazi-table .hidden-stems { 
        font-size: 0.55em !important; 
        padding: 1px 0 !important;
        line-height: 1.1; 
    }
    .bazi-table .hidden-stems span {
        display: block;
        white-space: nowrap;
    }

    .header-logo { width: 66px; height: 66px; } 
    .header-main-title { gap: 10px; }
    
    #luck-pillars-table-horizontal th, #luck-pillars-table-horizontal td { min-width: 55px; padding: 5px 2px; font-size: 0.8em; }
    .luck-pillars-horizontal-table .hidden-stems-cell { font-size: 0.65em; }
    .element-counts-wrapper, .result-grid { grid-template-columns: 1fr; }
    .shensha-cell { font-size: 0.5em; }
    .growth-phase-cell, .nayin-cell { font-size: 0.7em; }
    
    .bazi-table-container {
        flex-wrap: wrap;
    }
    #view-mode-selector {
        order: 3; 
        width: 100%;
        justify-content: center;
        margin-top: 10px;
        margin-right: 0;
    }
    #now-button {
        order: 2;
    }
    .bazi-table-container h3 {
        order: 1;
    }
    .display-options-grid {
        grid-template-columns: 1fr 1fr; 
    }
    .result-grid {
        grid-template-columns: 1fr !important;
    }
    .info-box {
        margin-bottom: 15px;
    }
    .bazi-nav-button {
        padding: 8px 4px;
    }

    .bazi-table .pillar-label,
    .bazi-table th:first-child, 
    .luck-pillars-horizontal-table th:first-child,
    #luck-pillars-table-horizontal th:first-child,
    #annual-pillars-container .luck-pillars-horizontal-table th:first-child,
    #monthly-pillars-container .luck-pillars-horizontal-table th:first-child,
    #day-pillars-container .luck-pillars-horizontal-table th:first-child {
        display: none !important;
    }
}