/* ===========================================================
   CYBERPUNK THEME
   =========================================================== */
@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Share+Tech+Mono&family=Orbitron:wght@500;700;900&display=swap");

:root {
  --cp-bg: #05060a;
  --cp-bg-2: #0b0f1a;
  --cp-panel: rgba(10, 16, 28, 0.78);
  --cp-cyan: #00e6f6;
  --cp-magenta: #ff013c;
  --cp-pink: #ff2e97;
  --cp-yellow: #f8f005;
  --cp-green: #00ff9c;
  --cp-text: #c8f7ff;
  --cp-dim: #5d7a8a;
  --cp-grid: rgba(0, 230, 246, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Share Tech Mono", "Courier New", monospace;
  color: var(--cp-text);
  background-color: var(--cp-bg);
  background-image:
    radial-gradient(circle at 15% 10%, rgba(255, 1, 60, 0.12), transparent 45%),
    radial-gradient(circle at 85% 90%, rgba(0, 230, 246, 0.12), transparent 45%),
    linear-gradient(var(--cp-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--cp-grid) 1px, transparent 1px),
    linear-gradient(180deg, var(--cp-bg) 0%, var(--cp-bg-2) 100%);
  background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px, 100% 100%;
  background-attachment: fixed;
  padding: 28px clamp(16px, 4vw, 56px) 60px;
  letter-spacing: 0.5px;
}

/* moving scanline overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.18) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  mix-blend-mode: overlay;
}

/* ---------- Headings ---------- */
h1 {
  font-family: "Orbitron", "Bebas Neue", sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 6vw, 3.4rem);
  letter-spacing: 6px;
  text-transform: uppercase;
  margin: 0 0 28px;
  color: var(--cp-cyan);
  text-shadow:
    0 0 6px var(--cp-cyan),
    3px 3px 0 var(--cp-magenta),
    -3px -3px 0 var(--cp-yellow);
  animation: title-flicker 4s infinite steps(60);
}

@keyframes title-flicker {
  0%, 92%, 100% { opacity: 1; }
  93% { opacity: 0.4; }
  94% { opacity: 1; }
  96% { opacity: 0.7; }
  97% { opacity: 1; }
}

h2 {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--cp-pink);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 46, 151, 0.35);
  text-shadow: 0 0 8px rgba(255, 46, 151, 0.6);
}

/* ---------- Panels / sections ---------- */
section {
  position: relative;
  background: var(--cp-panel);
  border: 1px solid rgba(0, 230, 246, 0.35);
  border-left: 3px solid var(--cp-cyan);
  padding: 20px 22px;
  margin-bottom: 24px;
  backdrop-filter: blur(2px);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 0 22px rgba(0, 230, 246, 0.12),
    inset 0 0 30px rgba(0, 0, 0, 0.45);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}

section::before {
  content: "";
  position: absolute;
  top: 8px;
  right: 10px;
  width: 8px;
  height: 8px;
  background: var(--cp-magenta);
  box-shadow: 0 0 10px var(--cp-magenta);
  animation: blink 1.4s infinite steps(2);
}

@keyframes blink {
  50% { opacity: 0.15; }
}

/* ---------- Labels ---------- */
label {
  color: var(--cp-cyan);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 2px;
}

/* ---------- Inputs / selects ---------- */
input[type="text"],
select {
  background: rgba(0, 0, 0, 0.55);
  color: var(--cp-text);
  border: 1px solid var(--cp-cyan);
  padding: 10px 12px;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.95rem;
  outline: none;
  transition: box-shadow 0.2s, border-color 0.2s;
}

input[type="text"] {
  width: 100%;
  max-width: 600px;
}

input[type="text"]:focus,
select:focus {
  border-color: var(--cp-pink);
  box-shadow: 0 0 12px rgba(255, 46, 151, 0.6);
}

input[type="text"]::placeholder {
  color: var(--cp-dim);
}

select option {
  background: var(--cp-bg-2);
  color: var(--cp-text);
}

/* ---------- Range slider ---------- */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  width: 200px;
  vertical-align: middle;
  background: linear-gradient(90deg, var(--cp-magenta), var(--cp-cyan));
  border-radius: 0;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 22px;
  background: var(--cp-yellow);
  box-shadow: 0 0 10px var(--cp-yellow);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 22px;
  border: 0;
  background: var(--cp-yellow);
  box-shadow: 0 0 10px var(--cp-yellow);
  cursor: pointer;
}

/* ---------- Generic buttons (Send, etc.) ---------- */
button:not(.button-49) {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cp-bg);
  background: var(--cp-cyan);
  border: 0;
  padding: 10px 22px;
  cursor: pointer;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 90% 100%, 0 100%);
  transition: background 0.2s, box-shadow 0.2s, transform 0.05s;
  box-shadow: 0 0 12px rgba(0, 230, 246, 0.5);
}

