/* --- 全局與佈局 --- */
body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    background-color: #1a1a1a;
    color: #e0e0e0;
    overflow: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px;
    background-color: #2c2c2c;
    border-radius: 12px;
}

.slideshow-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.slide {
    position: absolute;
    width: 90%;
    height: 90%;
    max-width: 1200px;
    max-height: 750px;
    background-color: #2c2c2c;
    border-radius: 12px;
    padding: 40px 50px;
    box-sizing: border-box;
    display: none;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    /* Allow scrolling for long content */
}

.slide.active {
    display: flex;
    opacity: 1;
}

/* --- 文本元素 --- */
.slide h1 {
    font-size: 3.2em;
    color: #4dabf7;
    margin-top: 0;
    margin-bottom: 10px;
    font-weight: 700;
    text-align: center;
    flex-shrink: 0;
}

.slide h2 {
    font-size: 2.2em;
    color: #ffffff;
    margin-top: 0;
    margin-bottom: 25px;
    border-bottom: 3px solid #4dabf7;
    padding-bottom: 10px;
    flex-shrink: 0;
    width: 100%;
    text-align: center;
}

.slide h3 {
    font-size: 1.6em;
    color: #a5d8ff;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.slide h4 {
    /* For sub-headers like "損益表", "現金流量表" */
    font-size: 1.4em;
    color: #a5d8ff;
    margin-top: 15px;
    /* Adjust margin-top */
    margin-bottom: 10px;
    /* Adjust margin-bottom */
    border-bottom: 1px solid #a5d8ff;
    padding-bottom: 5px;
    text-align: center;
}

.slide h5 {
    /* For "資產", "負債", "股東權益" inside BS visual */
    font-size: 1.3em;
    color: #f0f0f0;
    margin-top: 0;
    margin-bottom: 10px;
    text-align: center;
    padding-bottom: 5px;
    border-bottom: 1px solid #555;
}


.slide p,
.slide li {
    font-size: 1.3em;
    line-height: 1.7;
    color: #e0e0e0;
}

.slide ul {
    list-style-type: none;
    padding-left: 0;
    width: 100%;
    text-align: left;
}

.slide li {
    padding-left: 1.5em;
    position: relative;
    margin-bottom: 15px;
}

.slide li::before {
    content: "»";
    color: #4dabf7;
    font-weight: bold;
    position: absolute;
    left: 0;
    top: 5px;
}

.slide .subtitle {
    font-size: 1.5em;
    color: #b0b0b0;
    margin-top: 10px;
    font-style: italic;
    text-align: center;
    flex-shrink: 0;
}

.slide .highlight {
    color: #ffc107;
    /* Highlight color */
    font-weight: bold;
}

/* --- 表格樣式 --- */
.slide table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 1.1em;
}

.slide th,
.slide td {
    border: 1px solid #444;
    padding: 12px 15px;
    text-align: left;
    vertical-align: top;
}

.slide thead {
    background-color: #3a3a3a;
    color: #4dabf7;
    font-size: 1.1em;
}

.slide tbody tr:nth-child(odd) {
    background-color: #333;
}

/* --- 導航與計數器 --- */
.nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(77, 171, 247, 0.7);
    color: white;
    border: none;
    cursor: pointer;
    padding: 15px;
    font-size: 24px;
    z-index: 100;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s, opacity 0.3s;
    opacity: 1;
}

.nav-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

.nav-btn:hover {
    background-color: rgba(77, 171, 247, 1);
}

.prev {
    left: 20px;
}

.next {
    right: 20px;
}

.slide-counter {
    position: fixed;
    bottom: 20px;
    right: 30px;
    color: #aaa;
    font-size: 1.2em;
    z-index: 100;
}

