/* The frame of every viewer. A viewer's own renderer.css only styles what its renderer puts in #stage. */
:root {
  color-scheme: light dark;
  --bg: #f5f5f4; --card: #fff; --fg: #1c1d21; --muted: #5d6270; --line: #dfdeda; --accent: var(--viewer-accent, #3f51b5); --accent-fg: #fff;
  --bar: #fff; --err: #b3261e; --ok: #1b7f4b; --stage: #26282e;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15171c; --card: #1e2128; --fg: #e9eaee; --muted: #a3a8b5; --line: #2e323b; --accent: var(--viewer-accent-dark, #8c9eff); --accent-fg: #10131c; --bar: #1b1d23; --err: #f2b8b5; --ok: #7ad6a3; --stage: #101115; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; display: flex; flex-direction: column; background: var(--bg); color: var(--fg); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }

button, .btn-link { font: inherit; font-size: 14px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--fg); cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn-link:hover { border-color: var(--muted); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button:disabled { opacity: .55; cursor: default; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }

#bar { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 8px 14px; background: var(--bar); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: inherit; text-decoration: none; white-space: nowrap; }
#file-name { min-width: 0; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 14px; }
#toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; min-width: 0; }
.bar-end { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.pill { border-radius: 99px; font-size: 13px; padding: 4px 10px; color: var(--muted); }
button.tool { padding: 5px 9px; min-width: 32px; }
button.tool[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
body:not([data-state="landing"]) #foot { display: none; }
body[data-state="ready"] .brand span { display: none; }

#landing { flex: 1 0 auto; width: 100%; max-width: 820px; margin: 0 auto; padding: 32px 16px 24px; }
#landing h1 { font-size: clamp(28px, 4.4vw, 42px); line-height: 1.15; margin: 0 0 12px; }
#landing h2 { font-size: 20px; margin: 0 0 8px; }
#landing section { margin-top: 30px; }
.lead { font-size: 18px; color: var(--muted); margin: 0 0 22px; }
#dropzone { background: var(--card); border: 2px dashed var(--line); border-radius: 14px; padding: 34px 18px; text-align: center; }
body.dragging #dropzone { border-color: var(--accent); }
.drop-title { font-size: 18px; font-weight: 600; margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 14px; }
.fine { font-size: 12.5px; }
.ok { color: var(--ok); font-size: 14px; }
.features { margin: 0; padding-left: 20px; }
.features li { margin: 3px 0; }

#status, #error { flex: 1 0 auto; width: 100%; max-width: 620px; margin: 0 auto; padding: 72px 16px; text-align: center; }
#status-bar { width: 100%; }
#error h1 { font-size: 28px; margin: 0 0 10px; }
#error p { color: var(--muted); overflow-wrap: anywhere; }
#error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }

#stage { flex: 1 1 0; min-height: 0; background: var(--stage); position: relative; }

#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); max-width: min(92vw, 560px); background: #24262c; color: #fff; padding: 9px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.35); z-index: 10; }

#foot { flex: none; display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; padding: 16px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }

dialog { width: min(92vw, 480px); border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--fg); padding: 22px; }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog h2 { margin: 0 0 8px; font-size: 20px; }
#pro-body, #pro-sync { margin: 12px 0; }
#pro-sync { border-top: 1px solid var(--line); padding-top: 12px; }
#pro-sync button { margin-right: 6px; }
#pro-body label { display: block; margin-top: 12px; font-size: 14px; }
#license-key { width: 100%; font: 14px ui-monospace, Consolas, monospace; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); margin: 4px 0 8px; }
.license-error { color: var(--err); font-size: 14px; margin: 8px 0 0; }
.license-error:empty { display: none; }

/* privacy and terms */
.doc { flex: 1 0 auto; width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
.doc h1 { font-size: 32px; margin: 0 0 6px; }
.doc h2 { font-size: 20px; margin: 28px 0 8px; }
.doc .updated { color: var(--muted); font-size: 14px; }
.doc-head { padding: 12px 16px; background: var(--bar); border-bottom: 1px solid var(--line); }

@media (max-width: 640px) {
  #file-name { display: none; }
  #toolbar { order: 5; flex-basis: 100%; }
  body[data-state="ready"] .bar-end [data-choose-file] { display: none; }
  #landing { padding-top: 20px; }
}
