:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d7dce4;
  --accent: #1456d9;
  --accent-dark: #0d3f9f;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--ink);
  user-select: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.18;
  letter-spacing: 0;
}

.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.status-grid > div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
}

.status-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.status-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

button,
input {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  background: #b7c4d8;
}

.page-picker {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.page-picker input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  user-select: text;
}

.reader-panel {
  position: relative;
  min-width: 0;
  min-height: 100vh;
  padding: 18px;
}

#viewer {
  width: 100%;
  height: calc(100vh - 36px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0e1522;
}

.screen-watermark {
  pointer-events: none;
  position: absolute;
  inset: 18px;
  border-radius: 8px;
  opacity: 0.28;
  background-image: repeating-linear-gradient(
    -28deg,
    transparent 0,
    transparent 120px,
    rgba(13, 63, 159, 0.2) 121px,
    rgba(13, 63, 159, 0.2) 122px,
    transparent 123px,
    transparent 220px
  );
}

body.unauthorized .reader-panel::before {
  content: "链接无效或已过期";
  position: absolute;
  z-index: 10;
  inset: 18px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  color: var(--danger);
  font-size: 18px;
  font-weight: 800;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .reader-panel {
    min-height: 70vh;
  }

  #viewer {
    height: 70vh;
  }
}
