:root {
  --bg: #e8e6d1;
  --text: #111;
  --link: #1a1a8a;
  --box-bg: #f4f1de;
  --box-bg-2: #fff8dc;
  --border: #666;
}

body.dark {
  --bg: #1b1b1b;
  --text: #e8e6d1;
  --link: #8fb4ff;
  --box-bg: #2a2a2a;
  --box-bg-2: #232323;
  --border: #777;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Courier New", monospace;
  font-size: 18px;
  line-height: 1.35;
}

a {
  color: var(--link);
}

.page {
  max-width: 760px;
  margin: 40px auto;
  padding: 0 16px 50px;
  text-align: center;
}

.page.wide {
  max-width: 1000px;
}

.site-box,
.link-box,
.nav a,
.toggle-btn,
.reader-btn {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--box-bg);
  padding: 3px 8px;
  margin: 4px;
  text-decoration: none;
  color: var(--link);
  font-family: inherit;
  font-size: inherit;
}

.site-box {
  color: var(--text);
  font-weight: bold;
}

.toggle-btn,
.reader-btn {
  cursor: pointer;
}

.reader-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.intro {
  margin: 12px 0 24px;
  font-size: 15px;
}

.link-grid {
  margin-top: 10px;
}

.post {
  text-align: left;
  max-width: 720px;
  margin: 0 auto;
}

.post img {
  width: 100%;
  height: auto;
  display: block;
  margin: 12px 0 8px;
  border: 1px solid var(--border);
}

.caption {
  font-size: 16px;
  margin-bottom: 20px;
}

.reader-single {
  margin-top: 20px;
  background: #000;
}

.reader-page {
  display: none;
  background: #000;
}

.reader-page.active {
  display: block;
}

.reader-page img {
  display: block;
  width: auto;
  height: calc(100vh - 260px);
  max-width: 100%;
  max-height: calc(100vh - 260px);
  object-fit: contain;
  margin: 0 auto;
  background: #000;
}

.reader-controls {
  margin: 12px 0 18px;
}

.page-indicator {
  display: inline-block;
  margin: 4px 10px;
}

.reader-footer {
  margin-top: 10px;
  text-align: left;
}

body.reader-fullscreen {
  overflow: hidden;
}

body.reader-fullscreen .reader-single {
  position: fixed;
  inset: 0;
  z-index: 9999;
  margin: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.reader-fullscreen .reader-page {
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  background: #000;
}

body.reader-fullscreen .reader-page.active {
  display: flex;
}

body.reader-fullscreen .reader-page img {
  width: auto;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  margin: 0 auto;
  background: #000;
}

.reader-loader {
  width: min(700px, 90%);
  margin: 1rem auto;
  text-align: center;
}

.reader-loader-text {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.reader-loader-bar {
  width: 100%;
  height: 12px;
  border: 1px solid var(--border);
  background: var(--box-bg);
  overflow: hidden;
}

.reader-loader-fill {
  width: 0%;
  height: 100%;
  background: var(--text);
  transition: width 0.2s ease;
}