/* ================================================================ */
/* GLOBAL — CYBERPUNK + CRT EFFECTS                                 */
/* ================================================================ */

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

body {
  font-family: 'Poppins', sans-serif;
  background: #08060d;
  margin: 0;
  padding: 0 12px 12px 12px;
  color: #e4e4e8;
  position: relative;
  overflow-x: hidden;
  min-height: 100vh;
}

/* CRT scanlines + noise */
body:before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.03) 0,
      rgba(255,255,255,0.03) 1px,
      rgba(0,0,0,0.25) 2px
    ),
    url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=");
  mix-blend-mode: overlay;
  animation: crtFlicker 2.7s infinite ease-in-out;
  opacity: 0.32;
}

/* CRT vignette curvature */
body:after {
  content: "";
  position: fixed;
  inset: -8%;
  z-index: 998;
  pointer-events: none;
  background:
    radial-gradient(circle at center,
      transparent 55%,
      rgba(0,0,0,0.6) 100%);
  mix-blend-mode: multiply;
}

@keyframes crtFlicker {
  0% { opacity: 0.25; }
  50% { opacity: 0.38; }
  100% { opacity: 0.25; }
}

/* ================================================================ */
/* THEME VARIABLES — CYBERPUNK                                      */
/* ================================================================ */

:root {
  --card-bg: rgba(35, 5, 45, 0.55);
  --card-border: rgba(255, 0, 255, 0.28);

  --text: #f3e7ff;
  --subtext: #caaef2;

  --on:  #19b8b8;
  --off: #ff5599;
  --vol: #7d5bff;
  --mode:#fffb46;

  --btn-text: #ffffff;
  --btn-border: rgba(255,255,255,0.40);

  --btn-shadow: inset 0 0 15px rgba(0,0,0,0.85);

  --btn-glass: linear-gradient(
    rgba(255,255,255,0.18) 0%,
    rgba(255,255,255,0.06) 35%,
    rgba(0,0,0,0.5) 100%
  );

  --glow-on:  #3affff88;
  --glow-active: #3affff;
}

/* ================================================================ */
/* HOLOGRAPHIC TEXT SHIMMER                                         */
/* ================================================================ */

@keyframes holoShift {
  0%,100% { background-position: 0% 50%; }
  50%     { background-position: 100% 50%; }
}

/* ================================================================ */
/* HEADER & TITLE                                                    */
/* ================================================================ */

header {
  position: relative;
  z-index: 10;
}

h1 {
  text-align: center;
  font-size: 2rem;
  font-weight: 600;
  margin: 6px 0;
  padding: 8px 0;

  background: linear-gradient(120deg,#ff00ff,#00fff2,#ffe066,#ff00ff);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: holoShift 7s linear infinite;

  text-shadow:
    -2px 0 3px rgba(255,0,0,0.6),
     2px 0 3px rgba(0,255,255,0.6),
     0 2px 3px rgba(0,100,255,0.6);
}

/* ================================================================ */
/* MEDIA TICKER                                                      */
/* ================================================================ */

.ticker-container {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 0, 255, 0.3);
  border-radius: 6px;
  padding: 6px 0;
  margin: 0 auto 10px auto;
  max-width: 1300px;
  overflow: hidden;
  position: relative;
  z-index: 1;
  min-height: 32px;
}

.ticker-wrapper {
  display: flex;
  white-space: nowrap;
}

.ticker-text {
  display: inline-block;
  padding-left: 100%;
  animation: ticker 20s linear infinite;
  font-size: 0.95rem;
  color: #3affff;
  text-shadow: 0 0 10px rgba(58, 255, 255, 0.5);
}

.ticker-text.paused {
  animation-play-state: paused;
}

@keyframes ticker {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-100%, 0, 0); }
}

/* ================================================================ */
/* GRID LAYOUT                                                       */
/* ================================================================ */

main {
  position: relative;
  z-index: 10;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 8px;
  margin: 0 auto;
  max-width: 1300px;
}

