:root {
  --bg: #070a14; /* deep navy-black */
  --panel: #0f1428;
  --cyan: #00eaff;
  --pink: #ff2bd6;
  --yellow: #ffe600;
  --red: #ff3b3b;
  --muted: #96a0c2;
  --white: #e8f6ff;
}

@keyframes glowPulse {
  0%,
  100% {
    filter: drop-shadow(0 0 2px currentColor) drop-shadow(0 0 6px currentColor);
  }
  50% {
    filter: drop-shadow(0 0 2px currentColor) drop-shadow(0 0 14px currentColor);
  }
}

@keyframes scan {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(100%);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(
      1200px 600px at 20% -20%,
      #10183a 0%,
      transparent 55%
    ),
    radial-gradient(800px 400px at 110% 10%, #0a1230 0%, transparent 50%),
    var(--bg);
  color: var(--white);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  letter-spacing: 0.2px;
}

.terminal-frame {
  position: relative;
  max-width: 1100px;
  margin: 36px auto;
  padding: 24px;
  background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.04),
      transparent 18%
    ),
    var(--panel);
  border: 1px solid rgba(0, 234, 255, 0.25);
  border-radius: 16px;
  box-shadow: 0 0 0 2px rgba(0, 234, 255, 0.06), 0 20px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  isolation: isolate;
}

/* subtle scanlines */
.terminal-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.02) 0px,
    rgba(255, 255, 255, 0.02) 1px,
    transparent 2px,
    transparent 4px
  );
  mix-blend-mode: overlay;
  pointer-events: none;
  opacity: 0.5;
}

.terminal-frame::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -100%;
  height: 50%;
  background: linear-gradient(180deg, rgba(0, 234, 255, 0.08), transparent);
  animation: scan 8s linear infinite;
  pointer-events: none;
}

.title {
  text-align: center;
  margin: 10px 0 6px;
  font-weight: 800;
  font-size: clamp(28px, 4vw, 44px);
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(0, 234, 255, 0.9), 0 0 18px rgba(0, 234, 255, 0.65);
  letter-spacing: 1.2px;
}

.siren-row {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 10px;
  justify-items: center;
  margin: 6px 0 14px;
  opacity: 0.95;
}

.siren {
  width: 26px;
  height: 26px;
  color: var(--red);
  animation: glowPulse 1.8s ease-in-out infinite;
  filter: drop-shadow(0 0 2px var(--red)) drop-shadow(0 0 10px var(--red));
}

.grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.card {
  background: rgba(9, 14, 32, 0.8);
  border: 1px solid rgba(150, 160, 194, 0.18);
  border-radius: 14px;
  padding: 18px 16px;
  box-shadow: inset 0 0 24px rgba(0, 234, 255, 0.04),
    0 10px 24px rgba(0, 0, 0, 0.35);
}

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.wen-count {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(28px, 4vw, 42px);
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0, 234, 255, 0.8), 0 0 22px rgba(0, 234, 255, 0.5);
  font-weight: 800;
}

.wen-icon {
  width: 40px;
  height: 40px;
  color: var(--cyan);
  filter: drop-shadow(0 0 6px rgba(0, 234, 255, 0.8))
    drop-shadow(0 0 16px rgba(0, 234, 255, 0.5));
  animation: glowPulse 2.2s ease-in-out infinite;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 6px;
}

.kpi {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 230, 0, 0.2);
  border-radius: 12px;
  padding: 12px;
}

.kpi .label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.4px;
}

.kpi .value {
  margin-top: 6px;
  font-size: 20px;
  color: var(--yellow);
  text-shadow: 0 0 8px rgba(255, 230, 0, 0.55), 0 0 18px rgba(255, 230, 0, 0.35);
}

.status {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.status .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 234, 255, 0.05);
  border: 1px solid rgba(0, 234, 255, 0.18);
}

.status .key {
  color: var(--cyan);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
}

.status .val {
  color: var(--yellow);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 230, 0, 0.5);
}

