:root {
  --bg: #ffffff;
  --surface: #f7f5f1;
  --row-hover: #f0ece4;
  --text: #111;
  --muted: #6a6a6a;
  --accent: #d64c00;
  --border: #e5e0d6;
  --radius: 2px;
  --font: 'Oxanium', system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}
.topbar h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}
.meta .separator { color: var(--border); }
.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.link:hover { text-decoration: underline; }

main {
  padding: 16px 24px 60px;
  max-width: 1080px;
}

.day-group { margin-bottom: 20px; }
.day-group h2 {
  margin: 0 0 6px 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.08s;
}
.row:hover { background: var(--row-hover); }
.row.archived { opacity: 0.5; }

.row-badge {
  flex: 0 0 auto;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: var(--radius);
  background: #2a2a2a;
  color: #fff;
  white-space: nowrap;
  font-weight: 600;
  min-width: 86px;
  text-align: center;
}
.row-badge.youtube { background: #b00; }

.row-source {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  min-width: 90px;
}

.row-title {
  flex: 1 1 auto;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-date {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
  min-width: 70px;
  text-align: right;
}

.row-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.icon-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 16px;
  width: 26px;
  height: 26px;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: var(--row-hover); color: var(--accent); }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  background: var(--surface);
  border-radius: var(--radius);
}
.empty code {
  background: var(--bg);
  display: inline-block;
  margin-top: 8px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 12px;
}

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(20, 14, 8, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 100;
  padding: 60px 20px 20px;
  overflow-y: auto;
}
.modal-bg[hidden] { display: none; }
.modal {
  background: var(--bg);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
  width: 100%;
  max-width: 760px;
  padding: 24px 28px 28px;
  position: relative;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: 0;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
}
.modal-close:hover { background: var(--surface); color: var(--text); }

.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.modal-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
}
.modal-title {
  margin: 0 0 14px 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.btn {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  padding: 7px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.btn:hover { filter: brightness(0.95); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn.tertiary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn.tertiary:hover { color: var(--text); border-color: var(--muted); }

.section { margin-top: 14px; }
.section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}
.section-body {
  font-size: 14px;
  color: var(--text);
}

.deep {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius);
}
.story { margin-bottom: 16px; }
.story:last-child { margin-bottom: 0; }
.story-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}
.deep p { margin: 4px 0 8px 0; font-size: 14px; }
.deep ul { margin: 4px 0 8px 0; padding-left: 20px; }
.deep li { font-size: 14px; margin-bottom: 2px; }

.spinner {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  padding: 12px 0;
}
.error { color: #c00; font-size: 13px; padding: 8px 0; }

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--surface);
  padding: 1px 5px;
  border-radius: var(--radius);
}
