/* Custom properties — light/dark */
:root {
  --bg: #ffffff;
  --bg-subtle: #f5f5f5;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --read-bg: #fafafa;
  --read-text: #888;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --bg-subtle: #1e1e1e;
    --border: #2e2e2e;
    --text: #e8e8e8;
    --text-muted: #888888;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --danger: #f87171;
    --read-bg: #161616;
    --read-text: #666;
  }
}

/* Reset & base */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

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

/* Layout */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
  margin-bottom: 1.5rem;
}

.site-header .inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header .logo {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.tab {
  padding: 0.5rem 0;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 500;
}

/* Article rows */
.article-list { list-style: none; margin: 0; padding: 0; }

.article-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.article-row.is-read {
  background: var(--read-bg);
}

.article-row.is-read .article-title {
  color: var(--read-text);
}

.article-thumb {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 4px;
  overflow: hidden;
  align-self: center;
}

.article-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.article-main { flex: 1; min-width: 0; }

.article-title {
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  color: var(--text);
}

.article-title:hover { color: var(--accent); text-decoration: none; }

.article-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
  margin-top: 0.1rem;
  flex-wrap: wrap;
}

.article-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1;
}

.btn:hover { background: var(--bg-subtle); text-decoration: none; color: var(--text); }

.btn-icon {
  padding: 0.3rem;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
}

.btn-icon:hover { background: var(--bg-subtle); color: var(--text); }
.btn-icon.danger:hover { color: var(--danger); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); color: #fff; }

/* Save form */
.save-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.save-form input[type="url"] {
  flex: 1;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
}

.save-form input[type="url"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: transparent;
}

/* Login page */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  width: 100%;
  max-width: 320px;
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.login-box h1 { font-size: 1.2rem; margin: 0 0 1.25rem; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; margin-bottom: 0.3rem; color: var(--text-muted); }
.form-group input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}

.error-msg { color: var(--danger); font-size: 0.85rem; margin-bottom: 0.75rem; }

/* Reader view */
.reader-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1rem 4rem;
}

.reader-header {
  margin-bottom: 2rem;
}

.reader-title {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 0.5rem;
}

.reader-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.reader-actions { margin-top: 1rem; display: flex; gap: 0.5rem; }

/* Reader typography */
.reader-content {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.7;
  color: var(--text);
}

@media (max-width: 600px) {
  .reader-content { font-size: 17px; }
}

.reader-content p { margin: 0 0 1.2em; }
.reader-content h2 { font-size: 1.25rem; margin: 2em 0 0.5em; font-family: system-ui, sans-serif; }
.reader-content h3 { font-size: 1.1rem; margin: 1.5em 0 0.4em; font-family: system-ui, sans-serif; }
.reader-content a { color: var(--accent); }
.reader-content blockquote {
  margin: 1.5em 0;
  padding-left: 1em;
  border-left: 3px solid var(--border);
  color: var(--text-muted);
  font-style: italic;
}
.reader-content pre {
  background: var(--bg-subtle);
  padding: 1em;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.5;
  font-family: ui-monospace, monospace;
}
.reader-content code { font-family: ui-monospace, monospace; font-size: 0.88em; }
.reader-content img { max-width: 100%; height: auto; border-radius: 4px; }
.reader-content table { border-collapse: collapse; width: 100%; font-size: 0.9em; }
.reader-content th, .reader-content td {
  border: 1px solid var(--border);
  padding: 0.4em 0.7em;
  text-align: left;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Responsive tweaks */
@media (max-width: 500px) {
  .article-actions { display: none; }
  .reader-title { font-size: 1.3rem; }
}