/* --- CUSTOM SLIDE TYPE STYLES --- */
.image-placeholder-container,
.image-text-split-container,
.multi-image-container,
.custom-diagram-container,
.flowchart-container {
    width: 100%;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-box {
    width: 100%;
    height: 100%;
    max-height: 450px;
    background-color: #222;
    border: 2px dashed #555;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #888;
    font-size: 1.5em;
    padding: 20px;
    text-align: center;
    box-sizing: border-box;
}

.image-placeholder-container.with-caption {
    flex-direction: column;
    justify-content: flex-start;
}

.caption {
    width: 100%;
    text-align: center;
    font-size: 1.2em;
    color: #ccc;
    margin-top: 15px;
}

.image-text-split-container {
    gap: 30px;
}

.image-pane {
    flex: 1.2;
    height: 100%;
}

.text-pane {
    flex: 1;
    text-align: left;
}

.text-pane h2 {
    text-align: left;
    border: none;
    padding: 0;
    margin-bottom: 15px;
    font-size: 1.8em;
}

.text-pane p {
    font-size: 1.2em;
}

.multi-image-container {
    justify-content: space-around;
    gap: 20px;
}

.multi-image-container .placeholder-box {
    height: auto;
    min-height: 200px;
    flex: 1;
}

.dual-image-container {
    width: 100%;
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin-bottom: 20px;
    height: 300px;
}

.dual-image-container .placeholder-box {
    height: 100%;
    flex: 1;
}

/* --- Chart Container Styles (Retained for future use) --- */
.k-line-chart-container,
.echart-k-line-container {
    width: 100%;
    height: 500px;
    max-height: 85%;
    /* Ensure space within the slide */
    flex-grow: 1;
    margin-top: 20px;
    padding: 10px;
    box-sizing: border-box;
    background-color: #1f1f1f;
    border-radius: 8px;
    border: 1px solid #444;
}

.k-line-chart-container canvas {
    width: 100%;
    height: 100%;
}

/* --- Flowchart / Income Statement Styles (General) --- */
.flowchart-container {
    align-items: center;
    /* Center content vertically and horizontally */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
    flex-grow: 1;
    position: relative;
    /* For potential absolute positioned lines if needed */
    padding: 20px 0;
    /* Add some vertical padding */
}

/* This is the container for the original flowchart-like income statement (e.g. 損益表, 損益表-早餐店範例) */
.income-statement-container {
    width: 90%;
    max-width: 600px;
    /* Constrain width for a compact flow */
    margin: 0 auto;
    font-size: 1.1em;
    display: flex;
    /* Use flexbox for the main container */
    flex-direction: column;
    /* Stack rows vertically */
    gap: 15px;
    /* Spacing between steps */
    position: relative;
}

.income-statement-container.labeled {
    padding-left: 180px;
    /* Space for the label */
}




/* --- Diagram Styles (Balance Sheet, Cash Flow diagrams) --- */
.custom-diagram-container {
    flex-direction: column;
    padding: 10px 0;
    position: relative;
    min-height: 400px;
    display: flex;
    /* Ensure it's a flex container */
    justify-content: flex-start;
    /* Align content to top */
    align-items: center;
    /* Center content horizontally */
}

/* 整體容器：包含左側指示器 + 表格 */
.bs-container {
    display: flex;
    gap: 5px;
    align-items: stretch;
    position: relative;
}

/* 左側流動性指示器 */
.bs-liquidity-indicator {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    color: #b0b0b0;
    font-size: 0.9em;
    min-width: 60px;
    padding: 20px 0;
}

.bs-liquidity-indicator span {
    font-weight: 500;
}

.bs-liquidity-indicator .arrow-line {
    width: 2px;
    background-color: #888;
    flex-grow: 1;
    margin: 10px 0;
    position: relative;
}

.bs-liquidity-indicator .arrow-line::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 8px solid #888;
}

.bs-liquidity-indicator .label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    margin-top: 10px;
    font-size: 0.85em;
    letter-spacing: 2px;
}

/* 表格主體容器 */
.balance-sheet-wrapper {
    flex-grow: 1;
    display: flex;
    gap: 15px;
    align-items: stretch;
}

.balance-sheet-table {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 2px solid #555;
    border-radius: 8px;
    overflow: visible;
    background-color: #222;
}

.bs-table-column {
    display: flex;
    flex-direction: column;
}

.bs-table-section {
    padding: 20px;
    border-bottom: 1px solid #444;
    position: relative;
    min-width: 350px;
}

.bs-table-section:last-child {
    border-bottom: none;
}

.bs-table-left-column {
    background-color: #5b2a5a;
    border-right: 2px solid #555;
}

.bs-table-right-column .bs-table-section:first-child {
    background-color: #3b6b8b;
}

.bs-table-right-column .bs-table-section:last-child {
    background-color: #557e40;
    flex-grow: 1;
}

