:root {
  --bg: #070b16;
  --panel: #0e1526;
  --panel-2: #131c33;
  --line: #1f2a44;
  --text: #e8edf7;
  --muted: #8a96b3;
  --accent: #4cc9f0;
  --hot: #ff6b35;
  --good: #7bd389;
  --bad: #ff5d73;
  --font: "Space Grotesk", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, #14204a 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 10%, #2a0f3d 0%, transparent 55%), var(--bg);
  color: var(--text);
  font-family: var(--font);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 16px 20px 0;
  overflow: hidden;
}

/* --- nagłówek --- */
.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand h1 { margin: 0; }
.home { text-decoration: none; }
.neon-sm { font-size: clamp(18px, 2vw, 34px); }
.live { display: inline-flex; align-items: center; gap: 8px; font: 700 14px var(--mono); color: var(--bad);
        border: 1px solid var(--bad); padding: 4px 10px; border-radius: 999px; }
.live i { width: 9px; height: 9px; border-radius: 50%; background: var(--bad); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .3; transform: scale(.7); } }
.demo { font: 700 12px var(--mono); background: #ffb703; color: #111; padding: 3px 8px; border-radius: 6px; }
.clock { text-align: center; }
.clock-label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .12em; }
.countdown { font: 700 clamp(30px, 3.6vw, 60px) var(--mono); letter-spacing: .02em;
             background: linear-gradient(90deg, #4cc9f0, #b388ff, #f72585); -webkit-background-clip: text;
             background-clip: text; color: transparent; line-height: 1.1; }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 6px; min-width: 240px; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, #4cc9f0, #f72585); transition: width 1s; }
.status { display: flex; justify-content: flex-end; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.status .stale { color: var(--hot); }
#fullscreen { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
              font-size: 18px; width: 38px; height: 38px; cursor: pointer; }

/* --- KPI --- */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.kpi { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line);
       border-radius: 14px; padding: 12px 16px; display: flex; flex-direction: column; }
.kpi-value { font: 700 clamp(22px, 2.3vw, 40px) var(--mono); }
.kpi-value.bump { animation: bump .8s ease; }
@keyframes bump { 0% { color: var(--accent); transform: scale(1.08); } 100% { color: var(--text); transform: scale(1); } }
.kpi-label { color: var(--muted); font-size: 13px; }

/* --- scena --- */
.stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 24vw); gap: 14px; min-height: 0; }
.views, .side > div { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.views { display: flex; flex-direction: column; min-height: 0; padding: 12px 16px 8px; }
.tabs { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.tabs button { background: transparent; border: 1px solid transparent; color: var(--muted); font: 500 14px var(--font);
               padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.tabs button.active { color: var(--text); border-color: var(--line); background: var(--panel-2); }
.rotate-hint { margin-left: auto; font: 500 12px var(--mono); color: var(--muted); }
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.view[hidden] { display: none; }
.view-head { display: flex; align-items: baseline; gap: 14px; }
.view-head h2 { margin: 4px 0 6px; font-size: clamp(18px, 1.7vw, 28px); }
.sub { color: var(--muted); font-size: 14px; }
.chart { flex: 1; min-height: 300px; }

/* --- siatka zespołów --- */
.grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px;
        overflow: auto; align-content: start; padding-bottom: 8px; }
.card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
        border-left: 4px solid var(--c, var(--accent)); }
.card-top { display: flex; flex-wrap: nowrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.card-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-rank { font: 700 13px var(--mono); color: var(--muted); white-space: nowrap; }
.card-rank .up { color: var(--good); } .card-rank .down { color: var(--bad); }
.nums { display: flex; justify-content: space-between; gap: 10px; margin: 6px 0 4px; }
.nums div { display: flex; flex-direction: column; min-width: 0; }
.nums b { font: 700 15px var(--mono); white-space: nowrap; }
.nums small { color: var(--muted); font-size: 11px; }
.foot { display: flex; justify-content: space-between; gap: 8px; font: 500 12px var(--mono); color: var(--muted);
        white-space: nowrap; margin-top: 4px; }
.foot b { color: var(--text); }
.card svg { width: 100%; height: 36px; display: block; }
.mom { font: 700 12px var(--mono); }
.mom.up { color: var(--good); } .mom.down { color: var(--bad); } .mom.flat { color: var(--muted); }

/* --- panel boczny --- */
.side { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.hot { padding: 16px; background: linear-gradient(135deg, rgba(255,107,53,.22), rgba(247,37,133,.12)) !important;
       border-color: rgba(255,107,53,.5) !important; }
.hot-label { color: #ffb38a; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; }
.hot-name { font-size: clamp(22px, 2vw, 34px); font-weight: 700; margin: 6px 0; }
.hot-stats { font: 500 14px var(--mono); color: var(--muted); }
.feed { flex: 1; min-height: 0; padding: 12px 16px; display: flex; flex-direction: column; }
.feed h3 { margin: 0 0 8px; font-size: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.feed ol { list-style: none; margin: 0; padding: 0; overflow: hidden; flex: 1; }
.feed li { display: grid; grid-template-columns: 46px 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line);
           font-size: 14px; animation: slidein .6s ease; }
.feed li time { font: 500 12px var(--mono); color: var(--muted); padding-top: 2px; }
.feed li.milestone span { color: #ffd166; } .feed li.rank span { color: var(--good); }
.feed li.pr_merged span::before { content: "✓ "; color: var(--good); }
@keyframes slidein { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* --- pasek na dole --- */
.ticker { height: 40px; overflow: hidden; border-top: 1px solid var(--line); margin: 0 -20px; display: flex; align-items: center;
          background: rgba(7,11,22,.8); }
.ticker-track { white-space: nowrap; display: inline-block; padding-left: 100%; animation: scroll 90s linear infinite;
                font: 500 15px var(--font); color: var(--muted); }
.ticker-track b { color: var(--text); margin: 0 6px; }
.ticker-track .sep { color: var(--accent); margin: 0 18px; }
@keyframes scroll { to { transform: translateX(-100%); } }

.toast { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); background: linear-gradient(135deg, #f72585, #7209b7);
         padding: 22px 36px; border-radius: 18px; font-size: clamp(22px, 2.6vw, 44px); font-weight: 700;
         box-shadow: 0 20px 80px rgba(247,37,133,.45); animation: pop 4s ease forwards; z-index: 10; text-align: center; }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, 20px) scale(.9); } 10%,85% { opacity: 1; transform: translate(-50%, 0) scale(1); }
                 100% { opacity: 0; transform: translate(-50%, -10px); } }

@media (max-width: 900px) {
  html, body { height: auto; }
        body { display: block; overflow-x: hidden; overflow-y: auto; padding: 12px 16px 0; }
  body > * { margin-bottom: 14px; }
  .views { min-height: 0; }
  .view { flex: none; }
  .top { grid-template-columns: 1fr; text-align: left; }
  .clock { text-align: left; }
  .status { justify-content: flex-start; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-label { font-size: 12px; }
  .stage { grid-template-columns: minmax(0, 1fr); }
  .tabs { flex-wrap: wrap; }
  .rotate-hint { display: none; }
  .view-head { flex-direction: column; gap: 0; }
  .chart { min-height: 460px; }
  .grid { overflow: visible; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .feed ol { max-height: 480px; }
  .ticker { margin: 0 -16px; }
}
