:root {
  --bg: #0b0b0d;
  --bg2: #121216;
  --panel: #18181c;
  --line: #3a3a42;
  --line-soft: #2d2d33;
  --text: #e8e8ea;
  --muted: #a4a4ab;
  --accent: #6f6f76;
  --accent2: #595961;
  --good: #8bc9a5;
  --warn: #d7b37d;
  --bad: #d48f97;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Space Grotesk", "IBM Plex Sans", "PingFang SC", sans-serif;
  background:
    radial-gradient(1400px 500px at 30% -5%, rgba(150, 150, 160, 0.12), transparent 70%),
    radial-gradient(900px 500px at 100% 0%, rgba(110, 110, 120, 0.1), transparent 60%),
    linear-gradient(135deg, var(--bg), var(--bg2));
  height: 100vh;
  overflow: hidden;
  line-height: 1.45;
}

.app-shell {
  width: 100%;
  height: 100vh;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.glass {
  background: var(--panel);
  border-radius: 16px;
}

.topbar {
  display: flex;
  justify-content: center;
  gap: 14px;
  align-items: center;
  padding: 12px;
}

.search-wrap {
  display: flex;
  gap: 8px;
  width: 100%;
}

input[type="url"] {
  flex: 1;
  min-width: 0;
  height: 42px;
  border-radius: 10px;
  border: none;
  background: #141418;
  color: var(--text);
  padding: 0 14px;
  font-size: 14px;
}

button,
select {
  border: none;
  background: #232329;
  color: var(--text);
  border-radius: 10px;
  height: 42px;
  padding: 0 14px;
  font-size: 14px;
}

button {
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(420px, 620px);
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.viz-stage {
  position: relative;
  overflow: hidden;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid-bg {
  position: absolute;
  inset: 0;
  opacity: 0.14;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black 50%, transparent 92%);
}

.globe-core {
  position: relative;
  margin: 0 auto;
  width: min(72vmin, 720px);
  aspect-ratio: 1;
}

.globe {
  position: absolute;
  inset: 19%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(196, 196, 204, 0.3), rgba(52, 52, 58, 0.82) 48%, rgba(16, 16, 19, 0.96)),
    repeating-radial-gradient(circle at center, rgba(170, 170, 178, 0.16) 0 1px, transparent 1px 7px);
  box-shadow: inset 0 0 56px rgba(140, 140, 148, 0.25), 0 0 20px rgba(170, 170, 176, 0.18);
}

.globe::before,
.globe::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.globe::before {
  background: repeating-linear-gradient(
    90deg,
    rgba(168, 168, 176, 0.15) 0 2px,
    transparent 2px 16px
  );
  mask-image: radial-gradient(circle at center, transparent 58%, black 59%);
}

.globe::after {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 38%, rgba(0, 0, 0, 0.3));
}

.orbit {
  position: absolute;
  inset: 10%;
  border: 1px dashed rgba(170, 170, 180, 0.34);
  border-radius: 50%;
  animation: spin 16s linear infinite;
}

.orbit-b {
  inset: 5%;
  animation-duration: 23s;
  animation-direction: reverse;
}

.pin {
  position: absolute;
  left: 53%;
  top: 45%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 0 rgba(139, 201, 165, 0.75);
  animation: pulse 1.7s infinite;
}

.entry-btn {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  height: 34px;
  min-width: 68px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: #66666d;
  color: #f2f2f4;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.entry-btn:hover {
  background: #74747c;
  transform: translate(-50%, -50%) scale(1.03);
}

.entry-btn.active {
  background: #2f9e62;
  color: #ffffff;
}

.info-drawer {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px;
  overflow: hidden;
  transition: width 0.24s ease, opacity 0.24s ease, padding 0.24s ease;
}

.info-drawer.closed {
  width: 0;
  min-width: 0;
  padding: 0;
  opacity: 0;
  border-width: 0;
  pointer-events: none;
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: none;
}

.drawer-head strong {
  font-size: 17px;
}

.drawer-head button {
  height: 32px;
  font-size: 12px;
}

.drawer-panel {
  display: none;
  overflow: auto;
  padding-right: 4px;
  margin-top: 12px;
  flex: 1;
  min-height: 0;
}

.drawer-panel::-webkit-scrollbar {
  width: 8px;
}

.drawer-panel::-webkit-scrollbar-track {
  background: transparent;
}

.drawer-panel::-webkit-scrollbar-thumb {
  background: #3a3a42;
  border-radius: 999px;
}

.drawer-panel.active {
  display: block;
}

.sub-card {
  margin-top: 14px;
  border-top: none;
  padding-top: 12px;
}

.sub-card h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.01em;
}

.hint,
.inline-label,
.meta,
.resource-meta,
.image-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.inline-label {
  margin: 0;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.grid,
.overview-grid,
.image-list,
.resource-list,
.findings,
.seo-grid {
  margin-top: 8px;
  display: grid;
  gap: 10px;
}

.grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.overview-grid {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.image-list {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.stat-card,
.icon-card,
.image-item,
.resource-item,
.finding-item,
.seo-item {
  border: none;
  border-radius: 12px;
  background: #1d1d22;
  padding: 10px;
}

.stat-label {
  color: var(--muted);
  font-size: 11px;
}

.stat-value {
  display: block;
  margin-top: 4px;
  font-size: 17px;
  font-weight: 700;
}

.stat-value-sm {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.35;
}

.severity-high {
  border-left: 3px solid var(--bad);
}

.severity-medium {
  border-left: 3px solid var(--warn);
}

.severity-low {
  border-left: 3px solid var(--good);
}

.icon-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.icon-preview {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 6px;
  border: none;
  background: #131317;
}

.image-item {
  position: relative;
  overflow: hidden;
}

.image-item img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
  border: none;
}

.download-overlay {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 8px;
  height: 104px;
  border-radius: 8px;
  background: rgba(8, 8, 11, 0.52);
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease;
}

.image-item:hover .download-overlay {
  opacity: 1;
}

.download-btn {
  height: auto;
  padding: 6px 10px;
  background: #e6e6eb;
  color: #1a1a1f;
  border-radius: 8px;
  text-decoration: none;
  border: none;
  font-size: 12px;
  font-weight: 700;
}

.image-link,
.resource-url {
  display: block;
  margin-top: 6px;
  word-break: break-all;
  font-size: 12px;
  color: #d7d7de;
  text-decoration: none;
}

.seo-item strong {
  display: inline-block;
  min-width: 106px;
  color: #f0f0f2;
}

.muted {
  color: var(--muted);
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(139, 201, 165, 0.8);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(139, 201, 165, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(139, 201, 165, 0);
  }
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .info-drawer {
    max-height: 58vh;
  }
}

@media (max-width: 740px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-wrap {
    width: 100%;
    flex-direction: column;
  }

  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .globe-core {
    width: min(92vw, 560px);
  }

  .download-overlay {
    opacity: 1;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 6px;
    background: linear-gradient(180deg, rgba(1, 8, 16, 0.56), rgba(1, 8, 16, 0));
  }
}
