:root {
    color-scheme: light dark;
}

html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #ffffff;
    color: #333333;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Compose mounts on #compose-root and sizes its canvas from clientHeight,
   which includes padding — so the safe-area insets must live on the outer
   frame, not on the mount node. 100dvh tracks Chrome's collapsing chrome. */
.safe-area-frame {
    box-sizing: border-box;
    width: 100vw;
    height: 100dvh;
    padding-top: env(safe-area-inset-top, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
}

#compose-root {
    position: relative;
    width: 100%;
    height: 100%;
}

@media (prefers-color-scheme: dark) {
    html, body {
        background-color: #000000;
        color: #e0e0e0;
    }
}

.loader-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 280px;
    max-width: 80vw;
}

.spinner {
    display: block;
}

.progress-panel {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.app-name {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 16px;
    letter-spacing: 0.2px;
}

.progress-bar {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background-color: rgba(128, 128, 128, 0.18);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background-color: currentColor;
    border-radius: 2px;
    transition: width 0.18s ease-out;
}

.progress-pct {
    margin-top: 10px;
    font-size: 12px;
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
    text-align: center;
    width: 100%;
}

.progress-status {
    margin-top: 14px;
    font-size: 13px;
    opacity: 0.6;
    min-height: 1em;
}

.app-promo {
    margin-top: 28px;
    font-size: 12px;
    opacity: 0.55;
    text-align: center;
    line-height: 1.5;
}

.app-promo a {
    color: inherit;
    text-decoration: underline;
}

.app-promo a:hover {
    opacity: 0.85;
}

.fatal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    text-align: center;
    background-color: #ffffff;
    color: #333333;
}

@media (prefers-color-scheme: dark) {
    .fatal-overlay {
        background-color: #000000;
        color: #e0e0e0;
    }
}

.fatal-error-message {
    font-size: 15px;
    font-weight: 500;
    max-width: 320px;
}

.fatal-error-detail {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    line-height: 1.5;
    opacity: 0.65;
    max-width: 420px;
    max-height: 160px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: left;
    margin: 0;
}

.fatal-error-reload {
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 22px;
    border-radius: 6px;
    border: 1px solid currentColor;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.fatal-error-reload:hover {
    opacity: 0.85;
}
