@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css");

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f0f3f6;
  --text: #14171a;
  --muted: #5a6673;
  --border: #d9e0e7;
  --primary: #0b57d0;
  --badge-bg: #e8f0fe;
  --badge-text: #0b57d0;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #181c22;
  --surface-soft: #202631;
  --text: #f0f3f8;
  --muted: #a8b3c2;
  --border: #2c3440;
  --primary: #7fb3ff;
  --badge-bg: #21395f;
  --badge-text: #b8d4ff;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: inherit;
}

.container {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 2rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.logo {
  margin: 0;
  font-size: 1.8rem;
  line-height: 1.2;
}

.logo a {
  text-decoration: none;
}

.header-date {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.theme-toggle,
.date-nav button,
.category-tabs button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.theme-toggle:hover,
.date-nav button:hover,
.category-tabs button:hover {
  border-color: var(--primary);
}

.date-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-bottom: 1rem;
}

.archive-link {
  margin-left: auto;
  text-decoration: none;
  color: var(--primary);
  font-weight: 600;
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.1rem;
}

.category-tabs button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.news-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 220px;
}

.badge {
  align-self: flex-start;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  margin-bottom: 0.6rem;
}

.news-title {
  margin: 0 0 0.6rem;
  font-size: 1.06rem;
  line-height: 1.4;
}

.news-title a {
  text-decoration: none;
}

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

.news-summary {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.news-meta {
  margin-top: auto;
  font-size: 0.82rem;
  color: var(--muted);
}

.empty-state {
  margin: 1rem 0 0;
  padding: 1rem;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: var(--surface-soft);
  color: var(--muted);
}

.archive-guide {
  margin: 0 0 0.7rem;
  color: var(--muted);
}

.archive-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.archive-list li a {
  display: block;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
}

.archive-list li a:hover {
  border-color: var(--primary);
}

.site-footer {
  margin-top: 1.6rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.site-footer a {
  color: var(--primary);
  text-decoration: none;
}

/* ── Auth ── */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.auth-login-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--primary);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.auth-login-btn:hover { border-color: var(--primary); }

.auth-user {
  font-size: 0.9rem;
  font-weight: 600;
}
.auth-logout {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: underline;
}

/* ── Login Modal ── */
.login-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-modal-overlay[hidden] { display: none; }

.login-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  width: 90%;
  max-width: 380px;
  position: relative;
}
.modal-x {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
}
.modal-heading {
  font-size: 1.3rem;
  margin: 0 0 0.3rem;
}
.modal-sub {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 1.2rem;
}
.login-modal input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 0.7rem;
}
.login-modal input:focus { outline: none; border-color: var(--primary); }
.login-err { color: #e53e3e; font-size: 0.85rem; margin: 0 0 0.5rem; min-height: 1.2em; }
.login-submit {
  width: 100%;
  padding: 0.75rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.login-submit:hover { opacity: 0.9; }
.modal-register {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}
.modal-register a { color: var(--primary); }

/* ── Fact Check ── */
:root {
  --fc-green: #22c55e;
  --fc-yellow: #eab308;
  --fc-red: #ef4444;
}

.fc-area {
  margin-top: auto;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
}

.fc-btn {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}
.fc-btn:hover { border-color: var(--primary); color: var(--primary); }
.fc-btn:disabled { opacity: 0.6; cursor: wait; }

.factcheck-result {
  margin-top: 0.7rem;
}

.fc-score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}
.fc-label { font-size: 0.82rem; color: var(--muted); }
.fc-pct { font-size: 1.1rem; font-weight: 700; }

.fc-bar {
  height: 6px;
  background: var(--surface-soft);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.fc-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.fc-reason {
  font-size: 0.88rem;
  color: var(--text);
  margin: 0 0 0.3rem;
  line-height: 1.4;
}
.fc-caution {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}
.fc-error {
  font-size: 0.85rem;
  color: #e53e3e;
  margin: 0;
}

/* 제목 의도 분석 블록 */
.fc-headline-block {
  margin-top: 0.6rem;
  padding: 0.5rem 0.7rem;
  background: var(--surface-soft);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.fc-hl-label { font-size: 0.8rem; color: var(--muted); flex-basis: 100%; }
.fc-hl-intent { font-size: 0.85rem; font-weight: 600; }
.fc-badge {
  font-size: 0.75rem;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
}
.fc-badge-ok { background: #c6f6d5; color: #276749; }
.fc-badge-warn { background: #fefcbf; color: #7b6c00; }
.fc-hl-note {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.2rem 0 0;
  flex-basis: 100%;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .container {
    width: min(1200px, calc(100% - 1rem));
  }

  .logo {
    font-size: 1.45rem;
  }

  .theme-toggle {
    padding: 0.45rem 0.75rem;
    font-size: 0.82rem;
  }

  .archive-link {
    margin-left: 0;
  }
}

/* Google Sign-In */
.google-signin-wrap {
  display: flex;
  justify-content: center;
  margin: 8px 0 4px;
}
.login-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  color: #aaa;
  font-size: 13px;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e0e0e0;
}
