:root {
  --habs-red: #af1e2d;
  --habs-navy: #192168;
  --habs-white: #ffffff;
  --bg: #f4f4f8;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-muted: #666a80;
  --border: #e2e2ec;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.app-header {
  background: var(--habs-navy);
  color: var(--habs-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-icon {
  border-radius: 6px;
  display: block;
}

.brand-name {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.lang-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 3px;
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--habs-white);
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
}

.lang-btn.active {
  background: var(--habs-red);
}

.install-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--habs-navy);
  color: var(--habs-white);
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.2);
}

.install-banner-icon {
  flex: none;
  border-radius: 8px;
}

.install-banner-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  line-height: 1.3;
}

.install-banner-text strong {
  font-size: 0.9rem;
}

.install-banner-text span {
  color: rgba(255, 255, 255, 0.75);
}

.install-banner-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.install-btn {
  border: none;
  background: var(--habs-red);
  color: var(--habs-white);
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
}

.install-dismiss {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  flex: none;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

.install-dismiss:hover,
.install-dismiss:active {
  background: rgba(255, 255, 255, 0.14);
}

.sources-btn {
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: transparent;
  color: var(--habs-white);
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
}

.sources-btn:hover { background: rgba(255, 255, 255, 0.12); }

.notif-btn {
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: transparent;
  color: var(--habs-white);
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notif-btn:hover { background: rgba(255, 255, 255, 0.12); }

.notif-panel {
  position: fixed;
  top: 3.5rem;
  right: 0.75rem;
  z-index: 20;
  width: min(320px, calc(100vw - 1.5rem));
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  padding: 1rem;
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.notif-panel-header h2 {
  font-size: 1rem;
  margin: 0;
}

.notif-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}

.notif-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.6rem;
}

.notif-sources {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 0.6rem;
}

.notif-source-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.source-lang-heading {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  border-bottom: 2px solid var(--habs-navy);
  padding-bottom: 0.25rem;
  margin: 0.9rem 0 0.4rem;
}

.source-lang-heading:first-child {
  margin-top: 0;
}

.source-category-heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--habs-red);
  margin: 0.6rem 0 0.1rem;
}

.notif-status {
  font-size: 0.8rem;
  color: var(--habs-red);
  min-height: 1.1em;
  margin: 0 0 0.5rem;
}

.notif-actions {
  display: flex;
  gap: 0.5rem;
}

.notif-save {
  flex: 1;
  border: none;
  background: var(--habs-red);
  color: var(--habs-white);
  font-weight: 700;
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
}

.notif-disable {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem;
}

.updated-line {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0.25rem 0.25rem 1rem;
}

.news-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.news-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  gap: 0.85rem;
  padding: 0.85rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.news-card:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.news-thumb {
  width: 92px;
  height: 92px;
  flex: none;
  border-radius: 8px;
  object-fit: cover;
  background: var(--habs-navy);
}

.news-thumb-fallback {
  width: 92px;
  height: 92px;
  flex: none;
  border-radius: 8px;
  background: var(--habs-navy);
  display: flex;
  align-items: center;
  justify-content: center;
}

.news-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.news-source {
  display: inline-flex;
  align-self: flex-start;
  background: var(--habs-navy);
  color: var(--habs-white);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-bottom: 0.35rem;
}

.news-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  line-height: 1.3;
}

.news-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.4rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.news-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: auto;
}

.state-message {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem;
}

.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 1.5rem 1rem 2.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12131c;
    --card-bg: #1c1e2b;
    --text: #f0f0f5;
    --text-muted: #9498ab;
    --border: #2a2c3d;
  }
}

@media (max-width: 380px) {
  .install-banner-text span {
    display: none;
  }
}