/* ================================================================ */
/* CARD BASE STYLE                                                   */
/* ================================================================ */

.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 10px;
  backdrop-filter: blur(14px);
  border: 1px solid var(--card-border);
  box-shadow:
    0 0 12px rgba(255,0,255,0.2),
    0 0 12px rgba(0,255,255,0.2),
    inset 0 0 20px rgba(0,0,0,0.55);
  transition: box-shadow 0.3s ease;
}

.card:hover {
  box-shadow:
    0 0 18px rgba(255,0,255,0.3),
    0 0 18px rgba(0,255,255,0.3),
    inset 0 0 20px rgba(0,0,0,0.55);
}

.card h2 {
  margin: 0 0 8px 0;
  font-size: 1.05rem;
  font-weight: 600;

  background: linear-gradient(120deg,#ff00ff,#00fff2,#ffe066,#ff00ff);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: holoShift 9s linear infinite;
}

/* ================================================================ */
/* SECTION GLOWS                                                     */
/* ================================================================ */

.card.amplifiers {
  box-shadow:
    0 0 16px rgba(0,255,255,0.35),
    inset 0 0 20px rgba(0,0,0,0.7) !important;
  border-color: rgba(0,255,255,0.5) !important;
}

.card.lighting {
  box-shadow:
    0 0 16px rgba(255,180,0,0.35),
    inset 0 0 20px rgba(0,0,0,0.7) !important;
  border-color: rgba(255,180,0,0.5) !important;
}

.card.status-card {
  box-shadow:
    0 0 16px rgba(102,255,0,0.35),
    inset 0 0 20px rgba(0,0,0,0.7) !important;
  border-color: rgba(102,255,0,0.5) !important;
}

/* ================================================================ */
/* CONTROL ROWS                                                      */
/* ================================================================ */

.control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 6px 0;
  gap: 8px;
}

.label {
  flex: 1;
  font-size: 0.9rem;
  color: var(--subtext);
  min-width: 100px;
}

/* ================================================================ */
/* BUTTON WRAPPER                                                    */
/* ================================================================ */

.buttons {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  flex: 2;
}

/* ================================================================ */
/* GENERAL BUTTONS                                                   */
/* ================================================================ */

button {
  flex: 1 1 0;
  min-width: 0;
  padding: 3px 4px;
  font-size: 0.75rem;
  border-radius: 10px;
  cursor: pointer;

  background-image: var(--btn-glass);
  border: 1px solid var(--btn-border);

  box-shadow:
    var(--btn-shadow),
    inset 0 0 6px rgba(0,0,0,0.55);

  color: var(--btn-text);
  text-align: center;
  font-weight: 500;
  position: relative;
  overflow: hidden;

  transition:
    background 0.25s,
    transform 0.1s,
    box-shadow 0.25s,
    filter 0.25s,
    border-color 0.25s;

  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Disabled state */
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* ================================================================ */
/* RIPPLES + GLITCH                                                  */
/* ================================================================ */

button:after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 0; height: 0;
  background: rgba(255,255,255,0.3);
  opacity: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width .3s, height .3s, opacity .4s;
  pointer-events: none;
}

button:active:after {
  width: 160%; height: 160%;
  opacity: 0.15;
}

button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -10%;
  width: 120%;
  height: 25%;
  background: rgba(255,255,255,0.15);
  mix-blend-mode: overlay;
  opacity: 0;
  pointer-events: none;
}

@keyframes glitchSlice {
  0%   { transform: translateX(-4px); opacity: 0; }
  50%  { transform: translateX(4px);  opacity: 0.3; }
  100% { transform: translateX(0);    opacity: 0; }
}

button:active::before {
  animation: glitchSlice 0.18s steps(2, end);
}

/* ================================================================ */
/* BUTTON COLOR CLASSES                                              */
/* ================================================================ */

