:root {
  --line-width: 1vw;
  --line-color: #FFF; /* Existing: For bouncing line */
  --line-color-background: transparent; /* Existing: For bouncing line */
  --graph-line-color: #FF0000; 

  /* Color Palette Variables */
  --color-text-primary: #FFF;
  --color-text-secondary: #AAA;
  --color-background-page: #000; /* New: Single page background color */
  --color-svg-grid: #333;
}

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

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Calibri, Arial, Helvetica, sans-serif;
  box-sizing: border-box;
}

html {
  background-color: var(--color-background-page); /* Changed from gradient to single color */
  color: var(--color-text-primary);
}

body {
  height: 100vh;
  width: 100vw;
  min-height: 100vh;
  min-width: 100vw;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
  position: relative;
  user-select: none; /* Added to prevent text selection */
}

.container {
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  box-sizing: border-box;
  width: 100vw;
  height: 100vh;
  max-width: none;
  min-height: 0;
  margin: 0;
  position: relative;
}

.container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to right,
    var(--line-color) 0,          /* Line color and start */
    var(--line-color) var(--line-width),        /* Line color and end (width of line) */
    var(--line-color-background) var(--line-width),  /* Start of transparency after the line */
    var(--line-color-background) 100vw  /* End of transparency */
  );
  background-repeat: no-repeat;
  will-change: background-position-x; /* Updated: transform removed */
  animation: bounceLineContainer 2s linear infinite alternate;
  pointer-events: none;
  mix-blend-mode: difference; /* Added for inversion effect */
}

@keyframes bounceLineContainer {
  0% {
    background-position-x: 0vw; /* 0vw will resolve to 0px, which is an integer */
  }
  100% {
    background-position-x: round(down, calc(100vw - var(--line-width)), 1px); /* Changed step to 1px */
  }
}

.fps-graph {
  width: 100vw;
  height: 28vh;
  min-height: 120px;
  max-height: 35vh;
  display: block;
  margin: 0 0 0 0;
  background: transparent;
  flex: 0 0 auto;
}

.fps-graph polyline { /* Added rule for polyline stroke */
  stroke: var(--graph-line-color);
}

.fps-graph line { /* Added rule for grid line stroke */
  stroke: var(--color-svg-grid);
}

.fps-graph text { /* Added rule for label fill color */
  fill: var(--color-text-secondary);
}

.stats-row {
  display: flex;
  flex-direction: row;
  justify-content: stretch;
  align-items: stretch;
  width: 100%;
  height: 100%;
  flex: 1 1 0;
  gap: 0;
  overflow: auto; /* Enable scrolling if needed */
}

.stats-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  flex: 2 1 0;
  padding: 3vw 2vw 3vw 4vw;
  gap: 0.5em;
  min-width: 0;
}

.stats-secondary {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  flex: 1 1 0;
  padding: 3vw 4vw 3vw 2vw;
  gap: 0.5em;
  min-width: 0;
}

.stats-secondary > * {
  font-size: 2vw;
  font-weight: 500;
  letter-spacing: 0.02em;
  font-family: inherit;
  text-align: right;
  word-break: break-word;
  margin: 0;
}

.frame-count, .timestamp, .fps {
  font-size: 7vw;
  font-weight: bold;
  font-family: inherit;
  text-align: left;
  word-break: break-word;
}

.delta, .fps-stats, .elapsed { /* .fps-stats and .elapsed are effectively unused selectors here but kept for structure */
  font-size: 2vw;
  font-weight: 500;
  letter-spacing: 0.02em;
  font-family: inherit;
  text-align: right;
  word-break: break-word;
}

/* Remove all ::before label styles for stats */
.frame-count::before,
.timestamp::before,
.fps::before,
.delta::before,
.fps-stats::before, /* This class is not used anymore, can be removed or kept for future */
.frame-time-min::before,
.frame-time-max::before,
.frame-time-mean::before,
.frame-time-median::before,
.frame-time-p1::before, 
.frame-time-p99::before { 
  content: none;
}

.fps-stats { /* This class is not used anymore for a specific element, can be removed or repurposed */
  margin-bottom: 1em;
}

.container > *:last-child {
  margin-bottom: 0;
}

/* Stat label/value color split */
.stat-label {
  color: var(--color-text-secondary);
  font-weight: 400;
  font-size: 0.9em;
  font-family: inherit;
  margin-right: 0.3em;
  display: inline;
}

.stat-value {
  color: var(--color-text-primary);
  font-weight: 500;
  font-size: 1em;
  font-family: inherit;
  display: inline;
}

/* Responsive: mobile */
@media (max-width: 600px) {
  .stats-row {
    flex-direction: column;
    gap: 2vw;
  }
  .stats-main,
  .stats-secondary {
    align-items: center;
    justify-content: center;
    flex: none;
    padding: 4vw 4vw 2vw 4vw;
    gap: 0.5em;
  }
  .frame-count, .timestamp, .fps,
  .stats-secondary > *, /* This will cover all new frame time stat elements */
  .delta, /* .fps-stats, */ /* .elapsed, */ /* .fps-stats is no longer a specific element class, .elapsed removed */
  /* Explicitly listing old FPS classes, new frame time classes covered by .stats-secondary > * */
  .fps-min, .fps-max, .fps-mean, .fps-median { 
    font-size: 7vw;
    text-align: center;
  }
  .stat-label,
  .stat-value {
    display: inline;
    text-align: center;
    font-size: 1em;
  }
}