.bs-table-title {
    font-size: 1.5em;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 8px;
}

.bs-table-description {
    color: #ffffff;
    font-size: 1.1em;
    font-weight: bold;
    line-height: 0.8;
    margin: 8px 0;
}

.bs-table-items {
    list-style-type: none;
    padding-left: 0;
    margin: 8px 0;
}

.bs-table-items li {
    padding: 3px 0;
    padding-left: 1.2em;
    position: relative;
    color: #e0e0e0;
    font-size: 1em;
    line-height: 0.2;
}

.bs-table-items li::before {
    content: "•";
    color: #4dabf7;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* 右側到期日指示器（在表格外側） */
.bs-maturity-indicator {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    color: #d0d0d0;
    font-size: 0.85em;
    min-width: 60px;
    padding-top: 20px;
}

.bs-maturity-indicator span {
    font-weight: 500;
}

.bs-maturity-indicator .arrow-line {
    width: 2px;
    background-color: #aaa;
    height: 120px;
    margin: 8px 0;
    position: relative;
}

.bs-maturity-indicator .arrow-line::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 8px solid #aaa;
}

.bs-maturity-indicator .label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    margin-top: 8px;
    font-size: 0.85em;
    letter-spacing: 2px;
}

.formula {
    text-align: center;
    margin-top: 15px;
    padding: 6px;
    background: #3a3a3a;
    border-radius: 8px;
    border: 2px dashed #555;
    color: #4dabf7;
    font-weight: 600;
    font-size: 1.3em;
}


@media (max-width: 768px) {
    .balance-sheet-table {
        grid-template-columns: 1fr;
    }

    .bs-table-left-column {
        border-right: none;
        border-bottom: 2px solid #555;
    }

    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }
}

/* Existing CF conceptual diagram */
.cf-container {
    display: flex;
    width: 90%;
    align-items: stretch;
    gap: 0;
    position: relative;
    height: 450px;
}

.cf-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    background-color: #4dabf7;
    color: white;
    padding: 20px 10px;
    text-align: center;
    font-size: 1.1em;
    border-radius: 5px;
    letter-spacing: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
}

.cf-label.left {
    margin-right: 15px;
    height: 66%;
}

.cf-label.right {
    margin-left: 15px;
}

.cf-main-box {
    flex-grow: 1;
    border: 2px solid #555;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cf-item {
    padding: 20px 25px;
    border-bottom: 2px solid #555;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.cf-item:nth-child(1) {
    flex: 2;
    background-color: #9b2c5a;
}

.cf-item:nth-child(2) {
    flex: 1;
    background-color: #5b4a7a;
}

.cf-item:nth-child(3) {
    flex: 1;
    background-color: #4a6b8a;
    border-bottom: none;
}

.cf-item p {
    margin: 0;
    text-align: center;
    font-size: 1.1em;
    color: #ffffff;
    line-height: 1.6;
}

.cf-item p:first-child {
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 8px;
    font-size: 1.2em;
}

.cf-item p:last-child {
    font-size: 0.95em;
    color: #e8e8e8;
}

/* --- Company Comparison Layouts --- */
.company-comparison-container {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    gap: 40px;
    width: 100%;
    flex-grow: 1;
    text-align: left;
}

.company-column {
    flex: 1;
    padding: 20px;
    border: 1px solid #444;
    border-radius: 8px;
    background-color: #3a3a3a;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.company-column h3 {
    text-align: center;
    color: #4dabf7;
    border-bottom: 2px solid #4dabf7;
    padding-bottom: 10px;
    margin-top: 0;
    margin-bottom: 20px;
}

.company-column p {
    font-size: 1.1em;
    line-height: 1.8;
    margin-bottom: 15px;
}

/* Financial Statement Comparison - General Styling for two columns */
.financial-comparison-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 40px;
    width: 100%;
    flex-grow: 1;
    text-align: left;
    margin-top: 20px;
}

.financial-comparison-container .company-column {
    padding: 15px;
}

/* Financial Table Wrapper (for standard tables) */
.financial-table-wrapper {
    max-height: 450px;
    overflow-y: auto;
    margin-bottom: 20px;
    border: 1px solid #555;
    border-radius: 5px;
}

