:root {
  color-scheme: light dark;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --border: #d9dee7;
  --accent: #0f766e;
  --accent-text: #ffffff;
  --read: #edf7f4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0 14px;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.5;
}

.app {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar,
.navline,
.reader-toolbar,
.add-form {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar,
.navline,
.reader-toolbar {
  justify-content: space-between;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

p,
.status,
.reader-toolbar span {
  color: var(--muted);
  font-size: 14px;
}

.view {
  display: none;
  margin-top: 18px;
}

.view.active {
  display: block;
}

.add-form {
  margin-bottom: 18px;
}

.add-form input {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
}

.add-form button,
#refreshBtn,
#bookmarkBtn {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.list {
  display: grid;
  gap: 10px;
}

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
  text-align: left;
}

.item.read {
  background: var(--read);
}

.item-title {
  color: var(--text);
  font-weight: 650;
  overflow-wrap: anywhere;
}

.item-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.reader {
  min-height: calc(100vh - 36px);
}

.reader-toolbar {
  margin-bottom: 12px;
}

.page-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: calc(100vh - 118px);
  border-radius: 8px;
  background: #111827;
  overflow: hidden;
}

.page-frame img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 118px);
  object-fit: contain;
}

.page-side {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#prevPageBtn {
  left: 0;
}

#nextPageBtn {
  right: 0;
}

.status {
  min-height: 22px;
  margin-top: 12px;
}

@media (max-width: 560px) {
  .app {
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
  }

  .add-form {
    align-items: stretch;
    flex-direction: column;
  }

  .navline {
    align-items: flex-start;
    justify-content: flex-start;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b;
    --panel: #171d26;
    --text: #eef2f6;
    --muted: #9aa4b2;
    --border: #2d3645;
    --read: #10251f;
  }
}
