html {
  width: 100%;
}

header {
  text-align: center;
  width: 100%;
  padding: 5px 0;  
  box-sizing: border-box;
  position: absolute;  
  top: 0;  
  left: 0;  
  right: 0;  
  max-height: auto;  
  display: flex;
  flex-direction: column;
  align-items: flex-start;  
  background-color: rgba(255, 255, 255, 0.5) !important;
  border-radius: 6px;
}

header h1 {
  font-size: 2rem;
  font-weight: bold;
  color: #333;
  margin: 0px;
  text-align: left;
  margin-left: 110px;
  flex-grow: 1;
}

header h2 {
  font-size: 1rem;
  font-weight: bold;
  color: #333;
  text-align: left;
  margin-left: 110px;
  margin-top: 5px;
  margin-bottom: 0px;
  flex-grow: 1;
}

.custom-button {
  font-size: 16px;
  text-decoration: none;
  background-color: #075E6F;
  color: white;
  padding: 5px 10px;
  border-radius: 5px;
  position: absolute;
  left: 20px; 
  top: 50%;
  transform: translateY(-50%);
}

.custom-button:hover {
  background-color: #065565;
}

body {
  height: 100vh;
  width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  font-family: sans-serif;
  font-size: 75%;
  overflow: hidden;
  flex-direction: row;
}

#graph-container {
  flex-grow: 1;
  display: flex;
  justify-content: center; 
  align-items: center; 
  height: 100vh;
  justify-content: center;
}

svg {
  flex-basis: 100%;
}

#graph-svg {
  flex-grow: 1;
  transition: flex-basis 0.3s ease;
  width: 100%;
  height: 100%;
  margin: 0 auto;
}

body.panel-open #graph-svg {
  flex-basis: 65%;
}

.nodes circle {
  pointer-events: all;
}

#info-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 35%;
  height: 100vh;      
  padding: 10px;
  box-shadow: -2px 0 5px rgba(0,0,0,0.1);
  overflow-y: auto;
  display: none;
  background-color:#F5F5F5;
  border-radius: 6px 0 0 6px;
  flex-shrink: 0;
}

body.panel-open #info-panel {
  display: block !important;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  font-size: 12px;
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.close-btn:hover {
  background: #a71d2a;
}

.toggle-fans-btn {
  background: none;
  border: none;
  color: #0077cc;
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.9em;
}

#controls-wrapper {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: row;
  align-items: stretch; 
  gap: 16px;
  z-index: 1000;
}

#search-bar {
  display: flex;
  flex-direction: row;
  gap: 8px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ccc;
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

#search-box {
  border-radius: 6px;
}

#zoom-controls {
  display: flex;
  flex-direction: row;
  gap: 8px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ccc;
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.zoom-btn {
  width: 40px;
  height: 40px;
  font-size: 20px;
  background: #075E6F;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.zoom-btn:hover {
  background: #065565;
}

#color-legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr); 
  gap: 8px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ccc;
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  align-content: center; 
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85em;
  background: rgba(255, 255, 255, 0.9);
  border-color: silver;
  border-radius: 5px;
  box-shadow: none;
  border: none;
}

.legend-item.active {
  background: rgba(0, 0, 0, 0.15);
}

.legend-item:hover {
  background: rgba(0, 0, 0, 0.15);
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid #999;
}

#toggle-labels {
  display: grid;
  gap: 8px;
  background: #075E6F;
  border: 1px solid #ccc;
  padding: 10px 12px;
  border-radius: 6px;
  height: 40px;
  color:#ffffff;
  transition: all 0.3s ease;
  align-content: center;
}

#toggle-labels:hover {
  background: #065565;
}

#node-header {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #ccc;
  padding: 15px;
  border-radius: 6px;
  box-shadow:  0 2px 8px rgba(0, 0, 0, 0.15);
}

#node-header h2 {
  margin: 0 0 5px 0;
  font-size: 1.7em;
  color: #333;
}

#node-header p {
  margin: 0 0 15px 0;
  font-weight: bold;
  color: darkslategray;
  font-size: 1.3em;
}

#game-title-container {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  height: auto;
  max-height:8em;
  gap:5px;
  margin-bottom: 5px;
}

#game-title-rank {
  flex-basis: 70%;
  height:100%;
}

#game-title-rank h2 {
  margin: 0 0 5px 0;
  font-size: 1.7em;
  color: #333;
}

#game-image {
  flex-basis: 30%;
  height:100%;
  position: relative;
}

#game-image img {
  height: 100%;
  max-height: 7em;
  border-radius: 6px;
  margin-right:5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  float: right;
}

.info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 1.1em;
}

.info-label {
  font-weight: 600;
  max-width: 25%;
  color: #444;
}

.info-value {
  color: darkslategray;
  max-width: 70%;
  text-align: right;
}

span.chart-info {
  text-align: center;
  font-weight: bold;
}

#chart-selector {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  background: #ffffff;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  gap: 8px;
  flex-wrap: wrap;
}

#chart-content {
  margin-top: 10px;
  width: 100%;
}

.chart-btn {
  flex: 1 0 15%;
  min-width: 15px;
  max-width: 100%;
  min-height: 40px;
  padding: 8px 8px;
  font-size: 0.85rem;
  background: #075E6F;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.chart-btn:hover {
  background: #065565;
}

.chart-btn.active {
  background: #065565;
  font-weight: bold;
  box-shadow: 0 0 5px rgba(0,0,0,0.3);
}

@media (max-width: 768px) {
  body {
      flex-direction: column; 
  }
  #info-panel {
      position: relative;
      width: 100%;
      height: auto;
  }
  #graph-container {
      height: 80vh; 
  }
  #chart-selector {
    display: grid;
    flex-wrap: wrap;
    grid-template-columns: repeat(3, 1fr); 
  }
}