.recent {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.msg {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(150, 160, 194, 0.25);
}

.msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.handle {
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(0, 234, 255, 0.6);
  font-weight: 700;
  font-size: 14px;
}

.timestamp {
  color: var(--muted);
  font-size: 11px;
  font-family: "JetBrains Mono", monospace;
  opacity: 0.8;
}

.content {
  color: var(--yellow);
  text-shadow: 0 0 10px rgba(255, 230, 0, 0.45);
  line-height: 1.4;
}

/* Winner styling */
.winner-card {
  border: 2px solid var(--pink);
  box-shadow: 0 0 20px rgba(255, 43, 214, 0.3);
  background: rgba(255, 43, 214, 0.05);
}

.winner-message {
  padding: 16px;
  border-radius: 8px;
  background: rgba(255, 43, 214, 0.1);
  border: 1px solid rgba(255, 43, 214, 0.3);
}

.winner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.winner-handle {
  color: var(--pink);
  font-weight: 700;
  font-size: 16px;
  text-shadow: 0 0 10px rgba(255, 43, 214, 0.6);
}

.winner-timestamp {
  color: var(--cyan);
  font-size: 12px;
  font-family: "JetBrains Mono", monospace;
}

.winner-content {
  color: var(--yellow);
  font-size: 14px;
  line-height: 1.5;
  text-shadow: 0 0 8px rgba(255, 230, 0, 0.4);
}

/* Winner highlight in message list */
.msg.winner-highlight {
  border: 2px solid var(--pink);
  background: rgba(255, 43, 214, 0.1);
  box-shadow: 0 0 15px rgba(255, 43, 214, 0.4);
  transform: scale(1.02);
  transition: all 0.3s ease;
}

/* Winner glow animation */
@keyframes winnerGlow {
  0% {
    box-shadow: 0 0 20px rgba(255, 43, 214, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(255, 43, 214, 0.6),
      0 0 60px rgba(255, 43, 214, 0.4);
  }
  100% {
    box-shadow: 0 0 20px rgba(255, 43, 214, 0.3);
  }
}

/* Wheel of Fortune Styling */
.wheel-card {
  border: 2px solid var(--cyan);
  box-shadow: 0 0 20px rgba(0, 234, 255, 0.3);
  background: rgba(0, 234, 255, 0.05);
}

.wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px;
}

.wheel {
  position: relative;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  border: 4px solid var(--cyan);
  box-shadow: 0 0 30px rgba(0, 234, 255, 0.4);
  transition: transform 4s cubic-bezier(0.23, 1, 0.32, 1);
  background: var(--bg);
  overflow: hidden;
}

.wheel.spinning {
  animation: wheelSpin 4s cubic-bezier(0.23, 1, 0.32, 1);
}

.wheel-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: var(--bg);
  border: 3px solid var(--cyan);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(0, 234, 255, 0.6);
}

.wheel-pointer {
  color: var(--cyan);
  font-size: 20px;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(0, 234, 255, 0.8);
}

.wheel-pointer-outer {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--pink);
  font-size: 30px;
  font-weight: bold;
  text-shadow: 0 0 15px rgba(255, 43, 214, 0.8);
  z-index: 10;
  filter: drop-shadow(0 0 10px rgba(255, 43, 214, 0.6));
}

.wheel-segment {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

.segment-text {
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wheel-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.btn-spin {
  background: linear-gradient(135deg, var(--cyan), var(--pink));
  color: white;
  border: 1px solid var(--cyan);
  box-shadow: 0 0 15px rgba(0, 234, 255, 0.4);
  transition: all 0.3s ease;
  font-size: 14px;
  padding: 12px 24px;
}

.btn-spin:hover:not(:disabled) {
  box-shadow: 0 0 25px rgba(0, 234, 255, 0.6);
  transform: translateY(-2px);
}

.btn-spin:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.wheel-status {
  color: var(--cyan);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  min-height: 20px;
}

@keyframes wheelSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(var(--final-rotation));
  }
}

/* Confetti Container */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--pink);
  animation: confettiFall 3s linear forwards;
}

.confetti-piece:nth-child(2n) {
  background: var(--cyan);
}

.confetti-piece:nth-child(3n) {
  background: var(--yellow);
}

.confetti-piece:nth-child(4n) {
  background: var(--red);
}

@keyframes confettiFall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.footer {
  margin-top: 22px;
  text-align: center;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0, 234, 255, 0.8), 0 0 18px rgba(0, 234, 255, 0.5);
  font-weight: 700;
  letter-spacing: 1.2px;
}

/* Configuration panel */
.config-panel {
  background: rgba(9, 14, 32, 0.8);
  border: 1px solid rgba(150, 160, 194, 0.18);
  border-radius: 14px;
  padding: 18px 16px;
  margin-top: 18px;
  box-shadow: inset 0 0 24px rgba(0, 234, 255, 0.04),
    0 10px 24px rgba(0, 0, 0, 0.35);
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.config-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.config-row label {
  color: var(--cyan);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
}

.config-input {
  padding: 8px;
  border: 1px solid var(--cyan);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--white);
  font-family: inherit;
  font-size: 12px;
}

