:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --fact: #4ade80;
  --past: #60a5fa;
  --future: #60a5fa;
  --accent: #60a5fa;
  --danger: #ef4444;
  --grid: rgba(148, 163, 184, 0.15);
  --border: rgba(148, 163, 184, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

.hidden { display: none !important; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

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

.header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.today {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.legend {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}

.dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}
.dot.fact   { background: var(--fact); }
.dot.past   { background: var(--past); }
.dot.future { background: var(--future); }

.legend-sep { color: var(--muted); opacity: 0.5; margin: 0 0.1rem; }

.bar {
  display: inline-block;
  width: 0.2rem;
  height: 0.9rem;
  border-radius: 1px;
  margin-right: 0.35rem;
  vertical-align: -0.15rem;
}
.bar.event-up   { background: #4ade80; }
.bar.event-down { background: #ef4444; }

.link-button {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-decoration-color: rgba(148, 163, 184, 0.4);
  text-underline-offset: 3px;
}
.link-button:hover { color: var(--text); }

.chart-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  height: 70vh;
  min-height: 420px;
  position: relative;
}

#chart {
  width: 100% !important;
  height: 100% !important;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

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

.news-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 170px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.95rem 1.05rem 1.65rem;
  padding-right: 4rem;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
  overflow: hidden;
}

a.news-tile { cursor: pointer; }

.news-tile:hover:not(.news-tile--empty) {
  border-color: rgba(74, 222, 128, 0.45);
  transform: translateY(-1px);
}

.news-tile--empty { opacity: 0.55; }

.news-tile__weight {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1;
  color: var(--fact);
  background: rgba(74, 222, 128, 0.14);
  border-radius: 8px;
  padding: 0.25rem 0.55rem;
  letter-spacing: 0.02em;
}

.news-tile__weight--negative {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.14);
}

.news-tile__weight--neutral {
  color: var(--muted);
  background: rgba(148, 163, 184, 0.12);
}

.news-tile--empty .news-tile__weight {
  color: var(--muted);
  background: transparent;
}

.news-tile__title {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-tile__text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.news-tile__source {
  position: absolute;
  left: 1.05rem;
  bottom: 0.55rem;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: lowercase;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  opacity: 0.75;
  max-width: calc(100% - 2rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.news-tile:hover:not(.news-tile--empty) .news-tile__title {
  color: var(--fact);
}

.news-tile__placeholder {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-card h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.auth-card .muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-card input[type="password"],
.auth-card input[type="text"] {
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  color: var(--text);
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

.auth-card input:focus {
  border-color: var(--accent);
}

.auth-card button {
  background: var(--accent);
  color: #0b1220;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.auth-card button:hover { opacity: 0.9; }
.auth-card button:disabled { opacity: 0.5; cursor: not-allowed; }

.error-text {
  margin: 0;
  color: var(--danger);
  font-size: 0.85rem;
}
