:root {
  --toolbar-height: 42px;
  --dim-alpha: 0.30;
  --button-border: #a6a6a6;
  --button-bg: #f8f8f8;
  --button-active: #ddeeff;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #262626;
}

#toolbar {
  height: var(--toolbar-height);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  background: #eeeeee;
  border-bottom: 1px solid #c9c9c9;
  white-space: nowrap;
  overflow: hidden;
}

button, .button {
  appearance: none;
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 13px;
  line-height: 18px;
  color: #111;
  cursor: default;
  user-select: none;
}

button:hover, .button:hover { background: #ffffff; }
button.active { background: var(--button-active); border-color: #6aa0d8; }
button:disabled { opacity: 0.45; }

.file-button { position: relative; display: inline-block; }
.file-button input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }


.page-jump {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}

#pageInput {
  width: 56px;
  height: 28px;
  padding: 3px 5px;
  border: 1px solid var(--button-border);
  border-radius: 7px;
  background: white;
  color: #111;
  font-size: 13px;
}

#pageCount {
  color: #444;
  min-width: 34px;
}

.sep { width: 8px; }
.label { font-size: 13px; }

#status {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  padding-left: 8px;
}

#viewerScroller {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--toolbar-height);
  bottom: 0;
  overflow: auto;
  background: #333;
}

#emptyState {
  color: #f5f5f5;
  max-width: 820px;
  margin: 64px auto;
  padding: 24px;
  line-height: 1.45;
}

#emptyState h1 { margin-top: 0; }
#emptyState .small { opacity: 0.75; }

#pageWrap {
  position: relative;
  margin: 0 auto 24px auto;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.18);
  touch-action: none;
}

#pdfCanvas {
  display: block;
  background: white;
}

.shade {
  position: absolute;
  background: rgba(0, 0, 0, var(--dim-alpha));
  pointer-events: none;
  z-index: 2;
}

#focusBorder {
  position: absolute;
  border: 3px solid #f4c247;
  box-shadow: inset 0 0 0 1px rgba(255,255,230,.92), 0 0 0 1px rgba(70,40,0,.35);
  pointer-events: none;
  z-index: 3;
}

#dragPreview {
  position: absolute;
  border: 2px dashed #4fc3f7;
  background: rgba(79, 195, 247, 0.12);
  pointer-events: none;
  z-index: 4;
  display: none;
}

.hidden { display: none !important; }

#toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  max-width: min(720px, 90vw);
  padding: 10px 14px;
  background: rgba(15, 15, 15, .88);
  color: white;
  border-radius: 9px;
  font-size: 14px;
  z-index: 20;
  box-shadow: 0 8px 28px rgba(0,0,0,.3);
}

body.locked #toolbar { background: #fff3d1; }

.page-jump {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}

#pageInput {
  width: 54px;
  height: 28px;
  padding: 3px 5px;
  border: 1px solid var(--button-border);
  border-radius: 7px;
  background: #fff;
  font-size: 13px;
  text-align: right;
}

#pageInput:disabled { opacity: 0.55; }
#pageCount { opacity: 0.75; }

#focusBorder[data-kind="equation"] {
  border-color: #ffcf4a;
  box-shadow: inset 0 0 0 1px rgba(255,255,230,.95), 0 0 0 2px rgba(255, 207, 74, .24);
}

#focusBorder[data-kind="bullet"],
#focusBorder[data-kind="bullet-line"] {
  border-color: #84d481;
  box-shadow: inset 0 0 0 1px rgba(245,255,245,.92), 0 0 0 2px rgba(132, 212, 129, .22);
}
