:root{
  --bg:#0b0f19;
  --panel:#111827;
  --panel2:#0f172a;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --line:#24324d;
  --accent:#60a5fa;
  --good:#34d399;
  --warn:#fbbf24;
  --bad:#fb7185;
  --chip:#1f2a44;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Noto Sans KR", Arial, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: var(--sans);
  background: radial-gradient(1200px 700px at 20% -10%, rgba(96,165,250,.18), transparent 55%),
              radial-gradient(900px 600px at 80% 0%, rgba(52,211,153,.14), transparent 60%),
              var(--bg);
  color:var(--text);
}

.wrap{width:min(1200px, calc(100% - 32px)); margin:0 auto;}

.topbar{
  position: sticky;
  top:0;
  z-index:50;
  backdrop-filter: blur(10px);
  background: rgba(11,15,25,.72);
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.brand{display:flex; gap:14px; align-items:flex-start; padding:18px 0 10px;}
.brand h1{font-size:20px; margin:0; letter-spacing:-.2px;}
.subtitle{margin:4px 0 0; color:var(--muted); font-size:13px;}
.dot{width:14px; height:14px; border-radius:999px; margin-top:5px;
  background: linear-gradient(135deg, var(--accent), var(--good));
  box-shadow: 0 0 0 6px rgba(96,165,250,.12);
}

.controls{display:grid; grid-template-columns: 1fr; gap:10px; padding: 0 0 16px;}
.search input{
  width:100%; padding: 12px 12px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(17,24,39,.75);
  color: var(--text);
  outline: none;
}
.search input:focus{border-color: rgba(96,165,250,.55); box-shadow: 0 0 0 4px rgba(96,165,250,.12);}

.chips{display:flex; align-items:center; gap:10px; flex-wrap:nowrap; overflow:visible}

.companyBar{display:flex; align-items:center; gap:8px; flex-wrap:nowrap; overflow:hidden}
.companyBarInner{display:flex; align-items:center; gap:8px; flex-wrap:nowrap; overflow:auto; max-width: 100%; padding-bottom: 2px;}

.cbtn{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(31,42,68,.55);
  color: rgba(229,231,235,.92);
  cursor: pointer;
  user-select:none;
  white-space: nowrap;
}
.cbtn:hover{border-color: rgba(255,255,255,.20)}
.cbtn[aria-pressed="true"]{border-color: rgba(96,165,250,.55); background: rgba(96,165,250,.12);}

.cbtn.icon{
  width: 34px;
  height: 34px;
  padding: 0;
  display:flex;
  align-items:center;
  justify-content:center;
}
.cbtn.icon img{width: 18px; height: 18px; object-fit: contain;}

.hint{display:flex; gap:10px; align-items:center; justify-content:space-between; flex-wrap:wrap;}
.pill{font-size:11px; font-family: var(--mono); padding:3px 8px; border-radius: 999px; border:1px solid rgba(255,255,255,.10); background: rgba(255,255,255,.06)}
.muted{color: var(--muted); font-size: 12px;}
.mono{font-family: var(--mono);}

.zoomCtl{display:flex; gap:10px; align-items:center;}
.zoom{width: 160px; accent-color: rgba(96,165,250,.9)}
.fitBtn{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor: pointer;
}
.fitBtn:hover{border-color: rgba(255,255,255,.20)}

.stage{
  margin: 18px 0 20px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(17,24,39,.92), rgba(15,23,42,.86));
  box-shadow: var(--shadow);
  overflow: auto;
}

/* horizontal scroll canvas */
.stageInner{
  position: relative;
  width: 100%;
  min-width: 1800px; /* controlled by JS zoom */
  height: 620px;
  padding: 18px 16px;
}

.axis{position:absolute; left:0; right:0; top:50%; transform: translateY(-50%); padding: 0 16px;}
.axisLine{height:2px; background: linear-gradient(90deg, rgba(96,165,250,.4), rgba(36,50,77,.2));}

.ticks{position:relative; height:0;}
.tick{
  position:absolute;
  top: -10px;
  width:1px;
  height: 20px;
  background: rgba(255,255,255,.10);
}
.tickLabel{
  position:absolute;
  top: 12px;
  transform: translateX(-50%);
  font-size: 11px;
  font-family: var(--mono);
  color: rgba(229,231,235,.72);
  white-space: nowrap;
}

.events{position:absolute; inset:0; padding: 18px 16px;}

