:root {
  --bg: #0b1220;
  --bg-grad-a: #0b1220;
  --bg-grad-b: #101a31;
  --panel: #121b2e;
  --panel-soft: #1a2540;
  --panel-soft-2: #202e4d;
  --text: #e7edf7;
  --muted: #9aa7bf;
  --accent: #53c8ff;
  --accent-2: #7b9cff;
  --border: #2b3a59;
  --shadow: 0 10px 28px rgba(2, 8, 20, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(155deg, var(--bg-grad-a) 0%, var(--bg-grad-b) 100%);
  color: var(--text);
}

.app {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

.controls {
  padding: 1rem;
  border-right: 1px solid var(--border);
  background: var(--panel);
  font-size: 0.94rem;
  max-height: 100vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

h1 {
  margin: 0;
  font-size: 1.14rem;
  letter-spacing: 0.2px;
}

.subtitle {
  margin: 0.3rem 0 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.panel-header {
  position: sticky;
  top: -1rem;
  margin: -1rem -1rem 0.85rem -1rem;
  padding: 1rem 1rem 0.75rem 1rem;
  background: linear-gradient(to bottom, rgba(18, 27, 46, 0.98), rgba(18, 27, 46, 0.88));
  border-bottom: 1px solid var(--border);
  z-index: 3;
}

#guideModeBtn {
  margin-top: 0.55rem;
  width: 100%;
  font-size: 0.86rem;
}

.control-group {
  margin-top: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  padding: 0.62rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(32, 46, 77, 0.32);
}

label {
  color: var(--muted);
  font-size: 0.84rem;
  letter-spacing: 0.2px;
}

input,
select,
button {
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  border-radius: 8px;
  padding: 0.46rem 0.56rem;
  font-size: 0.92rem;
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

button {
  cursor: pointer;
  background: linear-gradient(180deg, #2b3f66, #233553);
  border-color: #34527f;
  font-weight: 500;
}

button:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(83, 200, 255, 0.18);
}

input:focus,
select:focus,
button:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(83, 200, 255, 0.18);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.42rem;
  border: 1px dashed rgba(83, 200, 255, 0.18);
  border-radius: 8px;
  padding: 0.42rem;
  background: rgba(26, 37, 64, 0.35);
}

.stats {
  margin-top: 0.85rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(26, 37, 64, 0.58);
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.88rem;
}

.legend {
  margin-top: 0.85rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(26, 37, 64, 0.58);
}

.legend h3 {
  margin: 0 0 0.55rem 0;
  font-size: 0.95rem;
  color: #cdd8ec;
  letter-spacing: 0.25px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0;
  font-size: 0.87rem;
  color: var(--muted);
}

.swatch {
  width: 18px;
  height: 4px;
  border-radius: 3px;
  display: inline-block;
}

.swatch-work {
  background: #00e676;
}

.swatch-inspiration {
  background: repeating-linear-gradient(
    to right,
    #ffd166 0 6px,
    transparent 6px 10px
  );
}

.swatch-uncertain {
  background: repeating-linear-gradient(
    to right,
    #ff4d6d 0 2px,
    transparent 2px 5px
  );
}

.graph-and-details {
  display: grid;
  grid-template-columns: 1fr 340px;
  min-width: 0;
}

#cy {
  width: 100%;
  height: 100vh;
}

.details {
  border-left: 1px solid var(--border);
  padding: 1rem;
  background: var(--panel);
  font-size: 0.94rem;
  max-height: 100vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.details h2 {
  margin-top: 0;
  font-size: 0.95rem;
  letter-spacing: 0.28px;
  text-transform: uppercase;
  color: #c9d5ea;
}

.section-title {
  margin: 0 0 0.45rem 0;
}

.detail-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(32, 46, 77, 0.45);
  padding: 0.9rem;
  font-size: 0.92rem;
  line-height: 1.45;
}

.detail-card .name {
  font-size: 1.02rem;
  margin-bottom: 0.5rem;
}

.detail-card .item {
  margin: 0.3rem 0;
}

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

.analytics-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(32, 46, 77, 0.42);
  padding: 0.75rem;
  margin-bottom: 0.85rem;
}

.analytics-panel h2 {
  margin: 0 0 0.35rem 0;
}

.advanced-edge-panel {
  margin-top: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  background: rgba(15, 23, 42, 0.35);
}

.advanced-edge-panel summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.86rem;
  user-select: none;
}

.advanced-edge-panel[open] summary {
  margin-bottom: 0.4rem;
}

.sweep-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
}

.controls::-webkit-scrollbar,
.details::-webkit-scrollbar {
  width: 9px;
}

.controls::-webkit-scrollbar-track,
.details::-webkit-scrollbar-track {
  background: rgba(17, 27, 46, 0.65);
}

.controls::-webkit-scrollbar-thumb,
.details::-webkit-scrollbar-thumb {
  background: rgba(83, 200, 255, 0.28);
  border-radius: 10px;
  border: 2px solid rgba(17, 27, 46, 0.65);
}

.title-with-icon,
.label-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.icon-badge {
  width: 1.1rem;
  height: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(83, 200, 255, 0.14);
  border: 1px solid rgba(83, 200, 255, 0.32);
  color: #9fdcff;
  font-size: 0.72rem;
  line-height: 1;
}

.icon-badge.small {
  width: 0.95rem;
  height: 0.95rem;
  font-size: 0.62rem;
}

.guide-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 20, 0.45);
  z-index: 5000;
  pointer-events: none;
}

.guide-target {
  position: relative;
  z-index: 5002 !important;
  outline: 3px solid rgba(83, 200, 255, 0.95);
  box-shadow: 0 0 0 6px rgba(83, 200, 255, 0.2);
  border-radius: 8px;
}

.guide-pointer {
  position: fixed;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f8fafc;
  border: 2px solid #111827;
  box-shadow: 0 0 0 6px rgba(248, 250, 252, 0.2);
  z-index: 5003;
  transition: left 320ms ease, top 320ms ease;
  pointer-events: none;
}

.guide-tooltip {
  position: fixed;
  max-width: 360px;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 10px;
  padding: 0.75rem;
  z-index: 5004;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
}

.guide-tooltip-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.guide-tooltip-text {
  font-size: 0.86rem;
  line-height: 1.4;
}

.guide-tooltip-controls {
  margin-top: 0.65rem;
  display: flex;
  gap: 0.45rem;
  justify-content: flex-end;
}

.guide-tooltip-controls button {
  font-size: 0.78rem;
  padding: 0.35rem 0.5rem;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

@media (max-width: 1300px) {
  .graph-and-details {
    grid-template-columns: 1fr;
  }

  .details {
    border-left: none;
    border-top: 1px solid var(--border);
  }

  #cy {
    height: 70vh;
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .controls {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

.unlock-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(155deg, var(--bg-grad-a) 0%, var(--bg-grad-b) 100%);
}

.unlock-overlay[hidden] {
  display: none;
}

.unlock-card {
  width: min(460px, 100%);
  padding: 1.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.unlock-card form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.unlock-status {
  min-height: 1.2em;
  color: var(--accent);
}
