﻿@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Noto+Sans+JP:wght@400;500;700&display=swap");

:root {
  --bg: #f5f7f2;
  --bg2: #ece8dd;
  --card: #ffffff;
  --ink: #172018;
  --sub: #4c5c4e;
  --accent: #0d9f6e;
  --accent-2: #1254d8;
  --danger: #a12a2a;
  --line: #d7ddd1;
  --soft: #edf2e8;
  --shadow: 0 10px 28px rgba(17, 33, 20, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans JP", "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, rgba(13, 159, 110, 0.13), transparent 30%),
    radial-gradient(circle at 80% 0%, rgba(18, 84, 216, 0.1), transparent 25%),
    linear-gradient(155deg, var(--bg), var(--bg2));
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(6px);
  background: rgba(245, 247, 242, 0.78);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-btn {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 999px;
}

.notify-global {
  background: #fff2dd;
  color: #8a5200;
  font-weight: 700;
}

.notify-global:not(.hidden) {
  box-shadow: 0 0 0 2px rgba(255, 180, 0, 0.32);
  animation: notifyPulse 1.8s ease-in-out infinite;
}

.sync-status {
  min-width: 92px;
  text-align: center;
}

.sync-status.syncing {
  background: #e5f0ff;
  color: #104b8b;
}

.sync-status.saved {
  background: #d7f3e8;
  color: #0f7f57;
}

.sync-status.error {
  background: #ffe2dd;
  color: #9c2f18;
}

.sync-status.locked {
  background: #f1ede4;
  color: #6c5a38;
}

.sync-status.off {
  background: #eceff3;
  color: #5f6671;
}

@keyframes notifyPulse {
  0% {
    transform: scale(1);
  }

  35% {
    transform: scale(1.04);
  }

  100% {
    transform: scale(1);
  }
}

.brand {
  font-family: "Space Grotesk", sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand span {
  color: var(--accent);
}

.status-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: #d7f3e8;
  color: #0f7f57;
  font-size: 12px;
  font-weight: 600;
}

.layout {
  display: grid;
  grid-template-columns: 250px 1fr 300px;
  gap: 18px;
  max-width: 1580px;
  margin: 20px auto;
  padding: 0 16px 24px;
}

.sidebar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 10px;
  height: fit-content;
}

.nav-btn {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: 12px;
  padding: 12px 12px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
  font-family: "Space Grotesk", sans-serif;
  transition: background 0.2s ease, transform 0.2s ease;
}

.nav-btn:hover {
  background: var(--soft);
  transform: translateX(2px);
}

.nav-btn.active {
  background: linear-gradient(120deg, #dbf7eb, #dfebff);
  color: #0b4d76;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-section+.sidebar-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.sidebar-heading {
  font-weight: 700;
  font-size: 12px;
  color: var(--sub);
  padding: 4px 10px;
}

.category-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.category-filter-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--sub);
}

.category-clear-btn {
  padding: 4px 8px;
  font-size: 11px;
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: none;
  overflow: visible;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 13px;
}

.category-item:hover {
  background: var(--soft);
}

.category-item.selected {
  background: linear-gradient(120deg, #dbf7eb, #e8f4ff);
}

.category-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.category-label {
  flex: 1;
  font-weight: 500;
}

.category-count {
  font-size: 11px;
  color: var(--sub);
  background: var(--line);
  padding: 2px 6px;
  border-radius: 999px;
}

.category-actions {
  display: flex;
  gap: 4px;
}

.category-edit {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.category-edit.hidden {
  display: none;
}

.category-edit-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--sub);
  margin-bottom: 8px;
}

.custom-category-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.category-rename-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.category-rename-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.category-rename-id {
  font-size: 11px;
  color: var(--sub);
  font-family: "Space Grotesk", sans-serif;
}

.category-rename-input {
  width: 100%;
}

.category-rename-save {
  justify-self: start;
  padding: 5px 10px;
  font-size: 12px;
}

.custom-category-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  background: var(--soft);
  border-radius: 6px;
  font-size: 12px;
}

.custom-category-item span {
  flex: 1;
}

.custom-category-item .remove-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  color: var(--danger);
  padding: 0 4px;
}

.category-edit-add {
  display: flex;
  gap: 4px;
}

.category-edit-add .compact-input {
  flex: 1;
}

.category-edit-actions {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.main {
  display: grid;
  gap: 14px;
}

.right-sidebar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  height: fit-content;
  overflow: hidden;
}

.right-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.trend-list {
  display: grid;
  gap: 8px;
}

.trend-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 8px;
  background: linear-gradient(180deg, #fff, #fafcf8);
}

.trend-rank {
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  color: #0f7f57;
  font-weight: 700;
}