.config-input:focus {
  outline: none;
  border-color: var(--yellow);
  box-shadow: 0 0 8px rgba(255, 230, 0, 0.3);
}

.config-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--cyan);
  cursor: pointer;
}

.checkbox-label {
  color: var(--white);
  font-size: 12px;
  margin-left: 8px;
  cursor: pointer;
}

.date-filter-container {
  display: flex;
  gap: 8px;
  align-items: center;
}

.date-input {
  flex: 1;
  min-width: 140px;
}

.btn-clear {
  background: var(--pink);
  color: var(--bg);
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-clear:hover {
  background: #ff6bdd;
  transform: translateY(-1px);
}

.btn-clear:active {
  transform: translateY(0);
}

.button-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  text-transform: uppercase;
}

.btn-winner {
  background: linear-gradient(135deg, var(--pink), var(--cyan));
  color: white;
  border: 1px solid var(--pink);
  box-shadow: 0 0 15px rgba(255, 43, 214, 0.4);
  transition: all 0.3s ease;
}

.btn-winner:hover {
  box-shadow: 0 0 25px rgba(255, 43, 214, 0.6);
  transform: translateY(-2px);
}

.btn-winner:active {
  transform: translateY(0);
}

.btn-start {
  background: var(--cyan);
  color: var(--bg);
  box-shadow: 0 0 10px rgba(0, 234, 255, 0.4);
}

.btn-start:hover {
  background: #00b8cc;
  box-shadow: 0 0 15px rgba(0, 234, 255, 0.6);
}

.btn-stop {
  background: var(--red);
  color: var(--white);
  box-shadow: 0 0 10px rgba(255, 59, 59, 0.4);
}

.btn-stop:hover {
  background: #cc2f2f;
  box-shadow: 0 0 15px rgba(255, 59, 59, 0.6);
}

.btn-test {
  background: var(--yellow);
  color: var(--bg);
  box-shadow: 0 0 10px rgba(255, 230, 0, 0.4);
}

.btn-test:hover {
  background: #e6cc00;
  box-shadow: 0 0 15px rgba(255, 230, 0, 0.6);
}

.btn-ai {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: white;
  border: 1px solid #8b5cf6;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
  transition: all 0.3s ease;
}

.btn-ai:hover {
  box-shadow: 0 0 25px rgba(139, 92, 246, 0.6);
  transform: translateY(-2px);
}

.btn-ai:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* responsive adjustments */
@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .kpis {
    grid-template-columns: 1fr;
  }
  .status {
    grid-template-columns: 1fr;
  }
  .msg {
    grid-template-columns: 1fr;
  }
  .config-grid {
    grid-template-columns: 1fr;
  }
  .button-row {
    flex-direction: column;
    align-items: center;
  }
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(5px);
}

.loading-content {
  text-align: center;
  color: white;
}

.loading-overlay .loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid #00ff88;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.loading-overlay .loading-text {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 10px;
  color: #00ff88;
}

.loading-overlay .loading-subtext {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.8);
}

/* AI Summary Styles */
.ai-summary-card {
  border: 1px solid rgba(139, 92, 246, 0.25);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.06),
    0 20px 60px rgba(0, 0, 0, 0.55);
}

.ai-summary-content {
  padding: 16px 0;
}

.ai-summary-loading {
  text-align: center;
  padding: 32px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(139, 92, 246, 0.3);
  border-top: 3px solid #8b5cf6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-text {
  color: var(--muted);
  font-size: 14px;
}

.ai-summary-result {
  display: grid;
  gap: 20px;
}

.summary-section h4 {
  margin: 0 0 8px 0;
  color: #8b5cf6;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-section p {
  margin: 0;
  color: var(--white);
  font-size: 13px;
  line-height: 1.5;
}

.summary-section ul {
  margin: 0;
  padding-left: 20px;
  color: var(--white);
  font-size: 13px;
  line-height: 1.5;
}

.summary-section li {
  margin-bottom: 4px;
}

.ai-summary-error {
  text-align: center;
  padding: 32px;
  border: 1px solid var(--red);
  border-radius: 8px;
  background: rgba(255, 59, 59, 0.1);
}

.error-message {
  color: var(--red);
  font-weight: 600;
  margin-bottom: 8px;
}

.error-details {
  color: var(--muted);
  font-size: 12px;
  font-family: monospace;
}
