:root{
  --bg:#07110a;
  --panel:rgba(255,255,255,.055);
  --panel2:rgba(255,255,255,.09);
  --txt:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.62);
  --border:rgba(255,255,255,.11);
  --shadow:0 14px 34px rgba(0,0,0,.45);
  --radius:18px;
  --accentA:rgba(34,197,94,.18);
  --accentB:rgba(16,185,129,.14);
  --accentC:rgba(132,204,22,.12);
  --ok:rgba(34,197,94,.80);
  --danger:rgba(248,113,113,.75);
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}
:root[data-theme="light"]{
  --bg:#f2fbf4;
  --panel:rgba(10,10,12,.05);
  --panel2:rgba(10,10,12,.08);
  --txt:rgba(10,10,12,.92);
  --muted:rgba(10,10,12,.62);
  --border:rgba(10,10,12,.10);
  --shadow:0 10px 25px rgba(0,0,0,.10);
  --accentA:rgba(34,197,94,.14);
  --accentB:rgba(16,185,129,.10);
  --accentC:rgba(132,204,22,.10);
  --ok:rgba(22,163,74,.70);
  --danger:rgba(239,68,68,.70);
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--sans);
  color:var(--txt);
  font-size:14px;
  background: radial-gradient(1200px 800px at 12% -10%, var(--accentC), transparent 60%),
              radial-gradient(1200px 800px at 88% 0%, var(--accentB), transparent 55%),
              radial-gradient(900px 650px at 70% 120%, var(--accentA), transparent 55%),
              var(--bg);
}
a{color:inherit; text-decoration:none}
a:hover{text-decoration:underline}

.wrap{max-width:1600px; margin:0 auto; padding:10px}

/* Shell (sidebar + content) */
.shell{margin-top:10px}
.content{min-width:0}
.sidebar{display:none}

@media (min-width: 980px){
  .shell{display:grid; grid-template-columns:240px 1fr; gap:12px}
  .sidebar{
    display:block;
    position:sticky;
    top:10px;
    height:calc(100vh - 20px);
    overflow:auto;
    border:1px solid var(--border);
    background: color-mix(in oklab, var(--panel2) 92%, transparent);
    border-radius:var(--radius);
    box-shadow:var(--shadow);
    padding:10px;
  }
  .sidebar .sideTitle{font-weight:950; letter-spacing:-.2px; margin:2px 6px 10px}
  .sidebar a{
    display:block;
    padding:8px 10px;
    border-radius:12px;
    border:1px solid transparent;
    color:var(--txt);
    text-decoration:none;
    font-weight:900;
  }
  .sidebar a:hover{
    background: color-mix(in oklab, var(--panel2) 70%, transparent);
    border-color:var(--border);
  }
  .sidebar a.active{
    background: color-mix(in oklab, var(--accentA) 45%, transparent);
    border-color: color-mix(in oklab, var(--ok) 30%, var(--border));
  }
  .sidebar .sideHint{margin:10px 6px 2px; color:var(--muted); font-size:12px; font-weight:850}
}

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  flex-wrap:wrap; gap:10px;
  padding:9px;
  border:1px solid var(--border);
  background: color-mix(in oklab, var(--panel2) 92%, transparent);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.titleRow{display:flex; align-items:center; gap:12px; flex-wrap:wrap}
.title{font-weight:900; letter-spacing:-.5px}
.buildTag{
  padding:2px 8px; border-radius:999px;
  border:1px solid var(--border);
  background: color-mix(in oklab, var(--panel2) 92%, transparent);
  color:var(--muted);
  font-size:12px; font-weight:800;
}
.subtitle{color:var(--muted); font-size:12px}
.actions{display:flex; gap:8px; align-items:center; flex-wrap:wrap; justify-content:flex-end}

.searchWrap{position:relative; display:flex; align-items:center; gap:6px}
.searchWrap input{
  width:min(520px, 70vw);
  padding:10px 40px 10px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background: color-mix(in oklab, var(--panel) 85%, transparent);
  color:var(--txt);
  outline:none;
}
.searchWrap input:focus{border-color: color-mix(in oklab, var(--ok) 55%, var(--border))}
.iconBtn{
  border:1px solid var(--border);
  background: color-mix(in oklab, var(--panel) 85%, transparent);
  color:var(--txt);
  height:36px; min-width:36px;
  padding:0 10px;
  border-radius:12px;
  cursor:pointer;
  font-weight:900;
}
.iconBtn:hover{background: color-mix(in oklab, var(--panel2) 85%, transparent)}
#clearSearch{position:absolute; right:6px; top:50%; transform:translateY(-50%); height:28px; min-width:28px; border-radius:999px}

.pill{
  font-size:12px; font-weight:900;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background: color-mix(in oklab, var(--panel) 82%, transparent);
  color:var(--muted);
}

