

/* ---------- Color Variables ---------- */
:root {
  --bg: #06040b;
  --fg: #e8e8f2;
  --muted: #a8a8c4;
  --primary: #b968ff;
  --accent: #00e6ff;
  --danger: #ff4d6d;
  --ok: #8fff6a;
}

/* ---------- Global Reset ---------- */
* {
  box-sizing: border-box;
}
html, body {
  height: 100%;
  margin: 0;
}
body {
  font-family: "Share Tech Mono", monospace;
  background:
    radial-gradient(1200px 600px at 10% -10%, #1a0f28 0%, transparent 60%),
    radial-gradient(1400px 700px at 110% 10%, #00233a 0%, transparent 60%),
    radial-gradient(800px 500px at 50% 120%, #1a0030 0%, transparent 70%),
    var(--bg);
  color: var(--fg);
  overflow-x: hidden;
}

/* ---------- Noise Overlay ---------- */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.035'/></svg>");
}

/* ---------- Header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  backdrop-filter: blur(8px);
  background: linear-gradient(to bottom, rgba(6,4,11,.85), rgba(6,4,11,.35));
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--primary), var(--accent), var(--primary));
  box-shadow: 0 0 16px var(--primary);
}

h1 {
  font-family: "Orbitron";
  font-size: 18px;
  margin: 0;
}

.blink {
  animation: blink 1.2s steps(2, end) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.status {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}
.wifi {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

/* ---------- Layout ---------- */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px;
}

/* ---------- Hero Section ---------- */
.hero h2 {
  font-family: "Orbitron";
  font-weight: 700;
  font-size: 28px;
  margin: 0 0 8px;
  text-shadow: 0 0 20px rgba(185,104,255,.35);
}
.sub {
  color: var(--muted);
  margin: 0 0 22px;
}

/* ---------- Input Panel ---------- */
.panel {
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  padding: 18px;
  box-shadow:
    0 10px 40px rgba(0,0,0,.35),
    inset 0 0 0 1px rgba(255,255,255,.02);
}

label {
  display: block;
  color: var(--muted);
  margin: 4px 0 8px;
}

.row {
  display: flex;
  gap: 10px;
}

input {
  flex: 1;
  padding: 14px;
  font-size: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(0,0,0,.25);
  color: var(--fg);
  outline: none;
}

button {
  border: none;
  cursor: pointer;
  padding: 14px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-family: "Orbitron";
  transition: 0.2s;
}

.primary {
  color: #061018;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  box-shadow:
    0 10px 22px rgba(0,230,255,.25),
    0 10px 22px rgba(185,104,255,.2);
}
.primary:hover {
  transform: translateY(-1px);
  filter: saturate(1.2);
}

.secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid rgba(255,255,255,.2);
}

/* ---------- Progress Bar ---------- */
.progress-wrap { margin: 18px 0 10px; }

.progress {
  position: relative;
  height: 18px;
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  overflow: hidden;
}
.bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  box-shadow:
    0 0 20px rgba(0,230,255,.35),
    0 0 30px rgba(185,104,255,.25) inset;
  transition: width .18s linear;
}
.progress .label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #0b0f14;
  font-weight: 700;
}

/* ---------- Logs ---------- */
.logs {
  margin-top: 14px;
  height: 170px;
  overflow: auto;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  border-radius: 12px;
  background: #0a0c14;
  border: 1px solid rgba(255,255,255,.07);
}
.logs .ok { color: var(--ok); }
.logs .warn { color: var(--accent); }
.logs .err { color: var(--danger); }

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.55);
  z-index: 10;
}
.modal.hidden { display: none; }

.modal-card {
  width: min(520px, 92%);
  border-radius: 16px;
  padding: 18px;
  background: #0d0f17;
  border: 1px solid rgba(255,255,255,.1);
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  color: var(--muted);
  padding: 20px;
  font-size: 12px;
}

/* ---------- Spawned Food ---------- */
.spawned-food {
  position: fixed;
  top: 50%;
  left: 50%;
  font-size: 50px;
  text-align: center;
  transform: translate(-50%, -50%) scale(0.8);
  text-shadow: 0 0 25px var(--primary);
  animation: pop 5s ease-in-out forwards;
  z-index: 20;
}
.spawned-food img {
  width: 200px;
  border-radius: 20px;
  margin-top: 10px;
  box-shadow: 0 0 20px var(--accent);
}
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  10% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  90% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); }
}

/* ---------- Glowing QR ---------- */
.qr-overlay {
  position: fixed;
  bottom: 15px;
  right: 15px;
  z-index: 50;
  opacity: .8;
  animation: qrPulse 4s infinite ease-in-out;
}
.qr-overlay img {
  width: 100px;
  border-radius: 12px;
  box-shadow: 0 0 18px var(--accent);
}
@keyframes qrPulse {
  0%,100% {
    transform: scale(1);
    filter: drop-shadow(0 0 10px var(--accent));
  }
  50% {
    transform: scale(1.05);
    filter: drop-shadow(0 0 18px var(--primary));
  }
}

/* ---------- Debug Overlay ---------- */
#debugOverlay {
  position: fixed;
  bottom: 20px;
  left: 20px;
  padding: 10px 14px;
  font-size: 13px;
  border-radius: 12px;
  color: var(--ok);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(6px);
  box-shadow: 0 0 20px rgba(0,230,255,0.2);
  animation: debugPulse 3s infinite ease-in-out;
  z-index: 1000;
}
@keyframes debugPulse {
  0%,100% { filter: drop-shadow(0 0 6px var(--accent)); }
  50% { filter: drop-shadow(0 0 14px var(--primary)); }
}

/* ---------- Mobile Responsiveness---------- */
@media (max-width: 640px) {
  .row { flex-direction: column; }
  .primary { width: 100%; }
}