.financial-table-wrapper table {
    margin-top: 0;
    font-size: 0.95em;
    min-width: 100%;
}

.financial-table-wrapper th,
.financial-table-wrapper td {
    padding: 8px 12px;
}

/* Balance Sheet Visual Container */
.bs-visual-container {
    display: flex;
    width: 100%;
    height: 400px;
    border: 2px solid #555;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
    background-color: #222;
    font-size: 0.8em;
}

.bs-visual-assets {
    flex: 1;
    background-color: #5b2a5a;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px dashed #777;
}

.bs-visual-right-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.bs-visual-liabilities {
    flex: 1;
    background-color: #3b6b8b;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-bottom: 1px dashed #777;
}

.bs-visual-equity {
    flex: 1;
    background-color: #557e40;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.bs-visual-container ul {
    list-style-type: none;
    padding-left: 0;
    margin: 10px 0;
    flex-grow: 1;
    overflow-y: auto;
    font-size: 0.8em;
    /* Adjusted to fit more content */
}

.bs-visual-container li {
    padding-left: 0;
    position: static;
    margin-bottom: 8px;
}

.bs-visual-container li::before {
    content: none;
}


.bs-total {
    font-weight: bold;
    color: #ffc107;
    text-align: right;
    margin-top: 10px;
    padding-top: 5px;
    border-top: 1px solid #777;
    font-size: 0.8em;
    /* Adjusted */
}

.bs-total-check {
    width: 100%;
    text-align: right;
    font-weight: bold;
    color: #4dabf7;
    margin-top: 10px;
    font-size: 0.8em;
    /* Adjusted */
}


/* Specific styling for the final analysis slide if needed */
.financial-comparison-container.analysis-only .company-column p {
    font-size: 1.15em;
}


.investment-summary {
    width: 100%;
    text-align: center;
    font-size: 1.5em;
    color: #ffc107;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px dashed #555;
    flex-shrink: 0;
}


/* --- NEW DIAGRAM STYLES (from images) --- */

.diagram-wrapper {
    position: relative;
    width: 100%;
    height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
}

/* General box styling for diagrams */
.diagram-box {
    background-color: #4a4a4a;
    border: 1px solid #777;
    border-radius: 5px;
    padding: 8px 15px;
    text-align: center;
    color: #e0e0e0;
    font-size: 0.95em;
    line-height: 1.4;
    position: absolute;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.diagram-box.highlight {
    background-color: #9b2c5a;
    color: white;
    font-weight: bold;
    padding: 10px 18px;
}

/* General arrow styling */
.diagram-arrow {
    position: absolute;
    background-color: #777;
    z-index: 0;
}

.diagram-arrow::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    z-index: 0;
}

/* Specific arrow styles for different directions */
.arrow-v {
    width: 2px;
}

.arrow-h {
    height: 2px;
}

/* Arrow tips */
.arrow-down::after {
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 5px 0 5px;
    border-color: #777 transparent transparent transparent;
}

.arrow-up::after {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 5px 8px 5px;
    border-color: transparent transparent #777 transparent;
}

.arrow-right::after {
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-width: 5px 0 5px 8px;
    border-color: transparent transparent transparent #777;
}

.arrow-left::after {
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-width: 5px 8px 5px 0;
    border-color: transparent #777 transparent transparent;
}

/* Text labels on arrows or next to them */
.diagram-line-label {
    position: absolute;
    color: #ccc;
    font-size: 0.8em;
    background-color: #2c2c2c;
    padding: 2px 5px;
    border-radius: 3px;
    z-index: 2;
}

/* 圖3-1-4 公司淨利分公司的財務報表概觀 specific styles */
.diagram-314 .diagram-box {
    font-size: 0.9em;
    padding: 6px 12px;
}

.diagram-314 .diagram-text-label {
    font-size: 0.75em;
    color: #b0b0b0;
}

/* 圖3-3-1 資產負債表長短對照 specific styles */
.diagram-331 .diagram-box {
    font-size: 0.9em;
    padding: 6px 12px;
}

.diagram-331 .diagram-text-label {
    font-size: 0.75em;
    color: #b0b0b0;
}

/* 圖3-7-1 做生意的完整週期 specific styles */
.diagram-371 {
    width: 90%;
    height: 350px;
    margin-top: 50px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
}