.panel{
  margin-top:10px;
  border:1px solid var(--border);
  border-radius:var(--radius);
  background: color-mix(in oklab, var(--panel) 65%, transparent);
  box-shadow:var(--shadow);
  padding:12px;
}
.panelHeader{display:flex; align-items:flex-start; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-bottom:10px}
.h{font-weight:900; letter-spacing:-.3px}
.meta{color:var(--muted); font-size:12px}
.panelActions{display:flex; gap:8px; align-items:center; flex-wrap:wrap; justify-content:flex-end}

.health{
  border:1px solid var(--border);
  background: color-mix(in oklab, var(--panel2) 80%, transparent);
  border-radius:999px;
  padding:5px 10px;
  font-size:12px;
  font-weight:950;
  letter-spacing:-.2px;
  color:var(--muted);
}
.health.ok{color:var(--ok)}
.health.fail{color:var(--danger)}
.health.retry{color:var(--txt)}

.miniBtn{
  border:1px solid var(--border);
  background: color-mix(in oklab, var(--panel) 85%, transparent);
  color:var(--txt);
  padding:6px 10px;
  border-radius:12px;
  cursor:pointer;
  font-weight:900;
  font-size:12px;
}
.miniBtn:hover{background: color-mix(in oklab, var(--panel2) 85%, transparent)}

.weatherTop{
  display:grid;
  grid-template-columns:1fr auto;
  gap:14px;
  align-items:center;
  padding:8px 0 12px;
}
.clock{font-weight:950; font-size:42px; letter-spacing:-1px}
.loc{color:var(--muted); font-weight:800; margin-top:4px}
.tempBig{font-weight:950; font-size:44px; letter-spacing:-1px; justify-self:end}
.tempSub{color:var(--muted); font-weight:800; justify-self:end}

.kpiGrid{display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:10px}
@media (max-width:1100px){.kpiGrid{grid-template-columns:repeat(2, minmax(0,1fr))}}
@media (max-width:520px){
  .weatherTop{grid-template-columns:1fr}
  .tempBig,.tempSub{justify-self:start}
  .kpiGrid{grid-template-columns:1fr}
}
.kpi{
  border:1px solid var(--border);
  border-radius:16px;
  background: color-mix(in oklab, var(--panel2) 75%, transparent);
  padding:10px;
  min-width:0;
}
.kpiHead{display:flex; align-items:baseline; justify-content:space-between; gap:10px}
.kpiName{font-weight:900; letter-spacing:-.2px}
.kpiVal{font-weight:950; font-size:20px; letter-spacing:-.4px}
.kpiSub{display:flex; justify-content:space-between; gap:10px; margin-top:6px; color:var(--muted); font-size:11px; font-weight:800}

.sectionTitle{margin:14px 0 8px; font-weight:950; letter-spacing:-.2px; color:color-mix(in oklab, var(--txt) 85%, var(--muted))}

.chartsStack{display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:12px}
.chartCard{
  border:1px solid var(--border);
  border-radius:16px;
  background: color-mix(in oklab, var(--panel2) 75%, transparent);
  padding:10px;
  min-width:0;
}
.chartHead{display:flex; align-items:flex-start; justify-content:space-between; gap:10px; flex-wrap:wrap}
.chartTitle{font-weight:950}
.chartInner{height:220px; margin-top:8px; overflow:hidden}
.chartCard .chartInner{height:240px}
.chartLg{height:240px; overflow:hidden}

.chartMeta{color:var(--muted); font-size:11px; font-weight:800}
.chartSvg{width:100%; height:100%; display:block; overflow:hidden;}
.chartLg{height:180px}

.mapWrap{
  border:1px solid var(--border);
  border-radius:16px;
  overflow:hidden;
  background: color-mix(in oklab, var(--panel) 88%, transparent);
  max-width:50%;
  margin:0 auto;
  display:flex;
  flex-direction:column;
  align-items:center;
}
.mapLink{display:block; aspect-ratio:1/1; width:100%; background: color-mix(in oklab, var(--panel2) 82%, transparent)}
.mapImg{width:100%; height:100%; object-fit:cover; display:block}
.mapCaption{padding:8px 10px; color:var(--muted); font-size:12px; font-weight:800; border-top:1px solid var(--border)}

