:root { color-scheme: light; font: 13px system-ui, sans-serif; color: #252525; background: #fff; --brand: #4d6bfe; }
* { box-sizing: border-box; letter-spacing: 0; }
body { margin: 0; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, .native-actions a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* --- Shared boot screen: first paint and the unpaired / failure screens --- */
.boot-screen { position: fixed; inset: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); }
.boot-screen h1 { font-size: 20px; font-weight: 500; margin: 0; }
.boot-screen p { margin: 0; max-width: 32em; overflow-wrap: anywhere; }
.boot-screen button { border: 1px solid #aaa; border-radius: 4px; background: transparent; padding: 8px 12px; }
.boot-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; user-select: none; color: var(--brand); }
.boot-brand svg { width: 84px; height: 84px; }
.boot-brand .boot-name { color: #252525; font-size: 22px; font-weight: 600; letter-spacing: 2px; }
.native-actions { display: flex; flex-direction: column; gap: 10px; width: min(100%, 280px); }
.native-actions a { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; border: 1px solid #aaa; border-radius: 8px; color: inherit; text-decoration: none; font: inherit; }
.native-actions a:first-child { color: #fff; background: #252525; border-color: #252525; }
.boot-reload { color: inherit; padding: 12px; min-height: 44px; }

/* --- Full-client shell --- */
.full-shell { position: fixed; inset: 0; display: flex; flex-direction: column; background: #fff; }
.full-shell[data-controls="client"] { padding-top: env(safe-area-inset-top); }
.full-shell { padding-bottom: env(safe-area-inset-bottom); }

/* Top bar: quiet while the splash speaks; a compact strip when it must narrate. */
.full-bar { min-height: 36px; padding: max(4px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 4px max(8px, env(safe-area-inset-left)); display: flex; align-items: center; gap: 8px; font-size: 12px; color: #555; }
.full-bar span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.full-bar button { flex: none; background: transparent; border: 0; padding: 6px; min-height: 32px; color: var(--brand); }
.full-bar button:disabled { cursor: default; opacity: 0.55; color: inherit; }
.full-content { position: relative; flex: 1; min-height: 0; }

/* Loading splash: brand-led, one honest progress line, diagnostics one tap away. */
.full-loading { position: absolute; inset: 0; background: #fff; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; opacity: 1; transition: opacity 0.25s ease; }
.full-content[data-state="ready"] .full-loading { opacity: 0; pointer-events: none; }
.full-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; user-select: none; color: var(--brand); }
.full-brand svg { width: 84px; height: 84px; }
.full-brand .boot-name { color: #252525; font-size: 22px; font-weight: 600; letter-spacing: 2px; }
.full-loading p { margin: 0; max-width: 32em; overflow-wrap: anywhere; }
.full-steps { display: flex; gap: 8px; align-items: center; }
.full-steps i { width: 6px; height: 6px; border-radius: 50%; background: #ddd; transition: background 0.3s ease; }
.full-steps i.done { background: var(--brand); }
.full-steps i.active { background: var(--brand); animation: pulse 1.2s ease-in-out infinite; }
.full-progress { width: min(60vw, 200px); height: 3px; border-radius: 2px; background: #eee; overflow: hidden; }
.full-progress b { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--brand); transition: width 0.4s ease; }
.full-hint { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: #888; }
.full-hint button { border: 0; background: none; color: var(--brand); padding: 0; font-size: 12px; text-decoration: underline; }

/* Diagnostic panel: collapsed behind the hint while loading, open on failure. */
.full-hint + .full-diagnostic { display: none; }
.full-hint[data-open="1"] + .full-diagnostic { display: block; }
.full-diagnostic { margin: 6px 0 0; width: min(92vw, 480px); max-height: 34vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; text-align: left; font: 11px/1.45 ui-monospace, monospace; color: #666; background: #f6f6f6; border: 1px solid #e3e3e3; border-radius: 10px; padding: 8px 10px; user-select: text; max-width: 100%; }
/* Failed state: drop the splash theater, keep message + reload + diagnostic readable. */
.full-content[data-state="failed"] .full-steps, .full-content[data-state="failed"] .full-progress { display: none; }
.full-content[data-state="failed"] .full-hint { display: none; }
.full-content[data-state="failed"] .full-diagnostic { display: block; margin: 0; }
.full-content[data-state="failed"] .full-brand { display: none; }
.full-content[data-state="failed"] .full-loading p { display: none; }

.full-frame { position: absolute; inset: 0; border: 0; width: 100%; height: 100%; background: #fff; }
.full-content:not([data-state="ready"]) .full-frame { pointer-events: none; }
.full-loading { max-width: 100%; }

@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; color: #eee; background: #191919; --brand: #7a90ff; }
  .full-shell, .full-loading, .full-frame { background: #191919; }
  .boot-brand .boot-name, .full-brand .boot-name { color: #eee; }
  .full-diagnostic { background: #242424; border-color: #3a3a3a; color: #9a9a9a; }
  .full-hint { color: #8a8a8a; }
  .full-steps i { background: #444; }
  .full-steps i.done, .full-steps i.active { background: var(--brand); }
  .full-progress { background: #333; }
  .full-bar { color: #aaa; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .full-loading { transition: none; } .full-steps i.active { animation: none; } }
