:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e2e4e9;
  --text: #1f2430;
  --text-muted: #6b7280;
  --accent: #2f5fd6;
  --accent-hover: #24449e;
  --danger: #c0392b;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.page-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.page-header h1 {
  margin: 0;
  font-size: 20px;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* login page */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}

.login-card h1 {
  margin: 0 0 24px;
  font-size: 18px;
  text-align: center;
  color: var(--text);
}

.login-card input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  margin-bottom: 16px;
}

.login-card input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
}

.login-card button {
  width: 100%;
  padding: 10px 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  cursor: pointer;
}

.login-card button:hover {
  background: var(--accent-hover);
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin: -8px 0 16px;
  min-height: 16px;
}

.error-msg.hidden {
  display: none;
}

/* book grid */

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.book-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.book-card h2 {
  margin: 0 0 4px;
  font-size: 17px;
}

.book-card .subtitle {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.book-card .status {
  display: inline-block;
  font-size: 12px;
  background: #eef2ff;
  color: var(--accent);
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 14px;
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.file-list li {
  padding: 4px 0;
  font-size: 14px;
}

.notice {
  color: var(--text-muted);
  font-size: 14px;
}

.notice.error {
  color: var(--danger);
}

/* reader */

.reader-top {
  margin-bottom: 20px;
}

.reader-view {
  max-width: 720px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
}

.reader-view h1,
.reader-view h2,
.reader-view h3 {
  line-height: 1.35;
}

.reader-view h1 {
  font-size: 26px;
  margin-top: 0;
}

.reader-view h2 {
  font-size: 21px;
  margin-top: 36px;
}

.reader-view h3 {
  font-size: 17px;
  margin-top: 28px;
}

.reader-view p {
  font-size: 16px;
  margin: 16px 0;
}

.reader-view ul,
.reader-view ol {
  font-size: 16px;
  padding-left: 24px;
}

.reader-view code {
  background: #f0f1f4;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 0.9em;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.reader-view pre {
  background: #f0f1f4;
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
}

.reader-view pre code {
  background: none;
  padding: 0;
}

.reader-view blockquote {
  margin: 16px 0;
  padding: 4px 16px;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
  background: #f8f9fb;
}

.reader-view table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
  margin: 16px 0;
}

.reader-view th,
.reader-view td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}

.reader-view th {
  background: #f8f9fb;
}
