* {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background: #f8f9fa;
}

h1 {
  text-align: center;
  margin-bottom: 5px;
}

/* ── Stats panel ── */
#stats-panel {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 15px 20px;
  margin-bottom: 20px;
}

#stats-panel h3 {
  margin: 0 0 10px 0;
  font-size: 1em;
  color: #444;
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.stat-badge {
  background: #e9ecef;
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 0.82em;
  color: #333;
  white-space: nowrap;
}

.stat-badge strong {
  color: #007bff;
}

.stats-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.stats-cat-item {
  background: #f0f8ff;
  border: 1px solid #cce5ff;
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 0.8em;
  color: #004085;
}

.stats-dates {
  margin-top: 8px;
  font-size: 0.8em;
  color: #666;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stats-date-item {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 2px 8px;
}

/* ── Filter controls ── */
#filter-controls {
  margin-bottom: 15px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Date group ── */
.date-group {
  margin-bottom: 28px;
}

.date-group-header {
  font-size: 1em;
  font-weight: bold;
  color: #555;
  border-bottom: 2px solid #dee2e6;
  padding: 6px 4px;
  margin-bottom: 12px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-group-header:hover {
  color: #007bff;
}

.collapse-arrow {
  font-size: 0.75em;
  transition: transform 0.15s;
}

.date-count {
  color: #999;
  font-weight: normal;
  font-size: 0.88em;
}

.date-group-body.collapsed {
  display: none;
}

/* ── Item card ── */
.item {
  background: white;
  border: 1px solid #ddd;
  padding: 12px 16px;
  margin-bottom: 10px;
  border-radius: 6px;
  transition: opacity 0.3s ease, background 0.3s ease;
}

.item.read {
  opacity: 0.5;
}

.item.starred {
  background: linear-gradient(135deg, #fff9e0 0%, #fff3b0 100%);
  border-color: #daa520;
}

/* irrelevant: hidden by default, collapsed when shown */
.item.irrelevant {
  display: none;
}

.item.irrelevant.show-irrelevant {
  display: block;
  opacity: 0.35;
}

.item.irrelevant .item-body,
.item.irrelevant .item-meta,
.item.irrelevant .item-content,
.item.irrelevant .classification,
.item.irrelevant .summary-section,
.item.irrelevant .simple-summary-section {
  display: none;
}

.item.irrelevant.show-irrelevant .item-header-buttons .btn:not(.btn-relevant) {
  display: none;
}

/* ── Item header ── */
.item-header {
  margin-bottom: 6px;
}

.item-title {
  font-size: 1em;
  font-weight: bold;
  margin: 0 0 6px 0;
  line-height: 1.4;
}

.item-title a {
  color: #1a0dab;
  text-decoration: none;
}

.item-title a:hover {
  text-decoration: underline;
}

.item-header-buttons {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
}

/* ── Meta ── */
.item-meta {
  color: #666;
  font-size: 0.83em;
  margin-bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ── Content ── */
.item-content {
  font-size: 0.88em;
  color: #333;
  margin: 6px 0;
}

/* ── Classification badge ── */
.classification {
  background-color: #e8f4fd;
  color: #0066aa;
  padding: 2px 10px;
  border-radius: 12px;
  display: inline-block;
  margin-top: 6px;
  font-size: 0.78em;
}

/* ── Buttons ── */
.btn {
  background: white;
  border: 1px solid #ccc;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.78em;
  white-space: nowrap;
}

.btn:hover {
  background-color: #f0f0f0;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn.read {
  background-color: #e0e0e0;
}

.btn.starred {
  background-color: #ffd700;
  color: #333;
  border-color: #daa520;
}

.btn.starred:hover {
  background-color: #ffed4e;
}

.btn-primary {
  background-color: #007bff;
  color: white;
  border-color: #007bff;
}

.btn-primary:hover {
  background-color: #0056b3;
}

.btn-success {
  background-color: #28a745;
  color: white;
  border-color: #28a745;
}

.btn-success:hover {
  background-color: #1e7e34;
}

.btn-warning {
  background-color: #fd7e14;
  color: white;
  border-color: #fd7e14;
}

.btn-warning:hover {
  background-color: #e06a00;
}

.btn-danger {
  background-color: #dc3545;
  color: white;
  border-color: #dc3545;
}

.btn-danger:hover {
  background-color: #b02a37;
}

.btn-relevant {
  background-color: #6c757d;
  color: white;
  border-color: #6c757d;
}

.btn-relevant:hover {
  background-color: #545b62;
}

.btn-force-summary,
.btn-force-simple {
  background: white;
  border: 1px solid #aaa;
  color: #555;
  font-size: 0.75em;
  padding: 3px 7px;
}

.btn-force-summary:hover,
.btn-force-simple:hover {
  background: #f0f0f0;
  color: #000;
}

/* ── Summary sections ── */
.summary-section {
  margin-top: 12px;
  padding: 12px;
  background: #fafafa;
  border-radius: 5px;
  border: 1px solid #eee;
}

.simple-summary-section {
  margin-top: 12px;
  padding: 14px;
  background: #f0f8f0;
  border-radius: 5px;
  border: 1px solid #c3e6cb;
  font-size: 0.87em;
  line-height: 1.7;
  color: #1a3a1a;
}

.simple-summary-section p {
  margin: 4px 0;
}

.simple-summary-section ul,
.simple-summary-section ol {
  margin: 4px 0 4px 20px;
  padding: 0;
}

.simple-summary-section li {
  margin: 2px 0;
}

.simple-summary-section code {
  background: #e8f5e9;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 0.95em;
}

.simple-summary-section blockquote {
  border-left: 3px solid #81c784;
  margin: 6px 0;
  padding: 4px 12px;
  color: #2e7d32;
  background: #e8f5e9;
  border-radius: 0 4px 4px 0;
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.summary-meta {
  color: #666;
  font-size: 0.88em;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 8px 0;
}

.tag {
  background: #e0e0e0;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.82em;
}

.summary-content {
  margin: 8px 0;
  padding: 10px;
  background: white;
  border-radius: 5px;
}

.summary-content h4 {
  margin: 0 0 5px 0;
  color: #333;
  font-size: 0.9em;
}

.notes-list {
  margin: 5px 0;
  padding-left: 20px;
}

.notes-list li {
  margin: 3px 0;
}

.json-preview {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 12px;
  border-radius: 5px;
  overflow-x: auto;
  font-family: monospace;
  font-size: 0.82em;
  max-height: 280px;
  overflow-y: auto;
  margin-top: 8px;
}

.copy-feedback {
  color: #28a745;
  font-size: 0.82em;
  margin-left: 8px;
}

.btn-group {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
}

.slogan {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 8px 14px;
  border-radius: 5px;
  margin: 8px 0;
  font-weight: bold;
  font-size: 0.9em;
}

.slogan-ja {
  background: linear-gradient(135deg, #e24667 0%, #a24bb2 100%);
}

/* ── x-cloak ── */
[x-cloak] {
  display: none !important;
}

/* ── Top bar ── */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.top-bar h1 {
  margin: 0;
  font-size: 1.4em;
}

.top-bar-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── Toolbar panel ── */
.toolbar-panel {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feed-url-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.feed-url-input {
  flex: 1;
  min-width: 200px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.88em;
}

.feed-message,
.history-message {
  font-size: 0.82em;
  color: #28a745;
  white-space: nowrap;
}

.history-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: white;
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal h2 {
  margin: 0 0 12px 0;
  font-size: 1.2em;
}

.modal-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1em;
  margin-bottom: 14px;
  box-sizing: border-box;
}

.modal-input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

.modal-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}