:root {
  --bg: #ffffff;           /* Pure white background */
  --panel: #f8f9fa;        /* Light gray for cards */
  --text: #1a1a2e;         /* Near-black text */
  --muted: #6b7280;        /* Medium gray secondary */
  --border: rgba(0,0,0,0.08);
  --accent: #2563eb;       /* Modern blue */
  --accent2: #059669;      /* Emerald green */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { font-weight: 700; letter-spacing: 0.2px; color: var(--text); }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px 56px;
}

.muted { color: var(--muted); }

.btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: #e5e7eb; }
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: rgba(0,0,0,0.05); }

.day { margin: 18px 0 26px; }
.day-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.day-title { margin: 0; font-size: 18px; font-weight: 700; }
.day-meta { color: var(--muted); font-size: 14px; }

.cards { display: grid; gap: 12px; }
.card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.card:hover {
  border-color: rgba(37,99,235,0.3);
  box-shadow: var(--shadow-md);
}
.card-title { font-weight: 700; margin-bottom: 4px; color: var(--text); }
.card-snippet {
  color: var(--muted);
  font-size: 14px;
  white-space: pre-wrap;
}
.card-meta { margin-top: 8px; color: var(--muted); font-size: 13px; }
.thumb {
  width: 112px;
  height: 78px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #e5e7eb;
}

.reader {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}
.reader-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.reader-kv { color: var(--text); font-weight: 600; }
.reader-kv .muted { font-weight: 500; margin-right: 6px; }
.reader-text {
  margin: 0;
  white-space: pre-wrap;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
}
.reader-html { color: var(--text); }
.reader-html p { margin: 0 0 10px; }

.section-title { margin: 18px 0 10px; font-size: 16px; font-weight: 700; }
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .grid { grid-template-columns: 1fr; } }

.imgbtn {
  padding: 0;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.1s;
}
.imgbtn:hover {
  box-shadow: var(--shadow-md);
}
.imgbtn:active {
  transform: scale(0.98);
}
.imgbtn img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}
@media (max-width: 520px) { .imgbtn img { height: 240px; } }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.95);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}
.lightbox[hidden] { display: none !important; }
.lightbox-img {
  max-width: min(1100px, 96vw);
  max-height: 78vh;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  background: var(--panel);
}
.lightbox-close {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 26px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, transform 0.1s;
}
.lightbox-close:hover { background: #e5e7eb; }
.lightbox-close:active { transform: scale(0.95); }
.lightbox-nav {
  position: fixed;
  bottom: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Swipe hint - mobile only */
.swipe-hint {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  color: var(--muted);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.lightbox:not([hidden]) .swipe-hint {
  opacity: 1;
}
@media (min-width: 769px) {
  .swipe-hint { display: none; }
}

/* Hide prev/next buttons on mobile - use swipe instead */
@media (max-width: 768px) {
  .lightbox-prev,
  .lightbox-next {
    display: none;
  }
}

.login-body { display: grid; place-items: center; min-height: 100vh; }
.login { width: 100%; padding: 22px 16px; }
.login-card {
  max-width: 420px;
  margin: 0 auto;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow-md);
}
.login-title { margin: 0 0 6px; font-size: 22px; font-weight: 700; color: var(--text); }
.label { display: block; margin-top: 14px; margin-bottom: 6px; color: var(--muted); font-weight: 600; }
.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  font-size: 16px;
  min-height: 44px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.alert {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(220, 38, 38, 0.3);
  background: rgba(254, 226, 226, 0.8);
  color: #991b1b;
}
.empty {
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}
