:root {
  --bg: #f5f5f7;
  --bg-card: #ffffff;
  --bg-secondary: #e8e8ed;
  --text: #1a1a2e;
  --text-secondary: #6b6b80;
  --accent: #6c63ff;
  --accent-hover: #5a52d5;
  --border: #e0e0e8;
  --danger: #e74c3c;
  --success: #27ae60;
  --star: #f39c12;
  --shadow: rgba(0,0,0,0.06);
  --radius: 12px;
}

[data-theme="dark"] {
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-secondary: #252540;
  --text: #e8e8f0;
  --text-secondary: #8888a0;
  --border: #2a2a45;
  --shadow: rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  transition: background .3s, color .3s;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1rem;
  backdrop-filter: blur(12px);
}
.header-inner {
  max-width: 960px; margin: 0 auto;
  display: flex; align-items: center; gap: .75rem;
}
.logo {
  font-size: 1.25rem; font-weight: 700;
  color: var(--accent); text-decoration: none;
  white-space: nowrap;
}
.search-box {
  flex: 1; position: relative;
}
.search-box input {
  width: 100%; padding: .5rem .75rem .5rem 2.25rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text);
  font-size: .875rem; outline: none;
  transition: border-color .2s;
}
.search-box input:focus { border-color: var(--accent); }
.search-box svg {
  position: absolute; left: .6rem; top: 50%;
  transform: translateY(-50%); width: 16px; height: 16px;
  stroke: var(--text-secondary); fill: none; stroke-width: 2;
}
.header-actions {
  display: flex; gap: .5rem; align-items: center;
}
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.icon-btn:hover { background: var(--bg-secondary); }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

/* Tabs */
.tabs {
  max-width: 960px; margin: 0 auto;
  padding: .75rem 1rem 0;
  display: flex; gap: .25rem;
  overflow-x: auto;
}
.tab {
  padding: .4rem .9rem; border-radius: 20px;
  border: none; background: transparent;
  color: var(--text-secondary); font-size: .8rem;
  font-weight: 500; cursor: pointer;
  white-space: nowrap; transition: all .2s;
}
.tab:hover { background: var(--bg-secondary); }
.tab.active {
  background: var(--accent); color: #fff;
}
.tab .count {
  margin-left: .3rem; font-size: .7rem;
  opacity: .8;
}

/* Article grid */
.articles {
  max-width: 960px; margin: 0 auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
}

@media (min-width: 640px) {
  .articles { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .articles { grid-template-columns: repeat(3, 1fr); }
}

/* Article card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  cursor: pointer;
  position: relative;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--shadow);
}
.card.is-read { opacity: .6; }
.card-image {
  width: 100%; height: 140px;
  object-fit: cover; display: block;
  background: var(--bg-secondary);
}
.card-body { padding: .75rem; }
.card-title {
  font-size: .9rem; font-weight: 600;
  line-height: 1.3; margin-bottom: .25rem;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.card-desc {
  font-size: .78rem; color: var(--text-secondary);
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: .4rem;
}
.card-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .72rem; color: var(--text-secondary);
}
.card-domain {
  font-weight: 500; color: var(--accent);
  max-width: 140px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.card-actions {
  position: absolute; top: .4rem; right: .4rem;
  display: flex; gap: .25rem; opacity: 0;
  transition: opacity .2s;
}
.card:hover .card-actions { opacity: 1; }
.card-btn {
  width: 30px; height: 30px; border-radius: 8px;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.5); color: #fff;
  backdrop-filter: blur(4px);
  transition: background .2s;
}
.card-btn:hover { background: rgba(0,0,0,0.7); }
.card-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.card-btn.starred svg { fill: var(--star); stroke: var(--star); }

/* Empty state */
.empty {
  grid-column: 1 / -1;
  text-align: center; padding: 3rem 1rem;
}
.empty svg { width: 64px; height: 64px; stroke: var(--text-secondary); fill: none; stroke-width: 1.5; margin-bottom: 1rem; }
.empty h3 { font-size: 1.1rem; margin-bottom: .4rem; }
.empty p { color: var(--text-secondary); font-size: .85rem; }

/* FAB */
.fab {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--accent); color: #fff;
  border: none; cursor: pointer; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(108,99,255,0.4);
  transition: transform .2s, box-shadow .2s;
}
.fab:hover { transform: scale(1.05); box-shadow: 0 6px 24px rgba(108,99,255,0.5); }
.fab svg { width: 24px; height: 24px; stroke: #fff; fill: none; stroke-width: 2.5; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-card); border-radius: 16px;
  padding: 1.5rem; width: 90%; max-width: 420px;
  transform: translateY(20px);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal h3 { margin-bottom: 1rem; font-size: 1.1rem; }
.modal input, .modal textarea {
  width: 100%; padding: .6rem .75rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text);
  font-size: .9rem; margin-bottom: .75rem;
  font-family: inherit; outline: none;
}
.modal input:focus, .modal textarea:focus { border-color: var(--accent); }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; }
.btn {
  padding: .5rem 1.1rem; border-radius: 8px;
  border: none; font-size: .85rem; font-weight: 500;
  cursor: pointer; transition: all .2s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-secondary); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }

/* Loading */
.loading {
  grid-column: 1 / -1;
  text-align: center; padding: 2rem;
}
.loading-spinner {
  width: 32px; height: 32px; margin: 0 auto;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed; bottom: 5rem; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text); color: var(--bg);
  padding: .6rem 1.2rem; border-radius: 8px;
  font-size: .85rem; z-index: 300;
  transition: transform .3s;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* Confirm dialog */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 250;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
}
.confirm-box {
  background: var(--bg-card); border-radius: 16px;
  padding: 1.5rem; width: 85%; max-width: 340px;
  text-align: center;
}
.confirm-box p { margin-bottom: 1rem; }
.confirm-box .modal-actions { justify-content: center; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Keyboard shortcut hints */
kbd {
  display: inline-block; padding: .1rem .35rem;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 4px; font-size: .7rem; font-family: inherit;
  color: var(--text-secondary); line-height: 1.4;
}