.trend-main a {
  color: #10448a;
  text-decoration: none;
  font-weight: 700;
}

.trend-main a:hover {
  text-decoration: underline;
}

.trend-meta {
  font-size: 11px;
  color: var(--sub);
  margin-top: 2px;
}

.trend-link-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.mobile-only {
  display: none;
}

.sidebar-close-btn,
.trend-close-btn {
  width: 28px;
  height: 28px;
}

.mobile-sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 24;
  background: rgba(20, 28, 22, 0.4);
}

.panel {
  display: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 0.22s ease;
}

.panel.active {
  display: block;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px;
}

.panel-body {
  padding: 14px;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* Compact Panel Head */
.panel-head.compact {
  padding: 8px 12px;
  gap: 8px;
}

.panel-head-left,
.panel-head-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.panel-head-center {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: center;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--soft);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.icon-btn:hover {
  background: var(--line);
}

.compact-select {
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.compact-input {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: #fff;
  width: 140px;
}

/* Settings Dropdown */
.settings-dropdown {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.settings-dropdown.hidden {
  display: none;
}

.setting-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--sub);
  cursor: pointer;
}

.setting-item input[type="checkbox"] {
  accent-color: var(--accent);
}

.setting-divider {
  border: none;
  border-left: 1px solid var(--line);
  height: 16px;
  margin: 0;
}

.setting-group-title {
  font-size: 12px;
  color: var(--sub);
  font-weight: 700;
}

.setting-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.setting-link {
  padding: 5px 9px;
  font-size: 12px;
}

/* Compact Panel Body */
.panel-body.compact {
  padding: 8px;
}

.poll-status {
  font-size: 11px;
  padding: 4px 8px;
  margin-bottom: 6px;
}

.feed-list.compact {
  gap: 6px;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 9px 10px;
}

textarea {
  min-height: 90px;
}

button {
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

button.secondary {
  background: #e2e9dd;
  color: #243025;
}

button.warn {
  background: var(--danger);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.feed-list,
.digest-list,
.notify-list,
.model-list,
.rss-list,
.log-list {
  display: grid;
  gap: 10px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  display: grid;
  gap: 4px;
  background: linear-gradient(180deg, #fff, #fafcf8);
}

.rss-card.selected {
  border-color: #77b799;
  box-shadow: inset 0 0 0 1px rgba(13, 159, 110, 0.28);
}

.rss-row-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: start;
}

.rss-select-input {
  margin-top: 3px;
}

.rss-meta-grid {
  display: grid;
  gap: 2px;
}

.rss-title {
  margin: 0;
  font-size: 14px;
}

.rss-bulk-toolbar {
  align-items: center;
}

.rss-bulk-toolbar #rssListMeta {
  margin-left: auto;
}

.card.with-thumb {
  grid-template-columns: 116px minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 6px;
  align-items: start;
}

.card.with-thumb> :not(.thumb) {
  grid-column: 2;
}

.card.with-thumb>.thumb.show {
  grid-column: 1;
  grid-row: 1 / span 6;
  width: 116px;
  height: 116px;
  max-height: none;
  justify-self: start;
  align-self: start;
  aspect-ratio: 1 / 1;
}

.card.flash {
  animation: flash 1.1s ease;
}

@keyframes flash {
  0% {
    box-shadow: 0 0 0 rgba(13, 159, 110, 0);
  }

  30% {
    box-shadow: 0 0 0 4px rgba(13, 159, 110, 0.22);
  }

  100% {
    box-shadow: 0 0 0 rgba(13, 159, 110, 0);
  }
}

.card-head {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: flex-start;
}

.card-title {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
}

.card-meta {
  color: var(--sub);
  font-size: 11px;
}

.thumb {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  display: none;
}

.thumb.show {
  display: block;
}

.tag-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.summary-rich {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #f7fbf5;
}

.summary-rich-lead {
  font-weight: 700;
  margin-bottom: 6px;
}

.summary-rich-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.summary-rich-item {
  padding: 2px 6px;
  border-radius: 6px;
}

.summary-rich-item.tone-1 {
  background: rgba(18, 84, 216, 0.08);
}

.summary-rich-item.tone-2 {
  background: rgba(13, 159, 110, 0.08);
}

.summary-rich-item.tone-3 {
  background: rgba(222, 124, 0, 0.11);
}

.summary-num {
  color: #14519b;
  font-weight: 800;
}

.summary-key {
  color: #9e5800;
  font-weight: 800;
}

.tag {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e4eef9;
  color: #10448a;
}

.badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: #dff5ea;
  color: #0f6f4e;
  font-size: 11px;
  font-weight: 700;
}

.badge.new {
  background: #ffe7c7;
  color: #9e5800;
}

.badge-inline {
  color: var(--accent);
  font-weight: 700;
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card-toolbar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.mini-btn {
  border: none;
  background: var(--soft);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease;
}

.mini-btn:hover {
  background: var(--line);
}

.detail-content {
  white-space: pre-wrap;
  line-height: 1.65;
  background: #fafcf8;
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 10px;
  min-height: 180px;
}

.muted {
  color: var(--sub);
  font-size: 12px;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.feedback-btn {
  min-width: 44px;
  padding: 8px 10px;
  font-size: 18px;
  line-height: 1;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.btn-source {
  background: #245b9f;
  color: #fff;
}

.btn-fav {
  background: #8e5d00;
  color: #fff;
}

.btn-good {
  background: #118450;
  color: #fff;
}

.btn-read {
  background: #2e6cb9;
  color: #fff;
}

.btn-bad {
  background: #b93a30;
  color: #fff;
}

.feedback-btn.action-pressed {
  animation: action-press 0.28s ease;
}

@keyframes action-press {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(17, 34, 17, 0);
  }

  45% {
    transform: scale(0.9);
    box-shadow: 0 0 0 6px rgba(17, 34, 17, 0.15);
    filter: brightness(1.08);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(17, 34, 17, 0);
  }
}

.quickstart-details {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(180deg, #fff, #fafcf8);
}

.quickstart-details summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 700;
}

.check-list {
  display: grid;
  gap: 4px;
}

.check-item {
  font-size: 13px;
}

.check-item.ok {
  color: #0f7f57;
}

.check-item.warn {
  color: #9e5800;
}

.notify-rule-list {
  display: grid;
  gap: 10px;
}

.notify-live-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.notify-live-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #0e5f43;
}

.notify-live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #12a56f;
  box-shadow: 0 0 0 0 rgba(18, 165, 111, 0.45);
  animation: pulse-live 1.8s infinite;
}

@keyframes pulse-live {
  0% {
    box-shadow: 0 0 0 0 rgba(18, 165, 111, 0.45);
  }

  70% {
    box-shadow: 0 0 0 9px rgba(18, 165, 111, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(18, 165, 111, 0);
  }
}

.notify-keyword-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.notify-keyword-chip {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e7f5ee;
  color: #0e6c4a;
  border: 1px solid #bfe7d4;
}

.notify-rule-row {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fafdfb;
  font-size: 12px;
  color: var(--sub);
}

.notify-rule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.notify-rule-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.notify-rule-keywords textarea {
  min-height: 70px;
}

.notify-rule-empty {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 12px;
  color: var(--sub);
}

.notify-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.notify-card {
  border-left: 4px solid transparent;
}

.notify-card.is-new {
  border-left-color: #0d9f6e;
  box-shadow: 0 8px 20px rgba(13, 159, 110, 0.12);
}

.notify-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.notify-seen-btn {
  padding: 5px 10px;
  font-size: 12px;
}

.nav-btn.has-alert {
  box-shadow: inset 0 0 0 1px rgba(13, 159, 110, 0.38);
  background: linear-gradient(120deg, #eaf8f1, #edf4ff);
}

.hidden {
  display: none !important;
}

.status-ai {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  display: inline-block;
}

.status-ai.ok {
  background: #dff5ea;
  color: #0f6f4e;
}

.status-ai.pending {
  background: #fff0cf;
  color: #8a5300;
}

.status-ai.failed {
  background: #ffe3e3;
  color: #9a2d2d;
}

@media (max-width: 1000px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .mobile-only {
    display: inline-flex;
  }

  .sidebar,
  .right-sidebar {
    position: fixed;
    top: 64px;
    bottom: 0;
    width: min(86vw, 340px);
    z-index: 30;
    overflow-y: auto;
    transition: transform 0.2s ease;
    border-radius: 14px 14px 0 0;
  }

  .sidebar {
    left: 0;
    transform: translateX(-110%);
  }

  .right-sidebar {
    right: 0;
    transform: translateX(110%);
  }

  body.mobile-left-open .sidebar {
    transform: translateX(0);
  }

  body.mobile-right-open .right-sidebar {
    transform: translateX(0);
  }

  body.mobile-left-open .mobile-sidebar-overlay,
  body.mobile-right-open .mobile-sidebar-overlay {
    display: block !important;
  }

  .nav-btn {
    text-align: left;
    font-size: 13px;
    padding: 10px 8px;
  }

  .topbar-actions {
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .topbar-btn {
    padding: 6px 9px;
  }

  .category-list {
    max-height: 360px;
    overflow-y: auto;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .notify-rule-meta {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .card.with-thumb {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .card.with-thumb>.thumb.show {
    width: 92px;
    height: 92px;
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: white;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  padding: 24px;
  border-radius: 16px;
}
