:root{color-scheme:light;--bg:#f4f4f0;--panel:#ffffff;--panel2:#f7f7f4;--text:#111111;--muted:#555555;--line:#9a9a94;--accent:#e7e7e2;--danger:#ffffff;--ok:#ffffff}
*{box-sizing:border-box}
body{margin:0;font-family:Arial,Helvetica,sans-serif;background:var(--bg);color:var(--text);min-height:100vh;font-size:16px;line-height:1.45}
.topbar{min-height:72px;display:flex;align-items:center;justify-content:space-between;padding:12px 6vw;border-bottom:2px solid #222;background:#fff;position:sticky;top:0;z-index:10}
.brand{display:flex;align-items:center;gap:12px;font-weight:700;letter-spacing:.02em;color:#000}.brand-mark{width:38px;height:38px;border:2px solid #222;border-radius:6px;display:grid;place-items:center;color:#000;background:#fff}
.topbar nav{display:flex;gap:18px;flex-wrap:wrap}.topbar a{color:#000;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px}.topbar a:hover{background:#eee}
.shell{width:min(1160px,92vw);margin:34px auto 60px}.hero{display:flex;justify-content:space-between;gap:28px;align-items:end;margin-bottom:28px}.hero h1{font-size:clamp(2rem,5vw,3.3rem);margin:0 0 8px;color:#000}.hero p{margin:0;color:#333}
.grid{display:grid;grid-template-columns:repeat(auto-fill,150px);gap:22px;align-items:start;justify-content:start}.book{width:150px;max-width:150px;background:#fff;border:2px solid #555;border-radius:5px;overflow:hidden;box-shadow:none}.book:hover{border-color:#000}.book a{color:inherit;text-decoration:none;display:block}.book-preview-link{display:block}
.preview{width:150px;height:213px;aspect-ratio:148/210;background:#fff;overflow:hidden;position:relative;border-bottom:1px solid #777}.preview img{display:block;width:100%;height:100%;object-fit:cover;background:#fff}.preview iframe{width:150%;height:150%;border:0;transform:scale(.667);transform-origin:top left;pointer-events:none;background:#fff}.preview:after{display:none}
.book-meta{padding:10px;background:#fff}.book-meta h2{font-size:.92rem;line-height:1.25;margin:0 0 9px;color:#000;overflow-wrap:anywhere}.book-meta p{margin:0;color:#333;font-size:.88rem}
.download-button,button,.button{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:11px 16px;border:2px solid #111;border-radius:4px;background:#eee;color:#000;font-weight:700;cursor:pointer;text-decoration:none}.download-button{display:flex;width:100%;padding:9px 5px;font-size:.76rem;line-height:1.15;text-align:center;background:#eee}.download-button:hover,button:hover,.button:hover{background:#d7d7d2}button.secondary,.button.secondary{background:#fff;color:#000}button.danger{background:#fff;color:#000;border:2px solid #111}
.login-wrap{min-height:calc(100vh - 180px);display:grid;place-items:center}.panel{width:min(520px,100%);background:#fff;border:2px solid #555;border-radius:6px;padding:28px;box-shadow:none}.panel h1,.panel h2{margin-top:0;color:#000}.field{display:grid;gap:8px;margin:14px 0}.field label{font-size:.95rem;color:#222;font-weight:600}.field input{width:100%;padding:13px 14px;border-radius:4px;border:2px solid #777;background:#fff;color:#000;outline:none;font-size:16px}.field input:focus{border-color:#000}
.flash{padding:12px 15px;border-radius:4px;margin-bottom:20px;border:2px solid #555;background:#fff;color:#000}.flash.ok,.flash.error{background:#fff;border-color:#555;color:#000}
.admin-grid{display:grid;grid-template-columns:1fr 1fr;gap:24px}.table-wrap{overflow:auto;border:2px solid #777;border-radius:4px}table{width:100%;border-collapse:collapse;background:#fff}th,td{padding:13px 14px;border-bottom:1px solid #999;text-align:left;vertical-align:middle;color:#000}th{font-size:.8rem;text-transform:uppercase;letter-spacing:.06em;color:#333;background:#eee}tr:last-child td{border-bottom:0}.inline{display:flex;gap:8px;flex-wrap:wrap}.muted{color:#444}.footer{text-align:center;color:#444;padding:25px}
.upload-progress-wrap{margin:16px 0 12px}.upload-progress-head{display:flex;justify-content:space-between;gap:15px;margin-bottom:7px;color:#222;font-size:.9rem;font-weight:600}.upload-progress-wrap progress{display:block;width:100%;height:20px;accent-color:#444}.upload-result{padding:10px 12px;border-radius:4px;margin:10px 0;font-size:.9rem;background:#fff;border:2px solid #777;color:#000}.upload-result.ok,.upload-result.error{background:#fff;border-color:#777;color:#000}button:disabled{opacity:.55;cursor:not-allowed}
@media(max-width:800px){body{font-size:17px}.topbar{height:auto;min-height:72px;align-items:flex-start;gap:14px;padding:16px 4vw}.topbar nav{justify-content:flex-end}.shell{width:94vw;margin-top:24px}.admin-grid{grid-template-columns:1fr}.hero{align-items:flex-start;flex-direction:column}.grid{grid-template-columns:repeat(auto-fill,150px);gap:16px}.preview{height:213px}}

.file-size {
  margin: .15rem 0 .55rem;
  font-size: .92rem;
  font-weight: 700;
  color: #222;
}
.download-dialog[hidden] { display: none !important; }
.download-dialog {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(255,255,255,.94);
}
.download-dialog-box {
  width: min(420px, 100%);
  padding: 22px;
  background: #fff;
  border: 2px solid #111;
}
.download-dialog-box h2 { margin-top: 0; color: #000; }
.download-dialog-box p { color: #111; }
.download-dialog progress {
  display: block;
  width: 100%;
  height: 28px;
  margin: 14px 0 8px;
  border: 2px solid #111;
  background: #fff;
}
.download-numbers {
  min-height: 1.5em;
  margin-bottom: 14px;
  font-weight: 700;
  color: #000;
}
.secondary-button {
  background: #fff;
  color: #000;
  border: 2px solid #111;
}
