/* Application shell: header, footer, statistics, and platform adjustments. */
header {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;

            height: calc(var(--header-height) + var(--safe-top));
            padding-top: var(--safe-top);
            padding: 0 15px;

            background: var(--card-bg);

            z-index: var(--z-header);
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-shrink: 0;
            transition: background-color var(--duration-normal);
        }

        .icon-btn {
            background: none; border: none; font-size: 1.5em; cursor: pointer; padding: 8px;
            color: var(--text-color); border-radius: 50%; transition: background var(--duration-fast);
            display: flex; align-items: center; justify-content: center; z-index: var(--z-header-control);
            width: 44px; height: 44px;
        }
        .icon-btn:active { background-color: var(--border-color); }
        
        .header-title-btn {
            position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
            max-width: 60%;
            background: none; border: none; 
            padding: 8px 12px; border-radius: 12px;
            cursor: pointer; z-index: var(--z-header-title);
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            transition: background-color var(--duration-fast);
        }
        .header-title-btn:active { background-color: var(--border-color); }
        
        .header-filename {
            font-size: 17px; font-weight: 600; margin: 0; white-space: nowrap;
            overflow: hidden; text-overflow: ellipsis; max-width: 100%;
            color: var(--text-color); line-height: 1.2;
        }
        
        .header-subtitle {
            font-size: 10px; color: var(--sub-text-color); font-weight: normal; margin-top: 2px;
            display: flex; align-items: center; gap: 4px;
        }
        .dot-indicator { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
        .dot-green { background-color: var(--success-pill); }
        .dot-yellow { background-color: var(--partial-pill); }
        .dot-red { background-color: var(--error-pill); }
        .stats-divider { margin: 0 2px; opacity: 0.3; font-size: 0.9em; }


        .stats-container { padding: 25px 20px; }
        .stats-card-row { display: flex; gap: 15px; margin-bottom: 20px; }
        .stats-card {
            flex: 1; background: var(--bg-color); border-radius: 16px; padding: 20px;
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            box-shadow: inset 0 0 0 1px var(--border-color);
        }
        .stats-value { font-size: 28px; font-weight: 700; color: var(--text-color); margin-bottom: 4px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
        .stats-value.good { color: var(--success-pill); }
        .stats-value.bad { color: var(--error-pill); }
        .stats-label { font-size: 12px; color: var(--sub-text-color); font-weight: 500; }
        
        #file-input { display: none; }


        footer {
            position: fixed;
            left: 0;
            right: 0;
            bottom: 0;

            height: calc(var(--footer-height) + var(--safe-bottom));
            padding: 0 15px;
            padding-bottom: var(--safe-bottom);

            background: var(--bg-color);
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
            flex-shrink: 0;

            z-index: var(--z-toc);
        }

        .nav-btn {
            background: none; border: none; font-size: 1.5em; cursor: pointer; color: var(--primary-color);
            width: 44px; height: 44px;
            padding: 0;
            display: flex; align-items: center; justify-content: center;
            transition: opacity var(--duration-fast);
        }
        .nav-btn:disabled { color: var(--border-color); cursor: default; }

        #progress-text {
            position: absolute; left: 50%; top: calc(var(--footer-height) / 2); transform: translate(-50%, -50%);
            background: none; border: none; font-size: 1rem; font-weight: 500; color: var(--text-color); font-family: inherit;
            cursor: pointer; padding: 10px 20px; border-radius: 8px; transition: background var(--duration-fast); user-select: none;
            max-width: 60%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        #progress-text:active { background: var(--border-color); }

        
        .online-loading { padding: 20px; text-align: center; color: #999; font-size: 13px; }
        
        #app-container.keyboard-open .card { transform: translateY(-20px) !important; }
        .hidden { display: none !important; }
        
        .currency-symbol::after {content: "$";}

        html.is-wechat footer {
          padding-bottom: 0px !important; 
          height: 70px !important; 
        }

        html.is-wechat #app-container {
            bottom: 70px !important;
        }
