:root {
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --border: rgba(20, 20, 30, 0.08);
  --text: #1c1f26;
  --text-muted: #656b77;
  --accent-gaming: #9061f9;
  --accent-tech: #14b8a6;
  --accent-ms: #0078d4;
  --brand-orange: #f2960c;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(20, 10, 40, 0.10), 0 1px 3px rgba(20, 10, 40, 0.06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  min-height: 100vh;
}

/* ---------------------------------------------------------------------- */
/* Tab-dependent gradient backdrop — three stacked full-viewport layers,  */
/* crossfaded via opacity so the colour change is smooth, not a hard cut. */
/* ---------------------------------------------------------------------- */

.bg-layers {
  position: fixed;
  inset: 0;
  z-index: -1;
}

.bg-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.7s ease;
}

.bg-layer.active { opacity: 1; }

.bg-gaming {
  background: linear-gradient(160deg, #2a1948 0%, #4b2e83 45%, #6b3fa0 75%, #4a2f7a 100%);
}

.bg-tech {
  background: linear-gradient(160deg, #082a28 0%, #0f5f57 45%, #14b8a6 80%, #0d6e63 100%);
}

.bg-microsoft {
  background: linear-gradient(160deg, #0a2e63 0%, #0d4fa0 45%, #2b8ce6 80%, #0a3d91 100%);
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

/* ---------------------------------------------------------------------- */
/* Header / brand                                                         */
/* ---------------------------------------------------------------------- */

.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 18px;
  box-shadow: var(--shadow);
}

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

.brand-logo-wrap {
  display: inline-flex;
  /* Bottom-aligned on purpose (not centered) — the stamp sits flush with
     the logo's baseline rather than floating at its vertical midpoint. */
  align-items: flex-end;
  gap: 10px;
}

/* Sits between the brand and the sync/updated controls, in the SAME row —
   auto margins soak up the leftover space on both sides, which centers it
   while naturally pushing brand/actions to the two edges. Deliberately not
   a separate row with its own divider: that read as a disconnected banner
   rather than part of the header. Sized noticeably bigger than the other
   header chrome on purpose — it's a fun flourish, meant to stand out a
   little, not blend in as another UI control. */
.team-chibis {
  height: 92px;
  width: auto;
  display: block;
  margin: 0 auto;
}

.brand-logo {
  height: 34px;
  width: auto;
  display: block;
  border-radius: 4px;
}

.brand-stamp {
  border: 2px solid var(--brand-orange);
  border-radius: 5px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--brand-orange);
  background: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}

.updated-at {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sync-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.sync-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  background: rgba(20, 20, 30, 0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}

.sync-btn:hover:not(:disabled) { background: rgba(20, 20, 30, 0.1); }

.sync-btn:disabled {
  cursor: default;
  opacity: 0.65;
}

.sync-icon { flex-shrink: 0; }

.sync-status {
  font-size: 11px;
  color: var(--text-muted);
  max-width: 240px;
  text-align: right;
  line-height: 1.3;
}

.sync-status--error { color: #b91c1c; }

@media (max-width: 560px) {
  .header-actions { width: 100%; justify-content: space-between; }
  .sync-wrap { align-items: flex-start; }
  .sync-status { text-align: left; }
}

/* ---------------------------------------------------------------------- */
/* Tabs                                                                    */
/* ---------------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow);
  width: fit-content;
}

.tab-btn {
  appearance: none;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.tab-icon { flex-shrink: 0; transition: color 0.15s ease; }

.tab-btn:hover { color: var(--text); background: rgba(20, 20, 30, 0.05); }

.tab-btn.active { color: #fff; background: var(--accent-ms); }

.tab-btn[data-tab="gaming"].active { background: var(--accent-gaming); }
.tab-btn[data-tab="tech"].active { background: var(--accent-tech); }
.tab-btn[data-tab="microsoft"].active { background: var(--accent-ms); }

.panel { display: none; }
.panel.active { display: block; }

/* ---------------------------------------------------------------------- */
/* Gaming / Tech source grid                                               */
/* ---------------------------------------------------------------------- */

.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.source-column {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.source-name {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

#panel-gaming .source-name { color: var(--accent-gaming); }
#panel-tech .source-name { color: var(--accent-tech); }

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.news-item { display: flex; flex-direction: column; gap: 2px; }

.news-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  line-height: 1.35;
}

.news-link:hover { color: var(--accent-ms); text-decoration: underline; }
#panel-gaming .news-link:hover { color: var(--accent-gaming); }
#panel-tech .news-link:hover { color: var(--accent-tech); }

.news-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* Recurring headline tags (currently just Azure: Launched / In Preview /
   In Development / Retirement / Announcing). Colour reads as a rough
   lifecycle progression — grey (early) -> amber (testing) -> green
   (shipped) -> red (going away) -- plus blue for general announcements,
   which isn't part of that progression. */
.news-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 3px;
}

.news-tag--in-development { background: rgba(100, 116, 139, 0.14); color: #475569; }
.news-tag--in-preview      { background: rgba(217, 119, 6, 0.14);  color: #b45309; }
.news-tag--launched        { background: rgba(22, 163, 74, 0.14);  color: #15803d; }
.news-tag--retirement      { background: rgba(220, 38, 38, 0.14);  color: #b91c1c; }
.news-tag--announcing      { background: rgba(37, 99, 235, 0.14);  color: #1d4ed8; }

/* Featured (first) item per source — includes the article thumbnail */
.news-item-featured {
  flex-direction: row;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border);
}

.news-thumb-link { flex-shrink: 0; }

.news-thumb {
  display: block;
  width: 68px;
  height: 68px;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(20, 20, 30, 0.08), rgba(20, 20, 30, 0.03));
}

.news-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.news-item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.empty-state {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 0;
}

/* ---------------------------------------------------------------------- */
/* Microsoft accordion                                                     */
/* ---------------------------------------------------------------------- */

.accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.accordion-section {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  padding: 16px 18px;
  cursor: pointer;
  text-align: left;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.accordion-trigger:hover { background: rgba(20, 20, 30, 0.04); }

.accordion-title { flex: 1; }

.accordion-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-ms);
  background: rgba(0, 120, 212, 0.1);
  border-radius: 999px;
  padding: 2px 10px;
}

.accordion-chevron {
  color: var(--text-muted);
  transition: transform 0.15s ease;
  font-size: 18px;
}

.accordion-trigger[aria-expanded="true"] .accordion-chevron {
  transform: rotate(90deg);
}

.accordion-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  padding: 0 18px;
}

.accordion-panel .item-list {
  padding: 4px 0 16px;
}

.accordion-panel .news-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.accordion-panel .news-item:last-child { border-bottom: none; }
.accordion-panel .news-item-featured { border-bottom: 1px solid var(--border); }

/* ---------------------------------------------------------------------- */
/* Footer                                                                  */
/* ---------------------------------------------------------------------- */

.app-footer {
  margin-top: 40px;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

@media (max-width: 560px) {
  .app-header { flex-direction: column; align-items: flex-start; }
  .team-chibis { height: 56px; margin: 4px auto; }
  .tab-btn span { display: none; }
  .tab-btn { padding: 10px; }
}