.diagram-371 .cycle-segment {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 0 10px;
    flex-shrink: 0;
}

.diagram-371 .diagram-box {
    min-width: 80px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    white-space: nowrap;
}

.diagram-371 .arrow-text {
    position: absolute;
    color: #ccc;
    font-size: 0.75em;
    background-color: #2c2c2c;
    padding: 2px 5px;
    border-radius: 3px;
    z-index: 2;
}

.diagram-371 .label-above {
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
}

.diagram-371 .label-below {
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
}

.diagram-371 .segment-arrow-h {
    height: 2px;
    background-color: #777;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 0;
}

.diagram-371 .segment-arrow-h::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 0 5px 8px;
    border-color: transparent transparent transparent #777;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
}

.diagram-371 .circle-number {
    position: absolute;
    background-color: #4dabf7;
    color: white;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8em;
    font-weight: bold;
    z-index: 5;
}

.diagram-371 .circle-top {
    top: 25px;
}

.diagram-371 .circle-bottom {
    bottom: 25px;
}


/* --- NEW Styles for "損益表 (解析)" Grid Layout --- */
/* This container overrides or provides specific styles for the "損益表 (解析)" slide */
.income-statement-grid-container {
    width: 90%;
    max-width: 900px;
    /* Constrain overall width */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* Spacing between rows */
    position: relative;
    /* For absolute positioning of labels */
    padding-left: 150px;
    /* Space for the labels on the far left */
    align-items: center;
    /* Center the entire grid horizontally */
}

.is-grid-wrapper {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 10px;
}

.is-grid-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

/* 通用分隔區 */
.is-section {
    grid-column: 1 / 5;
    display: grid;
    grid-template-columns: 100px 0.5fr 0.5fr 100px;
    gap: 5px;
    margin-bottom: 5px;
    align-items: start;
    font-size: 10px;
}

/* 通用分隔線 */
.is-divider {
    grid-column: 1 / 5;
    height: 2px;
    background-color: #d0d0d0;
    margin-bottom: 10px;
}

/* 通用標籤（左側說明） */
.is-label {
    grid-column: 1;
    text-align: left;
    padding-right: 10px;
    color: #555;
    display: flex;
    align-items: center;
}

/* 通用主要項目（中間欄位） */
.is-main-item {
    grid-column: 2;
    background-color: #a84d6e;
    color: white;
    padding: 10px 10px;
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
}

/* 通用標註（右側上方小字） */
.is-tag {
    grid-column: 4;
    text-align: left;
    padding-left: 10px;
    color: #333;
    display: flex;
    align-items: center;
}

/* 通用成本/費用盒子（右側項目） */
.is-box {
    grid-column: 3;
    background-color: #999999;
    color: white;
    padding: 10px 10px;
    border-radius: 4px;
    text-align: center;
}

/* 特定行數佔位 */
.row-span-2 {
    grid-row: 1 / 4;
}

.row-span-3 {
    grid-row: 1 / 4;
}

.row-2 {
    grid-row: 2;
}

.row-3 {
    grid-row: 3;
}


/* 損益表容器 */
.is-container {
    display: flex;
    gap: 5px;
    align-items: stretch;
    position: relative;
    max-width: 900px;
    width: 70%;
    margin: 0 auto;
}

/* 左側流動性指示器 */
.is-flow-indicator {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    color: #b0b0b0;
    font-size: 0.9em;
    min-width: 60px;
    padding: 20px 0;
}

.is-flow-indicator .arrow-line {
    width: 2px;
    background-color: #888;
    flex-grow: 1;
    margin: 10px 0;
    position: relative;
}

.is-flow-indicator .arrow-line::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 8px solid #888;
}

.is-flow-indicator .label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    margin-top: 10px;
    font-size: 0.85em;
    letter-spacing: 2px;
}

/* 損益表主體 */
.is-table-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 2px solid #555;
    border-radius: 8px;
    overflow: hidden;
    background-color: #222;
    width: 80%;
}

.is-section {
    padding: 5px 5px;
    border-bottom: 2px solid #555;
    position: relative;
    font-size: 1em;

}

.is-section:last-child {
    border-bottom: none;
}

/* 各階段背景色 */
.is-section.revenue {
    background-color: #9b2c5a;
}

