/* styles.css */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}
body {
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

#dashboard {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto 1fr;
  gap: 1.5em;
  padding: 1em;
  box-sizing: border-box;
  justify-items: center;
  align-items: start;
}

.panel.gauges {

  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1em;
  width: 100%;
}

.panel.charts {
  width: 100%;
}

.panel.flipboards {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1em;
}

canvas {
  background: #181c1f;
  border-radius: 12px;
  box-shadow: 0 4px 16px #0008;
}


canvas.gauge {
  width: 100%;
  height: auto;
}
body::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,255,70,0.04) 0px,
    rgba(0,255,70,0.04) 1px,
    transparent 1px,
    transparent 4px
  );
  z-index: 1;
}

body::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    90deg,
    rgba(0,255,70,0.05) 0px,
    rgba(0,255,70,0.05) 2px,
    transparent 2px,
    transparent 4px
  );
  mix-blend-mode: overlay;
  animation: scan 12s linear infinite;
  z-index: 3;
}

@keyframes scan {
  from { background-position: 0 0; }
  to { background-position: 100% 0; }
}
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
  overflow: hidden;
}

.flipboard-row {
  display: flex;
  flex-direction: column;
  gap: 2.5em; /* more space between boxes */
  align-items: center;
  justify-content: flex-start;
  width: auto;
  overflow: hidden;
}

.split, .flipboard-numbers {
  margin-top: 0;
  font-size: 1.05rem;
  font-family: 'JetBrains Mono', 'Fira Mono', 'Consolas', monospace;
  letter-spacing: 0.09em;
  text-shadow: none;
  filter: none;
  user-select: none;
  position: relative;
  z-index: 2;
  background: #181c1f;
  border-radius: 10px;
  padding: 18px 16px;
  min-width: 0;
  max-width: 90vw;
  width: 66ch;
  box-shadow: 0 4px 32px #000a;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  line-height: 1.7;
  white-space: normal;
}

.split {
  color: #f7f7f7;
  text-align: left;
  width: 66ch;
  height: 6.5em; /* 3 rows */
}

.flipboard-numbers {
  width: 66ch;
  height: 2.1em; /* 1 row */
  color: #b7e3ff;
  text-align: center;
  align-items: center;
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  background: #181c1f;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.flipboard-numbers .flip-row {
  justify-content: center;
  min-height: 2.1em;
  margin-bottom: 0;
}

.flip-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  min-height: 2.1em;
  margin-bottom: 0.1em;
}

.flip-row .flip-left {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.flip-row .flip-right {
  display: none; /* Hide old right column in text board */
}

/* Number board: each number is a flip-row with .flip-left only */
.flipboard-numbers .flip-row .flip-left {
  justify-content: flex-end;
}

.breathing-box {
  background: rgba(0,255,70,0.10);
  border: 3px solid #00ff46;
  border-radius: 16px;
  box-shadow: 0 0 32px 8px #00ff46cc, 0 0 0 2px #0ff inset;
  animation: border-glow 2.5s linear infinite alternate;
  padding: 0.5em 0.5em;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 0 0 0 0;
  width: 100%;
  min-width: 66ch;
  box-sizing: border-box;
  min-height: 0;
  overflow: hidden;
}

@keyframes border-glow {
  0% { box-shadow: 0 0 32px 8px #00ff46cc, 0 0 0 2px #0ff inset; }
  100% { box-shadow: 0 0 64px 16px #00ff46, 0 0 0 4px #0ff inset; }
}

/* make each split chunk inline */
.split div {
  display: inline-block;
  white-space: pre;
  font-weight: 500;
  font-size: 1.15em;
  transition: color 0.3s, background 0.3s;
  background: #23272b;
  color: #f7f7f7;
  border-radius: 2px;
  margin: 0 1px;
  min-width: 0.65em;
  min-height: 1.4em;
  box-shadow: 0 1px 2px #0008, 0 1px 0 #222 inset;
  border-bottom: 2px solid #444;
  border-top: 1px solid #333;
  perspective: 200px;
  position: relative;
  z-index: 2;
  vertical-align: middle;
  word-break: keep-all; /* Prevent breaking words across lines */
}
.split .flipping {
  /* 3D flip effect */
  animation: flipboard-flip 0.3s cubic-bezier(.77,0,.18,1) forwards;
  background: #333;
  color: #fff;
  box-shadow: 0 4px 16px #fff2, 0 1px 0 #fff1 inset;
}
@keyframes flipboard-flip {
  0% {
    transform: rotateX(0deg);
    filter: brightness(1.1);
  }
  50% {
    transform: rotateX(90deg);
    filter: brightness(0.7);
  }
  100% {
    transform: rotateX(0deg);
    filter: brightness(1.1);
  }
}

/* New styles for flipboard animation */
.flipboard-row .flip-left div {
  transition: transform 0.3s, color 0.3s, background 0.3s;
}
.flipboard-row .flip-left div.flipping {
  transform: rotateX(180deg);
  background: #333;
  color: #fff;
  box-shadow: 0 4px 16px #fff2, 0 1px 0 #fff1 inset;
}

#refresh-btn {
  margin-top: 1em;
  padding: 0.4em 1.2em;
  font-size: 1rem;
  font-family: 'JetBrains Mono', monospace;
  background: #00ff46;
  color: #000;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 4px #0008;
}
#refresh-btn:hover {
  background: #0f0;
}