.evt{
  --h: 210; /* per-card hue (JS overrides) */
  --s: 92%; /* per-card saturation (JS overrides). Lower = closer to white/gray */
  position:absolute;
  width: auto;
  min-width: 170px;
  max-width: 360px;
  overflow: hidden; /* lets the top color bar follow rounded corners */

  /* softer gradient, still clearly distinct by hue */
  border: 1px solid hsla(var(--h), var(--s), 72%, .30);
  background:
    linear-gradient(180deg,
      hsla(var(--h), var(--s), 70%, .14),
      hsla(var(--h), var(--s), 70%, .06)
    );

  border-radius: 14px;
  padding: 10px;
  box-shadow:
    0 14px 34px rgba(0,0,0,.42),
    0 0 18px hsla(var(--h), var(--s), 60%, .10);
}

.evt.open{z-index: 5;}

/* When expanded, make the card fully opaque so underlying content doesn't show through */
.evt.open{
  background: linear-gradient(180deg,
    hsl(var(--h) var(--s) 16%),
    hsl(var(--h) var(--s) 12%)
  );
  border-color: hsla(var(--h), var(--s), 72%, .55);
  box-shadow:
    0 18px 44px rgba(0,0,0,.55),
    0 0 22px hsla(var(--h), var(--s), 60%, .14);
}

/* dot on axis */
.evt::before{
  content:"";
  position:absolute;
  left: 14px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: hsl(var(--h) var(--s) 74%);
  box-shadow: 0 0 0 5px hsla(var(--h), var(--s), 74%, .18);
}

/* speech-bubble pointer */
.evt::after{
  content:"";
  position:absolute;
  left: 24px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
}
.evt.up::after{
  bottom: -10px;
  border-top: 10px solid hsla(var(--h), var(--s), 70%, .12);
}
.evt.down::after{
  top: -10px;
  border-bottom: 10px solid hsla(var(--h), var(--s), 70%, .12);
}

/* connector line to axis */
.evt.up::before{bottom: -18px;}
.evt.down::before{top: -18px;}
.evtLine{
  position:absolute;
  left: 18.5px;
  width: 1px;
  background: hsla(var(--h), var(--s), 70%, .22);
}

.evt.up .evtLine{bottom: -18px; height: 18px;}
.evt.down .evtLine{top: -18px; height: 18px;}

.evtMain{display:flex; gap:8px; align-items:center; position:relative;}

/* (1) thin top bar per company for faster comparisons */
.evtMain::before{
  content:"";
  position:absolute;
  left: -10px;
  right: -10px;
  top: -10px;
  height: 3px;
  background: linear-gradient(90deg,
    hsla(var(--h), var(--s), 74%, .92),
    hsla(var(--h), var(--s), 74%, .22)
  );
}
.logo{
  width: 18px;
  height: 18px;
  object-fit: contain;
  display:block;
  flex: 0 0 auto;
}
.evtTitle{
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.1px;
  line-height: 1.2;
  flex: 1 1 auto;
  min-width: 0;
}

.evtToggle{
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  color: rgba(229,231,235,.85);
  cursor: pointer;
}
.evtToggle:hover{border-color: rgba(255,255,255,.20)}

.evtMore{margin-top: 8px;}
.evtDesc{font-size: 11px; color: rgba(229,231,235,.72); line-height: 1.35;}
.evtMeta{margin-top: 8px; color: var(--muted); font-size: 11px; font-family: var(--mono); display:flex; align-items:center; gap:8px;}
.evtRef{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  height: 18px;
  line-height: 1;
  font-size: 12px;
  font-family: var(--mono);
  color: rgba(156,163,175,.95);
  text-decoration:none;
  border: none;
  background: transparent;
  opacity: .85;
  padding: 0 2px;
}
.evtRef:hover{color: rgba(96,165,250,.95); opacity: 1}

/* Company accent stripes */
.evt[data-company="OpenAI"]{border-color: rgba(96,165,250,.22)}
.evt[data-company="Anthropic"]{border-color: rgba(52,211,153,.22)}
.evt[data-company="Google"]{border-color: rgba(251,191,36,.20)}
.evt[data-company="Meta"]{border-color: rgba(59,130,246,.18)}
.evt[data-company="xAI"]{border-color: rgba(251,113,133,.22)}
.evt[data-company="DeepSeek"]{border-color: rgba(148,163,184,.22)}
.evt[data-company="Alibaba"]{border-color: rgba(251,146,60,.22)}

/* keyword highlight inside title (optional future) */

.footer{margin: 0 0 40px; color: var(--muted); font-size: 12px; line-height: 1.6;}
.sr{position:absolute; left:-9999px}

@media (min-width: 900px){
  .controls{grid-template-columns: 1fr auto; grid-template-areas: "search hint" "chips hint"; align-items:start;}
  .search{grid-area: search}
  .chips{grid-area: chips}
  .hint{grid-area: hint; justify-content:flex-end}
}

@media (max-width: 900px){
  /* keep filter/zoom in one line as much as possible */
  .hint{gap:12px;}
}

@media (max-width: 720px){
  .stageInner{height: 700px; min-width: 1400px;}
  .evt{width: 230px;}
}