.is-section.gross-profit {
    background-color: #8b3a5e;
}

.is-section.operating-profit {
    background-color: #7a4862;
}

.is-section.pretax-profit {
    background-color: #6a5666;
}

.is-section.net-profit {
    background-color: #557e40;
    flex-grow: 1;
}

/* 標題樣式 */
.is-section-title {
    font-size: 1.5em;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 12px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 8px;
}

.is-section-description {
    color: #ffffff;
    font-size: 1.1em;
    font-weight: bold;
    line-height: 1.6;
    margin: 8px 0;
    text-align: left;
    padding-left: 1.5em;
}

/* 項目列表 */
.is-items {
    list-style-type: none;
    padding-left: 0;
    margin: 5px 0 0 0;
    width: 80%;
    min-width: 500px;
}

.is-items li {
    padding: 5px 0;
    padding-left: 1.5em;
    position: relative;
    color: #e0e0e0;
    font-size: 1.05em;
    line-height: 0.2;
}

.is-items li::before {
    content: "•";
    color: #4dabf7;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* 收入項目縮排 */
.is-items li.income {
    padding-left: 1.5em;
    color: #d0d0d0;
}

/* 支出項目縮排 */
.is-items li.subtract {
    padding-left: 3em;
    color: #d0d0d0;
}

.is-items li.subtract::before {
    content: "−";
    color: #ff6b6b;
    left: 1.5em;
}

/* 括號說明樣式 */
.is-items li .note {
    color: #ffd93d;
    font-size: 0.95em;
    font-weight: normal;
    padding-left: 20px;
}

/* 右側標註指示器 */
.is-note-indicator {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    color: #d0d0d0;
    font-size: 0.85em;
    min-width: 140px;
    padding: 20px 0 20px 15px;
    text-align: left;
}

.is-note-item {
    margin-bottom: 40px;
    line-height: 0.2;
}

.is-note-item:last-child {
    margin-bottom: 0;
}

/* --- Overview Mode --- */
.slideshow-container.overview-mode {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    gap: 25px !important;
    padding: 80px 40px !important;
    align-items: start !important;
    justify-items: center !important;
    overflow-y: auto !important;
    background-color: #111 !important;
    height: 100vh !important;
    width: 100vw !important;
    box-sizing: border-box !important;
}

.overview-mode .slide {
    position: relative !important;
    display: flex !important;
    opacity: 1 !important;
    width: 100% !important;
    height: 200px !important;
    padding: 15px !important;
    font-size: 0.35em !important;
    /* Scale down content */
    cursor: pointer !important;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s !important;
    border: 3px solid transparent !important;
    overflow: hidden !important;
    margin: 0 !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3) !important;
}

.overview-mode .slide:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 0 20px rgba(77, 171, 247, 0.5) !important;
    border-color: rgba(77, 171, 247, 0.3) !important;
    z-index: 10;
}

.overview-mode .slide.active {
    border-color: #4dabf7 !important;
    box-shadow: 0 0 25px rgba(77, 171, 247, 0.7) !important;
}

.overview-mode .slide * {
    pointer-events: none !important;
    /* Disable interaction with slide content in overview */
}

/* Hide navigation and counter in overview mode */
.slideshow-container.overview-mode~.nav-btn,
.slideshow-container.overview-mode~.slide-counter {
    display: none !important;
}

/* Adjustments for overview thumbnails */
.overview-mode .slide h1,
.overview-mode .slide h2 {
    font-size: 2.5em !important;
    margin-bottom: 5px !important;
}

.overview-mode .slide p,
.overview-mode .slide li {
    font-size: 1.5em !important;
    line-height: 1.4 !important;
}

/* --- Dual ECharts Container --- */
.dual-echart-container {
    display: flex;
    width: 100%;
    height: 600px;
    /* Taller to accommodate charts */
    justify-content: space-between;
    gap: 20px;
    margin-top: 10px;
}

.dual-echart-box {
    flex: 1;
    height: 100%;
    background-color: #1f1f1f;
    border-radius: 8px;
    border: 1px solid #444;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.dual-echart-box h4 {
    margin: 0 0 10px 0;
    text-align: center;
    color: #ccc;
    font-size: 1.1em;
}

.dual-echart-content {
    flex-grow: 1;
    width: 100%;
}