.rtGrid{display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:10px}
@media (max-width:900px){.rtGrid{grid-template-columns:1fr}}
.rtCard{border:1px solid var(--border); border-radius:16px; background: color-mix(in oklab, var(--panel2) 75%, transparent); padding:12px; min-width:0; display:flex; flex-direction:column;}
.rtHead{display:flex; align-items:flex-start; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-bottom:8px}
.rtName{font-weight:950}
.rtBig{font-weight:950; font-size:18px; letter-spacing:-.3px}
.rtSub{color:var(--muted); font-size:11px; font-weight:800; margin-top:2px}
.badge{color:var(--muted); font-size:12px; font-weight:700}
.rtRows{display:flex; flex-direction:column; gap:8px; margin-top:8px}
.rtRow{display:flex; align-items:baseline; justify-content:space-between; gap:10px; padding:8px 10px; border:1px solid var(--border); border-radius:14px; background: color-mix(in oklab, var(--panel) 80%, transparent)}
.rtRow .k{color:var(--muted); font-size:11px; font-weight:900}
.rtRow .v{font-weight:900; font-size:12px; text-align:right}
.rtLink{display:inline-block; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}

.breakingList{display:flex; flex-direction:column; gap:10px}
.breakingItem{display:grid; grid-template-columns:72px minmax(0,1fr); gap:10px; align-items:start; padding:10px; border:1px solid var(--border); border-radius:16px; background: color-mix(in oklab, var(--panel2) 75%, transparent)}
.breakingThumb{width:72px; height:54px; border-radius:12px; overflow:hidden; background: color-mix(in oklab, var(--panel) 88%, transparent); border:1px solid var(--border)}
.breakingThumb img{width:100%; height:100%; object-fit:cover; display:block}
.breakingMain a{font-weight:800; line-height:1.25; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden}
.breakingMetaLine{color:var(--muted); font-size:11px; margin-top:4px; font-weight:800; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}

.feedsGrid{display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:10px}
@media (max-width:820px){.feedsGrid{grid-template-columns:1fr}}
.feedBlock{border:1px solid var(--border); border-radius:16px; background: color-mix(in oklab, var(--panel2) 75%, transparent); padding:10px; min-width:0}
.feedTitle{display:flex; align-items:flex-start; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-bottom:8px}
.feedTitle .h{font-weight:950}
.feedItems{display:flex; flex-direction:column; gap:8px; max-height:340px; overflow:auto; padding-right:2px; overscroll-behavior:contain; -webkit-overflow-scrolling:touch}
.item{display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; align-items:start; padding:8px 10px; border:1px solid var(--border); border-radius:14px; background: color-mix(in oklab, var(--panel) 80%, transparent)}
.item a{display:block; font-weight:700; font-size:13px; line-height:1.35; overflow:hidden; text-wrap:pretty; hyphens:auto; word-break:break-word; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;}
.when{color:var(--muted); font-size:11px; white-space:nowrap; text-align:right}
.skeleton{color:var(--muted); font-size:11px; padding:6px 10px}

