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

html, body { width: 100%; height: 100%; overflow: hidden; background: #0d1117; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

#scene { position: fixed; inset: 0; display: block; }

#ui {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 300px;
}

#search { display: flex; gap: 8px; }

#username {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #30363d;
  border-radius: 6px;
  background: #161b22;
  color: #e6edf3;
  font-size: 14px;
  outline: none;
}
#username:focus { border-color: #58a6ff; }

#search button {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: #238636;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
#search button:hover { background: #2ea043; }
#search button:disabled { opacity: 0.5; cursor: not-allowed; }

#status { color: #8b949e; font-size: 13px; min-height: 16px; }
#status.error { color: #f85149; }

#info {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #161b22cc;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #e6edf3;
  font-size: 13px;
}
#avatar { width: 40px; height: 40px; border-radius: 50%; }
#info-text b { color: #58a6ff; }

#tooltip {
  position: fixed;
  z-index: 20;
  padding: 6px 10px;
  background: #161b22ee;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #e6edf3;
  font-size: 12px;
  pointer-events: none;
  white-space: nowrap;
}

.hidden { display: none !important; }

#narrator {
  position: fixed;
  left: 50%;
  bottom: 48px;
  transform: translateX(-50%);
  max-width: min(760px, 88vw);
  background: rgba(13, 17, 23, 0.86);
  border: 1px solid #30363d;
  border-left: 4px solid #d9c34a;
  border-radius: 12px;
  padding: 18px 22px;
  color: #e6edf3;
  font-size: 20px;
  line-height: 1.5;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  z-index: 30;
  text-align: center;
}
#narrator-text { min-height: 1.5em; }
#narrator-skip {
  margin-top: 12px;
  background: #21262d;
  color: #8b949e;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
}
#narrator-skip:hover { color: #e6edf3; border-color: #8b949e; }

#legend {
  padding: 10px 12px;
  background: #161b22cc;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #e6edf3;
  font-size: 12px;
  backdrop-filter: blur(4px);
}
#legend h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #8b949e; margin-bottom: 8px; font-weight: 600; }
#legend .row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
#legend .sw { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
#legend .shape { color: #8b949e; margin-left: auto; font-size: 11px; }
#legend .count { color: #6e7681; font-size: 11px; }

.credits-card {
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid #30363d;
  border-top: 3px solid #d9c34a;
  border-radius: 12px;
  padding: 16px 20px;
  text-align: center;
  color: #e6edf3;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 12px 48px rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  min-width: 220px;
  user-select: none;
}
.credits-card .c-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.credits-card .c-sub { font-size: 13px; color: #8b949e; margin-bottom: 6px; }
.credits-card .c-by { font-size: 11px; color: #6e7681; margin-bottom: 12px; }
.credits-card .c-by a { color: #58a6ff; text-decoration: none; }
.credits-card .c-by a:hover { text-decoration: underline; }
.credits-card .c-share {
  background: #238636; color: #fff; border: none; border-radius: 6px;
  padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.credits-card .c-share:hover { background: #2ea043; }

#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #161b22; border: 1px solid #30363d; border-radius: 8px;
  padding: 10px 18px; color: #e6edf3; font-size: 14px; z-index: 50;
  opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.3s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