.btn-on  { background-color: var(--on); }
.btn-off { background-color: var(--off); }
.btn-vol { background-color: var(--vol); }
.btn-mode { 
  background-color: var(--mode); 
  padding: 3px 8px;
  color: #000;
  font-weight: 600;
}

/* ================================================================ */
/* LAMP TOGGLE BUTTONS                                               */
/* ================================================================ */

.toggle-btn {
  background-color: var(--off);
  flex: 1 1 0 !important;
  padding: 6px 12px;
  text-align: center;
  border-radius: 10px;
  font-size: 0.85rem;
}

.toggle-btn.active {
  background-color: var(--on);
  animation: cyberPulse 1.6s infinite ease-in-out;
  filter: brightness(1.2);
}

/* ================================================================ */
/* AMPLIFIER TOGGLE BUTTONS                                          */
/* ================================================================ */

.amp-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
}

.amp-grid .amp-toggle {
  flex: 0 0 calc(33.33% - 6px) !important;
}

.amp-toggle {
  background-color: var(--off) !important;
  padding: 8px 6px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
}

.amp-toggle.active {
  background-color: var(--on) !important;
  animation: cyberPulse 1.6s infinite ease-in-out;
  filter: brightness(1.25);
}

/* ================================================================ */
/* STATUS CARD                                                       */
/* ================================================================ */

.status-card {
  grid-column: span 1;
}

.status-indicator {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.status-row:last-child {
  border-bottom: none;
}

.status-label {
  font-size: 0.85rem;
  color: var(--subtext);
  opacity: 0.8;
}

.status-value {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--off);
  box-shadow: 0 0 8px currentColor;
  animation: statusPulse 2s infinite ease-in-out;
}

.status-dot.active {
  background: var(--on);
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ================================================================ */
/* GLOW PULSE                                                        */
/* ================================================================ */

@keyframes cyberPulse {
  0%   { box-shadow: 0 0 8px var(--glow-on); }
  50%  { box-shadow: 0 0 22px var(--glow-on); }
  100% { box-shadow: 0 0 8px var(--glow-on); }
}

/* ================================================================ */
/* PRESS FEEDBACK                                                     */
/* ================================================================ */

button:active:not(:disabled) {
  transform: scale(0.96) translate(-1px, 1px);
  filter: brightness(0.9) contrast(1.1);
}

/* ================================================================ */
/* HOVER                                                             */
/* ================================================================ */

button:hover:not(:disabled) {
  filter: brightness(1.2);
  border-color: rgba(255,255,255,0.55);
}

/* ================================================================ */
/* RESPONSIVE                                                        */
/* ================================================================ */

@media (max-width: 680px) {
  .control-row { 
    flex-direction: column; 
    align-items: flex-start; 
  }
  
  .buttons {
    width: 100%;
  }
  
  .label {
    width: 100%;
  }
  
  button { 
    padding: 8px 8px; 
    font-size: 0.85rem; 
    border-radius: 12px; 
  }
  
  .buttons { 
    gap: 6px; 
  }
  
  .card { 
    padding: 12px; 
    border-radius: 14px; 
  }
  
  .amp-grid .amp-toggle {
    flex: 0 0 calc(50% - 6px) !important;
  }
  
  h1 {
    font-size: 1.6rem;
  }
}

@media (min-width: 801px) {
  button { 
    padding: 3px 3px; 
    font-size: 0.72rem; 
    border-radius: 8px; 
  }
  
  .card { 
    padding: 8px; 
    border-radius: 10px; 
  }
}

@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .status-card {
    grid-column: span 1;
  }
}

/* ================================================================ */
/* SYSTEM STATUS COLORS                                              */
/* ================================================================ */

.status-value.good { color: #19b8b8; }
.status-value.warning { color: #fffb46; }
.status-value.bad { color: #ff5599; }

/* ================================================================ */
/* ACCESSIBILITY                                                     */
/* ================================================================ */

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Focus styles for keyboard navigation */
button:focus-visible {
  outline: 2px solid var(--glow-active);
  outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}