.sportsGrid{display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:10px}
@media (max-width:1100px){.sportsGrid{grid-template-columns:repeat(2, minmax(0,1fr))}}
@media (max-width:700px){.sportsGrid{grid-template-columns:1fr}}
.sportCard{border:1px solid var(--border); border-radius:16px; background: color-mix(in oklab, var(--panel2) 75%, transparent); padding:10px; min-width:0}
.sportHead{display:flex; align-items:flex-start; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-bottom:8px}
.sportName{font-weight:950}
.pill.live{color:color-mix(in oklab, var(--ok) 90%, var(--txt)); border-color:color-mix(in oklab, var(--ok) 35%, var(--border))}
.pill.bad{color:var(--danger)}
.sportLine{display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; align-items:start; padding:8px 10px; border:1px solid var(--border); border-radius:14px; background: color-mix(in oklab, var(--panel) 80%, transparent)}
.sportLine .label{color:var(--muted); font-size:11px; font-weight:900; margin-bottom:2px}
.sportLine .val{font-weight:900; font-size:12px; line-height:1.2; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.sportLine .when{color:var(--muted); font-size:11px}
.sportDetail{margin-top:8px}

.footer{margin:14px 0 20px}

.mobileNav{display:none}
@media (max-width:980px){
  .wrap{padding-bottom:calc(120px + env(safe-area-inset-bottom, 0px))}
  .mobileNav{display:flex; position:fixed; left:10px; right:10px; bottom:calc(10px + env(safe-area-inset-bottom, 0px)); z-index:40;
    border:1px solid var(--border); border-radius:18px; background: color-mix(in oklab, var(--panel2) 92%, transparent);
    box-shadow:var(--shadow); overflow:hidden}
  .mobileNav button{flex:1; padding:10px 8px; border:0; background:transparent; color:var(--muted); font-weight:950; cursor:pointer; font-size:12px}
  .mobileNav button.active{color:var(--txt); background: color-mix(in oklab, var(--accentA) 45%, transparent)}
  body[data-view] .panel{display:none}
  body[data-view="weather"] #panelWeather,
  body[data-view="realtime"] #panelRealtime,
  body[data-view="breaking"] #panelBreaking,
  body[data-view="feeds"] #panelFeeds,
  body[data-view="sports"] #panelSports{display:block}
  body[data-view="x"] #panelXFeeds{display:block}
}


/* Weather table */
.wxTableWrap{overflow:hidden; border:1px solid var(--border); border-radius:14px; max-width:100%}
.kpiGrid > .wxTableWrap{grid-column:1/-1; width:100%}

.wxTable{width:100%; border-collapse:separate; border-spacing:0; table-layout:fixed}
.wxTable th,.wxTable td{padding:8px 8px; border-bottom:1px solid var(--border); font-size:13px; vertical-align:top; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; text-align:center}
.wxTable th{position:sticky; top:0; background: color-mix(in oklab, var(--panel) 92%, transparent); text-align:center; font-weight:950; z-index:2}
.wxTable tr:last-child td{border-bottom:none}
.wxMetric{font-weight:900; white-space:normal;}
.wxNow{font-weight:950}
.wxSmall{color:var(--muted); font-weight:800; font-size:11px}
.wxRight{text-align:right}

.mapFrameWrap{display:block; aspect-ratio:1/1; width:100%; background: color-mix(in oklab, var(--panel2) 82%, transparent)}
.mapFrame{width:100%; aspect-ratio:1/1; background: color-mix(in oklab, var(--panel2) 82%, transparent)}

/* Sports standings */
.sportCard.wide{grid-column:1 / -1}
.sportLinks{margin-top:10px; display:flex; gap:10px; flex-wrap:wrap}
.sportLinks a{color:var(--link); text-decoration:none}
.sportLinks a:hover{text-decoration:underline}

.standTableWrap{border:1px solid var(--border); border-radius:16px; overflow:auto; max-height:520px; background:var(--panel2)}
.standTable{width:100%; border-collapse:collapse; min-width:620px; font-size:13px}
.standTable thead th{position:sticky; top:0; background: color-mix(in oklab, var(--panel2) 92%, var(--bg)); z-index:2}
.standTable th, .standTable td{padding:8px 10px; border-bottom:1px solid var(--border)}
.standTable th{text-align:right; font-weight:700}
.standTable td{text-align:right}
.standTable th:first-child, .standTable td:first-child{text-align:left}
.standTable .team{text-align:left}
.standTable tr.standHl{background: color-mix(in oklab, var(--acc) 16%, transparent)}

.sportKpiRow{display:flex; gap:14px; flex-wrap:wrap; margin-top:10px}
.sportKpi{padding:10px 12px; border:1px solid var(--border); border-radius:14px; background:var(--panel2)}
.sportKpi .k{font-size:12px; color:var(--muted)}
.sportKpi .v{font-size:18px; font-weight:800}

@media (max-width: 760px){
  /* wxTable mobile: evitá scroll horizontal */
  .wxTable th:nth-child(4), .wxTable td:nth-child(4),
  .wxTable th:nth-child(5), .wxTable td:nth-child(5){display:none}

  .chartsStack{grid-template-columns:1fr}
}


@media (max-width:900px){.mapWrap{max-width:100%}}


/* X timelines */
.xGrid{display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:12px;}
@media (max-width: 900px){.xGrid{grid-template-columns:1fr;}}
.xCard{border:1px solid var(--b); border-radius:14px; padding:10px; overflow:hidden;}
.xTitle{font-weight:600; margin-bottom:8px;}
.xCard .twitter-timeline{width:100% !important;}
/* X fallback (sin X) */
.xCard.xFallback .xTitle{margin-bottom:4px;}
.xFallbackList{
  max-height: 560px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel2);
}
.xFallbackItem{
  display:flex;
  gap:12px;
  padding:10px 12px;
  border-bottom: 1px solid var(--border);
}
.xFallbackItem:last-child{border-bottom:none;}
.xFallbackLeft{
  min-width: 84px;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:2px;
}
.xFallbackMag{
  font-weight:800;
  font-size:14px;
  letter-spacing:.2px;
}
.xFallbackTime{
  font-size:12px;
  opacity:.9;
}
.xFallbackMain{flex:1; min-width:0;}
.xFallbackPlace{
  font-size:14px;
  line-height:1.25;
}
.xFallbackSub{
  font-size:12px;
  opacity:.85;
  margin-top:2px;
}


/* --- Weather extras KPI cards --- */
.wxExtras{margin-top:12px}
.kpiCard{background:var(--panel2); border:1px solid var(--border); border-radius:14px; padding:10px 12px; box-shadow:0 6px 16px rgba(0,0,0,.15)}
.kpiLabel{font-size:12px; color:var(--muted); letter-spacing:.2px}
.kpiValue{font-size:16px; font-weight:650; color:var(--txt); margin-top:4px; line-height:1.18}
.kpiSub{font-size:12px; color:var(--muted); margin-top:4px; line-height:1.25}
