* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: -apple-system, "Microsoft YaHei", "PingFang SC", "Helvetica Neue", sans-serif;
  background: #0d1117;
  color: #c9d1d9;
  min-height: 100vh;
}

/* ===== Top Info Bar ===== */
#info-bar {
  position: fixed; top:0; left:0; right:0; z-index:2000;
  background: linear-gradient(135deg,#161b22,#0d1117);
  border-bottom: 2px solid #58a6ff;
  padding: 8px 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  box-shadow: 0 2px 16px rgba(88,166,255,.15);
  min-height: 44px;
}
#info-bar .l { color:#58a6ff; font-size:11px; font-weight:600; letter-spacing:.5px; }
#info-bar .v { color:#f0f6fc; font-size:13px; font-weight:500; }
.grp { display:flex; align-items:center; gap:4px; }
.sep { color:#30363d; font-size:14px; }

/* ===== Welcome ===== */
#welcome { display:none; margin:100px auto; max-width:600px; text-align:center; padding:40px; }
#welcome .icon { font-size:56px; margin-bottom:16px; }
#welcome h2 { color:#f0f6fc; margin-bottom:12px; font-size:20px; }
#welcome p { color:#8b949e; font-size:14px; line-height:1.7; }
#welcome code { background:#161b22; color:#58a6ff; padding:2px 8px; border-radius:4px; font-size:13px; }

/* ===== Loading ===== */
#loading { display:flex; justify-content:center; align-items:center; height:200px; color:#8b949e; font-size:15px; margin-top:70px; }
.spinner { width:32px; height:32px; border:3px solid #21262d; border-top:3px solid #58a6ff; border-radius:50%; animation:spin .7s linear infinite; margin-right:12px; }
@keyframes spin { to { transform:rotate(360deg); } }

/* ===== Error ===== */
#error-container { display:none; margin:80px auto 20px; max-width:700px; background:#1c1010; border:1px solid #da3633; border-radius:8px; padding:20px 28px; }
#error-container h3 { color:#f85149; margin-bottom:10px; font-size:16px; }
#error-container p { color:#c9d1d9; line-height:1.6; font-size:13px; white-space:pre-wrap; word-break:break-all; }

/* ===== Main Layout ===== */
#main-layout { display:none; margin-top:52px; }
.layout-row { display:flex; gap:0; min-height:calc(100vh - 52px); }

/* ===== Evidence Panel (Left) ===== */
#evidence-panel {
  width:360px; min-width:360px;
  background:#161b22;
  border-right:1px solid #21262d;
  overflow-y:auto;
  padding:16px;
}
#evidence-panel::-webkit-scrollbar { width:6px; }
#evidence-panel::-webkit-scrollbar-track { background:#0d1117; }
#evidence-panel::-webkit-scrollbar-thumb { background:#30363d; border-radius:3px; }

.panel-section { margin-bottom:14px; }
.panel-section-title {
  font-size:11px; font-weight:600; color:#58a6ff;
  text-transform:uppercase; letter-spacing:.8px;
  margin-bottom:6px; padding-bottom:4px;
  border-bottom:1px solid #21262d;
}

.ev-row { display:flex; padding:3px 0; }
.ev-label {
  width:100px; min-width:100px;
  font-size:12px; color:#8b949e;
  flex-shrink:0;
}
.ev-value {
  font-size:12.5px; color:#f0f6fc;
  word-break:break-word; line-height:1.5;
}
.ev-value.highlight-badge { color:#d2a8ff; }
.ev-value.warning-badge { color:#f0883e; }

/* Evidence Type Badge */
.type-badge {
  display:inline-block; padding:1px 8px; border-radius:3px;
  font-size:11px; font-weight:500;
}
.type-badge.metadata { background:#0d419d; color:#58a6ff; }
.type-badge.direct { background:#1a4a1a; color:#3fb950; }
.type-badge.calculated { background:#4a1a1a; color:#f85149; }

/* Confidence */
.conf-bar {
  display:inline-block; height:6px; border-radius:3px;
  vertical-align:middle; margin-right:4px;
}
.conf-bar.high { width:48px; background:#3fb950; }
.conf-bar.medium { width:32px; background:#d29922; }
.conf-bar.low { width:16px; background:#f85149; }

/* Review Badge */
.review-badge {
  display:inline-block; padding:1px 8px; border-radius:3px;
  font-size:11px; font-weight:500;
}
.review-badge.no { background:#1a4a1a; color:#3fb950; }
.review-badge.yes { background:#4a1a1a; color:#f85149; animation:pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

/* Quote Box */
.quote-box {
  background:#0d1117; border-left:3px solid #58a6ff;
  padding:8px 10px; border-radius:0 4px 4px 0;
  font-size:12px; line-height:1.6; color:#c9d1d9;
  font-style:italic; margin-top:2px;
}

/* Calculation Box */
.calc-box {
  background:#0d1117; border-left:3px solid #d29922;
  padding:8px 10px; border-radius:0 4px 4px 0;
  font-size:12px; line-height:1.5; color:#e6c384;
  font-family:"SF Mono","Menlo","Consolas",monospace;
  margin-top:2px; white-space:pre-wrap;
}

/* Note */
.note-text { color:#f0883e; font-size:12px; line-height:1.5; }

/* Diagnostic Panel */
.diag-box {
  background:#0d1117; border:1px solid #30363d; border-radius:4px;
  padding:6px 8px; font-size:11px; line-height:1.5;
  font-family:"SF Mono","Menlo","Consolas",monospace;
  margin-top:2px;
}
.diag-title { color:#58a6ff; font-weight:600; margin-bottom:4px; }
.diag-table { width:100%; border-collapse:collapse; }
.diag-table td { padding:1px 4px; color:#c9d1d9; vertical-align:top; }
.diag-table td:first-child { color:#8b949e; width:45%; white-space:nowrap; }

.coord-error-msg {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 50; background: #4a1a1a; color: #f85149;
  padding: 12px 20px; border-radius: 6px; font-size: 14px;
  border: 1px solid #da3633; white-space:nowrap;
}

/* ===== PDF Container (Right) ===== */
#pdf-side {
  flex:1; display:flex; flex-direction:column;
  background:#0d1117;
  overflow:hidden;
}
#pdf-container {
  flex:1; overflow:auto; position:relative;
  padding:16px; display:flex; justify-content:center;
}
#pdf-wrapper {
  position:relative; display:inline-block;
  border:1px solid #21262d; border-radius:6px;
  background:#fff; overflow:hidden; box-shadow:0 4px 24px rgba(0,0,0,.4);
}
.pdf-page-container {
  position: relative;
}
.pdf-canvas { display:block; }
.highlight-layer {
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 20;
}
.evidence-highlight {
  position: absolute;
  border: 3px solid #f85149;
  background: rgba(248,81,73,.15);
  box-sizing: border-box;
  z-index: 30;
  animation: flashHL 1s ease-in-out 3;
}
@keyframes flashHL { 0%,100%{opacity:1} 50%{opacity:.3} }

#pdf-page-label {
  text-align:center; padding:8px 16px;
  color:#8b949e; font-size:13px;
  border-bottom:1px solid #21262d;
  background:#161b22; flex-shrink:0;
}
#pdf-error { display:none; padding:20px; text-align:center; color:#f85149; font-size:14px; }

/* ===== Responsive: mobile ===== */
@media (max-width:820px) {
  .layout-row { flex-direction:column; }
  #evidence-panel { width:100%; min-width:0; max-height:50vh; border-right:none; border-bottom:1px solid #21262d; }
  #info-bar .v { font-size:11px; }
  #info-bar { padding:6px 10px; gap:4px 8px; }
  .grp .l { font-size:10px; }
}
