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

html, body {
  width: 100vw; height: 100vh;
  overflow: hidden;
  background: #1a1a2e;
  color: #e0e0e0;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  padding: 1.2vh 1.5vw;
  gap: 1vh;
}

header {
  text-align: center;
  flex-shrink: 0;
}

header h1 {
  font-size: clamp(0.9rem, 2vw, 1.5rem);
  color: #e6c44a;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

header .subtitle {
  font-size: clamp(0.6rem, 1.1vw, 0.85rem);
  color: #8a8aaf;
  margin-top: 0.3vh;
  font-style: italic;
}

.main-area {
  flex: 1;
  display: flex;
  gap: 1.2vw;
  min-height: 0;
}

.left-panel {
  flex: 0 0 28%;
  display: flex;
  flex-direction: column;
  gap: 1vh;
  min-height: 0;
}

.energy-diagram {
  background: #16213e;
  border: 1px solid #2a2a5a;
  border-radius: 0.6rem;
  padding: 1.2vh 1vw;
  flex: 0 0 auto;
}

.energy-diagram h2 {
  font-size: clamp(0.65rem, 1vw, 0.85rem);
  color: #e6c44a;
  margin-bottom: 0.8vh;
  text-align: center;
}

.energy-flow {
  display: flex;
  flex-direction: column;
  gap: 0.5vh;
}

.energy-node {
  display: flex;
  align-items: center;
  gap: 0.5vw;
  padding: 0.5vh 0.6vw;
  border-radius: 0.3rem;
  font-size: clamp(0.55rem, 0.85vw, 0.75rem);
  transition: all 0.3s ease;
  cursor: pointer;
}

.energy-node:hover {
  transform: translateX(3px);
}

.energy-node .icon { font-size: clamp(0.8rem, 1.3vw, 1.1rem); }

.node-rage { background: #3d1111; border-left: 3px solid #e74c3c; }
.node-brake { background: #3d2e11; border-left: 3px solid #f39c12; }
.node-heat { background: #3d3511; border-left: 3px solid #e6c44a; }
.node-air { background: #113d2e; border-left: 3px solid #2ecc71; }
.node-fish { background: #11293d; border-left: 3px solid #3498db; }
.node-fowl { background: #2d113d; border-left: 3px solid #9b59b6; }

.arrow {
  text-align: center;
  color: #4a4a7a;
  font-size: 0.7rem;
  line-height: 1;
}

.info-panel {
  background: #16213e;
  border: 1px solid #2a2a5a;
  border-radius: 0.6rem;
  padding: 1.2vh 1vw;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.info-panel h2 {
  font-size: clamp(0.65rem, 1vw, 0.85rem);
  color: #e6c44a;
  margin-bottom: 0.8vh;
}

.info-panel p {
  font-size: clamp(0.55rem, 0.8vw, 0.72rem);
  line-height: 1.5;
  color: #b0b0d0;
  margin-bottom: 0.6vh;
}

.info-panel .highlight {
  color: #e6c44a;
  font-weight: 600;
}

.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1vh;
  min-height: 0;
}

.chart-controls {
  display: flex;
  gap: 0.5vw;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.chart-btn {
  padding: 0.5vh 1vw;
  background: #16213e;
  border: 1px solid #2a2a5a;
  border-radius: 0.3rem;
  color: #b0b0d0;
  font-size: clamp(0.55rem, 0.8vw, 0.72rem);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chart-btn:hover { background: #1f2f5e; color: #e0e0e0; }
.chart-btn.active { background: #2a3f7e; color: #e6c44a; border-color: #e6c44a; }

.chart-area {
  flex: 1;
  background: #16213e;
  border: 1px solid #2a2a5a;
  border-radius: 0.6rem;
  padding: 1.5vh 1.2vw;
  min-height: 0;
  position: relative;
}

.chart-title {
  text-align: center;
  font-size: clamp(0.6rem, 0.95vw, 0.82rem);
  color: #e6c44a;
  margin-bottom: 1vh;
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: calc(100% - 3vh);
}

canvas#mainChart {
  width: 100% !important;
  height: 100% !important;
}

.tooltip {
  position: absolute;
  background: #0d1117;
  border: 1px solid #e6c44a;
  border-radius: 0.4rem;
  padding: 0.8vh 0.8vw;
  font-size: clamp(0.5rem, 0.75vw, 0.7rem);
  color: #e0e0e0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  max-width: 20vw;
  z-index: 100;
  line-height: 1.4;
}

.tooltip.visible { opacity: 1; }
.tooltip .tt-title { color: #e6c44a; font-weight: 600; margin-bottom: 0.3vh; }
.tooltip .tt-value { color: #3498db; }

.footer-bar {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4vh 0.5vw;
  background: #16213e;
  border: 1px solid #2a2a5a;
  border-radius: 0.3rem;
  font-size: clamp(0.5rem, 0.7vw, 0.65rem);
  color: #6a6a9a;
}

.footer-bar .jewish-note {
  color: #e6c44a;
  font-style: italic;
}

.bar-group {
  display: flex;
  align-items: flex-end;
  gap: 2%;
  height: 100%;
  padding: 0 5%;
  padding-bottom: 8%;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  cursor: pointer;
}

.bar-stack {
  width: 80%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  transition: all 0.4s ease;
  position: relative;
}

.bar-segment {
  width: 100%;
  transition: all 0.4s ease;
  border-radius: 2px 2px 0 0;
  min-height: 1px;
}

.bar-label {
  font-size: clamp(0.45rem, 0.7vw, 0.62rem);
  color: #8a8aaf;
  text-align: center;
  margin-top: 0.5vh;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.bar-col:hover .bar-stack {
  filter: brightness(1.3);
}

.legend {
  display: flex;
  gap: 1vw;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.5vh 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3vw;
  font-size: clamp(0.5rem, 0.7vw, 0.62rem);
  color: #b0b0d0;
  cursor: pointer;
  transition: opacity 0.2s;
}

.legend-item:hover { opacity: 0.8; }

.legend-swatch {
  width: clamp(8px, 0.8vw, 12px);
  height: clamp(8px, 0.8vw, 12px);
  border-radius: 2px;
}

.sparkline-row {
  display: flex;
  align-items: center;
  gap: 0.5vw;
  margin-bottom: 0.4vh;
}

.sparkline-label {
  font-size: clamp(0.5rem, 0.7vw, 0.62rem);
  color: #8a8aaf;
  width: 30%;
  text-align: right;
}

.sparkline-bar-bg {
  flex: 1;
  height: clamp(10px, 1.2vh, 16px);
  background: #0d1117;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.sparkline-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.sparkline-value {
  font-size: clamp(0.5rem, 0.7vw, 0.62rem);
  color: #e0e0e0;
  width: 12%;
  text-align: left;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 4px rgba(230, 196, 74, 0.2); }
  50% { box-shadow: 0 0 12px rgba(230, 196, 74, 0.5); }
}

.energy-node.active {
  animation: pulse-glow 2s ease-in-out infinite;
}