button:not(.button-49):hover {
  background: var(--cp-pink);
  box-shadow: 0 0 18px rgba(255, 46, 151, 0.8);
}

button:not(.button-49):active {
  transform: translateY(2px);
}

/* ---------- Disabled buttons ---------- */
button:disabled,
button[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
  filter: grayscale(1);
  box-shadow: none !important;
  color: #888 !important;
  text-shadow: none !important;
}

button:not(.button-49):disabled {
  background: #2a2f38 !important;
}

/* neutralize glitch button colors when disabled */
.button-49:disabled,
.button-49[disabled],
.button-49:disabled:after,
.button-49[disabled]:after {
  background: linear-gradient(45deg, transparent 5%, #3a3f47 5%) !important;
  box-shadow: 4px 0px 0px #555 !important;
  color: #888 !important;
  text-shadow: none !important;
}

/* stop the glitch animation on hover while disabled */
.button-49:disabled:hover:after,
.button-49[disabled]:hover:after {
  animation: none !important;
  clip-path: var(--slice-0) !important;
}

/* ---------- Chat ---------- */
#chatContainer {
  border: 1px solid var(--cp-cyan) !important;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 0 24px rgba(0, 230, 246, 0.12);
  font-size: 0.92rem;
  line-height: 1.5;
}

#chatContainer > div {
  margin-bottom: 6px;
  padding: 4px 6px;
  border-left: 2px solid transparent;
}

/* ---------- Connection status ---------- */
#connectionStatus {
  font-size: 0.85rem;
  letter-spacing: 1px;
  color: var(--cp-yellow);
  text-shadow: 0 0 6px rgba(248, 240, 5, 0.5);
}

/* ---------- Setup JSON / debug ---------- */
#setupJsonDisplay,
#debugInfo {
  background-color: rgba(0, 0, 0, 0.6) !important;
  color: var(--cp-green) !important;
  border: 1px solid rgba(0, 255, 156, 0.4);
  font-family: "Share Tech Mono", monospace;
}

/* ---------- Scrollbars ---------- */
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.4);
}
*::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--cp-cyan), var(--cp-magenta));
  border: 1px solid rgba(0, 0, 0, 0.5);
}

/* ===========================================================
   GLITCH BUTTON (existing)
   =========================================================== */
/* CSS */
.button-49,
.button-49:after {
  width: 150px;
  height: 42px;
  line-height: 44px;
  font-size: 20px;
  font-family: "Bebas Neue", sans-serif;
  background: linear-gradient(45deg, transparent 5%, #ff013c 5%);
  border: 0;
  color: #fff;
  letter-spacing: 3px;
  box-shadow: 6px 0px 0px #00e6f6;
  outline: transparent;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.button-49:after {
  --slice-0: inset(50% 50% 50% 50%);
  --slice-1: inset(80% -6px 0 0);
  --slice-2: inset(50% -6px 30% 0);
  --slice-3: inset(10% -6px 85% 0);
  --slice-4: inset(40% -6px 43% 0);
  --slice-5: inset(80% -6px 5% 0);

  content: "ALTERNATE TEXT";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    45deg,
    transparent 3%,
    #00e6f6 3%,
    #00e6f6 5%,
    #ff013c 5%
  );
  text-shadow:
    -3px -3px 0px #f8f005,
    3px 3px 0px #00e6f6;
  clip-path: var(--slice-0);
}

.button-49:hover:after {
  animation: 1s glitch;
  animation-timing-function: steps(2, end);
}

@keyframes glitch {
  0% {
    clip-path: var(--slice-1);
    transform: translate(-20px, -10px);
  }
  10% {
    clip-path: var(--slice-3);
    transform: translate(10px, 10px);
  }
  20% {
    clip-path: var(--slice-1);
    transform: translate(-10px, 10px);
  }
  30% {
    clip-path: var(--slice-3);
    transform: translate(0px, 5px);
  }
  40% {
    clip-path: var(--slice-2);
    transform: translate(-5px, 0px);
  }
  50% {
    clip-path: var(--slice-3);
    transform: translate(5px, 0px);
  }
  60% {
    clip-path: var(--slice-4);
    transform: translate(5px, 10px);
  }
  70% {
    clip-path: var(--slice-2);
    transform: translate(-10px, 10px);
  }
  80% {
    clip-path: var(--slice-5);
    transform: translate(20px, -10px);
  }
  90% {
    clip-path: var(--slice-1);
    transform: translate(-10px, 0px);
  }
  100% {
    clip-path: var(--slice-1);
    transform: translate(0);
  }
}

@media (min-width: 768px) {
  .button-49,
  .button-49:after {
    width: 200px;
    height: 42px;
    line-height: 44px;
  }
}
