* { box-sizing: border-box; }
:root { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; color: #1f302e; background: #f3f6f5; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body { min-height: 300px; }
.app-shell { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding: 14px 20px; background: #fff; border-bottom: 1px solid #dce7e3; z-index: 3; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; font-size: 24px; background: #d9eee6; color: #087152; }
.brand-copy { display: grid; gap: 4px; }
.brand-copy strong { font-size: 17px; letter-spacing: -0.02em; }
.brand-muted { color: #5c736e; font-size: 14px; font-weight: 500; }
.brand-copy small { color: #667b76; font-size: 12px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
button, .file-button { font: inherit; font-size: 13px; font-weight: 650; padding: 10px 12px; border-radius: 9px; cursor: pointer; background: #fff; color: #24423a; border: 1px solid #bdcfc8; transition: background 0.15s ease, border 0.15s ease; white-space: nowrap; }
button:hover { background: #eff5f2; border-color: #779a8e; }
.file-button { background: #117556; border-color: #117556; color: #fff; display: inline-flex; gap: 7px; }
.file-button:hover { background: #0b6047; border-color: #0b6047; }
button:disabled, .file-button.is-busy { opacity: 0.5; cursor: wait; }
#file-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
button:focus-visible, .file-button:focus-within { outline: 3px solid #8ad4ba; outline-offset: 2px; }
.viewer-stage { position: relative; min-height: 0; background: #f5f8f7; overflow: hidden; }
#molstar-host { position: absolute; inset: 0; }
/* Mol* places its hover/selection label at the viewport bottom-right.
   Keep it clear of the full-page status footer, without changing iframe mode. */
html:not(.embed-mode) #molstar-host { bottom: 26px; }
.loading { position: absolute; z-index: 2; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 11px; background: rgba(255,255,255,0.93); border: 1px solid #dfe8e5; border-radius: 14px; box-shadow: 0 12px 38px rgba(20,50,40,0.11); color: #49665c; padding: 15px 18px; font-size: 14px; pointer-events: none; }
.loading[hidden] { display: none; }
.spinner { width: 18px; height: 18px; border: 3px solid #d4e7df; border-top-color: #117556; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 18px; background: #fff; border-top: 1px solid #dce7e3; color: #586f67; font-size: 12px; z-index: 3; }
.status-line { display: flex; align-items: center; gap: 9px; max-width: 100%; overflow-wrap: anywhere; }
.status-dot { width: 7px; height: 7px; flex: 0 0 7px; background: #0e9e70; border-radius: 50%; }
.status-line.error .status-dot { background: #d95353; }
.footer-help { text-align: right; }
.embed-mode .toolbar, .embed-mode .footer { display: none; }
.embed-mode .app-shell { display: block; }
.embed-mode .viewer-stage { height: 100%; width: 100%; }
@media (max-width: 820px) { .toolbar { padding: 11px 12px; } .brand-copy small { display: none; } .footer-help { text-align: left; } button, .file-button { padding: 8px 10px; } }
